/** * @file app_display.h * @brief YF30137 7-segment display driver. * * The YF30137 is a 7-pin Charlieplexed LED module: * - 5 seven-segment digits (DIG1..DIG5, segments A..G) * - DIG6 holds two single indicators: A6 = "deg F", B6 = decimal point * * A dedicated FreeRTOS task (display_task) scans the module continuously. * Every other task updates the display simply by calling display_set(); * the scan task only reads the global state and never blocks callers. */ #ifndef __APP_DISPLAY_H__ #define __APP_DISPLAY_H__ #ifdef __cplusplus extern "C" { #endif #include /* Display type / unit (controls the DIG6 "deg F" indicator A6) */ #define DISP_TYPE_CELSIUS 0u /* degree C: A6 off */ #define DISP_TYPE_FAHRENHEIT 1u /* degree F: A6 on */ /* Number base for the displayed value */ #define DISP_BASE_DECIMAL 10u #define DISP_BASE_HEX 16u /** * @brief Update what the display should show (read by the scan task). * @param value floating value to display * @param type DISP_TYPE_CELSIUS / DISP_TYPE_FAHRENHEIT * @param base DISP_BASE_DECIMAL (1 decimal place) / DISP_BASE_HEX * @note Non-blocking; may be called from any task context. */ void display_set(float value, uint8_t type, uint8_t base); /** * @brief Display driver FreeRTOS task: Charlieplexing scan loop, never returns. */ void display_task(void *pvParameters); #ifdef __cplusplus } #endif #endif /* __APP_DISPLAY_H__ */