You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
934 B

12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. //
  4. #include "appdep.hpp"
  5. #define TAG "main"
  6. extern void umain();
  7. extern "C" {
  8. void StartDefaultTask(void const *argument) { umain(); }
  9. }
  10. /*******************************************************************************
  11. * MAIN *
  12. *******************************************************************************/
  13. /* IWDG init function */
  14. void MX_IWDG_Init(void) {
  15. hiwdg.Instance = IWDG;
  16. hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
  17. hiwdg.Init.Reload = 501;
  18. if (HAL_IWDG_Init(&hiwdg) != HAL_OK) {
  19. Error_Handler();
  20. }
  21. }
  22. int32_t getDeviceIdFromFlash() {
  23. int32_t *deviceId = (int32_t *)BOARD_TYPE_ID_FLASH_ADD;
  24. if (*deviceId <= 0) {
  25. return 0;
  26. }
  27. return *deviceId;
  28. }
  29. void umain() {
  30. MX_IWDG_Init();
  31. while (true) {
  32. osDelay(30);
  33. // debug_light_ctrl();
  34. HAL_IWDG_Refresh(&hiwdg);
  35. }
  36. }