Compare commits

...

6 Commits

Author SHA1 Message Date
Razvalyaev
08ae821797 Еще фиксы дебаунса в реакции 2026-04-24 12:01:00 +03:00
Razvalyaev
47d471c235 Фикс 0 дебаунса в игре на реакцию 2026-04-23 16:03:24 +03:00
Razvalyaev
fc470d0fb9 Добавлены новые настройки и они выделены в отдельный файл 2026-04-23 11:18:07 +03:00
Razvalyaev
c3a08dc1be Кнопка регистрируется по нажатию, а не отпусканию 2026-04-23 10:04:01 +03:00
Razvalyaev
34fe767338 Сделан настраиваемый дебаунс для кнопок
Убрал дебаунс на игру "реакция" и сделал задержку перед началом игры чуть побольше

Скорректированны текст пунктов меню
2026-04-22 14:51:19 +03:00
Razvalyaev
357d4e5454 Еще больше рефакторинга
- Выделение меню в отдельную группу
- Добавление отдельных модулей для функционала игр и для функционала часов
- Переход на 5 компилятор, чтобы прошивка меньше весила (не влезает в C6)
- Фикс варнингов для 5 компилятора
2026-04-22 10:05:39 +03:00
25 changed files with 2018 additions and 1287 deletions

View File

@@ -4,15 +4,22 @@
static uint8_t dutyValue = 5;
static time_t currentTime;
static uint8_t led_enable;
RTC_TimeTypeDef rtc_time;
#define BKP_DR_DUTY RTC_BKP_DR1
#define BKP_DR_LED_STATE RTC_BKP_DR2
#define BKP_DR_POWERON_SONG RTC_BKP_DR5
#define BKP_DR_ALARM_SONG RTC_BKP_DR6
#define BKP_DR_MENU_SOUND RTC_BKP_DR3
// Яркость в RTC Backup Register (используем BKP_DR1)
static void SaveDuty(void) {
HAL_RTCEx_BKUPWrite(&hrtc, RTC_BKP_DR1, dutyValue);
HAL_RTCEx_BKUPWrite(&hrtc, BKP_DR_DUTY, dutyValue);
}
static void LoadDuty(void) {
uint32_t val = HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1);
uint32_t val = HAL_RTCEx_BKUPRead(&hrtc, BKP_DR_DUTY);
dutyValue = (val <= 10 && val > 0) ? (uint8_t)val : 5;
}
@@ -24,6 +31,10 @@ void ClockManager_Init(void) {
if (HAL_RTC_GetTime(&hrtc, &rtc_time, RTC_FORMAT_BIN) != HAL_OK) {
ClockManager_ResetTime();
}
ClockManager_GetMenuSound();
ClockManager_GetAlarmSong();
ClockManager_GetPowerOnSong();
ClockManager_GetPowerOnSong();
}
time_t ClockManager_GetTime(int blink) {
@@ -33,7 +44,12 @@ time_t ClockManager_GetTime(int blink) {
if(blink)
{
if(currentTime.sec != rtc_time.Seconds)
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
{
if(led_enable)
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
else
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
}
}
currentTime.sec = rtc_time.Seconds;
return currentTime;
@@ -64,3 +80,64 @@ void ClockManager_SetDuty(uint8_t value) {
void ClockManager_ResetTime(void) {
ClockManager_SetTime(0, 0, 0);
}
// LED State in Backup Register
void ClockManager_SetLEDState(uint8_t state) {
if (state) {
led_enable = 1;
} else {
led_enable = 0;
}
HAL_RTCEx_BKUPWrite(&hrtc, BKP_DR_LED_STATE, state ? 1 : 0);
}
uint8_t ClockManager_GetLEDState(void) {
uint32_t led_enable = HAL_RTCEx_BKUPRead(&hrtc, BKP_DR_LED_STATE);
if (led_enable == 0 || led_enable == 1) {
// Сохраненное значение корректно
} else {
led_enable = 1; // По умолчанию LED включен
}
return (uint8_t)led_enable;
}
// PowerOn Song in Backup Register
void ClockManager_SetPowerOnSong(uint8_t song) {
if (song > 10) song = 10;
HAL_RTCEx_BKUPWrite(&hrtc, BKP_DR_POWERON_SONG, song);
}
uint8_t ClockManager_GetPowerOnSong(void) {
uint32_t val = HAL_RTCEx_BKUPRead(&hrtc, BKP_DR_POWERON_SONG);
if (val > 10) val = 0;
return (uint8_t)val;
}
// Alarm Song in Backup Register
void ClockManager_SetAlarmSong(uint8_t song) {
if (song > 10) song = 10;
HAL_RTCEx_BKUPWrite(&hrtc, BKP_DR_ALARM_SONG, song);
}
uint8_t ClockManager_GetAlarmSong(void) {
uint32_t val = HAL_RTCEx_BKUPRead(&hrtc, BKP_DR_ALARM_SONG);
if (val > 10) val = 0;
return (uint8_t)val;
}
// Menu Sound State in Backup Register
extern uint8_t g_sound_enabled;
void ClockManager_SetMenuSound(uint8_t enabled) {
g_sound_enabled = enabled ? 1 : 0;
HAL_RTCEx_BKUPWrite(&hrtc, BKP_DR_MENU_SOUND, g_sound_enabled);
}
uint8_t ClockManager_GetMenuSound(void) {
uint32_t val = HAL_RTCEx_BKUPRead(&hrtc, BKP_DR_MENU_SOUND);
g_sound_enabled = (val == 0 || val == 1) ? (uint8_t)val : 1;
return g_sound_enabled;
}

View File

@@ -23,4 +23,19 @@ void ClockManager_SetDuty(uint8_t value);
// Сброс времени на 00:00:00
void ClockManager_ResetTime(void);
#endif
// LED control
void ClockManager_SetLEDState(uint8_t state);
uint8_t ClockManager_GetLEDState(void);
// PowerOn Song (DR5)
void ClockManager_SetPowerOnSong(uint8_t song);
uint8_t ClockManager_GetPowerOnSong(void);
// Alarm Song (DR6)
void ClockManager_SetAlarmSong(uint8_t song);
uint8_t ClockManager_GetAlarmSong(void);
// Menu Sound
void ClockManager_SetMenuSound(uint8_t enabled);
uint8_t ClockManager_GetMenuSound(void);
#endif

View File

@@ -104,4 +104,4 @@ void Melody_Update(MelodyHandle* mh) {
uint8_t Melody_IsPlaying(MelodyHandle* mh) {
return mh->is_playing;
}
}

View File

@@ -24,4 +24,4 @@ void Melody_Stop(MelodyHandle* mh);
void Melody_Update(MelodyHandle* mh);
uint8_t Melody_IsPlaying(MelodyHandle* mh);
#endif
#endif

View File

@@ -1,695 +0,0 @@
#include "menu_items.h"
#include "segment.h"
#include "clock_manager.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
static MenuNode g_rootMenu;
// Сначала объявляем узлы активностей
MenuNode g_clockNode;
MenuNode g_timerNode;
MenuNode g_stopwatchNode;
MenuNode g_ZeroMillisNode;
MenuNode g_ReactionTimeNode;
MenuNode g_ClickerTimeNode;
// Потом объявляем узлы меню
MenuNode g_gamesNode;
MenuNode g_settingsNode;
MenuNode g_timeEditNode;
MenuNode g_dutyEditNode;
MenuNode g_LEDEditNode;
MenuNode g_MenuSoundNode;
MenuNode g_PowerOnSongNode;
MenuNode g_SongNode;
MenuNode g_resetNode;
// ==================== Данные ====================
typedef struct {
time_t editTime;
uint8_t editStep;
bool blinkState;
uint32_t lastBlink;
} TimeEditData;
typedef struct {
uint32_t startTime;
uint32_t pressTime;
bool celebrating;
bool result;
int32_t diff_ms;
uint8_t state;
} Game1SecData;
typedef struct {
uint32_t waitStart;
uint32_t ledOnTime;
uint32_t reactionTime;
uint8_t state;
} GameReactionData;
typedef struct {
uint32_t endTime;
uint16_t clicks;
bool active;
bool finished;
} GameClickerData;
static TimeEditData g_timeData;
static uint8_t g_originalDuty;
static uint8_t g_editDuty;
static Game1SecData g_game1sec;
static GameReactionData g_gameReaction;
static GameClickerData g_gameClicker;
// Текущая активность в корне
static MenuNode* g_currentActivity = NULL;
// ==================== Функции отображения активностей ====================
static void Display_Clock(void) {
time_t now = ClockManager_GetTime(1);
char buf[7];
sprintf(buf, "%02d%02d%02d", now.hour, now.min, now.sec);
Segment_SetString(buf);
}
static void Display_Timer(void) {
Segment_SetString("TIMER ");
}
static void Display_Stopwatch(void) {
Segment_SetString("SECOND ");
}
static void Display_ZeroMillis(void) {
char buf[7];
switch (g_game1sec.state) {
case 0:
g_game1sec.celebrating = 0;
sprintf(buf, "START"); break;
case 1:
g_game1sec.diff_ms = (HAL_GetTick() - g_game1sec.startTime);
case 2:
sprintf(buf, " %4d", g_game1sec.diff_ms/10);
break;
default: sprintf(buf, "ERROR"); break;
}
if(g_game1sec.state == 2)
{
if((g_game1sec.diff_ms/10)%100 == 0)
{
if(!g_game1sec.celebrating)
{
g_game1sec.celebrating = 1;
Melody_Play(&melody, &Polyphia_PlayingGod, 134);
}
}
}
Segment_SetString(buf);
}
static void Display_Reaction(void) {
char buf[7];
switch (g_gameReaction.state) {
case 0: sprintf(buf, "START"); break;
case 1: sprintf(buf, " "); break;
case 2: sprintf(buf, "888888"); break;
case 3: sprintf(buf, "%6d", g_gameReaction.reactionTime); break;
default: sprintf(buf, "ERROR"); break;
}
Segment_SetString(buf);
}
static void Display_Clicker(void) {
char buf[7];
if (!g_gameClicker.active && !g_gameClicker.finished) {
sprintf(buf, "START");
} else if (g_gameClicker.active) {
uint32_t remaining = (g_gameClicker.endTime - HAL_GetTick()) / 1000;
sprintf(buf, "%2d %3d", remaining, g_gameClicker.clicks);
} else {
sprintf(buf, " %3d", g_gameClicker.clicks);
}
Segment_SetString(buf);
}
static void Display_MenuItem(void) {
MenuNode* current = Menu_GetCurrentNode();
if (current && current->selectedChild < current->childCount) {
const char* name = current->children[current->selectedChild]->name;
char buf[7];
sprintf(buf, "%-6.6s", name);
Segment_SetString(buf);
}
}
static void Display_TimeEdit(void) {
char buf[7];
sprintf(buf, "%02d%02d%02d",
g_timeData.editTime.hour,
g_timeData.editTime.min,
g_timeData.editTime.sec);
if (g_timeData.blinkState && g_timeData.editStep < 6) {
buf[g_timeData.editStep] = ' ';
}
Segment_SetString(buf);
}
static void Display_DutyEdit(void) {
char buf[7] = "DUTY ";
if (g_editDuty == 10) {
buf[4] = '1';
buf[5] = '0';
} else {
buf[5] = '0' + g_editDuty;
}
Segment_SetString(buf);
}
static void Display_Reset(void) {
Segment_SetString("RESET ");
}
// ==================== Вход в активности ====================
static void OnEnter_Clock(void) {
g_currentActivity = &g_clockNode;
g_rootMenu.parent = &g_clockNode;
}
static void OnEnter_Timer(void) {
g_currentActivity = &g_timerNode;
g_rootMenu.parent = &g_timerNode;
}
static void OnEnter_Stopwatch(void) {
g_currentActivity = &g_stopwatchNode;
g_rootMenu.parent = &g_stopwatchNode;
}
static void OnEnter_ZeroMillis(void) {
g_game1sec.state = 0;
Menu_Refresh();
}
static void OnEnter_Reaction(void) {
g_gameReaction.state = 0;
Menu_Refresh();
}
static void OnEnter_Clicker(void) {
g_gameClicker.active = false;
g_gameClicker.finished = false;
g_gameClicker.clicks = 0;
Menu_Refresh();
}
static void OnEnter_TimeEdit(void) {
g_timeData.editTime = ClockManager_GetTime(0);
g_timeData.editStep = 0;
g_timeData.blinkState = true;
g_timeData.lastBlink = HAL_GetTick();
}
static void OnEnter_DutyEdit(void) {
g_originalDuty = ClockManager_GetDuty();
g_editDuty = g_originalDuty;
Segment_SetBrightness(g_editDuty * 10);
}
static void OnEnter_Reset(void) {}
// ==================== Обновления ====================
static void OnUpdate_TimeEdit(void) {
uint32_t tick = HAL_GetTick();
if (tick - g_timeData.lastBlink >= 500) {
g_timeData.lastBlink = tick;
g_timeData.blinkState = !g_timeData.blinkState;
Menu_Refresh();
}
}
static void OnUpdate_Reaction(void) {
uint32_t tick = HAL_GetTick();
if (g_gameReaction.state == 1) {
if (tick - g_gameReaction.waitStart >= g_gameReaction.ledOnTime) {
g_gameReaction.state = 2;
g_gameReaction.waitStart = tick;
Menu_Refresh();
}
}
else if (g_gameReaction.state == 2) {
if (tick - g_gameReaction.waitStart >= 2000) {
g_gameReaction.state = 3;
g_gameReaction.reactionTime = 999;
Menu_Refresh();
}
}
}
static void OnUpdate_Clicker(void) {
if (g_gameClicker.active && HAL_GetTick() >= g_gameClicker.endTime) {
g_gameClicker.active = false;
g_gameClicker.finished = true;
Menu_Refresh();
}
}
// ==================== Обработчики кнопок активностей ====================
static void Clock_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
}
}
static void Timer_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
}
}
static void Stopwatch_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
}
}
static void ZeroMillis_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
}
uint32_t tick = HAL_GetTick();
if (g_game1sec.state == 0 && btn == BUTTON_SELECT) {
g_game1sec.state = 1;
g_game1sec.startTime = tick;
Menu_Refresh();
}
else if ((btn == BUTTON_SELECT) && (g_game1sec.state == 1)) {
g_game1sec.state = 2;
g_game1sec.pressTime = HAL_GetTick();
g_game1sec.diff_ms = (g_game1sec.pressTime - g_game1sec.startTime);
if (g_game1sec.diff_ms < 0) g_game1sec.diff_ms = -g_game1sec.diff_ms;
Menu_Refresh();
}
else if ((g_game1sec.state == 2) && (btn == BUTTON_SELECT))
{
g_game1sec.state = 0;
}
}
static void Reaction_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
}
uint32_t tick = HAL_GetTick();
if (g_gameReaction.state == 0 && btn == BUTTON_SELECT) {
g_gameReaction.state = 1;
g_gameReaction.waitStart = tick;
g_gameReaction.ledOnTime = 1000 + (rand() % 4000);
Menu_Refresh();
}
else if (g_gameReaction.state == 2 && btn == BUTTON_SELECT) {
g_gameReaction.reactionTime = tick - g_gameReaction.waitStart;
g_gameReaction.state = 3;
Menu_Refresh();
}
else if ((g_gameReaction.state == 3) && (btn == BUTTON_SELECT))
{
g_gameReaction.state = 0;
}
}
static void Clicker_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
}
if (!g_gameClicker.active && !g_gameClicker.finished && btn == BUTTON_SELECT) {
g_gameClicker.active = true;
g_gameClicker.endTime = HAL_GetTick() + 10000;
g_gameClicker.clicks = 0;
Menu_Refresh();
}
else if (g_gameClicker.active && btn == BUTTON_UP) {
g_gameClicker.clicks++;
Menu_Refresh();
}
else if (g_gameClicker.finished && (btn == BUTTON_SELECT))
{
g_gameClicker.finished = 0;
g_gameClicker.active = 0;
}
}
static void TimeEdit_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
switch (btn) {
case BUTTON_UP: {
uint8_t tens, units;
switch (g_timeData.editStep) {
case 0:
tens = g_timeData.editTime.hour / 10;
units = g_timeData.editTime.hour % 10;
tens = (tens + 1) % 3;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 1:
tens = g_timeData.editTime.hour / 10;
units = (g_timeData.editTime.hour % 10 + 1) % 10;
if (tens == 2 && units > 3) units = 0;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 2:
tens = (g_timeData.editTime.min / 10 + 1) % 6;
g_timeData.editTime.min = tens * 10 + (g_timeData.editTime.min % 10);
break;
case 3:
units = (g_timeData.editTime.min % 10 + 1) % 10;
g_timeData.editTime.min = (g_timeData.editTime.min / 10) * 10 + units;
break;
case 4:
tens = (g_timeData.editTime.sec / 10 + 1) % 6;
g_timeData.editTime.sec = tens * 10 + (g_timeData.editTime.sec % 10);
break;
case 5:
units = (g_timeData.editTime.sec % 10 + 1) % 10;
g_timeData.editTime.sec = (g_timeData.editTime.sec / 10) * 10 + units;
break;
}
Menu_Refresh();
break;
}
case BUTTON_DOWN: {
uint8_t tens, units;
switch (g_timeData.editStep) {
case 0:
tens = g_timeData.editTime.hour / 10;
units = g_timeData.editTime.hour % 10;
tens = (tens == 0) ? 2 : tens - 1;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 1:
tens = g_timeData.editTime.hour / 10;
units = g_timeData.editTime.hour % 10;
if (units == 0) units = (tens == 2) ? 3 : 9;
else units--;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 2:
tens = g_timeData.editTime.min / 10;
tens = (tens == 0) ? 5 : tens - 1;
g_timeData.editTime.min = tens * 10 + (g_timeData.editTime.min % 10);
break;
case 3:
units = g_timeData.editTime.min % 10;
units = (units == 0) ? 9 : units - 1;
g_timeData.editTime.min = (g_timeData.editTime.min / 10) * 10 + units;
break;
case 4:
tens = g_timeData.editTime.sec / 10;
tens = (tens == 0) ? 5 : tens - 1;
g_timeData.editTime.sec = tens * 10 + (g_timeData.editTime.sec % 10);
break;
case 5:
units = g_timeData.editTime.sec % 10;
units = (units == 0) ? 9 : units - 1;
g_timeData.editTime.sec = (g_timeData.editTime.sec / 10) * 10 + units;
break;
}
Menu_Refresh();
break;
}
case BUTTON_SELECT:
g_timeData.editStep++;
if (g_timeData.editStep >= 6) {
ClockManager_SetTime(g_timeData.editTime.hour,
g_timeData.editTime.min,
g_timeData.editTime.sec);
Menu_GoBack();
}
Menu_Refresh();
break;
case BUTTON_BACK:
Menu_GoBack();
default:
break;
}
}
static void DutyEdit_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
switch (btn) {
case BUTTON_UP:
if (g_editDuty < 10) {
g_editDuty++;
Segment_SetBrightness(g_editDuty * 10);
Menu_Refresh();
}
break;
case BUTTON_DOWN:
if (g_editDuty > 0) {
g_editDuty--;
Segment_SetBrightness(g_editDuty * 10);
Menu_Refresh();
}
break;
case BUTTON_SELECT:
ClockManager_SetDuty(g_editDuty);
Menu_GoBack();
break;
case BUTTON_BACK:
ClockManager_SetDuty(g_originalDuty);
Menu_GoBack();
default:
break;
}
}
static void Reset_OnButton(Button_Type btn, bool longPress) {
if ((btn == BUTTON_SELECT) && longPress) {
ClockManager_ResetTime();
ClockManager_SetDuty(5);
Menu_GoBack();
}
}
// ==================== Узлы активностей (корень) ====================
MenuNode g_clockNode = {
.name = "CLOC",
.parent = NULL,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Clock,
.onEnter = OnEnter_Clock,
.onUpdate = NULL,
.onButton = Clock_OnButton,
.data = NULL
};
MenuNode g_timerNode = {
.name = "TIMER",
.parent = NULL,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Timer,
.onEnter = OnEnter_Timer,
.onUpdate = NULL,
.onButton = Timer_OnButton,
.data = NULL
};
MenuNode g_stopwatchNode = {
.name = "SECOND",
.parent = NULL,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Stopwatch,
.onEnter = OnEnter_Stopwatch,
.onUpdate = NULL,
.onButton = Stopwatch_OnButton,
.data = NULL
};
MenuNode g_ZeroMillisNode = {
.name = "00 SEC",
.parent = &g_gamesNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.needsRedraw = 1,
.display = Display_ZeroMillis,
.onEnter = OnEnter_ZeroMillis,
.onUpdate = NULL,
.onButton = ZeroMillis_OnButton,
.data = &g_game1sec
};
MenuNode g_ReactionTimeNode = {
.name = "CSTEST",
.parent = &g_gamesNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Reaction,
.onEnter = OnEnter_Reaction,
.onUpdate = OnUpdate_Reaction,
.onButton = Reaction_OnButton,
.data = &g_gameReaction
};
MenuNode g_ClickerTimeNode = {
.name = "CLICER",
.parent = &g_gamesNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Clicker,
.onEnter = OnEnter_Clicker,
.onUpdate = OnUpdate_Clicker,
.onButton = Clicker_OnButton,
.data = &g_gameClicker
};
// ==================== Узлы меню ====================
MenuNode g_gamesNode;
MenuNode g_settingsNode;
MenuNode g_timeEditNode;
MenuNode g_dutyEditNode;
MenuNode g_LEDEditNode;
MenuNode g_MenuSoundNode;
MenuNode g_PowerOnSongNode;
MenuNode g_SongNode;
MenuNode g_resetNode;
static MenuNode* g_gamesChildren[] = {
&g_ZeroMillisNode,
&g_ReactionTimeNode,
&g_ClickerTimeNode
};
static MenuNode* g_settingsChildren[] = {
&g_timeEditNode,
&g_dutyEditNode,
&g_LEDEditNode,
&g_MenuSoundNode,
&g_PowerOnSongNode,
&g_SongNode,
&g_resetNode
};
static MenuNode* g_mainMenuChildren[] = {
&g_clockNode,
&g_timerNode,
&g_stopwatchNode,
&g_gamesNode,
&g_settingsNode
};
static MenuNode g_rootMenu = {
.name = "MAIN",
.parent = NULL,
.children = g_mainMenuChildren,
.childCount = 5,
.selectedChild = 0,
.display = Display_MenuItem,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = NULL,
.data = NULL
};
void MenuItems_Init(void) {
g_gamesNode = (MenuNode){
.name = "PLAY",
.parent = &g_rootMenu,
.children = g_gamesChildren,
.childCount = 3,
.selectedChild = 0,
.display = Display_MenuItem,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = NULL,
.data = NULL
};
g_settingsNode = (MenuNode){
.name = "SETUP",
.parent = &g_rootMenu,
.children = g_settingsChildren,
.childCount = 7,
.selectedChild = 0,
.display = Display_MenuItem,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = NULL,
.data = NULL
};
g_timeEditNode = (MenuNode){
.name = "SET T",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_TimeEdit,
.onEnter = OnEnter_TimeEdit,
.onUpdate = OnUpdate_TimeEdit,
.onButton = TimeEdit_OnButton,
.data = &g_timeData
};
g_dutyEditNode = (MenuNode){
.name = "SET D",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_DutyEdit,
.onEnter = OnEnter_DutyEdit,
.onUpdate = NULL,
.onButton = DutyEdit_OnButton,
.data = &g_editDuty
};
g_resetNode = (MenuNode){
.name = "RESET",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Reset,
.onEnter = OnEnter_Reset,
.onUpdate = NULL,
.onButton = Reset_OnButton,
.data = NULL
};
}
MenuNode* Menu_GetRootMenu(void) {
return &g_rootMenu;
}
MenuNode* Menu_GetCurrentActivity(void) {
return g_currentActivity;
}

