2024-03-16 22:28:04 +08:00
|
|
|
#include "misc.h"
|
|
|
|
|
#include "led.h"
|
|
|
|
|
#include "file.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "bitmap.h"
|
|
|
|
|
#include "firmware.h"
|
|
|
|
|
|
|
|
|
|
void file_to_flash(void)
|
|
|
|
|
{
|
|
|
|
|
uint32_t ret;
|
|
|
|
|
|
|
|
|
|
ret = file_init();
|
|
|
|
|
if (ret == FILE_MASK_NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (ret & FILE_MASK_CONFIG) {
|
|
|
|
|
file_config_update();
|
|
|
|
|
}
|
|
|
|
|
if (ret & (FILE_MASK_MAIN | \
|
|
|
|
|
FILE_MASK_GAS1 | \
|
|
|
|
|
FILE_MASK_GAS2 | \
|
|
|
|
|
FILE_MASK_GAS3 | \
|
|
|
|
|
FILE_MASK_GAS4)) {
|
|
|
|
|
file_bitmap_update(ret);
|
|
|
|
|
}
|
|
|
|
|
if (ret & FILE_MASK_FW) {
|
|
|
|
|
file_firmware_update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void system_init(void)
|
|
|
|
|
{
|
|
|
|
|
led_init(LED1 | LED2);
|
|
|
|
|
led_off(LED1 | LED2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void led_blink(void)
|
|
|
|
|
{
|
2024-12-29 15:41:38 +08:00
|
|
|
for (uint32_t i=0; i<1; i++) {
|
2024-03-16 22:28:04 +08:00
|
|
|
led_delay_ms(250);
|
|
|
|
|
led_on(LED1 | LED2);
|
|
|
|
|
led_delay_ms(250);
|
|
|
|
|
led_off(LED1 | LED2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
system_init();
|
|
|
|
|
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
|
|
|
|
|
__enable_irq();
|
|
|
|
|
file_to_flash();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|