DMCP interface  03.15_020
dmcp.h
1 #ifndef __SYS_DMCP_H__
2 #define __SYS_DMCP_H__
3 
4 
5 
6 #include <stdint.h>
7 
8 typedef unsigned int uint;
9 
10 // Remove space before ! in next line to enable Intro page
11 /* ! \mainpage Introduction
12  *
13  * \section intro_sec Introduction
14  *
15  * This is the introduction.
16  *
17  * \section install_sec Installation
18  *
19  * \subsection step1 Step 1: Opening the box
20  *
21  * etc...
22  */
23 
24 
25 // --------------------------------------
27 // -------------------------------------
28 
29 
30 // -----------------------------------
32 // ----------------------------------
47 // -----------------------------------
49 // ----------------------------------
64 // -----------------------------------
66 // ----------------------------------
81 // --------------------------------------
83 // -------------------------------------
92 // --------------------------------------
94 // -------------------------------------
112 // ----------------------------------------
114 // ---------------------------------------
115 
131 // -----------------------------------
133 // ----------------------------------
134 
155 #include "ff_ifc.h"
156 
157 
164 // HW interface
165 
169 void LCD_clear();
170 
174 void LCD_power_on();
175 
179 void LCD_power_off(int clear);
180 
196 void LCD_write_line(uint8_t * buf);
197 
213 // --------------------------------------
215 // -------------------------------------
221 // Configuration
222 #define LCD_INVERT_XAXIS
223 #define LCD_INVERT_DATA
224 // -------
225 
226 
227 #define BLT_OR 0
228 #define BLT_ANDN 1
229 #define BLT_XOR 2
231 #define BLT_NONE 0
232 #define BLT_SET 1
235 #ifdef LCD_INVERT_DATA
236 # define LCD_EMPTY_VALUE 0xFF
237 # define LCD_SET_VALUE 0
238 #else
239 # define LCD_EMPTY_VALUE 0
240 # define LCD_SET_VALUE 0xFF
241 #endif
242 
243 #define LCD_X 400
244 #define LCD_Y 240
245 #define LCD_LINE_SIZE 50
246 #define LCD_LINE_BUF_SIZE (LCD_LINE_SIZE+4)
253 // Drawing Prototypes
254 
258 void lcd_clear_buf();
259 
264 void lcd_refresh();
265 
270 void lcd_refresh_dma();
271 
275 void lcd_refresh_wait();
276 
280 void lcd_forced_refresh();
281 
285 void lcd_refresh_lines(int ln, int cnt);
286 
287 
306 void bitblt24(uint32_t x, uint32_t dx, uint32_t y, uint32_t val, int blt_op, int fill);
307 
308 
309 
313 uint8_t * lcd_line_addr(int y);
314 
315 
324 void lcd_fill_rect(uint32_t x, uint32_t y, uint32_t dx, uint32_t dy, int val);
325 
326 
336 void lcd_fill_ptrn(int x, int y, int dx, int dy, int ptrn1, int ptrn2);
337 
338 
346 void lcd_fillLine(int ln, uint8_t val);
347 
348 
357 void lcd_fillLines(int ln, uint8_t val, int cnt);
358 
359 
367 void lcd_set_buf_cleared(int val);
368 
377 int lcd_get_buf_cleared();
378 
379 
385 uint8_t reverse_byte(uint8_t x);
386 
400 #define SCR_DIR "/SCREENS"
401 
405 #define OFFIMG_DIR "/OFFIMG"
406 
407 
408 
409 // Screenshot
418 int create_screenshot(int report_error);
419 
420 // Place image into LCD buffer
421 
433 void lcd_draw_img(const char* img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y);
434 
435 
447 void lcd_draw_img_direct(const char* img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y);
448 
449 
462 void lcd_draw_img_part(const char* img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y, uint32_t dx);
463 
464 
465 
466 // Off images
472 void draw_power_off_image(int allow_errors);
473 
479 void reset_off_image_cycle();
480 
481 #define BG_COL_PAPER 0xf4f2dc
482 #define BG_COL_LCD 0xdff5cc
500 int update_bmp_file_header(FIL* fp, int width, int height, uint32_t bg_color);
501 
502 
503 // ----------------------------------
504 
505 
509 // ----------------------------------
510 
524 typedef struct {
525  const char * name;
526  uint8_t width;
527  uint8_t height;
528  uint8_t baseline;
529  uint8_t first_char;
530  uint8_t char_cnt;
531  uint8_t scale_x;
532  uint8_t scale_y;
533  uint8_t const * data;
534  uint16_t const * offs;
535 } line_font_t;
536 
537 
541 #define NR2T(x) (-(x)-1) // x<0
542 
546 #define T2NR(x) (-(x)-1) // x>=0
547 
548 
554 typedef struct {
555  line_font_t const * f;
556  int16_t x;
557  int16_t y;
558  int16_t ln_offs;
559  int16_t y_top_grd;
560  int8_t ya;
561  int8_t yb;
562  int8_t xspc;
563  int8_t xoffs;
565  uint8_t fixed;
566  uint8_t inv;
567  uint8_t bgfill;
568  uint8_t lnfill;
569  uint8_t newln;
579  const uint8_t *post_offs;
580 } disp_stat_t;
581 
582 
583 
588 void lcd_writeNl(disp_stat_t * ds);
589 
594 void lcd_prevLn(disp_stat_t * ds);
595 
600 void lcd_writeClr(disp_stat_t * ds);
601 
602 
608 void lcd_setLine(disp_stat_t * ds, int ln_nr);
609 
610 
617 void lcd_setXY(disp_stat_t * ds, int x, int y);
618 
624 int lcd_lineHeight(disp_stat_t * ds);
625 
626 
632 int lcd_baseHeight(disp_stat_t * ds);
633 
634 
640 int lcd_fontWidth(disp_stat_t * ds);
641 
642 
651 void lcd_writeText(disp_stat_t * ds, const char* text);
652 
669 void lcd_textToBox(disp_stat_t * ds, int x, int width, char *text, int from_right, int align_right);
670 
671 
672 
679 int lcd_textWidth(disp_stat_t * ds, const char* text);
680 
687 int lcd_charWidth(disp_stat_t * ds, int c);
688 
689 
690 
701 int lcd_textToWidth(disp_stat_t * ds, const char* text, int expected_width, int * plen);
702 
703 
704 
715 int lcd_textToWidthR(disp_stat_t * ds, const char* text, int expected_width, int * plen);
716 
717 
718 
726 void lcd_writeTextWidth(disp_stat_t * ds, const char* text);
727 
728 
743 int lcd_textForWidth(disp_stat_t * ds, const char* text, int expected_width, int * plen);
744 
745 
746 
753 int lcd_nextFontNr(int nr);
754 
761 int lcd_prevFontNr(int nr);
762 
768 void lcd_switchFont(disp_stat_t * ds, int nr);
769 
774 int lcd_toggleFontT(int nr);
775 
776 
782 void lcd_print(disp_stat_t * ds, const char* fmt, ...);
783 
784 
790 #define lcd_printAt(ds, ln, ...) do { lcd_setLine(ds, ln); lcd_print(ds, __VA_ARGS__); } while(0)
791 
796 #define lcd_printR(ds, ...) do { ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)
797 
803 #define lcd_printRAt(ds, ln, ...) do { lcd_setLine(ds, ln); ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)
804 
808 #define lcd_puts lcd_writeText
809 
816 #define lcd_putsAt(ds, ln, str) do { lcd_setLine(ds, ln); lcd_puts(ds,str); } while(0)
817 
823 #define lcd_putsR(ds, str) do { ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)
824 
825 
832 #define lcd_putsRAt(ds, ln, str) do { lcd_setLine(ds, ln); ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)
833 
838 // ----------------------------------
839 
840 
847 #define DISP_CALC 0
848 #define DISP_SYS_MENU 2
849 #define DISP_BOOTLOADER 4
850 #define DISP_UNIMPLEMENTED 5
851 #define DISP_USB_WRITE 6
852 #define DISP_MSC_CONNECT_USB 7
853 #define DISP_ABOUT 8
854 #define DISP_FAT_FORMAT 9
855 #define DISP_FAULT 11
856 #define DISP_QSPI_BAD_CRC 12
857 #define DISP_QSPI_CHECK 13
858 #define DISP_MARK_REGION 15
859 #define DISP_DISK_TEST 16
860 #define DISP_DSKTST_CONNECT_USB 17
861 #define DISP_QSPI_CONNECT_USB 18
862 #define DISP_OFF_IMAGE_ERR 19
863 #define DISP_HELP 21
864 #define DISP_BOOTLDR_CON_USB 22
865 #define DISP_PROD_DIAG 23
866 #define DISP_POWER_CHECK 24
867 #define DISP_FLASH_CONNECT_USB 26
868 // ----
869 
870 
876 int lcd_for_calc(int what);
877 
888 #define LCD_MENU_LINES 32
890 #define MENU_KEY_LABEL_LEN 12
891 #define MENU_KEY_COUNT 6
894 void lcd_draw_menu_bg();
895 
901 void lcd_draw_menu_key(int nr, const char *key, int highlight);
902 
908 void lcd_draw_menu_keys(const char *keys[]);
909 
914 // ----------------------------------
915 
916 
923 // === Date/Time
924 
925 
926 
931 #define PRINT_DT_TM_SZ 20
932 
933 
937 typedef struct {
938  uint16_t year;
939  uint8_t month;
940  uint8_t day;
941 } dt_t;
942 
946 typedef struct {
947  uint8_t hour;
948  uint8_t min;
949  uint8_t sec;
950  uint8_t csec;
956  uint8_t dow;
957 } tm_t;
958 
963 const char* get_wday_shortcut(int day); // 0 = Monday
968 const char* get_month_shortcut(int month); // 1 = Jan
969 
973 int julian_day(dt_t *d);
974 
978 void julian_to_date(int julian_day, dt_t *d);
979 
991 void print_dmy_date(char * s, int const sz, dt_t *dt, const char * prefix, int shortmon, char sep_arg);
992 
1003 void print_clk24_time(char * t, int const sz, tm_t *tm, int disp_sec, int disp_dow);
1004 
1008 // ----------------------------------
1009 
1019 // System data block (SDB)
1020 
1021 
1022 
1023 
1024 
1038 typedef int get_flag_fn_t();
1039 typedef void set_flag_fn_t(int val);
1051 
1059 
1060 
1066 
1072 
1073 
1079 
1085 
1094 
1095 
1096 
1100 typedef void void_fn_t();
1101 
1105 uint32_t calc_state;
1106 
1113 
1114 
1115 
1122 const char * key_to_alpha_table;
1123 
1124 
1125 
1126 
1139 
1144 
1165 
1172 
1179 
1192 // ----------------------------------
1193 
1194 #define PLATFORM_VERSION "3.20"
1195 
1196 // System interface version
1197 #define PLATFORM_IFC_CNR 3
1198 #define PLATFORM_IFC_VER 15
1199 
1200 // STATIC_ASSERT ...
1201 #define ASSERT_CONCAT_(a, b) a##b
1202 #define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
1203 #define STATIC_ASSERT(e,m) ;enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) }
1204 //#define STATIC_ASSERT(expr, msg) typedef char ASSERT_CONCAT(static_assert_check_, __LINE__) [(expr) ? (+1) : (-1)]
1205 
1206 #define _STRINGIFY(x) #x
1207 #define STR(x) _STRINGIFY(x)
1208 
1209 #define BIT(n) (1<<(n))
1210 
1211 
1212 
1213 
1239 int qspi_user_write(uint8_t *data, int size, int offset, int erase);
1240 
1245 uint8_t * qspi_user_addr();
1246 
1251 int qspi_user_size();
1252 
1253 
1271 void rtc_read(tm_t * tm, dt_t *dt);
1272 
1278 void rtc_write(tm_t * tm, dt_t *dt);
1279 
1280 
1285 void rtc_update_time_sec(int delta_sec);
1286 
1287 
1294 uint8_t rtc_read_century();
1295 
1307 void rtc_write_century(uint8_t cent);
1308 
1313 uint8_t rtc_read_min();
1314 
1319 uint8_t rtc_read_sec();
1320 
1327 void rtc_wakeup_delay();
1328 
1329 
1338 void rtc_check_unset();
1339 
1340 
1341 
1345 #define RTCREGS_SS_PER_SEC 256
1346 
1347 
1355 uint32_t get_rtc_ticks();
1356 
1357 
1358 
1362 typedef struct {
1363  uint32_t dt;
1364  uint32_t tm;
1365  uint16_t ss;
1366 } rtc_time_regs_t;
1367 
1368 
1372 typedef struct {
1374  uint64_t dsec;
1375  uint32_t jday;
1376  uint32_t sec;
1377  uint32_t msec;
1379 
1380 
1385 
1386 
1387 
1388 
1389 
1390 
1391 
1392 
1393 
1394 
1403 void rtc_set_alarm(tm_t * tm, dt_t *dt);
1404 
1405 
1409 void rtc_cancel_alarm();
1410 
1411 
1412 
1425 // ==== VBAT
1426 
1431 uint32_t read_power_voltage();
1432 
1437 int get_lowbat_state();
1438 
1443 int get_vbat();
1444 
1445 // ==== USB functions
1450 int usb_powered();
1451 
1464 // ==== Buzzer
1465 
1466 // Freq in mHz
1467 
1472 void start_buzzer_freq(uint32_t freq);
1473 
1477 void stop_buzzer();
1478 
1484 void set_buzzer(int pin1val, int pin2val);
1485 
1486 
1490 void beep_volume_up();
1491 
1495 void beep_volume_down();
1496 
1501 int get_beep_volume();
1502 
1522 // ==== REGIONS
1523 
1528 uint32_t mark_region(uint32_t id);
1529 
1533 void no_region();
1534 
1544 // ==== RESET values
1545 
1546 #define NO_SPLASH_MAGIC 0xEACE7362
1547 #define ALLOC_FAIL_MAGIC 0x363EACE7
1548 #define CLEAN_RESET_MAGIC 0x3EACE736
1549 #define RUN_DMCP_MAGIC 0x3CE7EA37
1556 void set_reset_magic(uint32_t value);
1557 
1558 
1559 
1560 // === RESET STATE FILE
1561 
1562 #define RESET_STATE_FILE_SIZE 0x38
1568 int is_reset_state_file();
1569 
1574 char * get_reset_state_file();
1575 
1585 void set_reset_state_file(const char * str);
1586 
1587 
1591 void sys_reset();
1592 
1593 
1620 // Aux buf
1621 #define AUX_BUF_SIZE (5*512)
1627 char * aux_buf_ptr();
1628 
1633 void * write_buf_ptr();
1634 
1639 int write_buf_size();
1640 
1641 
1646 
1654 int sys_write_buf_used();
1655 
1663 // Program info structure
1664 #define PROG_INFO_MAGIC 0xd377C0DE
1665 
1666 void program_main();
1667 
1670 typedef struct {
1671  uint32_t pgm_magic;
1672  uint32_t pgm_size;
1673  void * pgm_entry;
1674  uint32_t ifc_cnr;
1675  uint32_t ifc_ver;
1676  uint32_t qspi_size;
1677  uint32_t qspi_crc;
1678  char pgm_name[16];
1679  char pgm_ver[16];
1680 } prog_info_t;
1681 
1685 // Keyboard
1686 int read_key(int *k1, int *k2);
1687 void suspended_bg_key_read();
1688 void resume_bg_key_read();
1689 
1690 
1691 // Timer
1692 uint32_t get_tim1_timer();
1693 
1694 
1695 // Base frequency 8MHz
1696 #define TIMER_BASE_FREQ (8000000)
1697 void start_timer2(uint32_t div32);
1698 void start_timer3(uint16_t div16);
1699 void stop_timer2();
1700 void stop_timer3();
1701 
1702 
1703 
1704 
1705 
1706 
1707 
1708 
1709 // ----------------------------------
1710 
1720 // Printer
1721 #define PRINT_GRA_LN 1
1722 #define PRINT_TXT_LN 0
1724 #define MAX_82240_WIDTH 166
1725 #define DFLT_82240_LINE_DUR 1800
1731 void print_byte(uint8_t b);
1732 
1733 
1739 void print_buffer(uint8_t * buf, int cnt);
1740 
1741 
1742 
1747 int print_is_ready();
1748 
1749 
1750 
1751 // Printer delay in ms
1756 uint printer_get_delay();
1757 
1762 void printer_set_delay(uint val);
1763 
1768 void printer_advance_buf(int what);
1769 
1774 int printer_busy_for(int what);
1775 
1780 // ----------------------------------
1781 
1797 // --------------------------------
1798 // Menu pages
1799 // --------------------------------
1800 
1801 
1809 typedef struct {
1810  const char * name;
1811  const uint8_t * items;
1821  const char* const * msg;
1822 
1827 } smenu_t;
1828 
1829 
1830 // --------------------------------------
1832 // -------------------------------------
1842 extern const smenu_t MID_SYS_WARN;
1843 extern const smenu_t MID_SYSTEM;
1844 extern const smenu_t MID_FAT_FORMAT;
1845 extern const smenu_t MID_DSKTST_ENTER;
1846 extern const smenu_t MID_PROD_DIAG;
1847 extern const smenu_t MID_PROD_DIAG2;
1848 extern const smenu_t MID_DMCP;
1849 extern const smenu_t MID_BASE_SETUP;
1857 // --------------------------------------
1859 // -------------------------------------
1870 #define MI_SYSTEM 192
1871 #define MI_BOOTLOADER 193
1872 #define MI_QSPI_LOADER 194
1873 #define MI_DIAG 195
1874 #define MI_MSC 196
1875 #define MI_ABOUT 197
1876 #define MI_BASE_SETUP 198
1877 #define MI_BEEP_MUTE 199
1878 #define MI_SYSTEM_ENTER 200
1879 #define MI_RELOAD_RESET 201
1880 #define MI_SET_TIME 202
1881 #define MI_SET_DATE 203
1882 #define MI_FF_ENTER 204
1883 #define MI_FAT_FORMAT 205
1884 #define MI_DISK_TEST 206
1885 #define MI_DSKTST_ENTER 207
1886 #define MI_DISK_INFO 208
1887 #define MI_LOAD_QSPI 209
1888 #define MI_SLOW_AUTOREP 210
1890 #define MI_EXIT 211
1892 #define MI_KBD_TEST 212
1893 #define MI_LCD_TEST 213
1894 #define MI_IR_TEST 214
1895 #define MI_BEEP_TEST 215
1896 #define MI_DMCP_MENU 216
1898 #define MI_SELF_TEST 217
1900 #define MI_RAMFLASH 218
1902 #define MI_PGM_INFO 219
1903 #define MI_PGM_RUN 220
1904 #define MI_PGM_LOAD 221
1906 #define MI_RUN_DMCP 222
1908 #define MI_OFF_MODE 223
1909 // --------------------------------
1910 
1911 
1918 typedef int run_menu_item_fn_t(uint8_t line_id);
1919 
1923 typedef const char * menu_line_str_fn_t(uint8_t line_id, char * s, const int slen);
1924 
1925 
1926 // --------------------------------------
1928 // -------------------------------------
1933 // --------------------------------
1934 #define MENU_MAX_LEVEL 8
1936 #define MENU_FONT t24
1937 #define MENU_LCD_LINES 8
1939 #define MENU_RESET 0
1940 #define MENU_ADD 1
1942 #define MRET_UNIMPL -1
1943 #define MRET_EXIT -2
1949 #define MRET_LEAVELIMIT 512
1950 // --------------------------------
1955 // === Base menu functions ===
1964 int handle_menu(const smenu_t * menu_id, int action, int cur_line);
1965 
1966 
1974 int run_menu_item_sys(uint8_t line_id);
1975 
1976 
1986 int run_menu_item(uint8_t line_id);
1987 
1999 const char * menu_line_str(uint8_t line_id, char * ln, const int ln_len);
2000 
2001 
2002 // --------------------------------------
2004 // -------------------------------------
2012 // === Menu formatting support
2018 const char * rb_str(int val);
2019 
2020 
2026 const char * sel_str(int val);
2027 
2036 char * opt_str(char * s, char const *txt, int val);
2037 
2045 char * date_str(char * s, const char * txt);
2046 
2054 char * time_str(char * s, const char * txt);
2055 
2074 void run_set_time();
2075 
2079 void run_set_date();
2080 
2081 // === Base dialogs
2085 void disp_disk_info(const char * hdr);
2086 
2095 int power_check_screen();
2096 
2097 // === File selection ===
2098 
2100 #define MAX_PGM_FN_LEN 24
2101 
2111 typedef int (*file_sel_fn_t)(const char * fpath, const char * fname, void * data);
2112 
2125 int file_selection_screen(const char * title, const char * base_dir, const char * ext, file_sel_fn_t sel_fn,
2126  int disp_new, int overwrite_check, void * data);
2127 
2128 
2146 // ---------------------------------------------------
2147 // Item selection screen
2148 // ---------------------------------------------------
2149 
2157 #define ISEL_FILL_ITEMS -100
2158 
2166 #define ISEL_KEY_PRESSED -101
2167 
2175 #define ISEL_EXIT -102
2176 
2184 #define ISEL_POST_DRAW -2
2185 
2193 #define ISEL_PRE_DRAW -1
2194 
2195 
2199 typedef uint16_t list_item_t;
2200 
2201 struct item_sel_state;
2202 
2206 typedef void isel_disp_line_fn_t(int lnr, list_item_t *fis, int cur_fnr, struct item_sel_state *st);
2207 
2211 typedef void fis_name_fn_t(struct item_sel_state *st, list_item_t fis, char * nmbuf, int len);
2212 
2213 
2217 typedef struct item_sel_state {
2218  int8_t fnr;
2219  int8_t top_nr;
2220  int8_t lncnt;
2221  int8_t roll_lines;
2222  int8_t key;
2227  int fcnt;
2229  // -- Set by user --
2230  const char * title;
2231  char * title2;
2233  char * lnbuf;
2234  int lnsize;
2236  void * data;
2237  void * items;
2240 
2241 
2249 
2250 
2258 
2259 
2265 int item_sel_engine(item_sel_state_t *st, int upd);
2266 
2267 
2278 void item_sel_header(item_sel_state_t *st, int update);
2279 
2280 
2289 // ---------------------------------------------------
2290 
2309 void msg_box(disp_stat_t * ds, const char * txt, int inv);
2310 
2313 // ----------------------------------
2314 
2315 
2316 #define MAX_LCD_LINE_LEN 40
2317 
2318 
2319 // -----------------------
2320 // Bit masks operations
2321 // -----------------------
2322 #define VAL(x,val) ((x) & (val))
2323 #define CLR(x,val) val &= ~(x)
2324 #define SET(x,val) val |= (x)
2325 #define MSK(x,val) (~(x) & (val))
2326 #define SETMSK(x,m,val) val = (MSK(m,val)|(x))
2327 //#define SETBY(c,x,val) (c) ? SET(x,val) : CLR(x,val)
2328 #define SETBY(c,x,val) if (c) { SET(x,val); } else { CLR(x,val); }
2329 
2330 
2331 
2332 
2333 
2334 
2335 #define ST(x) VAL(x,calc_state)
2336 #define VAL_ST(x) VAL(x,calc_state)
2337 #define CLR_ST(x) CLR(x,calc_state)
2338 #define SET_ST(x) SET(x,calc_state)
2339 #define SETMSK_ST(x,m) SETMSK(x,m,calc_state)
2340 #define SETBY_ST(c,x) SETBY(c,x,calc_state)
2341 
2342 
2343 
2344 #define STAT_CLEAN_RESET BIT(0)
2345 #define STAT_RUNNING BIT(1)
2346 #define STAT_SUSPENDED BIT(2)
2347 #define STAT_KEYUP_WAIT BIT(3)
2348 #define STAT_OFF BIT(4)
2349 #define STAT_SOFT_OFF BIT(5)
2350 #define STAT_MENU BIT(6)
2351 #define STAT_BEEP_MUTE BIT(7)
2352 #define STAT_SLOW_AUTOREP BIT(8)
2353 #define STAT_PGM_END BIT(9)
2354 #define STAT_CLK_WKUP_ENABLE BIT(10)
2355 #define STAT_CLK_WKUP_SECONDS BIT(11) // 0 - wakeup runner each minute, 1 - each second
2356 #define STAT_CLK_WKUP_FLAG BIT(12)
2357 #define STAT_DMY BIT(13)
2358 #define STAT_CLK24 BIT(14)
2359 #define STAT_POWER_CHANGE BIT(15)
2360 
2361 #define STAT_HW_BEEP BIT(28)
2362 #define STAT_HW_USB BIT(29)
2363 #define STAT_HW_IR BIT(30)
2364 
2365 #define STAT_HW (STAT_HW_BEEP | STAT_HW_USB | STAT_HW_IR)
2366 
2367 
2368 
2369 
2370 
2371 
2372 // --------------------------------------
2373 
2374 // -------------------------------------
2383 #define MAX_KEY_NR 37
2384 #define MAX_FNKEY_NR 43
2387 // -------------
2388 // Key codes
2389 // -------------
2390 
2391 #define KEY_SIGMA 1
2392 #define KEY_INV 2
2393 #define KEY_SQRT 3
2394 #define KEY_LOG 4
2395 #define KEY_LN 5
2396 #define KEY_XEQ 6
2397 #define KEY_STO 7
2398 #define KEY_RCL 8
2399 #define KEY_RDN 9
2400 #define KEY_SIN 10
2401 #define KEY_COS 11
2402 #define KEY_TAN 12
2403 #define KEY_ENTER 13
2404 #define KEY_SWAP 14
2405 #define KEY_CHS 15
2406 #define KEY_E 16
2407 #define KEY_BSP 17
2408 #define KEY_UP 18
2409 #define KEY_7 19
2410 #define KEY_8 20
2411 #define KEY_9 21
2412 #define KEY_DIV 22
2413 #define KEY_DOWN 23
2414 #define KEY_4 24
2415 #define KEY_5 25
2416 #define KEY_6 26
2417 #define KEY_MUL 27
2418 #define KEY_SHIFT 28
2419 #define KEY_1 29
2420 #define KEY_2 30
2421 #define KEY_3 31
2422 #define KEY_SUB 32
2423 #define KEY_EXIT 33
2424 #define KEY_0 34
2425 #define KEY_DOT 35
2426 #define KEY_RUN 36
2427 #define KEY_ADD 37
2429 #define KEY_F1 38
2430 #define KEY_F2 39
2431 #define KEY_F3 40
2432 #define KEY_F4 41
2433 #define KEY_F5 42
2434 #define KEY_F6 43
2436 #define KEY_SCREENSHOT 44
2437 #define KEY_SH_UP 45
2438 #define KEY_SH_DOWN 46
2440 #define KEY_DOUBLE_RELEASE 99
2442 #define KEY_PAGEUP KEY_DIV
2443 #define KEY_PAGEDOWN KEY_MUL
2454 // ---------------------------
2455 // Key buffer functions
2456 // ---------------------------
2457 
2462 int key_empty();
2463 
2469 int key_push(int k1);
2470 
2475 int key_tail();
2476 
2481 int key_pop();
2482 
2483 
2488 int key_pop_last();
2494 void key_pop_all();
2495 
2496 
2497 // Key functions
2503 int key_to_nr(int key);
2504 
2505 // Key
2510 int sys_last_key();
2511 
2520 void wait_for_key_press();
2521 
2526 void wait_for_key_release(int tout);
2527 
2528 
2529 
2554 int runner_get_key(int *repeat);
2555 
2567 int runner_get_key_delay(int *repeat, uint timeout, uint rep0, uint rep1, uint rep1tout);
2568 
2569 
2570 // ---------------------------
2571 // Runner get key
2572 // ---------------------------
2573 
2588 int runner_key_tout_value(const int first);
2589 
2590 
2591 
2601 // Autorepeat
2606 
2610 int is_slow_autorepeat();
2611 
2623 void runner_key_tout_init(const int slow);
2624 
2625 
2626 
2637 // Auto off
2638 
2639 
2640 #define AUTO_OFF_SECONDS 600
2641 #define AUTO_OFF_MENU 300
2647 void reset_auto_off();
2648 
2653 int is_auto_off();
2654 
2659 int is_menu_auto_off();
2660 
2665 int sys_auto_off_cnt();
2666 
2684 // Check and create dir
2685 // returns 0 on success
2686 int check_create_dir(const char * dir);
2687 
2693 int file_exists(const char * fn);
2694 
2700 int file_size(const char * fn);
2701 
2702 
2718 void make_date_filename(char * fn, const char * dir, const char * ext);
2719 
2720 
2739 int sys_disk_ok();
2740 
2747 int sys_disk_write_enable(int val);
2748 
2754 
2755 
2770 void sys_disk_check_valid();
2771 
2776 void set_fat_label(const char * label);
2777 
2794 void sys_timer_disable(int timer_ix);
2795 
2801 void sys_timer_start(int timer_ix, uint32_t ms_value);
2802 
2808 int sys_timer_active(int timer_ix);
2809 
2814 int sys_timer_timeout(int timer_ix);
2815 
2816 
2817 
2821 void sys_delay(uint32_t ms_delay);
2822 
2823 // Current systick count
2824 
2833 uint32_t sys_tick_count();
2834 
2839 uint32_t sys_current_ms();
2840 
2854 // Critical sections
2855 
2859 void sys_critical_start();
2860 
2864 void sys_critical_end();
2865 
2866 // Sleep
2867 
2871 void sys_sleep();
2872 
2873 // Free memory
2874 
2879 int sys_free_mem();
2880 
2881 // ==== HW ID
2882 
2889 uint8_t get_hw_id();
2890 
2905 // ---------------------------
2906 // Flashing
2907 // ---------------------------
2908 
2909 
2911 void sys_flashing_init();
2913 void sys_flashing_finish();
2914 
2922 int sys_flash_erase_block(void* start_addr, uint32_t size);
2923 
2932 int sys_flash_write_block(void* dst_addr, uint8_t * src_buf, uint32_t size);
2933 
2936 // ---------------------------
2937 
2938 
2957 // ----------------------------------
2958 
2959 
2960 // Help
2961 #define HELP_INDEX "/HELP/index.htm"
2968 void run_help();
2969 
2970 
2976 void run_help_file(const char * help_file);
2977 
2978 
2984 typedef void user_style_fn_t(char *class_attr, disp_stat_t *ds);
2985 
2986 
3001 void run_help_file_style(const char * help_file, user_style_fn_t *user_style_fn);
3002 
3003 
3006 // ----------------------------------
3007 
3008 
3009 
3010 #endif
3011 
uint8_t first_char
Code of first character.
Definition: dmcp.h:529
int key_empty()
Check whether key buffer is empty.
int8_t fnr
Currently selected list item.
Definition: dmcp.h:2218
int key_pop()
Remove and return next key from key buffer.
const smenu_t MID_PROD_DIAG2
Production diagnostic screen - selftest version in main menu.
int sys_flash_write_block(void *dst_addr, uint8_t *src_buf, uint32_t size)
Write data to flash.
set_flag_fn_t * set_flag_clk24
Setter callback for CLK24 flag.
Definition: dmcp.h:1071
const uint8_t * items
Menu items.
Definition: dmcp.h:1811
line_font_t const * f
Current font.
Definition: dmcp.h:555
uint printer_get_delay()
Returns current printer line delay.
void disp_disk_info(const char *hdr)
Activates "Disk Info" screen.
char * get_reset_state_file()
Get pointer to reset state file.
uint32_t get_rtc_ticks()
Get time ticks (linear time)
int item_sel_engine(item_sel_state_t *st, int upd)
Main item selection engine loop.
int max_items
Maximal number of items.
Definition: dmcp.h:2226
uint8_t rtc_read_min()
Reads current minute.
rtc_ticks_stat_t * rtc_update_ticks()
Returns pointer to currently updated RTC ticks structure.
char * date_str(char *s, const char *txt)
Formats text followed by date.
void lcd_fill_ptrn(int x, int y, int dx, int dy, int ptrn1, int ptrn2)
Fills rectangular area with prescribed pattern.
run_menu_item_fn_t * run_menu_item_app
System callback variable to run menu item (see Menu system for details)
Definition: dmcp.h:1138
uint32_t jday
julian day
Definition: dmcp.h:1375
int qspi_user_size()
Returns size (in bytes) of the user QSPI data area.
void item_sel_reinit(item_sel_state_t *st)
Cleanup before items reload.
int printer_busy_for(int what)
Wait until printer buffer is free for given line type.
void fis_name_fn_t(struct item_sel_state *st, list_item_t fis, char *nmbuf, int len)
Callback function for getting list item name.
Definition: dmcp.h:2211
uint32_t mark_region(uint32_t id)
Mark executed code.
void LCD_power_on()
Powers on the LCD hardware.
int lcd_lineHeight(disp_stat_t *ds)
Returns line height.
int16_t x
Current x position.
Definition: dmcp.h:556
int sys_auto_off_cnt()
Returns remaining auto-off seconds.
uint8_t * qspi_user_addr()
Returns pointer to the user QSPI data area.
uint32_t tm
Date part.
Definition: dmcp.h:1364
disp_stat_t * t20
Font state for small system font.
Definition: dmcp.h:1164
int sys_disk_ok()
Returns current disk status.
get_flag_fn_t * get_flag_dmy
Getter callback for DMY flag.
Definition: dmcp.h:1050
void rtc_cancel_alarm()
Cancels any pending RTC alarm.
int lcd_for_calc(int what)
Displays predefined static screen by id.
uint8_t csec
Centiseconds (1/100s)
Definition: dmcp.h:950
void sys_reset()
Invoke CPU reset.
const smenu_t MID_SYSTEM
System menu.
int sys_is_disk_write_enable()
Returns current disk write state.
const char * title
Screen title.
Definition: dmcp.h:2230
const smenu_t MID_BASE_SETUP
System setup menu.
int16_t ln_offs
Line offset (when displaying by line numbers)
Definition: dmcp.h:558
uint8_t const * data
Font data.
Definition: dmcp.h:533
void set_fat_label(const char *label)
Sets disk label.
FatFs file structure used in file operations.
Definition: ff_ifc.h:66
void lcd_setLine(disp_stat_t *ds, int ln_nr)
Jump to given line.
int8_t key
key code, set by engine for ISEL_KEY_PRESSED
Definition: dmcp.h:2222
int lcd_textToWidthR(disp_stat_t *ds, const char *text, int expected_width, int *plen)
Determines which part of text from the end of the string fits in expected_width.
uint8_t lnfill
Fill whole line before writing line.
Definition: dmcp.h:568
void run_set_date()
Activates "Set Date" screen.
void run_set_time()
Activates "Set Time" screen.
void sys_timer_start(int timer_ix, uint32_t ms_value)
Starts system timer (non-periodic pooling timer)
void wait_for_key_press()
Wait for key press.
void print_buffer(uint8_t *buf, int cnt)
Send bytes to printer.
void lcd_refresh()
Start lcd refresh - could be blocking or non-blocking based on current system default (only dirty lin...
void lcd_draw_menu_key(int nr, const char *key, int highlight)
const char * name
Font name.
Definition: dmcp.h:525
int8_t lncnt
Number of LCD lines available.
Definition: dmcp.h:2220
int qspi_user_write(uint8_t *data, int size, int offset, int erase)
Writes data to the user QSPI data area.
const char * sel_str(int val)
Returns &#39;cross&#39; selection string.
void lcd_print(disp_stat_t *ds, const char *fmt,...)
Print formatted string.
uint32_t sec
seconds in day
Definition: dmcp.h:1376
int sys_write_buf_used()
Get &#39;write-buffer-used&#39; flag.
disp_stat_t * fReg
Font state for user font.
Definition: dmcp.h:1178
uint8_t inv
Draw inverted.
Definition: dmcp.h:566
const char * key_to_alpha_table
Key to alpha translation table.
Definition: dmcp.h:1122
void void_fn_t()
General prototype for void function.
Definition: dmcp.h:1100
void draw_power_off_image(int allow_errors)
Draw subsequent image from OFFIMG_DIR directory.
void rtc_read(tm_t *tm, dt_t *dt)
Read current data and time.
void sys_critical_end()
Leave critical section.
int julian_day(dt_t *d)
Calculates Julian day for given date.
const char * get_month_shortcut(int month)
Three character shortcut of month name.
void run_help_file(const char *help_file)
Starts help screen.
void lcd_clear_buf()
Clear LCD buffer.
int sys_last_key()
Returns currently pressed key code.
void sys_timer_disable(int timer_ix)
Disables system timer.
void lcd_setXY(disp_stat_t *ds, int x, int y)
Jump to pixel position (x,y)
int lcd_textToWidth(disp_stat_t *ds, const char *text, int expected_width, int *plen)
Determines which part of text fits in expected_width.
isel_disp_line_fn_t * disp_line_fn
Line draw function.
Definition: dmcp.h:2232
void item_sel_init(item_sel_state_t *st)
Initializes item sel structure.
int handle_menu(const smenu_t *menu_id, int action, int cur_line)
Starts menu screen.
uint8_t rtc_read_sec()
Reads current second.
void print_dmy_date(char *s, int const sz, dt_t *dt, const char *prefix, int shortmon, char sep_arg)
Formats date according to supplied and system flags.
const char * menu_line_str(uint8_t line_id, char *ln, const int ln_len)
(Defined by user) Should return string representation of given menu item
void make_date_filename(char *fn, const char *dir, const char *ext)
Creates filename using current date/time.
rtc_time_regs_t regs
Time stamp.
Definition: dmcp.h:1373
menu_line_str_fn_t * menu_line_str_app
System callback variable to get menu item string (see Menu system for details)
Definition: dmcp.h:1143
void stop_buzzer()
Stop tone.
void_fn_t * post_disp
Function called after the menu is drawn to LCD.
Definition: dmcp.h:1826
int(* file_sel_fn_t)(const char *fpath, const char *fname, void *data)
"File selected" callback for file_selection_screen()
Definition: dmcp.h:2111
int lcd_baseHeight(disp_stat_t *ds)
Returns baseline position.
void beep_volume_up()
Increase tone volume.
int runner_get_key(int *repeat)
Wait for key event or timeout.
fis_name_fn_t * fis_name_fn
Name callback.
Definition: dmcp.h:2225
int8_t xspc
Space between chars.
Definition: dmcp.h:562
void julian_to_date(int julian_day, dt_t *d)
Calculates date for given Julian day.
uint8_t dow
Day of week.
Definition: dmcp.h:956
uint32_t calc_state
Main calculator state flags.
Definition: dmcp.h:1105
uint8_t newln
Jump to new line after writing line.
Definition: dmcp.h:569
int write_buf_size()
Get write buffer size.
uint8_t height
Font height in pixels.
Definition: dmcp.h:527
const char * get_wday_shortcut(int day)
Three character shortcut of day name.
int lcd_toggleFontT(int nr)
Toggle font number between normal and TT font.
void wait_for_key_release(int tout)
Wait for key release or timeout.
int lcd_prevFontNr(int nr)
Get previous (smaller) font number.
int file_size(const char *fn)
Returns file size.
uint8_t char_cnt
Number of characters.
Definition: dmcp.h:530
const smenu_t MID_FAT_FORMAT
FAT format menu.
int lcd_get_buf_cleared()
Reads &#39;LCD buffer cleared&#39; flag.
int power_check_screen()
Check power voltage and requests USB connection if power is low.
int toggle_slow_autorepeat()
Toggle slow_autorepeat flag in system.
void set_reset_state_file(const char *str)
Set reset state file to given string.
int run_menu_item_sys(uint8_t line_id)
Invoke particular sys menu function.
uint8_t reverse_byte(uint8_t x)
Swaps bits in byte.
int sys_flash_erase_block(void *start_addr, uint32_t size)
Flash block erase.
int8_t top_nr
Item number currently first on LCD.
Definition: dmcp.h:2219
void lcd_fill_rect(uint32_t x, uint32_t y, uint32_t dx, uint32_t dy, int val)
Fills rectangular area of LCD.
int runner_get_key_delay(int *repeat, uint timeout, uint rep0, uint rep1, uint rep1tout)
Wait for key event or timeout with more autorepeat and timeout control.
const char * rb_str(int val)
Returns &#39;dot&#39; selection string.
void printer_set_delay(uint val)
Sets printer line delay.
int usb_powered()
Returns USB powered status.
char * title2
(Optional) Right part of title (aligned right)
Definition: dmcp.h:2231
void sys_flashing_finish()
Disable flashing.
set_flag_fn_t * set_beep_mute
Setter callback for Beep Mute flag.
Definition: dmcp.h:1084
int fcnt
Current item count.
Definition: dmcp.h:2227
uint8_t baseline
Baseline in pixels.
Definition: dmcp.h:528
void lcd_refresh_wait()
Issue LCD refresh and wait until done (only dirty lines are updated)
void lcd_forced_refresh()
Write immediately whole LCD buffer to LCD regardless of dirty flags.
void sys_critical_start()
Enter critical section.
void user_style_fn_t(char *class_attr, disp_stat_t *ds)
Prototype for user style callback function.
Definition: dmcp.h:2984
const smenu_t MID_PROD_DIAG
Production diagnostic screen.
int sys_disk_write_enable(int val)
(En/Dis)able disk write mode
int sys_timer_timeout(int timer_ix)
Check for timer timeout.
void sys_delay(uint32_t ms_delay)
Delays program by specified number of milliseconds.
char * lnbuf
Line buffer (optional - only app wants to use it for line drawing)
Definition: dmcp.h:2233
struct item_sel_state item_sel_state_t
Item selection state.
uint32_t read_power_voltage()
Reads power voltage.
uint8_t fixed
Draw in fixed width.
Definition: dmcp.h:565
void * write_buf_ptr()
Get pointer to write buffer.
uint16_t const * offs
Character offsets in data.
Definition: dmcp.h:534
const smenu_t MID_DSKTST_ENTER
Disk test menu.
set_flag_fn_t * set_flag_dmy
Setter callback for DMY flag.
Definition: dmcp.h:1058
const uint8_t * post_offs
Array with character x offsets (optional)
Definition: dmcp.h:579
void lcd_set_buf_cleared(int val)
Sets &#39;LCD buffer cleared&#39; flag.
int16_t y
Current y position.
Definition: dmcp.h:557
Font structure.
Definition: dmcp.h:524
int is_menu_auto_off()
Check menu auto-off state.
void rtc_write(tm_t *tm, dt_t *dt)
Set date and time.
int lcd_charWidth(disp_stat_t *ds, int c)
Returns width of character.
uint8_t * lcd_line_addr(int y)
Returns pointer to line data (doesn&#39;t depend on LCD_INVERT_XAXIS)
uint16_t year
Year.
Definition: dmcp.h:938
get_flag_fn_t * is_flag_clk24
Getter callback for CLK24 flag.
Definition: dmcp.h:1065
int key_tail()
Check for key in key buffer.
void rtc_check_unset()
Check whether RTC was updated from cold start state. Displays set time and set date dialogs if it was...
uint32_t msec
seconds in day corresponding to current minute (for easy sub-minute updates)
Definition: dmcp.h:1377
int lcd_textWidth(disp_stat_t *ds, const char *text)
Calculates width of text.
int key_push(int k1)
Push key at the end of key buffer.
uint8_t hour
Hours.
Definition: dmcp.h:947
int8_t ya
Lines to fill above the font.
Definition: dmcp.h:560
int get_flag_fn_t()
Get flag function prototype.
Definition: dmcp.h:1038
int get_vbat()
Returns battery voltage.
int8_t xoffs
X offset for first char on line.
Definition: dmcp.h:563
void lcd_textToBox(disp_stat_t *ds, int x, int width, char *text, int from_right, int align_right)
Display text in confined area.
int get_lowbat_state()
Returns low-battery flag.
void lcd_draw_img_direct(const char *img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y)
Put image directly on LCD.
const char * name
Display name of the menu.
Definition: dmcp.h:1810
uint16_t ss
Subsecond part.
Definition: dmcp.h:1365
Item selection state.
Definition: dmcp.h:2217
uint8_t month
Month 1-12.
Definition: dmcp.h:939
void key_pop_all()
Remove all keys from key buffer.
int lcd_textForWidth(disp_stat_t *ds, const char *text, int expected_width, int *plen)
Calculate text width without breaking words
void lcd_fillLine(int ln, uint8_t val)
Fill LCD line with value.
Date info structure.
Definition: dmcp.h:937
const char * menu_line_str_fn_t(uint8_t line_id, char *s, const int slen)
Prototype for menu_line_str function.
Definition: dmcp.h:1923
void no_region()
Clear current region.
void LCD_clear()
Sends clear command to LCD.
disp_stat_t * t24
Font state for normal system font.
Definition: dmcp.h:1171
void run_help_file_style(const char *help_file, user_style_fn_t *user_style_fn)
Starts help screen.
uint64_t dsec
julian day * seconds_per_day
Definition: dmcp.h:1374
int is_auto_off()
Check auto-off state.
int8_t yb
Lines to fill below the font.
Definition: dmcp.h:561
void_fn_t * after_fat_format
This callback function is called by system after FAT disk format (if set)
Definition: dmcp.h:1093
void msg_box(disp_stat_t *ds, const char *txt, int inv)
Display message box.
void lcd_refresh_lines(int ln, int cnt)
Write immediately lines [ln .. ln+cnt-1] to LCD.
Single menu screen definition.
Definition: dmcp.h:1809
Font display state.
Definition: dmcp.h:554
void print_clk24_time(char *t, int const sz, tm_t *tm, int disp_sec, int disp_dow)
Formats time according to supplied and system flags.
void lcd_refresh_dma()
Start non-blocking LCD refresh, LCD refresh continues in background (only dirty lines are updated) ...
int run_menu_item_fn_t(uint8_t line_id)
Prototype for run_menu_item function.
Definition: dmcp.h:1918
void lcd_draw_img_part(const char *img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y, uint32_t dx)
Put part of image into LCD buffer.
int run_menu_item(uint8_t line_id)
(Defined by user) Invoke functionality for selected menu item
void printer_advance_buf(int what)
Add line type to printer buffer emulation.
uint32_t dt
Time part.
Definition: dmcp.h:1363
void bitblt24(uint32_t x, uint32_t dx, uint32_t y, uint32_t val, int blt_op, int fill)
Blits dx bits from val at position x, y.
void lcd_draw_img(const char *img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y)
Put image into LCD buffer.
void runner_key_tout_init(const int slow)
Initialize slow autorepeat flag.
uint8_t scale_y
Scaling factor in y direction.
Definition: dmcp.h:532
const smenu_t MID_DMCP
Top level system menu.
int create_screenshot(int report_error)
Create screenshot.
uint8_t min
Minutes.
Definition: dmcp.h:948
void * data
Custom data (useful for line draw callback)
Definition: dmcp.h:2236
list_item_t * fis
List items.
Definition: dmcp.h:2224
int check_create_dir(const char *dir)
Creates directory if doesn&#39;t exist.
void lcd_writeClr(disp_stat_t *ds)
Jump to first line.
void lcd_writeNl(disp_stat_t *ds)
Jump to next line.
get_flag_fn_t * is_beep_mute
Getter callback for Beep Mute flag.
Definition: dmcp.h:1078
void isel_disp_line_fn_t(int lnr, list_item_t *fis, int cur_fnr, struct item_sel_state *st)
Display line callback prototype.
Definition: dmcp.h:2206
uint8_t scale_x
Scaling factor in x direction.
Definition: dmcp.h:531
void LCD_power_off(int clear)
Powers off the LCD hardware.
int sys_timer_active(int timer_ix)
Check timer running status.
void rtc_wakeup_delay()
Workaround for CPU bug.
int lcd_nextFontNr(int nr)
Get next (bigger) font number.
void * items
Custom data for items.
Definition: dmcp.h:2237
char * opt_str(char *s, char const *txt, int val)
Format selection string.
void lcd_draw_menu_keys(const char *keys[])
const char *const * msg
Message displayed above menu. NULL = no message.
Definition: dmcp.h:1821
int is_slow_autorepeat()
Query slow autorepeat flag value.
void lcd_prevLn(disp_stat_t *ds)
Jump to previous line.
uint8_t sec
Seconds.
Definition: dmcp.h:949
void lcd_writeText(disp_stat_t *ds, const char *text)
Display text.
int get_beep_volume()
Returns current tone volume.
int8_t roll_lines
How many lines should remain visible while scrolling up/down.
Definition: dmcp.h:2221
void lcd_fillLines(int ln, uint8_t val, int cnt)
Fill LCD lines with value.
void LCD_write_line(uint8_t *buf)
Sends line data to LCD.
uint8_t day
Day 1-31.
Definition: dmcp.h:940
uint8_t width
Font width in pixels.
Definition: dmcp.h:526
void sys_sleep()
Suspend program until next event.
void rtc_update_time_sec(int delta_sec)
Shift time by given amount of seconds.
void rtc_set_alarm(tm_t *tm, dt_t *dt)
Plants RTC alarm at given time.
void set_buzzer(int pin1val, int pin2val)
Set buzzer IO pins to given values.
void sys_flashing_init()
Enable flashing.
void reset_off_image_cycle()
Resets off image loop to first image.
char * time_str(char *s, const char *txt)
Formats text followed by time.
int print_is_ready()
Check whether IR hw is ready for send.
RTC ticks state.
Definition: dmcp.h:1372
void lcd_switchFont(disp_stat_t *ds, int nr)
Set current font to given font number.
void item_sel_header(item_sel_state_t *st, int update)
Display header for item selection dialog.
int lcd_fontWidth(disp_stat_t *ds)
Returns width of font.
void lcd_writeTextWidth(disp_stat_t *ds, const char *text)
Updates display state as if lcd_writeText() was be called.
uint32_t sys_current_ms()
Get current millisecond.
void start_buzzer_freq(uint32_t freq)
Start tone.
int runner_key_tout_value(const int first)
Returns key repeat timeout value.
const smenu_t MID_SYS_WARN
System menu entry warning.
uint8_t get_hw_id()
Query hardware id.
void set_flag_fn_t(int val)
Set flag function prototype.
Definition: dmcp.h:1039
int file_exists(const char *fn)
Check whether file exists.
int key_to_nr(int key)
Returns corresponding number for key code key.
int lnsize
Size of lnbuf.
Definition: dmcp.h:2234
void sys_disk_check_valid()
Update disk state based on low level disk state.
void beep_volume_down()
Decrease tone volume.
uint8_t bgfill
Fill background while drawing.
Definition: dmcp.h:567
void rtc_write_century(uint8_t cent)
Write century.
FIL * ppgm_fp
Pointer to file handle provided by system.
Definition: dmcp.h:1112
int sys_free_mem()
Query free memory for malloc.
void sys_clear_write_buf_used()
Clear &#39;write-buffer-used&#39; flag.
Time info structure.
Definition: dmcp.h:946
uint8_t rtc_read_century()
Read current century.
int16_t y_top_grd
Don&#39;t overwrite anything above this LCD y-line.
Definition: dmcp.h:559
RTC time stamp parts.
Definition: dmcp.h:1362
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)
Displays file selection dialog.
uint16_t list_item_t
Type for item list item_sel_state::fis.
Definition: dmcp.h:2199
uint32_t sys_tick_count()
Get current tick count.