View File

@@ -158,4 +158,4 @@ typedef struct {
#define NOTE_REST 0
#endif
#endif

View File

@@ -13,13 +13,13 @@ volatile uint8_t GLOBAL_BRIGHTNESS = 100; // Глобальная ярко
#define SWAP_BIT5_BIT6(x) (((x) & 0x9F) | (((x) & 0x20) << 1) | (((x) & 0x40) >> 1))
// Макросы для быстрой работы с пинами (вместо HAL_GPIO_WritePin)
#define SET_SEGMENT_A(val) SEGMENT_A_GPIO_Port->BSRR = (SEGMENT_A_Pin << 16) | ((val) ? 0 : SEGMENT_A_Pin)
#define SET_SEGMENT_B(val) SEGMENT_B_GPIO_Port->BSRR = (SEGMENT_B_Pin << 16) | ((val) ? 0 : SEGMENT_B_Pin)
#define SET_SEGMENT_C(val) SEGMENT_C_GPIO_Port->BSRR = (SEGMENT_C_Pin << 16) | ((val) ? 0 : SEGMENT_C_Pin)
#define SET_SEGMENT_D(val) SEGMENT_D_GPIO_Port->BSRR = (SEGMENT_D_Pin << 16) | ((val) ? 0 : SEGMENT_D_Pin)
#define SET_SEGMENT_E(val) SEGMENT_E_GPIO_Port->BSRR = (SEGMENT_E_Pin << 16) | ((val) ? 0 : SEGMENT_E_Pin)
#define SET_SEGMENT_F(val) SEGMENT_F_GPIO_Port->BSRR = (SEGMENT_F_Pin << 16) | ((val) ? 0 : SEGMENT_F_Pin)
#define SET_SEGMENT_G(val) SEGMENT_G_GPIO_Port->BSRR = (SEGMENT_G_Pin << 16) | ((val) ? 0 : SEGMENT_G_Pin)
#define SET_SEGMENT_A(val) SEGMENT_A_GPIO_Port->BSRR = ((uint32_t)SEGMENT_A_Pin << 16) | ((val) ? 0 : SEGMENT_A_Pin)
#define SET_SEGMENT_B(val) SEGMENT_B_GPIO_Port->BSRR = ((uint32_t)SEGMENT_B_Pin << 16) | ((val) ? 0 : SEGMENT_B_Pin)
#define SET_SEGMENT_C(val) SEGMENT_C_GPIO_Port->BSRR = ((uint32_t)SEGMENT_C_Pin << 16) | ((val) ? 0 : SEGMENT_C_Pin)
#define SET_SEGMENT_D(val) SEGMENT_D_GPIO_Port->BSRR = ((uint32_t)SEGMENT_D_Pin << 16) | ((val) ? 0 : SEGMENT_D_Pin)
#define SET_SEGMENT_E(val) SEGMENT_E_GPIO_Port->BSRR = ((uint32_t)SEGMENT_E_Pin << 16) | ((val) ? 0 : SEGMENT_E_Pin)
#define SET_SEGMENT_F(val) SEGMENT_F_GPIO_Port->BSRR = ((uint32_t)SEGMENT_F_Pin << 16) | ((val) ? 0 : SEGMENT_F_Pin)
#define SET_SEGMENT_G(val) SEGMENT_G_GPIO_Port->BSRR = ((uint32_t)SEGMENT_G_Pin << 16) | ((val) ? 0 : SEGMENT_G_Pin)
// ==================== Таблица символов ====================
// Для общего анода: 0 - сегмент горит, 1 - сегмент не горит

View File

@@ -31,4 +31,4 @@ void Segment_SetBrightness(uint8_t percent);
// Вызывается каждые PROCESS_INTERVAL_US микросекунд или из таймера
void Segment_Process(void);
#endif
#endif

View File

@@ -123,4 +123,4 @@ static const Note_t Polyphia_PlayingGod_Notes[] = {
{SI2, NOTE_SIXTEENTH},
{MI3, NOTE_SIXTEENTH},
};
static Melody_t Polyphia_PlayingGod = {song_length(Polyphia_PlayingGod_Notes), Polyphia_PlayingGod_Notes};
static Melody_t Polyphia_PlayingGod = {song_length(Polyphia_PlayingGod_Notes), Polyphia_PlayingGod_Notes};

View File

@@ -51,4 +51,4 @@ static const Note_t SFX_Alarm_Notes[] = {
{NOTE_REST, NOTE_EIGHTH},
{LA4, NOTE_EIGHTH}
};
static Melody_t SFX_Alarm = {song_length(SFX_Alarm_Notes), SFX_Alarm_Notes};
static Melody_t SFX_Alarm = {song_length(SFX_Alarm_Notes), SFX_Alarm_Notes};

209
Core/Menu/clock.c Normal file
View File

@@ -0,0 +1,209 @@
#include "menu_items.h"
#include "clock.h"
#include "segment.h"
#include "clock_manager.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
uint32_t startTime;
uint32_t elapsedTime; // Íàêîïëåííîå âðåìÿ ïðè ïàóçå
bool running;
uint8_t state; // 0 = Ñáðîøåí, 1 = Çàïóùåí, 2 = Ïàóçà
} StopwatchData;
typedef struct {
uint32_t targetTime; // Öåëåâîå âðåìÿ â ìñ
uint32_t startTime;
uint32_t elapsedTime; // Íàêîïëåííîå âðåìÿ ïðè ïàóçå
uint8_t editStep; // 0-5: ðàçðÿäû, 6: ãîòîâî
uint8_t state; // 0 = Íàñòðîéêà, 1 = Çàïóùåí, 2 = Ïàóçà, 3 = Çàâåðøåí
bool running;
bool blinkState;
uint32_t lastBlink;
} TimerData;
static StopwatchData g_stopwatch;
static TimerData g_timer;
// Âñïîìîãàòåëüíàÿ ôóíêöèÿ äëÿ ôîðìàòèðîâàíèÿ ìì:ññ:öñ
static void FormatTime(uint32_t ms, char* buf) {
uint32_t total_sec = ms / 1000;
uint32_t minutes = total_sec / 60;
uint32_t seconds = total_sec % 60;
uint32_t centiseconds = (ms % 1000) / 10;
if (minutes > 0) {
sprintf(buf, "%2d%02d%02d", minutes, seconds, centiseconds);
} else {
sprintf(buf, " %2d%02d", seconds, centiseconds);
}
}
/////// CLOCK ////////
static void Display_Clock(void) {
time_t now = ClockManager_GetTime(1);
char buf[7];
sprintf(buf, "%02d%02d%02d", now.hour, now.min, now.sec);
Segment_SetString(buf);
}
static void OnEnter_Clock(void) {
g_currentActivity = &g_clockNode;
g_rootMenu.parent = &g_clockNode;
Menu_Refresh();
}
static void Clock_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
}
}
/////// ÑÅÊÓÍÄÎÌÅÐ ////////
static void Display_Stopwatch(void) {
char buf[7];
uint32_t current_ms = 0;
switch (g_stopwatch.state) {
case 0: // Ñáðîøåí
sprintf(buf, " 000");
break;
case 1: // Çàïóùåí
current_ms = (HAL_GetTick() - g_stopwatch.startTime) + g_stopwatch.elapsedTime;
FormatTime(current_ms, buf);
break;
case 2: // Ïàóçà
FormatTime(g_stopwatch.elapsedTime, buf);
break;
default:
sprintf(buf, "ERROR");
break;
}
Segment_SetString(buf);
}
static void OnUpdate_Stopwatch(void) {
// Äëÿ ñåêóíäîìåðà íå íóæåí îòäåëüíûé update,
// ò.ê. Display îáíîâëÿåòñÿ ïî òàéìåðó ìåíþ
static uint32_t lastUpdate = 0;
if (g_stopwatch.state == 1) {
uint32_t tick = HAL_GetTick();
if (tick - lastUpdate >= 10) { // Îáíîâëåíèå êàæäûå 10 ìñ
lastUpdate = tick;
Menu_Refresh();
}
}
}
static void OnEnter_Stopwatch(void) {
g_currentActivity = &g_stopwatchNode;
g_rootMenu.parent = &g_stopwatchNode;
g_stopwatch.state = 0;
g_stopwatch.running = false;
g_stopwatch.elapsedTime = 0;
Menu_Refresh();
}
static void Stopwatch_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
uint32_t tick = HAL_GetTick();
if (g_stopwatch.state == 0 && btn == BUTTON_SELECT) {
// Ñòàðò
g_stopwatch.state = 1;
g_stopwatch.running = true;
g_stopwatch.startTime = tick;
g_stopwatch.elapsedTime = 0;
Menu_Refresh();
}
else if (g_stopwatch.state == 1 && btn == BUTTON_SELECT) {
// Ïàóçà
g_stopwatch.state = 2;
g_stopwatch.running = false;
g_stopwatch.elapsedTime += tick - g_stopwatch.startTime;
Menu_Refresh();
}
else if (g_stopwatch.state == 2 && btn == BUTTON_SELECT) {
// Ïðîäîëæèòü
g_stopwatch.state = 1;
g_stopwatch.running = true;
g_stopwatch.startTime = tick;
Menu_Refresh();
}
else if ((g_stopwatch.state == 1 || g_stopwatch.state == 2) && btn == BUTTON_BACK) {
// Ñáðîñ
g_stopwatch.state = 0;
g_stopwatch.running = false;
g_stopwatch.elapsedTime = 0;
Menu_Refresh();
}
}
/////// ÒÀÉÌÅÐ ////////
static void Display_Timer(void) {
Segment_SetString("FUTURE");
}
static void OnUpdate_Timer(void) {
}
static void OnEnter_Timer(void) {
}
static void Timer_OnButton(Button_Type btn, bool longPress) {
}
// NODES
MenuNode g_clockNode = {
.name = "CLOCH",
.parent = NULL,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.needsRedraw = 1,
.display = Display_Clock,
.onEnter = OnEnter_Clock,
.onUpdate = NULL,
.onButton = Clock_OnButton,
.data = NULL
};
MenuNode g_stopwatchNode = {
.name = "SECOND",
.parent = NULL,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.needsRedraw = 1,
.display = Display_Stopwatch,
.onEnter = OnEnter_Stopwatch,
.onUpdate = OnUpdate_Stopwatch,
.onButton = Stopwatch_OnButton,
.data = &g_stopwatch
};
MenuNode g_timerNode = {
.name = "TIHER",
.parent = NULL,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.needsRedraw = 1,
.display = Display_Timer,
.onEnter = OnEnter_Timer,
.onUpdate = OnUpdate_Timer,
.onButton = Timer_OnButton,
.data = &g_timer
};

