// DEV devices #define DEV_PATH_STYLUS "/dev/input/stylus" #define DEV_PATH_TOUCH "/dev/input/touch" #define DEV_PATH_FB "/dev/fb0" // Path definitions #define US_HOME_PATH "/mnt/us/extensions/simplenotes" #define US_SAVE_PATH "/mnt/us/simplenotes" // Raw stylus ranges (from full calibration) #define RAW_X_MIN 0 #define RAW_X_MAX 15624 // left ~15624, right ~0 #define RAW_Y_MIN 0 #define RAW_Y_MAX 20832 // top ~20832, bottom ~0 // Stroke thickness in pixels #define STROKE_PX 3 // Height of the top/bottom gesture bar in pixels #define TOPBAR_H 100 // Refresh interval in ms #define REFRESH_INTERVAL_MS 45 // Double-tap window and feedback delay #define DOUBLE_TAP_WINDOW_SEC 2 #define SAVE_FEEDBACK_SLEEP_SEC 1 // Tiny 5x7 bitmap font #define TITLE_FONT_W 5 #define TITLE_FONT_H 7 #define TITLE_FONT_ADVANCE 6 // 5px glyph + 1px space // ============================================================================ // Framebuffer context // ============================================================================ typedef struct { int fd; struct fb_fix_screeninfo finfo; struct fb_var_screeninfo vinfo; uint8_t *fbp; size_t screensize; } fb_ctx_t; // ============================================================================ // Global drawing / state // ============================================================================ static uint8_t *g_bitmap = NULL; // 1-bit (stored as bytes) full-screen: 1=black, 0=white static int g_fb_width = 0; static int g_fb_height = 0; typedef enum { TAP_NONE = 0, TAP_LEFT, TAP_RIGHT, TAP_BOTTOM_RIGHT } tap_zone_t; static tap_zone_t g_last_tap_zone = TAP_NONE; static int g_tap_count = 0; static time_t g_last_tap_timestamp = 0;