1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include "board.h"
- #include "bootloader.h"
- #include "global.h"
- #include "iap.h"
- #include "queue.h"
- #include "stm32f4xx_gpio.h"
- #include "system_stm32f4xx.h"
- #include <stm32f4xx.h>
- extern SqQueue CanQueueImportant; // CANÖØÒªÊý¾Ý¶ÓÁÐ
- int main(void)
- {
- rt_hw_board_init();
- u16 cnt = 0;
- CanData_TypeDef element;
- rt_pin_mode(RED_LED_PIN, PIN_MODE_OUTPUT);
- rt_pin_mode(GREEN_LED_PIN, PIN_MODE_OUTPUT);
- InitQueue(&CanQueueImportant);
- while (1)
- {
- if (GetHead(&CanQueueImportant, &element) != ERROR)
- {
- cnt = 0;
- delay_ms(1000);
- GPIO_ToggleBits(GPIOF, GPIO_Pin_9);
- iap_process(&element);
- }
- else if (flash_up_is_ok() == TRUE)
- {
- iap_from_flash();
- boot_goto_app(APP_ADDRESS);
- }
- else
- {
- cnt++;
- delay_ms(10);
- if (cnt > 100)
- {
- boot_goto_app(APP_ADDRESS);
- }
- }
- }
- }
|