64f9e34fc3
Complete working firmware including: - CMakeLists.txt for Pico SDK build - SSD1306 OLED driver (128x32, I2C) - High-resolution latency measurement using hardware timer - Debounced button with short/long press detection - Three modes: Single, Continuous, Stats - USB serial debugging output Includes 8x8 font with numbers and letters for display.
24 lines
459 B
C
24 lines
459 B
C
#ifndef BUTTON_H
|
|
#define BUTTON_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
BTN_NONE,
|
|
BTN_SHORT_PRESS, // < 500ms
|
|
BTN_LONG_PRESS // >= 500ms
|
|
} button_event_t;
|
|
|
|
// Initialize button GPIO
|
|
void button_init(void);
|
|
|
|
// Poll button state (call in main loop)
|
|
// Returns event type when button is released
|
|
button_event_t button_poll(void);
|
|
|
|
// Check if button is currently pressed
|
|
bool button_is_pressed(void);
|
|
|
|
#endif // BUTTON_H
|