12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include "bootloader.h"
- #include "can.h"
- #include "dwt.h"
- #include "global.h"
- #include "iap.h"
- #include "led.h"
- #include "queue.h"
- #include "system_stm32f4xx.h"
- #include <stm32f4xx.h>
- extern SqQueue CanQueueImportant; // CANÖØÒªÊý¾Ý¶ÓÁÐ
- int main(void)
- {
- u16 cnt = 0;
- CanData_TypeDef element;
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
- DWT_Init();
- LED_Init();
- InitQueue(&CanQueueImportant);
- CAN2_Init();
- while (1)
- {
- if (GetHead(&CanQueueImportant, &element) != ERROR)
- {
- cnt = 0;
- LED_RUN_ON();
- iap_process(&element);
- }
- else if (flash_up_is_ok() == TRUE)
- {
- Iap_from_Flash();
- boot_goto_app(APP_ADDRESS);
- }
- else
- {
- cnt++;
- bsp_DelayMS(10);
- if (cnt > 100)
- {
- boot_goto_app(APP_ADDRESS);
- }
- }
- }
- }
|