123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /********************************* (C) РОТЕК ***********************************
- * @module hw_init
- * @file hw_init.c
- * @version 1.0.0
- * @date XX.XX.XXXX
- * $brief hw_init
- *******************************************************************************
- * @history Version Author Comment
- * XX.XX.XXXX 1.0.0 Telenkov D.A. First release.
- *******************************************************************************
- */
- #include "stm32f4xx.h"
- #include "common_config.h"
- #include "hw_init.h"
- #include "wdg.h"
- #include "usart.h"
- #include "settings_api.h"
- #include "bt_6701_settings.h"
- #include "buttons.h"
- #include "commands_api.h"
- #include "led.h"
- #include "rtc.h"
- #include "gpio.h"
- #include "spi_flash.h"
- #include "stm32_uid.h"
- #include "port_microrl.h"
- #ifdef RS485_USART
- #include "rs485_echo.h"
- #endif
- #include "FreeRTOS.h"
- #include "task.h"
- #ifdef PRINTF_STDLIB
- #include <stdio.h>
- #endif
- #ifdef PRINTF_CUSTOM
- #include "tinystdio.h"
- #endif
- char STM_ID[33];
- char STM_ID_HEX[12];
- void service_com_task(void* params)
- {
- int c;
- for(;;){
- c = service_getchar(portMAX_DELAY);
- if(c >= 0)
- {
- MICRORL_GetChar((uint8_t)c);
- }
- }
- }
- uint32_t time_test =0;
- /**
- * @brief Инициализация необходимых модулей
- */
- void BT_6702_Init(void)
- {
- uint8_t len;
- gpio_init();
- WDG_Init();
- spi_flash_init();
-
- InitUSART();
- MICRORL_Init();
- init_settings();
-
- SETTINGS_Load();
- Service_SETTINGS_SetWebParamsDef();
- Service_SETTINGS_SetTempWebParamsDef();
- SETTINGS_Save();
-
- COM_ReadTestState();
-
- memset(STM_ID, 0, 33);
- GetSTM32IDStr(STM_ID, &len); // Уникальный ID чипа
- GetSTM32IDInt(STM_ID_HEX);
-
- BUTTON_Init(); // Кнопки
- LED_Init();
-
- TM_RTC_Init(TM_RTC_ClockSource_External);
- time_test = RTC_GetUnixTime();
- #ifdef RS485_USART
- /* RS485 echo loop */
- rs485echo_init();
- #endif
- xTaskCreate(service_com_task, ( char * ) "service_com_task", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY, NULL);
- // Создает таски для выполнения команд тестера
- xTaskCreate(vTestCommands, "TestProcessing", 2*configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
-
- printf("Hello world\r\n");
- }
- /********************************* (C) РОТЕК **********************************/
|