### run_help_file(const char *help_file) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__help.html Starts the help screen with a specified help file. ```APIDOC ## run_help_file(const char *help_file) ### Description Starts the help screen with the given help file. ### Method Function call ### Endpoint `void run_help_file(const char *help_file)` ### Parameters - **help_file** (const char *) - Required - Help file name ### Return Value None ``` -------------------------------- ### run_help() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__help.html Starts the default help screen using the default help file "/HELP/index.htm". ```APIDOC ## run_help() ### Description Starts the default help screen with the default file "/HELP/index.htm". ### Method Function call ### Endpoint `void run_help()` ### Parameters None ### Return Value None ``` -------------------------------- ### Example Usage of lcd_draw_menu_keys Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__softmenu.html Demonstrates how to define key label arrays and draw the menu based on a conditional flag. ```c const char * menu_mdy[] = {"DMY", "+1m","+1d","-1d","+1y","-1y"}; const char * menu_dmy[] = {"MDY", "+1d","-1d","+1m","+1y","-1y"}; lcd_draw_menu_keys(is_flag_dmy() ? menu_dmy : menu_mdy); ``` -------------------------------- ### run_help_file_style(const char *help_file, user_style_fn_t *user_style_fn) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__help.html Starts the help screen with a specified file and a user style callback for custom styling. ```APIDOC ## run_help_file_style(const char *help_file, user_style_fn_t *user_style_fn) ### Description Starts the help screen with the given file and a user style callback. The callback is invoked when the help browser encounters an unsupported 'class' attribute, allowing the user to adjust the display state. ### Method Function call ### Endpoint `void run_help_file_style(const char *help_file, user_style_fn_t *user_style_fn)` ### Parameters - **help_file** (const char *) - Required - Help file name - **user_style_fn** (user_style_fn_t *) - Required - User style callback ### Return Value None ``` -------------------------------- ### Generate and display a QR code Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__qrcode__disp.html This example demonstrates the workflow for encoding a string into a QR code structure and rendering it on the display using qrcode_initText and qrcode_disp. ```c const int QRver = 4; const int QRecc = ECC_MEDIUM; QRCode qrcode; uint8_t *qrcodeBytes = (uint8_t*)aux_buf_ptr()+512; // Prepare string char *buf = aux_buf_ptr(); strcpy(buf, "String to encode. Has to fit to QRver."); // Encode and display qrcode_initText(&qrcode, qrcodeBytes, QRver, QRecc, buf); qrcode_disp(&qrcode, 208,36, 5); ``` -------------------------------- ### handle_menu Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__menu__system.html Starts a menu screen with the given menu definition, action, and initial line selection. Returns an exit code. ```APIDOC ## handle_menu ### Description Starts a menu screen. ### Function Signature int handle_menu(const smenu_t *menu_id, int action, int cur_line) ### Parameters - **menu_id** (const smenu_t *) - Required - Menu definition structure - **action** (int) - Required - MENU_RESET for first menu screen, MENU_ADD for nested menu - **cur_line** (int) - Required - Line selected at start ### Returns - **int** - Exit code ``` -------------------------------- ### Define a menu message array Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/structsmenu__t.html Example showing how to define a message array for a menu, which must be terminated by a NULL pointer. ```c const char* const dsktst_warn_msg[] = { "All data stored in the FAT", "disk will be destroyed by", "this low-level media test!", NULL }; ``` -------------------------------- ### Define a menu screen with smenu_t Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/structsmenu__t.html Example showing the definition of a menu screen named 'Print to File' using the smenu_t structure and a corresponding menu item array. ```c const uint8_t mid_print[] = { MI_PRTOF_GRAPH, MI_PRTOF_TEXT, MI_PRTOF_GR_IN_TXT, MI_PRTOF_NOIR, 0 }; // Terminator const smenu_t MID_PRINT = { "Print to File", mid_print, NULL, NULL }; ``` -------------------------------- ### start_buzzer_freq(uint32_t freq) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__buzzer.html Starts a tone at the specified frequency. ```APIDOC ## start_buzzer_freq(uint32_t freq) ### Description Start tone. ### Parameters - **freq** (uint32_t) - Required - [mHz] Tone frequency ### Returns void ``` -------------------------------- ### lcd_refresh Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__graphics.html Starts an LCD refresh, which may be blocking or non-blocking based on the system default. Only dirty lines are updated. ```APIDOC ## lcd_refresh ### Description Starts an LCD refresh. The refresh may be blocking or non-blocking depending on the current system default. Only dirty lines are updated. ### Method void lcd_refresh() ### Parameters None. ### Returns None. ``` -------------------------------- ### lcd_refresh_dma Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__graphics.html Starts a non-blocking LCD refresh that continues in the background. Only dirty lines are updated. ```APIDOC ## lcd_refresh_dma ### Description Starts a non-blocking LCD refresh. The refresh continues in the background. Only dirty lines are updated. ### Method void lcd_refresh_dma() ### Parameters None. ### Returns None. ``` -------------------------------- ### lcd_prevFontNr Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Gets the previous (smaller) font number. ```APIDOC ## lcd_prevFontNr ### Description Gets the previous (smaller) font number. ### Function Signature int lcd_prevFontNr(int nr) ### Parameters - **nr** (int) - The current font number. ### Returns (int) The previous font number. ``` -------------------------------- ### lcd_nextFontNr Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Gets the next (bigger) font number. ```APIDOC ## lcd_nextFontNr ### Description Gets the next (bigger) font number. ### Function Signature int lcd_nextFontNr(int nr) ### Parameters - **nr** (int) - The current font number. ### Returns (int) The next font number. ``` -------------------------------- ### printer_get_delay Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__printer.html Gets the current printer line delay in milliseconds. ```APIDOC ## printer_get_delay ### Description Returns current printer line delay. ### Returns - (uint) [ms] Printer line delay ``` -------------------------------- ### print_is_ready Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__printer.html Checks if the IR hardware is ready to send data to the printer. ```APIDOC ## print_is_ready ### Description Check whether IR hw is ready for send. ### Returns - (0/1) 1 = IR hw is ready ``` -------------------------------- ### item_sel_init() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__seleng.html Initializes the item selection state structure. It fills the structure with zeros and sets default values. ```APIDOC ## item_sel_init() ### Description Initializes the item selection state structure. It fills the structure with zeros and sets default values. ### Method Function ### Signature void item_sel_init(item_sel_state_t * _st_) ### Parameters - **st** (item_sel_state_t*) - Required - Item selection state ### Remarks - Fills selection state structure with zeros and sets defaults. ``` -------------------------------- ### qrcode_initBytes Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__qrcode__gen.html Generates a QR code from binary data. The caller must provide a QRCode structure and a buffer of sufficient size (see qrcode_getBufferSize). ```APIDOC ## qrcode_initBytes ### Description Generates a QR code for given data. ### Function Signature int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length) ### Parameters - **qrcode** (QRCode*) - Required - QR code structure - **modules** (uint8_t*) - Required - Buffer for QR code data - **version** (uint8_t) - Required - QR code version - **ecc** (uint8_t) - Required - QR code ECC level - **data** (uint8_t*) - Required - Data to encode - **length** (uint16_t) - Required - Number of bytes to encode ### Return Value - **int8_t** - Status code (0 on success, negative on error). ``` -------------------------------- ### create_screenshot Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/dmcp_8h_source.html Creates a screenshot. ```APIDOC ## create_screenshot ### Description Creates a screenshot. ### Method int create_screenshot(int report_error) ### Parameters - **report_error** (int) - Required - Whether to report errors. ### Returns int - Status code. ``` -------------------------------- ### sys_disk_ok() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__disk__fat.html Returns the current disk status. Returns 1 if the disk is ready, 0 otherwise. ```APIDOC ## sys_disk_ok() ### Description Returns current disk status. ### Function Signature int sys_disk_ok() ### Parameters None ### Returns - (int) 1 = Disk is ready, 0 = not ready ``` -------------------------------- ### run_set_date() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__sys.html Activates the 'Set Date' screen. ```APIDOC ## run_set_date() ### Description Activates the "Set Date" screen. ### Method Function ### Endpoint void run_set_date() ``` -------------------------------- ### check_create_dir Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__disk__other.html Creates directory if doesn't exist. ```APIDOC ## check_create_dir ### Description Creates directory if doesn't exist. ### Method Function ### Endpoint int check_create_dir(const char *dir) ### Parameters - **dir** (const char *) - Required - Directory pathname ### Returns Returns 0 on success ``` -------------------------------- ### lcd_prevLn Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Jumps to the previous line on the display. ```APIDOC ## lcd_prevLn ### Description Jumps to the previous line on the display. ### Function Signature void lcd_prevLn(disp_stat_t *ds) ### Parameters - **ds** (disp_stat_t*) - Pointer to the display state structure. ### Returns None. ``` -------------------------------- ### disp_disk_info(hdr) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__sys.html Activates the 'Disk Info' screen. ```APIDOC ## disp_disk_info(hdr) ### Description Activates the "Disk Info" screen. ### Method Function ### Endpoint void disp_disk_info(const char *hdr) ### Parameters #### Parameters - **hdr** (const char*) - Description: Header for the disk info screen. ``` -------------------------------- ### lcd_writeClr Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Jumps to the first line on the display. ```APIDOC ## lcd_writeClr ### Description Jumps to the first line on the display. ### Function Signature void lcd_writeClr(disp_stat_t *ds) ### Parameters - **ds** (disp_stat_t*) - Pointer to the display state structure. ### Returns None. ``` -------------------------------- ### file_selection_screen Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__sys.html Displays file selection dialog. ```APIDOC ## file_selection_screen ### Description Displays file selection dialog. ### Method Function ### Endpoint int file_selection_screen(const char *title, const char *base_dir, const char *ext, file_sel_fn_t sel_fn, int disp_new, int overwrite_check, void *data) ### Parameters - **title** (const char*) - Screen title - **base_dir** (const char*) - Base directory where the file list starts - **ext** (const char*) - Extension (including dot if required) - **sel_fn** (file_sel_fn_t) - Callback function for selected file - **disp_new** (int) - (0/1) 1 = Display "" line - **overwrite_check** (int) - (0/1) 1 = Check whether file exists and asks for overwrite permission before `sel_fn` is called - **data** (void*) - User supplied data pointer passed directly to `sel_fn` ### Returns MRET_EXIT if canceled, otherwise contains value passed from `sel_fn` ``` -------------------------------- ### qrcode_disp(QRCode *qr, int xo, int yo, int z) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__qrcode__disp.html Displays a generated QR code on the LCD screen at the specified position with the given zoom factor. The QR code must be previously generated using qrcode_initText or similar function. ```APIDOC ## qrcode_disp(QRCode *qr, int xo, int yo, int z) ### Description Displays generated QR code on the LCD screen. ### Function Signature void qrcode_disp(QRCode *qr, int xo, int yo, int z) ### Parameters - **qr** (QRCode*) - Required - Pointer to the QR code structure containing the generated QR code data. - **xo** (int) - Required - X position on LCD where the QR code will be displayed. - **yo** (int) - Required - Y position on LCD where the QR code will be displayed. - **z** (int) - Required - Number of pixels per QR code "bit" square (zoom factor). ### Return Value void - This function does not return a value. ### Example ```c const int QRver = 4; const int QRecc = ECC_MEDIUM; QRCode qrcode; uint8_t *qrcodeBytes = (uint8_t*)aux_buf_ptr()+512; // Prepare string char *buf = aux_buf_ptr(); strcpy(buf, "String to encode. Has to fit to QRver."); // Encode and display qrcode_initText(&qrcode, qrcodeBytes, QRver, QRecc, buf); qrcode_disp(&qrcode, 208, 36, 5); ``` ### Related Functions - **qrcode_initText** - int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data) - Generate QR code for given string. - **aux_buf_ptr** - char * aux_buf_ptr() - Get pointer to aux memory buffer. ### Related Constants - **ECC_MEDIUM** - #define ECC_MEDIUM - ECC medium. Defined in qrcode_ifc.h:67. ### Related Data Structures - **QRCode** - QR code data structure. Defined in qrcode_ifc.h:76. ``` -------------------------------- ### lcd_putsAt Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Macro that jumps to a given line and prints a string. ```APIDOC ## lcd_putsAt ### Description Macro that jumps to line `ln` and prints a string. ### Macro Definition #define lcd_putsAt(_ds_, _ln_, _str_) do { lcd_setLine(ds, ln); lcd_puts(ds,str); } while(0) ### Parameters - **ds** (disp_stat_t*) - Display state - **ln** (int) - Line number - **str** (const char*) - String to print ### Related Macros - `lcd_puts` - Shortcut for lcd_writeText() ``` -------------------------------- ### qrcode_ifc.h header with QRCode struct and API prototypes Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/qrcode__ifc_8h_source.html Header file for the QR code library. Defines the QRCode struct, encoding modes, ECC levels, and function prototypes for generating and reading QR codes. Includes a C++ extern "C" guard and a LOCK_VERSION macro to reduce memory usage. ```c #ifndef __QRCODE_H_ #define __QRCODE_H_ #ifndef __cplusplus typedef unsigned char bool; static const bool false = 0; static const bool true = 1; #endif #include // If set to non-zero, this library can ONLY produce QR codes at that version // This saves a lot of dynamic memory, as the codeword tables are skipped #ifndef LOCK_VERSION #define LOCK_VERSION 0 #endif // QR Code Format Encoding #define MODE_NUMERIC 0 #define MODE_ALPHANUMERIC 1 #define MODE_BYTE 2 // Error Correction Code Levels #define ECC_LOW 0 #define ECC_MEDIUM 1 #define ECC_QUARTILE 2 #define ECC_HIGH 3 typedef struct QRCode { uint8_t version; uint8_t size; uint8_t ecc; uint8_t mode; uint8_t mask; uint8_t *modules; } QRCode; #ifdef __cplusplus extern "C"{ #endif /* __cplusplus */ uint16_t qrcode_getBufferSize(uint8_t version); int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data); int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length); bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __QRCODE_H_ */ ``` -------------------------------- ### run_set_time() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__sys.html Activates the 'Set Time' screen. ```APIDOC ## run_set_time() ### Description Activates the "Set Time" screen. ### Method Function ### Endpoint void run_set_time() ``` -------------------------------- ### wait_for_key_release(int tout) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__kbd__basic.html Waits for key release or timeout. ```APIDOC ## wait_for_key_release(int tout) ### Description Waits for key release or timeout. ### Function Signature void wait_for_key_release(int tout) ### Parameters - **tout** (int) - Required - [1/100s] Timeout or 0 to wait until key is released. ``` -------------------------------- ### lcd_for_calc Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/dmcp_8h_source.html Displays a predefined static screen by id. ```APIDOC ## lcd_for_calc ### Description Displays a predefined static screen by id. ### Method int lcd_for_calc(int what) ### Parameters - **what** (int) - Required - Screen id. ### Returns int - Status code. ``` -------------------------------- ### lcd_putsR Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Prints a string in inverse video at the current line position. ```APIDOC ## lcd_putsR ### Description Print string inversely at current line. ### Parameters - **ds** (disp_stat_t *) - Display state - **str** (const char *) - String to print ### Macro Definition #define lcd_putsR(ds, str) do { ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0) ``` -------------------------------- ### LCD_power_on Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/dmcp_8h_source.html Powers on the LCD hardware. ```APIDOC ## LCD_power_on ### Description Powers on the LCD hardware. ### Method void LCD_power_on() ### Parameters None. ### Returns None. ``` -------------------------------- ### lcd_putsRAt Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Jumps to a specified line and prints a string in inverse video. ```APIDOC ## lcd_putsRAt ### Description Jump to line `ln` and print string inversely. ### Parameters - **ds** (disp_stat_t *) - Display state - **ln** (int) - Line number - **str** (const char *) - String to print ### Macro Definition #define lcd_putsRAt(ds, ln, str) do { lcd_setLine(ds, ln); ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0) ``` -------------------------------- ### lcd_writeNl Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Jumps to the next line on the display. ```APIDOC ## lcd_writeNl ### Description Jumps to the next line on the display. ### Function Signature void lcd_writeNl(disp_stat_t *ds) ### Parameters - **ds** (disp_stat_t*) - Pointer to the display state structure. ### Returns None. ``` -------------------------------- ### key_push(int k1) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__kbd__basic.html Pushes a key at the end of the key buffer. ```APIDOC ## key_push(int k1) ### Description Pushes a key at the end of the key buffer. ### Function Signature int key_push(int k1) ### Parameters - **k1** (int) - Required - Key to store ### Returns - (0/1) 1 = success, 0 = buffer full ``` -------------------------------- ### set_fat_label(const char *label) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__disk__fat.html Sets the disk label. ```APIDOC ## set_fat_label(const char *label) ### Description Sets disk label. ### Function Signature void set_fat_label(const char *label) ### Parameters - **label** (const char*) - Required - New disk label ### Returns None ``` -------------------------------- ### wait_for_key_press() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__kbd__basic.html Waits for a key press. ```APIDOC ## wait_for_key_press() ### Description Waits for a key press. First waits for key release, then for key press and release. Function also exits if the key isn't pressed after AUTO_OFF_MENU timeout. ### Function Signature void wait_for_key_press() ``` -------------------------------- ### lcd_draw_menu_bg Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/dmcp_8h_source.html Draws the menu background. ```APIDOC ## lcd_draw_menu_bg ### Description Draws the menu background. ### Method void lcd_draw_menu_bg() ### Parameters None. ### Returns None. ``` -------------------------------- ### lcd_prevLn() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Moves the display cursor to the previous line. ```APIDOC ## void lcd_prevLn(disp_stat_t * _ds_) ### Description Jump to previous line. ### Parameters - **ds** (disp_stat_t *) - Display state ``` -------------------------------- ### lcd_printAt Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Macro that jumps to a given line and prints a formatted string. ```APIDOC ## lcd_printAt ### Description Macro that jumps to line `ln` and prints a formatted string. ### Macro Definition #define lcd_printAt(_ds_, _ln_, ...) do { lcd_setLine(ds, ln); lcd_print(ds, __VA_ARGS__); } while(0) ### Parameters - **ds** (disp_stat_t*) - Display state - **ln** (int) - Line number - **...** - Format string and arguments for lcd_print ### Related Functions - `lcd_print` - Print formatted string. - `lcd_setLine` - Jump to given line. ``` -------------------------------- ### qrcode_getBufferSize Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__qrcode__gen.html Returns the buffer size required for a given QR code version. Use this to allocate the modules buffer before calling qrcode_initText or qrcode_initBytes. ```APIDOC ## qrcode_getBufferSize ### Description Returns the buffer size required for a given QR code version. ### Function Signature uint16_t qrcode_getBufferSize(uint8_t version) ### Parameters - **version** (uint8_t) - Required - QR code version ### Return Value - **uint16_t** - Buffer size in bytes required for the given version. ``` -------------------------------- ### item_sel_header() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__seleng.html Displays the header for the item selection dialog. It shows the title and subtitle from the state and optionally forces an LCD refresh. ```APIDOC ## item_sel_header() ### Description Displays the header for the item selection dialog. It shows the title and subtitle from the state and optionally forces an LCD refresh. ### Method Function ### Signature void item_sel_header(item_sel_state_t * _st_, int _update_) ### Parameters - **st** (item_sel_state_t*) - Required - Item selection state - **update** (int) - Required - (0/1) 1 - forces LCD refresh after header draw ### Remarks - Displays header according to item_sel_state::title and item_sel_state::title2. - Jumps to first available line on LCD. - Optionally forces LCD refresh. ``` -------------------------------- ### Macro Definitions for LCD Menu Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__softmenu.html Definitions for the number of menu lines, key count, and maximum label length. ```c #define LCD_MENU_LINES 32 #define MENU_KEY_LABEL_LEN 12 #define MENU_KEY_COUNT 6 ``` -------------------------------- ### lcd_draw_menu_keys Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/dmcp_8h_source.html Draws multiple menu keys. ```APIDOC ## lcd_draw_menu_keys ### Description Draws multiple menu keys. ### Method void lcd_draw_menu_keys(const char *keys[]) ### Parameters - **keys** (const char*[]) - Required - Array of key labels. ### Returns None. ``` -------------------------------- ### item_sel_engine() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__seleng.html Main item selection engine loop. It processes user input and updates the selection state. The loop should be enclosed in a user loop that detects the key pressed indicator and handles the key code stored in the state. ```APIDOC ## item_sel_engine() ### Description Main item selection engine loop. It processes user input and updates the selection state. The loop should be enclosed in a user loop that detects the key pressed indicator and handles the key code stored in the state. ### Method Function ### Signature int item_sel_engine(item_sel_state_t * _st_, int _upd_) ### Parameters - **st** (item_sel_state_t*) - Required - Item selection state - **upd** (int) - Required - (0/1) 1 - force repaint ### Return Value Returns an integer. A value of -101 (ISEL_KEY_PRESSED) indicates a key was pressed; other values may indicate other events. ### Remarks - The function returns ISEL_KEY_PRESSED (-101) when a key is pressed. The user loop should detect this and handle the key code stored in item_sel_state::key. - The function may also return other values for different events. ``` -------------------------------- ### power_check_screen() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__dlg__sys.html Checks power voltage and requests USB connection if power is low. Returns 0 if sufficient battery or USB connected, 1 if dialog canceled or timeout with no USB connection. ```APIDOC ## power_check_screen() ### Description This dialog checks the battery voltage and requests the user to connect USB power if the battery voltage is too low. It can be used before power intensive operations. ### Method Function ### Endpoint int power_check_screen() ### Returns - **int** - (0/1) 0 = Sufficient battery or USB connected, 1 = Dialog canceled or timeout, no USB connected ``` -------------------------------- ### key_tail() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__kbd__basic.html Checks for a key in the key buffer. ```APIDOC ## key_tail() ### Description Checks for a key in the key buffer. ### Function Signature int key_tail() ### Returns - Next key in key buffer or -1 if buffer is empty ``` -------------------------------- ### lcd_setLine Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Jumps to a given line on the display. ```APIDOC ## lcd_setLine ### Description Jumps to a given line on the display. ### Function Signature void lcd_setLine(disp_stat_t *ds, int ln_nr) ### Parameters - **ds** (disp_stat_t*) - Pointer to the display state structure. - **ln_nr** (int) - The line number to jump to. ### Returns None. ``` -------------------------------- ### lcd_print() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Prints a formatted string to the display using printf-like formatting. ```APIDOC ## void lcd_print(disp_stat_t * _ds_, const char * _fmt_, ...) ### Description Print formatted string. ### Parameters - **ds** (disp_stat_t *) - Display state - **fmt** (const char *) - Printf like format ``` -------------------------------- ### make_date_filename Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__disk__other.html Creates filename using current date/time. ```APIDOC ## make_date_filename ### Description Creates filename using current date/time. ### Method Function ### Endpoint void make_date_filename(char *fn, const char *dir, const char *ext) ### Parameters - **fn** (char *) - Required - String buffer for created filename - **dir** (const char *) - Required - File directory - **ext** (const char *) - Required - File extension ### Returns void ### Notes Created string has following format: //YYYYMMDD-hhmmsscc i.e. has to contain dot if required ### Example Usage char fname[40]; make_date_filename(fname, PRINT_DIR, ".prn"); ``` -------------------------------- ### LCD Menu Drawing Functions Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__softmenu.html Functions to draw the menu background, individual keys, or the entire set of keys. ```c void lcd_draw_menu_bg (); void lcd_draw_menu_key (int nr, const char *key, int highlight); void lcd_draw_menu_keys (const char *keys[]); ``` -------------------------------- ### run_menu_item_sys Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__menu__system.html Invokes a particular system menu function by line id. Allows launching system functions like USB disk mode from user programs. ```APIDOC ## run_menu_item_sys ### Description Invoke particular sys menu function. ### Function Signature int run_menu_item_sys(uint8_t line_id) ### Parameters - **line_id** (uint8_t) - Required - Sys menu line id ### Returns - **int** - Exit code ### Usage Example run_menu_item_sys(MI_MSC); ``` -------------------------------- ### key_empty() Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__kbd__basic.html Checks whether the key buffer is empty. ```APIDOC ## key_empty() ### Description Checks whether the key buffer is empty. ### Function Signature int key_empty() ### Returns - (0/1) 1 = Key buffer empty ``` -------------------------------- ### lcd_draw_menu_keys Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__softmenu.html Draws the entire soft-menu using the provided array of key labels. ```APIDOC ## void lcd_draw_menu_keys(const char *keys[]) ### Description Draws the whole soft-menu according to the supplied key labels. ### Method void lcd_draw_menu_keys(const char *keys[]) ### Parameters - **keys** (const char *[]) - Required - Array of key labels to draw ### Example ```c const char * menu_mdy[] = {"DMY", "+1m","+1d","-1d","+1y","-1y"}; const char * menu_dmy[] = {"MDY", "+1d","-1d","+1m","+1y","-1y"}; lcd_draw_menu_keys(is_flag_dmy() ? menu_dmy : menu_mdy); ``` ``` -------------------------------- ### Blocking print with buffer timing (printer_busy_for, printer_advance_buf) Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__printer.html Waits until sufficient printer buffer space is ready for the line type determined by pr_len, then sends bytes and updates buffer timers. Uses PRINT_GRA_LN for lines longer than 25 bytes, PRINT_TXT_LN otherwise. ```c // prlen > 25 is just an example int ln_type = (pr_len > 25) ? PRINT_GRA_LN : PRINT_TXT_LN; // Wait until sufficient printer buffer space is ready while ( printer_busy_for(ln_type) ) { // Do something useful } for(x=0; xinv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0) ### Parameters - **ds** (disp_stat_t*) - Display state - **ln** (int) - Line number - **...** - Format string and arguments for lcd_print ``` -------------------------------- ### lcd_textToBox Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/dmcp_8h_source.html Displays text in a confined area. ```APIDOC ## lcd_textToBox ### Description Displays text in a confined area. ### Method void lcd_textToBox(disp_stat_t *ds, int x, int width, char *text, int from_right, int align_right) ### Parameters - **ds** (disp_stat_t*) - Required - Display state. - **x** (int) - Required - X coordinate. - **width** (int) - Required - Width of the box. - **text** (char*) - Required - Text to display. - **from_right** (int) - Required - Whether to start from right. - **align_right** (int) - Required - Whether to align right. ### Returns None. ``` -------------------------------- ### Generate a date-based filename Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__disk__other.html Uses make_date_filename to create a filename string in the format //YYYYMMDD-hhmmsscc. ```c char fname[40]; make_date_filename(fname, PRINT_DIR, ".prn"); ``` -------------------------------- ### lcd_textToBox Source: https://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/group__lcd__text.html Displays text in a confined area with optional alignment. ```APIDOC ## lcd_textToBox ### Description Displays text in a confined area with optional alignment. ### Function Signature void lcd_textToBox(disp_stat_t *ds, int x, int width, char *text, int from_right, int align_right) ### Parameters - **ds** (disp_stat_t*) - Pointer to the display state structure. - **x** (int) - The x-coordinate of the box. - **width** (int) - The width of the box. - **text** (char*) - The text to display. - **from_right** (int) - Flag indicating whether to start from the right. - **align_right** (int) - Flag indicating right alignment. ### Returns None. ```