//IMU初始化 void ANO_IMU::Init() { //滤波器参数初始化 filter_Init(); //传感器初始化 sensor_Init(); }
/** * Initializes all of the device systems. If the clear button * is held down at the end of the initialization then defaults * are restored to all EEPROM settings. * * @return Returns 'OK' if previous data was found by data_Init(), 'ERROR' otherwise. */ status init(void) { Time time; int i; cli(); user_Init(); timer_Wait_MS(1000); // The serial port is now connected to the GSM modem, not the FTDI chip... // coms_Init(); gsm_modem_Init(); usart_Print_Num(SERIAL, UBRR1L); sensor_Init(true); data_Init(); if (user_Get_Button(BUTTON_CLEAR)) { for (i = 0; i < 50; i++) { timer_Wait_MS(50); user_Toggle_LED(LED_CLEAR); user_Toggle_LED(LED_STOP); user_Toggle_LED(LED_START); user_Toggle_LED(LED_POWER); } adx_Calibrate(); rtc_Init(); data_Reset_EEPROM(); wdt_enable(WDTO_120MS); } // Hard-coded time and date for now since we don't have // an application to set the time with... // We should really try to get this from the GSM modem time.hours = 12; // set to noon time.minutes = 0; time.seconds = 0; time.month = 2; // March time.dow = 5; // Thursday time.year = 12; // 2012 time.date = 1; // The 1st rtc_Set_Time(&time); sei(); return OK; }
/** * Initializes all of the device systems. If the clear button * is held down at the end of the initialization then defaults * are restored to all EEPROM settings. * * @return Returns 'OK' if previous data was found by data_Init(), 'ERROR' otherwise. */ status init(void) { int i; cli(); user_Init(); timer_Wait_MS(1000); coms_Init(); sensor_Init(true); data_Init(); if (user_Get_Button(BUTTON_CLEAR)) { for (i = 0; i < 50; i++) { timer_Wait_MS(50); user_Toggle_LED(LED_CLEAR); user_Toggle_LED(LED_STOP); user_Toggle_LED(LED_START); user_Toggle_LED(LED_POWER); } adx_Calibrate(); rtc_Init(); data_Reset_EEPROM(); wdt_enable(WDTO_120MS); } sei(); return OK; }
void HEXIWEAR_startup( task_param_t param ) { uint8_t status = 0; /** output GPIO config */ GPIO_DRV_Init( NULL, OLED_cfg ); GPIO_DRV_Init( NULL, FLASH_cfg ); GPIO_DRV_Init( NULL, PWR_cfg ); GPIO_DRV_Init( NULL, VIBRO_cfg ); GPIO_DRV_Init( NULL, RGB_cfg ); GPIO_DRV_Init( NULL, KW40_GPIO_cfg ); GPIO_DRV_Init( NULL, REL_GPIO_cfg ); /** input GPIO config */ GPIO_DRV_Init( BAT_CHG_cfg, NULL ); GPIO_DRV_Init( TAP_cfg, NULL ); // lajkatest // GPIO_DRV_Init( GPIO_TEST_CFG, NULL ); #if defined( HEXIWEAR_DEBUG ) GPIO_DRV_Init( NULL, DEBUG_cfg ); #endif power_ResetKW40(); timer_Init( HEXIWEAR_TIMER_SENSOR ); status |= RTC_Init(); status |= FLASH_Init( &flashModule, &flashSettings ); // intern flash initialization INTFLASH_Init(); // enable power save by default // power_EnablePowerSave(); power_DisablePowerSave(); // set to deep sleep by default // power_SetSleepMode( POWER_SLEEP_TYPE_DEEP ); // RGB off FLASH_SetOFF(); // visual indication for testing HR sensor // MAXIM_Test(); /** create basic tasks */ status |= Notification_Init(); status |= HostInterface_Init(); status |= sensor_Init(); status |= power_Init(); status |= GuiDriver_Init(); haptic_MutexCreate(); sensor_InitAcc(); /** set GPIO interrupt for the tap function */ PORT_HAL_SetPinIntMode( PORTC, 1, kPortIntFallingEdge ); /** set charging battery interrupt */ PORT_HAL_SetPinIntMode( PORTC, 12, kPortIntEitherEdge ); NVIC_SetPriority( PORTC_IRQn, HEXIWEAR_CHG_IRQ_PRIO ); INT_SYS_EnableIRQ( PORTC_IRQn ); // status |= Run_USB_Task(); if ( HEXIWEAR_STATUS_SUCCESS != status ) { catch( CATCH_INIT ); } /** check for settings in flash at startup */ gui_sensorTag_CheckAtStartup(); haptic_CheckAtStartup(); CLOCK_SYS_Init( g_clockManConfigsArr, FSL_CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, FSL_CLOCK_MANAGER_CALLBACK_CNT ); POWER_SYS_Init( powerConfigsArr, 2U, powerStaticCallbacksConfigsArr , 2U ); // make battery readings regular sensor_SetPacketTargets( PACKET_BAT, sensor_GetPacketTargets( PACKET_BAT) | PACKET_PUSH_POWER_MGMT, true ); volatile uint32_t foo = CLOCK_SYS_GetSystemClockFreq(); while (1) { OSA_TaskDestroy( NULL ); } }
void HEXIWEAR_startup( task_param_t param ) { uint8_t status = 0; /** output GPIO configuration */ GPIO_DRV_Init( NULL, OLED_cfg ); GPIO_DRV_Init( NULL, FLASH_cfg ); GPIO_DRV_Init( NULL, PWR_cfg ); GPIO_DRV_Init( NULL, VIBRO_cfg ); GPIO_DRV_Init( NULL, RGB_cfg ); GPIO_DRV_Init( NULL, KW40_GPIO_cfg ); /** input GPIO configuration */ GPIO_DRV_Init( BAT_CHG_cfg, NULL ); GPIO_DRV_Init( TAP_cfg, NULL ); #if defined( HEXIWEAR_DEBUG ) GPIO_DRV_Init( NULL, DEBUG_cfg ); #endif power_ResetKW40(); timer_Init( HEXIWEAR_TIMER_SENSOR ); status |= RTC_Init(); status |= FLASH_Init( &flashModule, &flashSettings ); // intern flash initialization INTFLASH_Init(); // RGB off FLASH_SetOFF(); /** create basic tasks */ status |= Notification_Init(); status |= HostInterface_Init(); status |= sensor_Init(); status |= GuiDriver_Init(); haptic_MutexCreate(); sensor_InitAcc(); /** set GPIO interrupt for the tap function */ PORT_HAL_SetPinIntMode( PORTC, 1, kPortIntFallingEdge ); /** set charging battery interrupt */ PORT_HAL_SetPinIntMode( PORTC, 12, kPortIntEitherEdge ); NVIC_SetPriority( PORTC_IRQn, HEXIWEAR_CHG_IRQ_PRIO ); INT_SYS_EnableIRQ( PORTC_IRQn ); if ( HEXIWEAR_STATUS_SUCCESS != status ) { catch( CATCH_INIT ); } /** check for settings in flash at startup */ gui_sensorTag_CheckAtStartup(); haptic_CheckAtStartup(); CLOCK_SYS_Init( g_clockManConfigsArr, FSL_CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, FSL_CLOCK_MANAGER_CALLBACK_CNT ); POWER_SYS_Init( powerConfigsArr, 2U, powerStaticCallbacksConfigsArr , 2U ); // turn on regular battery readings sensor_SetPacketTargets( PACKET_BAT, sensor_GetPacketTargets( PACKET_BAT) | PACKET_PUSH_POWER_MGMT, true ); while (1) { power_Init(); OSA_TaskDestroy( NULL ); } }