示例#1
0
/*---------------------------  -----------------------*/
void system_module_init()
{
    // uart init
    simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, 0); 
    xprintf("start up..\r\n");
    
    //  
    system_HFCLK_init();

    //  
    if(!system_battery_self_test())
    {
        system_low_battery();
    }
    //  
     system_bootloader_check();
    //   
    system_led_flicker_init();
    nrf_gpio_pin_set(RED_LED);
    //  
    system_parameter_init();
    //  
    system_I2C_init();
    //  
    system_gpio_LoToHi_INT_init(ACCE_TAP_PIN_NUMBER);
    
    nrf_delay_ms(2000);
    nrf_gpio_pin_clear(RED_LED);
    
    
}
示例#2
0
文件: main.c 项目: CorBiNO/Atomwear
/**@brief Function for application main entry.
 */
int main(void)
{
	system_HFCLK_init();
	// uart init
    simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, 0); 
    xprintf("APP start up..\r\n");
	
	mcu_bootloader_check();
    // Initialize.
    app_trace_init();
    leds_init();
    buttons_init();
    ble_stack_init();
    device_manager_init();
    timers_init();
    gap_params_init();
    advertising_init();
    services_init();
    sensor_sim_init();
    conn_params_init();
	
	//I2C and sensor initial
	system_I2C_init();
	OLED_Init();
	sensor_init();
	enter_pedo_mode();	
	
	GPIO_HiToLo_INT_config(BUTTON_2);
	
	// Test battery
	if(!battery_self_detect())
    {
        system_low_battery();
    }
	
	// Start execution.
    application_timers_start();
    advertising_start();
	
	// Enter main loop.
    for (;;)
    {
        power_manage();
    }
}