9
Core/Menu/clock.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef CLOCK_H
#define CLOCK_H
#include "menu.h"
extern MenuNode g_clockNode;
extern MenuNode g_timerNode;
extern MenuNode g_stopwatchNode;
#endif

284
Core/Menu/games.c Normal file
View File

@@ -0,0 +1,284 @@
#include "menu_items.h"
#include "games.h"
#include "segment.h"
#include "clock_manager.h"
#include "menu_items.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
uint32_t startTime;
uint32_t pressTime;
bool celebrating;
bool result;
int32_t diff_ms;
uint8_t state;
} Game1SecData;
typedef struct {
uint32_t waitStart;
uint32_t ledOnTime;
uint32_t reactionTime;
uint8_t state;
} GameReactionData;
typedef struct {
uint32_t endTime;
uint16_t clicks;
bool active;
bool finished;
} GameClickerData;
static Game1SecData g_game1sec;
static GameReactionData g_gameReaction;
static GameClickerData g_gameClicker;
/////// ZERO MILLIS ////////
static void Display_ZeroMillis(void) {
char buf[7];
switch (g_game1sec.state) {
case 0:
g_game1sec.celebrating = 0;
sprintf(buf, "START"); break;
case 1:
g_game1sec.diff_ms = (HAL_GetTick() - g_game1sec.startTime);
case 2:
sprintf(buf, " %4d", g_game1sec.diff_ms/10);
break;
default: sprintf(buf, "ERROR"); break;
}
if(g_game1sec.state == 2)
{
if((g_game1sec.diff_ms/10)%100 == 0)
{
if(!g_game1sec.celebrating)
{
g_game1sec.celebrating = 1;
Melody_Play(&melody, &Polyphia_PlayingGod, 134);
}
}
}
Segment_SetString(buf);
}
static void OnEnter_ZeroMillis(void) {
g_game1sec.state = 0;
Menu_Refresh();
}
static void ZeroMillis_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
}
uint32_t tick = HAL_GetTick();
if (g_game1sec.state == 0 && btn == BUTTON_SELECT) {
g_game1sec.state = 1;
g_game1sec.startTime = tick;
Menu_Refresh();
}
else if ((btn == BUTTON_SELECT) && (g_game1sec.state == 1)) {
g_game1sec.state = 2;
g_game1sec.pressTime = HAL_GetTick();
g_game1sec.diff_ms = (g_game1sec.pressTime - g_game1sec.startTime);
if (g_game1sec.diff_ms < 0) g_game1sec.diff_ms = -g_game1sec.diff_ms;
Menu_Refresh();
}
else if ((g_game1sec.state == 2) && (btn == BUTTON_SELECT))
{
g_game1sec.state = 0;
}
}
/////// REACTION ////////
static void OnUpdate_Reaction(void) {
uint32_t tick = HAL_GetTick();
if (g_gameReaction.state == 1) {
if (tick - g_gameReaction.waitStart >= g_gameReaction.ledOnTime) {
g_gameReaction.state = 2;
g_gameReaction.waitStart = tick;
Menu_Refresh();
}
}
else if (g_gameReaction.state == 2) {
if (tick - g_gameReaction.waitStart >= 2000) {
g_gameReaction.state = 3;
g_gameReaction.reactionTime = 999;
Menu_Refresh();
}
}
}
static void Display_Reaction(void) {
char buf[7];
switch (g_gameReaction.state) {
case 0: sprintf(buf, "START"); break;
case 1: sprintf(buf, " "); break;
case 2: sprintf(buf, "888888"); break;
case 3: sprintf(buf, "%6d", g_gameReaction.reactionTime); break;
case 4: sprintf(buf, "FAIL"); break;
default: sprintf(buf, "ERROR"); break;
}
Segment_SetString(buf);
}
static void OnEnter_Reaction(void) {
g_gameReaction.state = 0;
g_ctx.debounceTime = 0;
Menu_Refresh();
}
static void Reaction_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
g_ctx.debounceTime = 30;
}
uint32_t tick = HAL_GetTick();
if (g_gameReaction.state == 0 && btn == BUTTON_SELECT) {
g_gameReaction.state = 1;
g_gameReaction.waitStart = tick;
g_gameReaction.ledOnTime = 1200 + (rand() % 2000);
g_ctx.debounceTime = 0;
Menu_Refresh();
}
else if (g_gameReaction.state == 1 && btn == BUTTON_SELECT) {
g_gameReaction.reactionTime = 0;
g_gameReaction.state = 4;
g_ctx.debounceTime = 30;
Menu_Refresh();
}
else if (g_gameReaction.state == 2 && btn == BUTTON_SELECT) {
g_gameReaction.reactionTime = tick - g_gameReaction.waitStart;
g_gameReaction.state = 3;
g_ctx.debounceTime = 30;
Menu_Refresh();
}
else if ((g_gameReaction.state >= 3) && (btn == BUTTON_SELECT))
{
g_gameReaction.state = 1;
g_gameReaction.waitStart = tick;
g_gameReaction.ledOnTime = 500 + (rand() % 2000);
g_ctx.debounceTime = 0;
}
}
/////// CLICLER ////////
static void Display_Clicker(void) {
char buf[7];
if (!g_gameClicker.active && !g_gameClicker.finished) {
sprintf(buf, "START");
} else if (g_gameClicker.active) {
uint32_t remaining = (g_gameClicker.endTime - HAL_GetTick()) / 1000;
sprintf(buf, "%2d %3d", remaining, g_gameClicker.clicks);
} else {
sprintf(buf, " %3d", g_gameClicker.clicks);
}
Segment_SetString(buf);
}
static void OnEnter_Clicker(void) {
g_gameClicker.active = false;
g_gameClicker.finished = false;
g_gameClicker.clicks = 0;
Menu_Refresh();
}
static void OnUpdate_Clicker(void) {
if (g_gameClicker.active && HAL_GetTick() >= g_gameClicker.endTime) {
g_gameClicker.active = false;
g_gameClicker.finished = true;
Menu_Refresh();
}
}
static void Clicker_OnButton(Button_Type btn, bool longPress) {
if (longPress && btn == BUTTON_SELECT) {
Menu_OpenMenu(&g_rootMenu);
return;
}
if (btn == BUTTON_BACK) {
Menu_GoBack();
}
if (!g_gameClicker.active && !g_gameClicker.finished && btn == BUTTON_SELECT) {
g_gameClicker.active = true;
g_gameClicker.endTime = HAL_GetTick() + 10000;
g_gameClicker.clicks = 0;
Menu_Refresh();
}
else if (g_gameClicker.active && btn == BUTTON_UP) {
g_gameClicker.clicks++;
Menu_Refresh();
}
else if (g_gameClicker.finished && (btn == BUTTON_SELECT))
{
g_gameClicker.finished = 0;
g_gameClicker.active = 0;
}
}
// NODES
MenuNode g_ZeroMillisNode = {
.name = "00 SEC",
.parent = &g_gamesNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.needsRedraw = 1,
.display = Display_ZeroMillis,
.onEnter = OnEnter_ZeroMillis,
.onUpdate = NULL,
.onButton = ZeroMillis_OnButton,
.data = &g_game1sec
};
MenuNode g_ReactionTimeNode = {
.name = "CSTEST",
.parent = &g_gamesNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Reaction,
.onEnter = OnEnter_Reaction,
.onUpdate = OnUpdate_Reaction,
.onButton = Reaction_OnButton,
.data = &g_gameReaction
};
MenuNode g_ClickerTimeNode = {
.name = "CLICER",
.parent = &g_gamesNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Clicker,
.onEnter = OnEnter_Clicker,
.onUpdate = OnUpdate_Clicker,
.onButton = Clicker_OnButton,
.data = &g_gameClicker
};
MenuNode* g_gamesChildren[3] = {
&g_ZeroMillisNode,
&g_ReactionTimeNode,
&g_ClickerTimeNode
};

