-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.h
More file actions
45 lines (32 loc) · 1.11 KB
/
display.h
File metadata and controls
45 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef DISPLAY_H
#define DISPLAY_H
#include <stdint.h>
#include <stdbool.h>
// Display modes
typedef enum {
DISPLAY_MODE_IDLE,
DISPLAY_MODE_MEASURING,
DISPLAY_MODE_RESULT
} display_mode_t;
// Display structure
typedef struct {
display_mode_t mode;
float value_to_display; // Value in millimeters
bool led_indicator_on; // Object detection LED
uint8_t segment_data[4]; // Seven-segment display data
} display_t;
// Initialize display
void display_init(display_t *display);
// Update display with measurement value
void display_update(display_t *display, float value_mm, bool object_detected);
// Set LED indicator state
void display_set_led_indicator(display_t *display, bool on);
// Convert float value to seven-segment display
void display_show_value(display_t *display, float value_mm);
// Clear display
void display_clear(display_t *display);
// Convert digit to seven-segment code
uint8_t display_digit_to_segments(uint8_t digit);
// Write to display hardware (to be implemented based on hardware)
void display_write_segments(uint8_t *segments, uint8_t count);
#endif // DISPLAY_H