123
Fork of LG by
Device.c
- Committer:
- Diletant
- Date:
- 2016-05-03
- Revision:
- 149:abbf7663d27d
- Parent:
- 137:14a0c452cf32
- Child:
- 156:e68ee0bcdcda
File content as of revision 149:abbf7663d27d:
#include "Device.h" Device device; HashParam hashParamTable[HASH_PARAM_COUNT]; HashFunc hashFuncTable[HASH_FUNC_COUNT]; void InitDevice(void) { //Init system SystemInit1(); // Инициализация контроллера: установка тактовых частот SystemCoreClockUpdate1(); // расчет тактовой частоты процессора перед инициализацией UART - 100MHz //Init timers Init_TIM1(7812); //Timer 1: CCLK / 7812 = 12800.819Hz; Vibro: Timer1/32 = 400.025Hz; Init_TIM2(); //Timer 2: CCLK / 4 / 250 = 100kHz enable_timer1(); enable_timer2(); //Load default settings InitAllWithDefaults(); //Load from flash FlashReadAll(); //Init flash memory InitFlash(); //Init service port InitServicePort(); //Init host commununication port InitHostPort(); //Init host commununication protocol InitHostProtocol(); InitSSP(); //Init light-up and back light unit InitLightUp(); //Init dither InitDither(); //Init path length control system InitPathLengthControlSystem(); } void StartDevice(void){ StartLightUp(); StartDither(); } void InitAllWithDefaults(void){ device.settings.address = 0; device.settings.uart.startupBaudRate = 38400; InitFlashWithDefaults(); InitServicePortWithDefaults(); InitHostPortWithDefaults(); InitHostProtocolWithDefaults(); InitLightUpWithDefaults(); InitSSPWithDefaults(); InitDitherWithDefaults(); InitPathLengthControlSystemWithDefaults(); } /* int32_t FindByHash(uint32_t hash){ for (uint32_t i = 0; i < HASH_PARAM_COUNT; i++){ if (hashParamTable[i].hash == hash) return i; } return -1; } */