11
Core/Menu/games.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef GAMES_H
#define GAMES_H
#include "menu.h"
extern MenuNode g_ZeroMillisNode;
extern MenuNode g_ReactionTimeNode;
extern MenuNode g_ClickerTimeNode;
extern MenuNode* g_gamesChildren[3];
#endif

View File

@@ -15,7 +15,7 @@ void Menu_Init(MenuNode* startNode) {
g_ctx.currentNode = startNode;
g_ctx.needsRedraw = true;
g_ctx.lastTick = 0;
g_ctx.debounceTime = 30;
if (startNode && startNode->onEnter) {
startNode->onEnter();
}
@@ -62,18 +62,20 @@ void Menu_HandleButton(Button_Type btn, bool longPress) {
switch (btn) {
case BUTTON_UP:
SOUND_CLICK;
if (g_ctx.currentNode->selectedChild > 0) {
g_ctx.currentNode->selectedChild--;
g_ctx.needsRedraw = true;
g_ctx.currentNode->selectedChild--;
if (g_ctx.currentNode->selectedChild > g_ctx.currentNode->childCount - 1) {
g_ctx.currentNode->selectedChild = g_ctx.currentNode->childCount - 1;
}
g_ctx.needsRedraw = true;
break;
case BUTTON_DOWN:
SOUND_CLICK;
if (g_ctx.currentNode->selectedChild < g_ctx.currentNode->childCount - 1) {
g_ctx.currentNode->selectedChild++;
g_ctx.needsRedraw = true;
g_ctx.currentNode->selectedChild++;
if (g_ctx.currentNode->selectedChild > g_ctx.currentNode->childCount - 1) {
g_ctx.currentNode->selectedChild = 0;
}
g_ctx.needsRedraw = true;
break;
case BUTTON_SELECT: {
@@ -114,16 +116,17 @@ void Menu_Process(void) {
g_ctx.lastDebounceTime[i] = tick;
}
if ((tick - g_ctx.lastDebounceTime[i]) > 30) { // DEBOUNCE_MS = 30
if ((tick - g_ctx.lastDebounceTime[i]) >= g_ctx.debounceTime) { // DEBOUNCE_MS = 30
if (reading != g_ctx.buttonState[i]) {
g_ctx.buttonState[i] = reading;
if (g_ctx.buttonState[i]) {
g_ctx.pressStartTime[i] = tick;
g_ctx.longPressTriggered[i] = false;
Menu_HandleButton((Button_Type)i, false);
} else {
if (!g_ctx.longPressTriggered[i]) {
Menu_HandleButton((Button_Type)i, false);
// Menu_HandleButton((Button_Type)i, false);
}
}
}
@@ -192,4 +195,4 @@ void Menu_Sound_Toggle(void) {
uint8_t Menu_Sound_IsEnabled(void) {
return g_sound_enabled;
}
}

View File

@@ -42,7 +42,7 @@ typedef struct {
uint32_t lastTick;
bool needsRedraw;
int32_t debounceTime;
uint32_t lastDebounceTime[BUTTON_COUNT];
uint8_t lastButtonState[BUTTON_COUNT];
uint8_t buttonState[BUTTON_COUNT];
@@ -67,4 +67,4 @@ void Menu_Sound_Off(void);
void Menu_Sound_Toggle(void);
uint8_t Menu_Sound_IsEnabled(void);
#endif
#endif

91
Core/Menu/menu_items.c Normal file
View File

@@ -0,0 +1,91 @@
#include "menu_items.h"
#include "segment.h"
#include "clock_manager.h"
#include "games.h"
#include "clock.h"
#include "settings.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
MenuNode g_rootMenu;
// объявляем узлы меню
MenuNode g_gamesNode;
MenuNode g_settingsNode;
// ==================== Данные ====================
// Текущая активность в корне
MenuNode* g_currentActivity = NULL;
// ==================== Функции отображения активностей ====================
static void Display_MenuItem(void) {
MenuNode* current = Menu_GetCurrentNode();
if (current && current->selectedChild < current->childCount) {
const char* name = current->children[current->selectedChild]->name;
char buf[7];
sprintf(buf, "%-6.6s", name);
Segment_SetString(buf);
}
}
// ==================== Узлы меню ====================
MenuNode g_gamesNode;
MenuNode g_settingsNode;
static MenuNode* g_mainMenuChildren[] = {
&g_clockNode,
&g_timerNode,
&g_stopwatchNode,
&g_gamesNode,
&g_settingsNode
};
MenuNode g_rootMenu = {
.name = "MAIN",
.parent = NULL,
.children = g_mainMenuChildren,
.childCount = 5,
.selectedChild = 0,
.display = Display_MenuItem,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = NULL,
.data = NULL
};
void MenuItems_Init(void) {
g_gamesNode = (MenuNode){
.name = "PLAY",
.parent = &g_rootMenu,
.children = g_gamesChildren,
.childCount = sizeof(g_gamesChildren)/sizeof(g_gamesChildren[0]),
.selectedChild = 0,
.display = Display_MenuItem,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = NULL,
.data = NULL
};
g_settingsNode = (MenuNode){
.name = "SETUP",
.parent = &g_rootMenu,
.children = g_settingsChildren,
.childCount = sizeof(g_settingsChildren)/sizeof(g_settingsChildren[0]),
.selectedChild = 0,
.display = Display_MenuItem,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = NULL,
.data = NULL
};
}
MenuNode* Menu_GetRootMenu(void) {
return &g_rootMenu;
}
MenuNode* Menu_GetCurrentActivity(void) {
return g_currentActivity;
}

View File

@@ -3,17 +3,13 @@
#include "menu.h"
extern MenuNode* g_currentActivity;
// Глобальные узлы меню (для доступа из main.c)
extern MenuNode g_clockNode;
extern MenuNode g_timerNode;
extern MenuNode g_stopwatchNode;
extern MenuNode g_rootMenu;
extern MenuNode g_gamesNode;
extern MenuNode g_settingsNode;
extern MenuNode g_timeEditNode;
extern MenuNode g_dutyEditNode;
extern MenuNode g_resetNode;
// Инициализация всех пунктов меню
void MenuItems_Init(void);
#endif
#endif

430
Core/Menu/settings.c Normal file
View File

@@ -0,0 +1,430 @@
#include "menu_items.h"
#include "settings.h"
#include "segment.h"
#include "clock_manager.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
time_t editTime;
uint8_t editStep;
bool blinkState;
uint32_t lastBlink;
} TimeEditData;
static TimeEditData g_timeData;
static uint8_t g_originalDuty;
static uint8_t g_editDuty;
/////// TIME EDIT ////////
static void Display_TimeEdit(void) {
char buf[7];
sprintf(buf, "%02d%02d%02d",
g_timeData.editTime.hour,
g_timeData.editTime.min,
g_timeData.editTime.sec);
if (g_timeData.blinkState && g_timeData.editStep < 6) {
buf[g_timeData.editStep] = ' ';
}
Segment_SetString(buf);
}
static void OnEnter_TimeEdit(void) {
g_timeData.editTime = ClockManager_GetTime(0);
g_timeData.editStep = 0;
g_timeData.blinkState = true;
g_timeData.lastBlink = HAL_GetTick();
}
static void OnUpdate_TimeEdit(void) {
uint32_t tick = HAL_GetTick();
if (tick - g_timeData.lastBlink >= 500) {
g_timeData.lastBlink = tick;
g_timeData.blinkState = !g_timeData.blinkState;
Menu_Refresh();
}
}
static void TimeEdit_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
switch (btn) {
case BUTTON_UP: {
uint8_t tens, units;
switch (g_timeData.editStep) {
case 0:
tens = g_timeData.editTime.hour / 10;
units = g_timeData.editTime.hour % 10;
tens = (tens + 1) % 3;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 1:
tens = g_timeData.editTime.hour / 10;
units = (g_timeData.editTime.hour % 10 + 1) % 10;
if (tens == 2 && units > 3) units = 0;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 2:
tens = (g_timeData.editTime.min / 10 + 1) % 6;
g_timeData.editTime.min = tens * 10 + (g_timeData.editTime.min % 10);
break;
case 3:
units = (g_timeData.editTime.min % 10 + 1) % 10;
g_timeData.editTime.min = (g_timeData.editTime.min / 10) * 10 + units;
break;
case 4:
tens = (g_timeData.editTime.sec / 10 + 1) % 6;
g_timeData.editTime.sec = tens * 10 + (g_timeData.editTime.sec % 10);
break;
case 5:
units = (g_timeData.editTime.sec % 10 + 1) % 10;
g_timeData.editTime.sec = (g_timeData.editTime.sec / 10) * 10 + units;
break;
}
Menu_Refresh();
break;
}
case BUTTON_DOWN: {
uint8_t tens, units;
switch (g_timeData.editStep) {
case 0:
tens = g_timeData.editTime.hour / 10;
units = g_timeData.editTime.hour % 10;
tens = (tens == 0) ? 2 : tens - 1;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 1:
tens = g_timeData.editTime.hour / 10;
units = g_timeData.editTime.hour % 10;
if (units == 0) units = (tens == 2) ? 3 : 9;
else units--;
g_timeData.editTime.hour = tens * 10 + units;
break;
case 2:
tens = g_timeData.editTime.min / 10;
tens = (tens == 0) ? 5 : tens - 1;
g_timeData.editTime.min = tens * 10 + (g_timeData.editTime.min % 10);
break;
case 3:
units = g_timeData.editTime.min % 10;
units = (units == 0) ? 9 : units - 1;
g_timeData.editTime.min = (g_timeData.editTime.min / 10) * 10 + units;
break;
case 4:
tens = g_timeData.editTime.sec / 10;
tens = (tens == 0) ? 5 : tens - 1;
g_timeData.editTime.sec = tens * 10 + (g_timeData.editTime.sec % 10);
break;
case 5:
units = g_timeData.editTime.sec % 10;
units = (units == 0) ? 9 : units - 1;
g_timeData.editTime.sec = (g_timeData.editTime.sec / 10) * 10 + units;
break;
}
Menu_Refresh();
break;
}
case BUTTON_SELECT:
g_timeData.editStep++;
if (g_timeData.editStep >= 6) {
ClockManager_SetTime(g_timeData.editTime.hour,
g_timeData.editTime.min,
g_timeData.editTime.sec);
Menu_GoBack();
}
Menu_Refresh();
break;
case BUTTON_BACK:
Menu_GoBack();
default:
break;
}
}
/////// DUTY EDIT ////////
static void Display_DutyEdit(void) {
char buf[7] = "DUTY ";
if (g_editDuty == 10) {
buf[4] = '1';
buf[5] = '0';
} else {
buf[5] = '0' + g_editDuty;
}
Segment_SetString(buf);
}
static void OnEnter_DutyEdit(void) {
g_originalDuty = ClockManager_GetDuty();
g_editDuty = g_originalDuty;
Segment_SetBrightness(g_editDuty * 10);
}
static void DutyEdit_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
switch (btn) {
case BUTTON_UP:
if (g_editDuty < 10) {
g_editDuty++;
Segment_SetBrightness(g_editDuty * 10);
Menu_Refresh();
}
break;
case BUTTON_DOWN:
if (g_editDuty > 0) {
g_editDuty--;
Segment_SetBrightness(g_editDuty * 10);
Menu_Refresh();
}
break;
case BUTTON_SELECT:
ClockManager_SetDuty(g_editDuty);
Menu_GoBack();
break;
case BUTTON_BACK:
ClockManager_SetDuty(g_originalDuty);
Menu_GoBack();
default:
break;
}
}
/////// RESET ////////
static void Display_Reset(void) {
Segment_SetString("RESET ");
}
static void OnEnter_Reset(void) {}
static void Reset_OnButton(Button_Type btn, bool longPress) {
if ((btn == BUTTON_SELECT) && longPress) {
ClockManager_ResetTime();
ClockManager_SetDuty(5);
Menu_GoBack();
}
}
/////// LED EDIT ////////
static void Display_LEDEdit(void) {
if (ClockManager_GetLEDState()) {
Segment_SetString("LED 1");
} else {
Segment_SetString("LED 0");
}
}
static void LEDEdit_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
uint8_t newState;
switch (btn) {
case BUTTON_SELECT:
newState = !ClockManager_GetLEDState();
ClockManager_SetLEDState(newState);
Menu_Refresh();
break;
case BUTTON_BACK:
Menu_GoBack();
break;
default:
break;
}
}
/////// POWER ON SONG ////////
static void Display_PowerOnSong(void) {
char buf[7];
sprintf(buf, "PnS%02d", ClockManager_GetPowerOnSong());
Segment_SetString(buf);
}
static void PowerOnSong_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
uint8_t current = ClockManager_GetPowerOnSong();
switch (btn) {
case BUTTON_UP:
if (current < 10) {
current++;
ClockManager_SetPowerOnSong(current);
Menu_Refresh();
}
break;
case BUTTON_DOWN:
if (current > 0) {
current--;
ClockManager_SetPowerOnSong(current);
Menu_Refresh();
}
break;
case BUTTON_SELECT:
case BUTTON_BACK:
Menu_GoBack();
break;
default:
break;
}
}
/////// ALARM SONG ////////
static void Display_AlarmSong(void) {
char buf[7];
sprintf(buf, "AL%02d", ClockManager_GetAlarmSong());
Segment_SetString(buf);
}
static void AlarmSong_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
uint8_t current = ClockManager_GetAlarmSong();
switch (btn) {
case BUTTON_UP:
if (current < 10) {
current++;
ClockManager_SetAlarmSong(current);
Menu_Refresh();
}
break;
case BUTTON_DOWN:
if (current > 0) {
current--;
ClockManager_SetAlarmSong(current);
Menu_Refresh();
}
break;
case BUTTON_SELECT:
case BUTTON_BACK:
Menu_GoBack();
break;
default:
break;
}
}
/////// ALARM SONG ////////
static void Display_MenuSound(void) {
if (ClockManager_GetMenuSound()) {
Segment_SetString("BEEP 1");
} else {
Segment_SetString("BEEP 0");
}
}
static void MenuSound_OnButton(Button_Type btn, bool longPress) {
(void)longPress;
uint8_t newState;
switch (btn) {
case BUTTON_SELECT:
newState = !ClockManager_GetMenuSound();
ClockManager_SetMenuSound(newState);
Menu_Refresh();
break;
case BUTTON_BACK:
Menu_GoBack();
break;
default:
break;
}
}
// NODES// NODES
MenuNode g_timeEditNode = {
.name = "SET T",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_TimeEdit,
.onEnter = OnEnter_TimeEdit,
.onUpdate = OnUpdate_TimeEdit,
.onButton = TimeEdit_OnButton,
.data = &g_timeData
};
MenuNode g_dutyEditNode = {
.name = "SET D",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_DutyEdit,
.onEnter = OnEnter_DutyEdit,
.onUpdate = NULL,
.onButton = DutyEdit_OnButton,
.data = &g_editDuty
};
MenuNode g_LEDEditNode = {
.name = "LED",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_LEDEdit,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = LEDEdit_OnButton,
.data = NULL
};
MenuNode g_MenuSoundNode = {
.name = "BEEP",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_MenuSound,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = MenuSound_OnButton,
.data = NULL
};
MenuNode g_PowerOnSongNode = {
.name = "PonS",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_PowerOnSong,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = PowerOnSong_OnButton,
.data = NULL
};
MenuNode g_AlarmSongNode = {
.name = "AL",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_AlarmSong,
.onEnter = NULL,
.onUpdate = NULL,
.onButton = AlarmSong_OnButton,
.data = NULL
};
MenuNode g_resetNode = {
.name = "RESET",
.parent = &g_settingsNode,
.children = NULL,
.childCount = 0,
.selectedChild = 0,
.display = Display_Reset,
.onEnter = OnEnter_Reset,
.onUpdate = NULL,
.onButton = Reset_OnButton,
.data = NULL
};
MenuNode* g_settingsChildren[] = {
&g_timeEditNode,
&g_dutyEditNode,
&g_LEDEditNode,
&g_MenuSoundNode,
&g_PowerOnSongNode,
&g_AlarmSongNode,
&g_resetNode
};

15
Core/Menu/settings.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "menu.h"
extern MenuNode g_timeEditNode;
extern MenuNode g_dutyEditNode;
extern MenuNode g_LEDEditNode;
extern MenuNode g_MenuSoundNode;
extern MenuNode g_PowerOnSongNode;
extern MenuNode g_AlarmSongNode;
extern MenuNode g_resetNode;
extern MenuNode* g_settingsChildren[7];
#endif

View File

@@ -29,6 +29,7 @@
#include "segment.h"
#include "melody.h"
#include "songs.h"
#include "clock.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -137,7 +138,7 @@ int main(void)
{
Menu_Process();
Melody_Update(&melody);
ClockManager_GetTime(1);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */

File diff suppressed because one or more lines are too long

View File

@@ -173,13 +173,18 @@
<Ww>
<count>4</count>
<WinNumber>1</WinNumber>
<ItemText>g_ctx</ItemText>
<ItemText>g_ctx,0x0A</ItemText>
</Ww>
<Ww>
<count>5</count>
<WinNumber>1</WinNumber>
<ItemText>g_game1sec</ItemText>
</Ww>
<Ww>
<count>6</count>
<WinNumber>1</WinNumber>
<ItemText>led_enable,0x0A</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint>
<THDelay>0</THDelay>
@@ -224,6 +229,10 @@
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<SystemViewers>
<Entry>
<Name>System Viewer\EXTI</Name>
<WinId>35902</WinId>
</Entry>
<Entry>
<Name>System Viewer\GPIOB</Name>
<WinId>35905</WinId>
@@ -608,54 +617,6 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Clock\menu_items.c</PathWithFileName>
<FilenameWithoutPath>menu_items.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>28</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Clock\menu_items.h</PathWithFileName>
<FilenameWithoutPath>menu_items.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>29</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Clock\menu.c</PathWithFileName>
<FilenameWithoutPath>menu.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>30</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Clock\menu.h</PathWithFileName>
<FilenameWithoutPath>menu.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>31</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Clock\segment.c</PathWithFileName>
<FilenameWithoutPath>segment.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
@@ -663,7 +624,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>32</FileNumber>
<FileNumber>28</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@@ -675,7 +636,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>33</FileNumber>
<FileNumber>29</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@@ -687,7 +648,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>34</FileNumber>
<FileNumber>30</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@@ -699,7 +660,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>35</FileNumber>
<FileNumber>31</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@@ -711,7 +672,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>36</FileNumber>
<FileNumber>32</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@@ -723,7 +684,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>37</FileNumber>
<FileNumber>33</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@@ -735,6 +696,134 @@
</File>
</Group>
<Group>
<GroupName>Menu</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>34</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\clock.c</PathWithFileName>
<FilenameWithoutPath>clock.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>35</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\clock.h</PathWithFileName>
<FilenameWithoutPath>clock.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>36</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\games.c</PathWithFileName>
<FilenameWithoutPath>games.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>37</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\games.h</PathWithFileName>
<FilenameWithoutPath>games.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\settings.c</PathWithFileName>
<FilenameWithoutPath>settings.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>39</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\settings.h</PathWithFileName>
<FilenameWithoutPath>settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>40</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\menu_items.c</PathWithFileName>
<FilenameWithoutPath>menu_items.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>41</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\menu_items.h</PathWithFileName>
<FilenameWithoutPath>menu_items.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>42</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\menu.c</PathWithFileName>
<FilenameWithoutPath>menu.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>43</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Menu\menu.h</PathWithFileName>
<FilenameWithoutPath>menu.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>

View File

@@ -10,9 +10,8 @@
<TargetName>lamp</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>6190000::V6.19::ARMCLANG</pArmCC>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F103C8</Device>
@@ -82,7 +81,7 @@
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>1</RunUserProg2>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
@@ -324,7 +323,7 @@
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>3</wLevel>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
@@ -341,7 +340,7 @@
<MiscControls></MiscControls>
<Define>USE_HAL_DRIVER,STM32F103xB</Define>
<Undefine></Undefine>
<IncludePath>../Core/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include;../Core/Clock</IncludePath>
<IncludePath>../Core/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include;../Core/Clock;..\Core\Menu</IncludePath>
</VariousControls>
</Cads>
<Aads>
@@ -777,26 +776,6 @@
<FileType>5</FileType>
<FilePath>..\Core\Clock\clock_manager.h</FilePath>
</File>
<File>
<FileName>menu_items.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Clock\menu_items.c</FilePath>
</File>
<File>
<FileName>menu_items.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Clock\menu_items.h</FilePath>
</File>
<File>
<FileName>menu.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Clock\menu.c</FilePath>
</File>
<File>
<FileName>menu.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Clock\menu.h</FilePath>
</File>
<File>
<FileName>segment.c</FileName>
<FileType>1</FileType>
@@ -834,6 +813,61 @@
</File>
</Files>
</Group>
<Group>
<GroupName>Menu</GroupName>
<Files>
<File>
<FileName>clock.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Menu\clock.c</FilePath>
</File>
<File>
<FileName>clock.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Menu\clock.h</FilePath>
</File>
<File>
<FileName>games.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Menu\games.c</FilePath>
</File>
<File>
<FileName>games.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Menu\games.h</FilePath>
</File>
<File>
<FileName>settings.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Menu\settings.c</FilePath>
</File>
<File>
<FileName>settings.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Menu\settings.h</FilePath>
</File>
<File>
<FileName>menu_items.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Menu\menu_items.c</FilePath>
</File>
<File>
<FileName>menu_items.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Menu\menu_items.h</FilePath>
</File>
<File>
<FileName>menu.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Menu\menu.c</FilePath>
</File>
<File>
<FileName>menu.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Menu\menu.h</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
@@ -854,4 +888,13 @@
<files/>
</RTE>
<LayerInfo>
<Layers>
<Layer>
<LayName>lamp</LayName>
<LayPrjMark>1</LayPrjMark>
</Layer>
</Layers>
</LayerInfo>
</Project>

View File

@@ -214,114 +214,114 @@ ARM Macro Assembler Page 4
]
130 00000000 IMPORT __main
131 00000000 IMPORT SystemInit
132 00000000 4809 LDR R0, =SystemInit
133 00000002 4780 BLX R0
134 00000004 4809 LDR R0, =__main
135 00000006 4700 BX R0
136 00000008 ENDP
137 00000008
138 00000008 ; Dummy Exception Handlers (infinite loops which can be
modified)
132 00000000
133 00000000
134 00000000 4809 LDR R0, =SystemInit
135 00000002 4780 BLX R0
136 00000004 4809 LDR R0, =__main
137 00000006 4700 BX R0
138 00000008 ENDP
139 00000008
140 00000008 NMI_Handler
140 00000008 ; Dummy Exception Handlers (infinite loops which can be
modified)
141 00000008
142 00000008 NMI_Handler
PROC
141 00000008 EXPORT NMI_Handler [WEA
143 00000008 EXPORT NMI_Handler [WEA
K]
142 00000008 E7FE B .
143 0000000A ENDP
145 0000000A HardFault_Handler
144 00000008 E7FE B .
145 0000000A ENDP
147 0000000A HardFault_Handler
PROC
146 0000000A EXPORT HardFault_Handler [WEA
148 0000000A EXPORT HardFault_Handler [WEA
K]
147 0000000A E7FE B .
148 0000000C ENDP
150 0000000C MemManage_Handler
149 0000000A E7FE B .
150 0000000C ENDP
152 0000000C MemManage_Handler
PROC
151 0000000C EXPORT MemManage_Handler [WEA
153 0000000C EXPORT MemManage_Handler [WEA
K]
152 0000000C E7FE B .
153 0000000E ENDP
155 0000000E BusFault_Handler
154 0000000C E7FE B .
155 0000000E ENDP
157 0000000E BusFault_Handler
PROC
156 0000000E EXPORT BusFault_Handler [WEA
158 0000000E EXPORT BusFault_Handler [WEA
K]
157 0000000E E7FE B .
158 00000010 ENDP
160 00000010 UsageFault_Handler
159 0000000E E7FE B .
160 00000010 ENDP
162 00000010 UsageFault_Handler
PROC
161 00000010 EXPORT UsageFault_Handler [WEA
163 00000010 EXPORT UsageFault_Handler [WEA
K]
162 00000010 E7FE B .
163 00000012 ENDP
164 00000012 SVC_Handler
164 00000010 E7FE B .
165 00000012 ENDP
166 00000012 SVC_Handler
PROC
165 00000012 EXPORT SVC_Handler [WEA
K]
166 00000012 E7FE B .
167 00000012 EXPORT SVC_Handler [WEA
ARM Macro Assembler Page 5
167 00000014 ENDP
169 00000014 DebugMon_Handler
PROC
170 00000014 EXPORT DebugMon_Handler [WEA
K]
171 00000014 E7FE B .
172 00000016 ENDP
173 00000016 PendSV_Handler
168 00000012 E7FE B .
169 00000014 ENDP
171 00000014 DebugMon_Handler
PROC
174 00000016 EXPORT PendSV_Handler [WEA
172 00000014 EXPORT DebugMon_Handler [WEA
K]
175 00000016 E7FE B .
176 00000018 ENDP
177 00000018 SysTick_Handler
173 00000014 E7FE B .
174 00000016 ENDP
175 00000016 PendSV_Handler
PROC
178 00000018 EXPORT SysTick_Handler [WEA
176 00000016 EXPORT PendSV_Handler [WEA
K]
179 00000018 E7FE B .
180 0000001A ENDP
181 0000001A
182 0000001A Default_Handler
177 00000016 E7FE B .
178 00000018 ENDP
179 00000018 SysTick_Handler
PROC
180 00000018 EXPORT SysTick_Handler [WEA
K]
181 00000018 E7FE B .
182 0000001A ENDP
183 0000001A
184 0000001A EXPORT WWDG_IRQHandler [WEA
184 0000001A Default_Handler
PROC
185 0000001A
186 0000001A EXPORT WWDG_IRQHandler [WEA
K]
185 0000001A EXPORT PVD_IRQHandler [WEA
187 0000001A EXPORT PVD_IRQHandler [WEA
K]
186 0000001A EXPORT TAMPER_IRQHandler [WEA
188 0000001A EXPORT TAMPER_IRQHandler [WEA
K]
187 0000001A EXPORT RTC_IRQHandler [WEA
189 0000001A EXPORT RTC_IRQHandler [WEA
K]
188 0000001A EXPORT FLASH_IRQHandler [WEA
190 0000001A EXPORT FLASH_IRQHandler [WEA
K]
189 0000001A EXPORT RCC_IRQHandler [WEA
191 0000001A EXPORT RCC_IRQHandler [WEA
K]
190 0000001A EXPORT EXTI0_IRQHandler [WEA
192 0000001A EXPORT EXTI0_IRQHandler [WEA
K]
191 0000001A EXPORT EXTI1_IRQHandler [WEA
193 0000001A EXPORT EXTI1_IRQHandler [WEA
K]
192 0000001A EXPORT EXTI2_IRQHandler [WEA
194 0000001A EXPORT EXTI2_IRQHandler [WEA
K]
193 0000001A EXPORT EXTI3_IRQHandler [WEA
195 0000001A EXPORT EXTI3_IRQHandler [WEA
K]
194 0000001A EXPORT EXTI4_IRQHandler [WEA
196 0000001A EXPORT EXTI4_IRQHandler [WEA
K]
195 0000001A EXPORT DMA1_Channel1_IRQHandler [WEA
197 0000001A EXPORT DMA1_Channel1_IRQHandler [WEA
K]
196 0000001A EXPORT DMA1_Channel2_IRQHandler [WEA
198 0000001A EXPORT DMA1_Channel2_IRQHandler [WEA
K]
197 0000001A EXPORT DMA1_Channel3_IRQHandler [WEA
199 0000001A EXPORT DMA1_Channel3_IRQHandler [WEA
K]
198 0000001A EXPORT DMA1_Channel4_IRQHandler [WEA
200 0000001A EXPORT DMA1_Channel4_IRQHandler [WEA
K]
199 0000001A EXPORT DMA1_Channel5_IRQHandler [WEA
201 0000001A EXPORT DMA1_Channel5_IRQHandler [WEA
K]
200 0000001A EXPORT DMA1_Channel6_IRQHandler [WEA
K]
201 0000001A EXPORT DMA1_Channel7_IRQHandler [WEA
202 0000001A EXPORT DMA1_Channel6_IRQHandler [WEA
K]
@@ -329,142 +329,144 @@ K]
ARM Macro Assembler Page 6
202 0000001A EXPORT ADC1_2_IRQHandler [WEA
203 0000001A EXPORT DMA1_Channel7_IRQHandler [WEA
K]
203 0000001A EXPORT USB_HP_CAN1_TX_IRQHandler [WEA
204 0000001A EXPORT ADC1_2_IRQHandler [WEA
K]
204 0000001A EXPORT USB_LP_CAN1_RX0_IRQHandler [WEA
205 0000001A EXPORT USB_HP_CAN1_TX_IRQHandler [WEA
K]
205 0000001A EXPORT CAN1_RX1_IRQHandler [WEA
206 0000001A EXPORT USB_LP_CAN1_RX0_IRQHandler [WEA
K]
206 0000001A EXPORT CAN1_SCE_IRQHandler [WEA
207 0000001A EXPORT CAN1_RX1_IRQHandler [WEA
K]
207 0000001A EXPORT EXTI9_5_IRQHandler [WEA
208 0000001A EXPORT CAN1_SCE_IRQHandler [WEA
K]
208 0000001A EXPORT TIM1_BRK_IRQHandler [WEA
209 0000001A EXPORT EXTI9_5_IRQHandler [WEA
K]
209 0000001A EXPORT TIM1_UP_IRQHandler [WEA
210 0000001A EXPORT TIM1_BRK_IRQHandler [WEA
K]
210 0000001A EXPORT TIM1_TRG_COM_IRQHandler [WEA
211 0000001A EXPORT TIM1_UP_IRQHandler [WEA
K]
211 0000001A EXPORT TIM1_CC_IRQHandler [WEA
212 0000001A EXPORT TIM1_TRG_COM_IRQHandler [WEA
K]
212 0000001A EXPORT TIM2_IRQHandler [WEA
213 0000001A EXPORT TIM1_CC_IRQHandler [WEA
K]
213 0000001A EXPORT TIM3_IRQHandler [WEA
214 0000001A EXPORT TIM2_IRQHandler [WEA
K]
214 0000001A EXPORT TIM4_IRQHandler [WEA
215 0000001A EXPORT TIM3_IRQHandler [WEA
K]
215 0000001A EXPORT I2C1_EV_IRQHandler [WEA
216 0000001A EXPORT TIM4_IRQHandler [WEA
K]
216 0000001A EXPORT I2C1_ER_IRQHandler [WEA
217 0000001A EXPORT I2C1_EV_IRQHandler [WEA
K]
217 0000001A EXPORT I2C2_EV_IRQHandler [WEA
218 0000001A EXPORT I2C1_ER_IRQHandler [WEA
K]
218 0000001A EXPORT I2C2_ER_IRQHandler [WEA
219 0000001A EXPORT I2C2_EV_IRQHandler [WEA
K]
219 0000001A EXPORT SPI1_IRQHandler [WEA
220 0000001A EXPORT I2C2_ER_IRQHandler [WEA
K]
220 0000001A EXPORT SPI2_IRQHandler [WEA
221 0000001A EXPORT SPI1_IRQHandler [WEA
K]
221 0000001A EXPORT USART1_IRQHandler [WEA
222 0000001A EXPORT SPI2_IRQHandler [WEA
K]
222 0000001A EXPORT USART2_IRQHandler [WEA
223 0000001A EXPORT USART1_IRQHandler [WEA
K]
223 0000001A EXPORT USART3_IRQHandler [WEA
224 0000001A EXPORT USART2_IRQHandler [WEA
K]
224 0000001A EXPORT EXTI15_10_IRQHandler [WEA
225 0000001A EXPORT USART3_IRQHandler [WEA
K]
225 0000001A EXPORT RTC_Alarm_IRQHandler [WE
226 0000001A EXPORT EXTI15_10_IRQHandler [WEA
K]
227 0000001A EXPORT RTC_Alarm_IRQHandler [WE
AK]
226 0000001A EXPORT USBWakeUp_IRQHandler [WEA
228 0000001A EXPORT USBWakeUp_IRQHandler [WEA
K]
227 0000001A
228 0000001A WWDG_IRQHandler
229 0000001A PVD_IRQHandler
230 0000001A TAMPER_IRQHandler
231 0000001A RTC_IRQHandler
232 0000001A FLASH_IRQHandler
233 0000001A RCC_IRQHandler
234 0000001A EXTI0_IRQHandler
235 0000001A EXTI1_IRQHandler
229 0000001A
230 0000001A WWDG_IRQHandler
231 0000001A PVD_IRQHandler
232 0000001A TAMPER_IRQHandler
233 0000001A RTC_IRQHandler
234 0000001A FLASH_IRQHandler
235 0000001A RCC_IRQHandler
ARM Macro Assembler Page 7
236 0000001A EXTI2_IRQHandler
237 0000001A EXTI3_IRQHandler
238 0000001A EXTI4_IRQHandler
239 0000001A DMA1_Channel1_IRQHandler
240 0000001A DMA1_Channel2_IRQHandler
241 0000001A DMA1_Channel3_IRQHandler
242 0000001A DMA1_Channel4_IRQHandler
243 0000001A DMA1_Channel5_IRQHandler
244 0000001A DMA1_Channel6_IRQHandler
245 0000001A DMA1_Channel7_IRQHandler
246 0000001A ADC1_2_IRQHandler
247 0000001A USB_HP_CAN1_TX_IRQHandler
248 0000001A USB_LP_CAN1_RX0_IRQHandler
249 0000001A CAN1_RX1_IRQHandler
250 0000001A CAN1_SCE_IRQHandler
251 0000001A EXTI9_5_IRQHandler
252 0000001A TIM1_BRK_IRQHandler
253 0000001A TIM1_UP_IRQHandler
254 0000001A TIM1_TRG_COM_IRQHandler
255 0000001A TIM1_CC_IRQHandler
256 0000001A TIM2_IRQHandler
257 0000001A TIM3_IRQHandler
258 0000001A TIM4_IRQHandler
259 0000001A I2C1_EV_IRQHandler
260 0000001A I2C1_ER_IRQHandler
261 0000001A I2C2_EV_IRQHandler
262 0000001A I2C2_ER_IRQHandler
263 0000001A SPI1_IRQHandler
264 0000001A SPI2_IRQHandler
265 0000001A USART1_IRQHandler
266 0000001A USART2_IRQHandler
267 0000001A USART3_IRQHandler
268 0000001A EXTI15_10_IRQHandler
269 0000001A RTC_Alarm_IRQHandler
270 0000001A USBWakeUp_IRQHandler
271 0000001A
272 0000001A E7FE B .
273 0000001C
274 0000001C ENDP
236 0000001A EXTI0_IRQHandler
237 0000001A EXTI1_IRQHandler
238 0000001A EXTI2_IRQHandler
239 0000001A EXTI3_IRQHandler
240 0000001A EXTI4_IRQHandler
241 0000001A DMA1_Channel1_IRQHandler
242 0000001A DMA1_Channel2_IRQHandler
243 0000001A DMA1_Channel3_IRQHandler
244 0000001A DMA1_Channel4_IRQHandler
245 0000001A DMA1_Channel5_IRQHandler
246 0000001A DMA1_Channel6_IRQHandler
247 0000001A DMA1_Channel7_IRQHandler
248 0000001A ADC1_2_IRQHandler
249 0000001A USB_HP_CAN1_TX_IRQHandler
250 0000001A USB_LP_CAN1_RX0_IRQHandler
251 0000001A CAN1_RX1_IRQHandler
252 0000001A CAN1_SCE_IRQHandler
253 0000001A EXTI9_5_IRQHandler
254 0000001A TIM1_BRK_IRQHandler
255 0000001A TIM1_UP_IRQHandler
256 0000001A TIM1_TRG_COM_IRQHandler
257 0000001A TIM1_CC_IRQHandler
258 0000001A TIM2_IRQHandler
259 0000001A TIM3_IRQHandler
260 0000001A TIM4_IRQHandler
261 0000001A I2C1_EV_IRQHandler
262 0000001A I2C1_ER_IRQHandler
263 0000001A I2C2_EV_IRQHandler
264 0000001A I2C2_ER_IRQHandler
265 0000001A SPI1_IRQHandler
266 0000001A SPI2_IRQHandler
267 0000001A USART1_IRQHandler
268 0000001A USART2_IRQHandler
269 0000001A USART3_IRQHandler
270 0000001A EXTI15_10_IRQHandler
271 0000001A RTC_Alarm_IRQHandler
272 0000001A USBWakeUp_IRQHandler
273 0000001A
274 0000001A E7FE B .
275 0000001C
276 0000001C ALIGN
276 0000001C ENDP
277 0000001C
278 0000001C ;*******************************************************
************************
279 0000001C ; User Stack and Heap initialization
278 0000001C ALIGN
279 0000001C
280 0000001C ;*******************************************************
************************
281 0000001C IF :DEF:__MICROLIB
288 0000001C
289 0000001C IMPORT __use_two_region_memory
290 0000001C EXPORT __user_initial_stackheap
291 0000001C
292 0000001C __user_initial_stackheap
281 0000001C ; User Stack and Heap initialization
282 0000001C ;*******************************************************
************************
283 0000001C IF :DEF:__MICROLIB
290 0000001C
291 0000001C IMPORT __use_two_region_memory
292 0000001C EXPORT __user_initial_stackheap
293 0000001C
294 0000001C 4804 LDR R0, = Heap_Mem
295 0000001E 4905 LDR R1, =(Stack_Mem + Stack_Size)
296 00000020 4A05 LDR R2, = (Heap_Mem + Heap_Size)
297 00000022 4B06 LDR R3, = Stack_Mem
298 00000024 4770 BX LR
294 0000001C __user_initial_stackheap
295 0000001C
296 0000001C 4804 LDR R0, = Heap_Mem
297 0000001E 4905 LDR R1, =(Stack_Mem + Stack_Size)
298 00000020 4A05 LDR R2, = (Heap_Mem + Heap_Size)
ARM Macro Assembler Page 8
299 00000026
300 00000026 00 00 ALIGN
301 00000028
302 00000028 ENDIF
299 00000022 4B06 LDR R3, = Stack_Mem
300 00000024 4770 BX LR
301 00000026
302 00000026 00 00 ALIGN
303 00000028
304 00000028 END
304 00000028 ENDIF
305 00000028
306 00000028 END
00000000
00000000
00000000
@@ -473,10 +475,11 @@ ARM Macro Assembler Page 8
00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
ork --depend=lamp\startup_stm32f103xb.d -olamp\startup_stm32f103xb.o -I.\RTE\_l
amp -IE:\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IE:\Arm\Packs\Keil\STM32
F1xx_DFP\2.4.0\Device\Include --predefine="__UVISION_VERSION SETA 538" --predef
ine="_RTE_ SETA 1" --predefine="STM32F10X_MD SETA 1" --predefine="_RTE_ SETA 1"
--list=startup_stm32f103xb.lst startup_stm32f103xb.s
amp -IC:\Users\I\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC
:\Users\I\AppData\Local\Arm\Packs\Keil\STM32F1xx_DFP\2.4.0\Device\Include --pre
define="__UVISION_VERSION SETA 538" --predefine="_RTE_ SETA 1" --predefine="STM
32F10X_MD SETA 1" --predefine="_RTE_ SETA 1" --list=startup_stm32f103xb.lst sta
rtup_stm32f103xb.s
@@ -497,8 +500,8 @@ Symbol: Stack_Mem
Definitions
At line 35 in file startup_stm32f103xb.s
Uses
At line 295 in file startup_stm32f103xb.s
At line 297 in file startup_stm32f103xb.s
At line 299 in file startup_stm32f103xb.s
__initial_sp 00000400
@@ -529,8 +532,8 @@ Symbol: Heap_Mem
Definitions
At line 47 in file startup_stm32f103xb.s
Uses
At line 294 in file startup_stm32f103xb.s
At line 296 in file startup_stm32f103xb.s
At line 298 in file startup_stm32f103xb.s
__heap_base 00000000
@@ -600,52 +603,52 @@ ADC1_2_IRQHandler 0000001A
Symbol: ADC1_2_IRQHandler
Definitions
At line 246 in file startup_stm32f103xb.s
At line 248 in file startup_stm32f103xb.s
Uses
At line 96 in file startup_stm32f103xb.s
At line 202 in file startup_stm32f103xb.s
At line 204 in file startup_stm32f103xb.s
BusFault_Handler 0000000E
Symbol: BusFault_Handler
Definitions
At line 155 in file startup_stm32f103xb.s
At line 157 in file startup_stm32f103xb.s
Uses
At line 65 in file startup_stm32f103xb.s
At line 156 in file startup_stm32f103xb.s
At line 158 in file startup_stm32f103xb.s
CAN1_RX1_IRQHandler 0000001A
Symbol: CAN1_RX1_IRQHandler
Definitions
At line 249 in file startup_stm32f103xb.s
At line 251 in file startup_stm32f103xb.s
Uses
At line 99 in file startup_stm32f103xb.s
At line 205 in file startup_stm32f103xb.s
At line 207 in file startup_stm32f103xb.s
CAN1_SCE_IRQHandler 0000001A
Symbol: CAN1_SCE_IRQHandler
Definitions
At line 250 in file startup_stm32f103xb.s
At line 252 in file startup_stm32f103xb.s
Uses
At line 100 in file startup_stm32f103xb.s
At line 206 in file startup_stm32f103xb.s
At line 208 in file startup_stm32f103xb.s
DMA1_Channel1_IRQHandler 0000001A
Symbol: DMA1_Channel1_IRQHandler
Definitions
At line 239 in file startup_stm32f103xb.s
At line 241 in file startup_stm32f103xb.s
Uses
At line 89 in file startup_stm32f103xb.s
At line 195 in file startup_stm32f103xb.s
At line 197 in file startup_stm32f103xb.s
DMA1_Channel2_IRQHandler 0000001A
Symbol: DMA1_Channel2_IRQHandler
Definitions
At line 240 in file startup_stm32f103xb.s
At line 242 in file startup_stm32f103xb.s
Uses
@@ -654,61 +657,61 @@ ARM Macro Assembler Page 2 Alphabetic symbol ordering
Relocatable symbols
At line 90 in file startup_stm32f103xb.s
At line 196 in file startup_stm32f103xb.s
At line 198 in file startup_stm32f103xb.s
DMA1_Channel3_IRQHandler 0000001A
Symbol: DMA1_Channel3_IRQHandler
Definitions
At line 241 in file startup_stm32f103xb.s
At line 243 in file startup_stm32f103xb.s
Uses
At line 91 in file startup_stm32f103xb.s
At line 197 in file startup_stm32f103xb.s
At line 199 in file startup_stm32f103xb.s
DMA1_Channel4_IRQHandler 0000001A
Symbol: DMA1_Channel4_IRQHandler
Definitions
At line 242 in file startup_stm32f103xb.s
At line 244 in file startup_stm32f103xb.s
Uses
At line 92 in file startup_stm32f103xb.s
At line 198 in file startup_stm32f103xb.s
At line 200 in file startup_stm32f103xb.s
DMA1_Channel5_IRQHandler 0000001A
Symbol: DMA1_Channel5_IRQHandler
Definitions
At line 243 in file startup_stm32f103xb.s
At line 245 in file startup_stm32f103xb.s
Uses
At line 93 in file startup_stm32f103xb.s
At line 199 in file startup_stm32f103xb.s
At line 201 in file startup_stm32f103xb.s
DMA1_Channel6_IRQHandler 0000001A
Symbol: DMA1_Channel6_IRQHandler
Definitions
At line 244 in file startup_stm32f103xb.s
At line 246 in file startup_stm32f103xb.s
Uses
At line 94 in file startup_stm32f103xb.s
At line 200 in file startup_stm32f103xb.s
At line 202 in file startup_stm32f103xb.s
DMA1_Channel7_IRQHandler 0000001A
Symbol: DMA1_Channel7_IRQHandler
Definitions
At line 245 in file startup_stm32f103xb.s
At line 247 in file startup_stm32f103xb.s
Uses
At line 95 in file startup_stm32f103xb.s
At line 201 in file startup_stm32f103xb.s
At line 203 in file startup_stm32f103xb.s
DebugMon_Handler 00000014
Symbol: DebugMon_Handler
Definitions
At line 169 in file startup_stm32f103xb.s
At line 171 in file startup_stm32f103xb.s
Uses
At line 72 in file startup_stm32f103xb.s
At line 170 in file startup_stm32f103xb.s
At line 172 in file startup_stm32f103xb.s
Default_Handler 0000001A
@@ -720,7 +723,7 @@ Relocatable symbols
Symbol: Default_Handler
Definitions
At line 182 in file startup_stm32f103xb.s
At line 184 in file startup_stm32f103xb.s
Uses
None
Comment: Default_Handler unused
@@ -728,55 +731,55 @@ EXTI0_IRQHandler 0000001A
Symbol: EXTI0_IRQHandler
Definitions
At line 234 in file startup_stm32f103xb.s
At line 236 in file startup_stm32f103xb.s
Uses
At line 84 in file startup_stm32f103xb.s
At line 190 in file startup_stm32f103xb.s
At line 192 in file startup_stm32f103xb.s
EXTI15_10_IRQHandler 0000001A
Symbol: EXTI15_10_IRQHandler
Definitions
At line 268 in file startup_stm32f103xb.s
At line 270 in file startup_stm32f103xb.s
Uses
At line 118 in file startup_stm32f103xb.s
At line 224 in file startup_stm32f103xb.s
At line 226 in file startup_stm32f103xb.s
EXTI1_IRQHandler 0000001A
Symbol: EXTI1_IRQHandler
Definitions
At line 235 in file startup_stm32f103xb.s
At line 237 in file startup_stm32f103xb.s
Uses
At line 85 in file startup_stm32f103xb.s
At line 191 in file startup_stm32f103xb.s
At line 193 in file startup_stm32f103xb.s
EXTI2_IRQHandler 0000001A
Symbol: EXTI2_IRQHandler
Definitions
At line 236 in file startup_stm32f103xb.s
At line 238 in file startup_stm32f103xb.s
Uses
At line 86 in file startup_stm32f103xb.s
At line 192 in file startup_stm32f103xb.s
At line 194 in file startup_stm32f103xb.s
EXTI3_IRQHandler 0000001A
Symbol: EXTI3_IRQHandler
Definitions
At line 237 in file startup_stm32f103xb.s
At line 239 in file startup_stm32f103xb.s
Uses
At line 87 in file startup_stm32f103xb.s
At line 193 in file startup_stm32f103xb.s
At line 195 in file startup_stm32f103xb.s
EXTI4_IRQHandler 0000001A
Symbol: EXTI4_IRQHandler
Definitions
At line 238 in file startup_stm32f103xb.s
At line 240 in file startup_stm32f103xb.s
Uses
At line 88 in file startup_stm32f103xb.s
At line 194 in file startup_stm32f103xb.s
At line 196 in file startup_stm32f103xb.s
@@ -788,55 +791,55 @@ EXTI9_5_IRQHandler 0000001A
Symbol: EXTI9_5_IRQHandler
Definitions
At line 251 in file startup_stm32f103xb.s
At line 253 in file startup_stm32f103xb.s
Uses
At line 101 in file startup_stm32f103xb.s
At line 207 in file startup_stm32f103xb.s
At line 209 in file startup_stm32f103xb.s
FLASH_IRQHandler 0000001A
Symbol: FLASH_IRQHandler
Definitions
At line 232 in file startup_stm32f103xb.s
At line 234 in file startup_stm32f103xb.s
Uses
At line 82 in file startup_stm32f103xb.s
At line 188 in file startup_stm32f103xb.s
At line 190 in file startup_stm32f103xb.s
HardFault_Handler 0000000A
Symbol: HardFault_Handler
Definitions
At line 145 in file startup_stm32f103xb.s
At line 147 in file startup_stm32f103xb.s
Uses
At line 63 in file startup_stm32f103xb.s
At line 146 in file startup_stm32f103xb.s
At line 148 in file startup_stm32f103xb.s
I2C1_ER_IRQHandler 0000001A
Symbol: I2C1_ER_IRQHandler
Definitions
At line 260 in file startup_stm32f103xb.s
At line 262 in file startup_stm32f103xb.s
Uses
At line 110 in file startup_stm32f103xb.s
At line 216 in file startup_stm32f103xb.s
At line 218 in file startup_stm32f103xb.s
I2C1_EV_IRQHandler 0000001A
Symbol: I2C1_EV_IRQHandler
Definitions
At line 259 in file startup_stm32f103xb.s
At line 261 in file startup_stm32f103xb.s
Uses
At line 109 in file startup_stm32f103xb.s
At line 215 in file startup_stm32f103xb.s
At line 217 in file startup_stm32f103xb.s
I2C2_ER_IRQHandler 0000001A
Symbol: I2C2_ER_IRQHandler
Definitions
At line 262 in file startup_stm32f103xb.s
At line 264 in file startup_stm32f103xb.s
Uses
At line 112 in file startup_stm32f103xb.s
At line 218 in file startup_stm32f103xb.s
At line 220 in file startup_stm32f103xb.s
I2C2_EV_IRQHandler 0000001A
@@ -848,64 +851,64 @@ Symbol: I2C2_EV_IRQHandler
ARM Macro Assembler Page 5 Alphabetic symbol ordering
Relocatable symbols
At line 261 in file startup_stm32f103xb.s
At line 263 in file startup_stm32f103xb.s
Uses
At line 111 in file startup_stm32f103xb.s
At line 217 in file startup_stm32f103xb.s
At line 219 in file startup_stm32f103xb.s
MemManage_Handler 0000000C
Symbol: MemManage_Handler
Definitions
At line 150 in file startup_stm32f103xb.s
At line 152 in file startup_stm32f103xb.s
Uses
At line 64 in file startup_stm32f103xb.s
At line 151 in file startup_stm32f103xb.s
At line 153 in file startup_stm32f103xb.s
NMI_Handler 00000008
Symbol: NMI_Handler
Definitions
At line 140 in file startup_stm32f103xb.s
At line 142 in file startup_stm32f103xb.s
Uses
At line 62 in file startup_stm32f103xb.s
At line 141 in file startup_stm32f103xb.s
At line 143 in file startup_stm32f103xb.s
PVD_IRQHandler 0000001A
Symbol: PVD_IRQHandler
Definitions
At line 229 in file startup_stm32f103xb.s
At line 231 in file startup_stm32f103xb.s
Uses
At line 79 in file startup_stm32f103xb.s
At line 185 in file startup_stm32f103xb.s
At line 187 in file startup_stm32f103xb.s
PendSV_Handler 00000016
Symbol: PendSV_Handler
Definitions
At line 173 in file startup_stm32f103xb.s
At line 175 in file startup_stm32f103xb.s
Uses
At line 74 in file startup_stm32f103xb.s
At line 174 in file startup_stm32f103xb.s
At line 176 in file startup_stm32f103xb.s
RCC_IRQHandler 0000001A
Symbol: RCC_IRQHandler
Definitions
At line 233 in file startup_stm32f103xb.s
At line 235 in file startup_stm32f103xb.s
Uses
At line 83 in file startup_stm32f103xb.s
At line 189 in file startup_stm32f103xb.s
At line 191 in file startup_stm32f103xb.s
RTC_Alarm_IRQHandler 0000001A
Symbol: RTC_Alarm_IRQHandler
Definitions
At line 269 in file startup_stm32f103xb.s
At line 271 in file startup_stm32f103xb.s
Uses
At line 119 in file startup_stm32f103xb.s
At line 225 in file startup_stm32f103xb.s
At line 227 in file startup_stm32f103xb.s
@@ -917,10 +920,10 @@ RTC_IRQHandler 0000001A
Symbol: RTC_IRQHandler
Definitions
At line 231 in file startup_stm32f103xb.s
At line 233 in file startup_stm32f103xb.s
Uses
At line 81 in file startup_stm32f103xb.s
At line 187 in file startup_stm32f103xb.s
At line 189 in file startup_stm32f103xb.s
Reset_Handler 00000000
@@ -935,43 +938,43 @@ SPI1_IRQHandler 0000001A
Symbol: SPI1_IRQHandler
Definitions
At line 263 in file startup_stm32f103xb.s
At line 265 in file startup_stm32f103xb.s
Uses
At line 113 in file startup_stm32f103xb.s
At line 219 in file startup_stm32f103xb.s
At line 221 in file startup_stm32f103xb.s
SPI2_IRQHandler 0000001A
Symbol: SPI2_IRQHandler
Definitions
At line 264 in file startup_stm32f103xb.s
At line 266 in file startup_stm32f103xb.s
Uses
At line 114 in file startup_stm32f103xb.s
At line 220 in file startup_stm32f103xb.s
At line 222 in file startup_stm32f103xb.s
SVC_Handler 00000012
Symbol: SVC_Handler
Definitions
At line 164 in file startup_stm32f103xb.s
At line 166 in file startup_stm32f103xb.s
Uses
At line 71 in file startup_stm32f103xb.s
At line 165 in file startup_stm32f103xb.s
At line 167 in file startup_stm32f103xb.s
SysTick_Handler 00000018
Symbol: SysTick_Handler
Definitions
At line 177 in file startup_stm32f103xb.s
At line 179 in file startup_stm32f103xb.s
Uses
At line 75 in file startup_stm32f103xb.s
At line 178 in file startup_stm32f103xb.s
At line 180 in file startup_stm32f103xb.s
TAMPER_IRQHandler 0000001A
Symbol: TAMPER_IRQHandler
Definitions
At line 230 in file startup_stm32f103xb.s
At line 232 in file startup_stm32f103xb.s
@@ -980,61 +983,61 @@ Relocatable symbols
Uses
At line 80 in file startup_stm32f103xb.s
At line 186 in file startup_stm32f103xb.s
At line 188 in file startup_stm32f103xb.s
TIM1_BRK_IRQHandler 0000001A
Symbol: TIM1_BRK_IRQHandler
Definitions
At line 252 in file startup_stm32f103xb.s
At line 254 in file startup_stm32f103xb.s
Uses
At line 102 in file startup_stm32f103xb.s
At line 208 in file startup_stm32f103xb.s
At line 210 in file startup_stm32f103xb.s
TIM1_CC_IRQHandler 0000001A
Symbol: TIM1_CC_IRQHandler
Definitions
At line 255 in file startup_stm32f103xb.s
At line 257 in file startup_stm32f103xb.s
Uses
At line 105 in file startup_stm32f103xb.s
At line 211 in file startup_stm32f103xb.s
At line 213 in file startup_stm32f103xb.s
TIM1_TRG_COM_IRQHandler 0000001A
Symbol: TIM1_TRG_COM_IRQHandler
Definitions
At line 254 in file startup_stm32f103xb.s
At line 256 in file startup_stm32f103xb.s
Uses
At line 104 in file startup_stm32f103xb.s
At line 210 in file startup_stm32f103xb.s
At line 212 in file startup_stm32f103xb.s
TIM1_UP_IRQHandler 0000001A
Symbol: TIM1_UP_IRQHandler
Definitions
At line 253 in file startup_stm32f103xb.s
At line 255 in file startup_stm32f103xb.s
Uses
At line 103 in file startup_stm32f103xb.s
At line 209 in file startup_stm32f103xb.s
At line 211 in file startup_stm32f103xb.s
TIM2_IRQHandler 0000001A
Symbol: TIM2_IRQHandler
Definitions
At line 256 in file startup_stm32f103xb.s
At line 258 in file startup_stm32f103xb.s
Uses
At line 106 in file startup_stm32f103xb.s
At line 212 in file startup_stm32f103xb.s
At line 214 in file startup_stm32f103xb.s
TIM3_IRQHandler 0000001A
Symbol: TIM3_IRQHandler
Definitions
At line 257 in file startup_stm32f103xb.s
At line 259 in file startup_stm32f103xb.s
Uses
At line 107 in file startup_stm32f103xb.s
At line 213 in file startup_stm32f103xb.s
At line 215 in file startup_stm32f103xb.s
TIM4_IRQHandler 0000001A
@@ -1046,61 +1049,61 @@ Relocatable symbols
Symbol: TIM4_IRQHandler
Definitions
At line 258 in file startup_stm32f103xb.s
At line 260 in file startup_stm32f103xb.s
Uses
At line 108 in file startup_stm32f103xb.s
At line 214 in file startup_stm32f103xb.s
At line 216 in file startup_stm32f103xb.s
USART1_IRQHandler 0000001A
Symbol: USART1_IRQHandler
Definitions
At line 265 in file startup_stm32f103xb.s
At line 267 in file startup_stm32f103xb.s
Uses
At line 115 in file startup_stm32f103xb.s
At line 221 in file startup_stm32f103xb.s
At line 223 in file startup_stm32f103xb.s
USART2_IRQHandler 0000001A
Symbol: USART2_IRQHandler
Definitions
At line 266 in file startup_stm32f103xb.s
At line 268 in file startup_stm32f103xb.s
Uses
At line 116 in file startup_stm32f103xb.s
At line 222 in file startup_stm32f103xb.s
At line 224 in file startup_stm32f103xb.s
USART3_IRQHandler 0000001A
Symbol: USART3_IRQHandler
Definitions
At line 267 in file startup_stm32f103xb.s
At line 269 in file startup_stm32f103xb.s
Uses
At line 117 in file startup_stm32f103xb.s
At line 223 in file startup_stm32f103xb.s
At line 225 in file startup_stm32f103xb.s
USBWakeUp_IRQHandler 0000001A
Symbol: USBWakeUp_IRQHandler
Definitions
At line 270 in file startup_stm32f103xb.s
At line 272 in file startup_stm32f103xb.s
Uses
At line 120 in file startup_stm32f103xb.s
At line 226 in file startup_stm32f103xb.s
At line 228 in file startup_stm32f103xb.s
USB_HP_CAN1_TX_IRQHandler 0000001A
Symbol: USB_HP_CAN1_TX_IRQHandler
Definitions
At line 247 in file startup_stm32f103xb.s
At line 249 in file startup_stm32f103xb.s
Uses
At line 97 in file startup_stm32f103xb.s
At line 203 in file startup_stm32f103xb.s
At line 205 in file startup_stm32f103xb.s
USB_LP_CAN1_RX0_IRQHandler 0000001A
Symbol: USB_LP_CAN1_RX0_IRQHandler
Definitions
At line 248 in file startup_stm32f103xb.s
At line 250 in file startup_stm32f103xb.s
Uses
@@ -1109,33 +1112,33 @@ ARM Macro Assembler Page 9 Alphabetic symbol ordering
Relocatable symbols
At line 98 in file startup_stm32f103xb.s
At line 204 in file startup_stm32f103xb.s
At line 206 in file startup_stm32f103xb.s
UsageFault_Handler 00000010
Symbol: UsageFault_Handler
Definitions
At line 160 in file startup_stm32f103xb.s
At line 162 in file startup_stm32f103xb.s
Uses
At line 66 in file startup_stm32f103xb.s
At line 161 in file startup_stm32f103xb.s
At line 163 in file startup_stm32f103xb.s
WWDG_IRQHandler 0000001A
Symbol: WWDG_IRQHandler
Definitions
At line 228 in file startup_stm32f103xb.s
At line 230 in file startup_stm32f103xb.s
Uses
At line 78 in file startup_stm32f103xb.s
At line 184 in file startup_stm32f103xb.s
At line 186 in file startup_stm32f103xb.s
__user_initial_stackheap 0000001C
Symbol: __user_initial_stackheap
Definitions
At line 292 in file startup_stm32f103xb.s
At line 294 in file startup_stm32f103xb.s
Uses
At line 290 in file startup_stm32f103xb.s
At line 292 in file startup_stm32f103xb.s
Comment: __user_initial_stackheap used once
56 symbols
@@ -1151,7 +1154,7 @@ Symbol: Heap_Size
At line 43 in file startup_stm32f103xb.s
Uses
At line 47 in file startup_stm32f103xb.s
At line 296 in file startup_stm32f103xb.s
At line 298 in file startup_stm32f103xb.s
Stack_Size 00000400
@@ -1160,7 +1163,7 @@ Symbol: Stack_Size
At line 32 in file startup_stm32f103xb.s
Uses
At line 35 in file startup_stm32f103xb.s
At line 295 in file startup_stm32f103xb.s
At line 297 in file startup_stm32f103xb.s
__Vectors_Size 000000EC
@@ -1183,7 +1186,7 @@ Symbol: SystemInit
Definitions
At line 131 in file startup_stm32f103xb.s
Uses
At line 132 in file startup_stm32f103xb.s
At line 134 in file startup_stm32f103xb.s
Comment: SystemInit used once
__main 00000000
@@ -1191,13 +1194,13 @@ Symbol: __main
Definitions
At line 130 in file startup_stm32f103xb.s
Uses
At line 134 in file startup_stm32f103xb.s
At line 136 in file startup_stm32f103xb.s
Comment: __main used once
__use_two_region_memory 00000000
Symbol: __use_two_region_memory
Definitions
At line 289 in file startup_stm32f103xb.s
At line 291 in file startup_stm32f103xb.s
Uses
None
Comment: __use_two_region_memory unused