hw_init.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /********************************* (C) РОТЕК ***********************************
  2. * @module hw_init
  3. * @file hw_init.c
  4. * @version 1.0.0
  5. * @date XX.XX.XXXX
  6. * $brief hw_init
  7. *******************************************************************************
  8. * @history Version Author Comment
  9. * XX.XX.XXXX 1.0.0 Telenkov D.A. First release.
  10. *******************************************************************************
  11. */
  12. #include "stm32f4xx.h"
  13. #include "hw_init.h"
  14. #include "wdg.h"
  15. #include "usart.h"
  16. #include "settings_api.h"
  17. #include "buttons.h"
  18. #include "commands_api.h"
  19. #include "led.h"
  20. #include "rtc.h"
  21. #include "gpio.h"
  22. #include "spi_flash.h"
  23. #include "stm32_uid.h"
  24. #include "port_microrl.h"
  25. #include "FreeRTOS.h"
  26. #include "task.h"
  27. #ifdef PRINTF_STDLIB
  28. #include <stdio.h>
  29. #endif
  30. #ifdef PRINTF_CUSTOM
  31. #include "tinystdio.h"
  32. #endif
  33. char STM_ID[33];
  34. char STM_ID_HEX[12];
  35. void service_com_task(void* params)
  36. {
  37. int c;
  38. for(;;){
  39. c = service_getchar(portMAX_DELAY);
  40. if(c >= 0)
  41. {
  42. MICRORL_GetChar((uint8_t)c);
  43. }
  44. }
  45. }
  46. uint32_t time_test =0;
  47. /**
  48. * @brief Инициализация необходимых модулей
  49. */
  50. void BT_6702_Init(void)
  51. {
  52. uint8_t len;
  53. gpio_init();
  54. WDG_Init();
  55. spi_flash_init();
  56. InitUSART();
  57. MICRORL_Init();
  58. init_settings();
  59. SETTINGS_Load();
  60. /*SETTINGS_SetTempWebParamsDef();
  61. SETTINGS_Save();*/
  62. COM_ReadTestState();
  63. memset(STM_ID, 0, 33);
  64. GetSTM32IDStr(STM_ID, &len); // Уникальный ID чипа
  65. GetSTM32IDInt(STM_ID_HEX);
  66. BUTTON_Init(); // Кнопки
  67. LED_Init();
  68. TM_RTC_Init(TM_RTC_ClockSource_External);
  69. time_test = RTC_GetUnixTime();
  70. xTaskCreate(service_com_task, ( char * ) "service_com_task", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY, NULL);
  71. // Создает таски для выполнения команд тестера
  72. xTaskCreate(vTestCommands, "TestProcessing", 2*configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
  73. printf("Hello world\r\n");
  74. }
  75. /********************************* (C) РОТЕК **********************************/