123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- /*
- * menu.c
- *
- * Created on: Jan 26, 2022
- * Author: radioman
- */
- /*
- Menu Structure:
- Dose rate measure
- Total dose measure
- Reset total dose
- Time
- Reset timer
- Settings:
- Measurement settings:
- Reset total dose
- Sound settings:
- Sound volume
- Sound type
- Buttons volume
- Back
- Alarm settings:
- Alarm at dose rate
- Alarm at dose
- Alarm sound type
- Alarm volume
- Back
- Energy-saving settings
- Display auto-shutdown
- Device auto-shutdown
- Back
- About
- */
- #include "menu.h"
- #include "ssd1306.h"
- static menu_entry_td menu[] = { \
- { .title = "Dose rate measure", .id = 1, .parent_id = 0 },
- { .title = "Total dose measure", .id = 2, .parent_id = 0 },
- { .title = "Up Time", .id = 3, .parent_id = 0 },
- { .title = "Settings", .id = 4, .parent_id = 0 },
- { .title = "Sound", .id = 5, .parent_id = 3 },
- { .title = "Sound volume", .id = 6, .parent_id = 4 },
- { .title = "Sound type", .id = 7, .parent_id = 4 },
- { .title = "Button sound", .id = 8, .parent_id = 4 },
- { .title = "Back", .id = 9, .parent_id = 4 },
- { .title = "Alarm", .id = 10, .parent_id = 3 },
- { .title = "Alarm at dose rate", .id = 11, .parent_id = 9 },
- { .title = "Alarm at dose", .id = 12, .parent_id = 9 },
- { .title = "Alarm sound type", .id = 13, .parent_id = 9 },
- { .title = "Alarm volume", .id = 14, .parent_id = 9 },
- { .title = "Back", .id = 15, .parent_id = 9 },
- { .title = "Energy-saving", .id = 16, .parent_id = 3 },
- { .title = "Display auto-shutdown", .id = 17, .parent_id = 15 },
- { .title = "Device auto-shutdown", .id = 18, .parent_id = 15 },
- { .title = "Back", .id = 19, .parent_id = 15 },
- { .title = "Information", .id = 20, .parent_id = 0 }
- };
- menu_entry_td* GetMenuEntry(uint8_t id)
- {
- return &menu[id];
- }
- void MenuShow(uint8_t id)
- {
- int x = 0, y = 0;
- SSD1306_COLOR color = White;
- menu[1].selected = 1;
- for(int i = 0; i < (sizeof(menu) / sizeof(menu_entry_td)); i++)
- {
- if(menu[i].parent_id == 0)
- {
- ssd1306_SetCursor(x, y);
- (menu[i].selected) ? (color = Black) : (color = White);
- ssd1306_WriteString(menu[i].title, Font_7x10, color);
- y += 11;
- }
- }
- }
|