void sensorsInit(void) { //Turn off TMP007 configure_tmp_007(0); //Power down Gyro IOCPinTypeGpioOutput(BOARD_IOID_MPU_POWER); GPIOPinClear(BOARD_MPU_POWER); //Power down Mic IOCPinTypeGpioOutput(BOARD_IOID_MIC_POWER); GPIOPinClear(1 << BOARD_IOID_MIC_POWER); //Turn off external flash ext_flash_init(); //includes power down instruction //Turn off OPT3001 configure_opt_3001(0); configure_bmp_280(0); //Power off Serial domain (Powered on in sensor configurations!) PRCMPowerDomainOff(PRCM_DOMAIN_SERIAL); while((PRCMPowerDomainStatus(PRCM_DOMAIN_SERIAL) != PRCM_DOMAIN_POWER_OFF)); //Shut down I2C board_i2c_shutdown(); }
/*---------------------------------------------------------------------------*/ void board_init() { /* Disable global interrupts */ bool int_disabled = ti_lib_int_master_disable(); /* Turn on relevant PDs */ wakeup_handler(); /* Enable GPIO peripheral */ ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); /* Apply settings and wait for them to take effect */ ti_lib_prcm_load_set(); while(!ti_lib_prcm_load_get()); /* Make sure the external flash is in the lower power mode */ ext_flash_init(); lpm_register_module(&launchpad_module); /* For unsupported peripherals, select a default pin configuration */ configure_unused_pins(); /* Re-enable interrupt if initially enabled. */ if(!int_disabled) { ti_lib_int_master_enable(); } }
PROCESS_THREAD(blinker_test_loop, ev, data) { PROCESS_BEGIN(); // (1) UART Output printf("OTA Image Example: Starting\n"); #if PLATFORM_HAS_LEDS // (2) Start blinking green LED leds_init(); leds_on(BLINKER_PIN); #else printf("Platform does not support LED. Unique ID: %u\n", OTA_EXAMPLE_UNIQUE_ID); #endif ctimer_set( &blink_timer, (CLOCK_SECOND/2), blink_looper, NULL); // (3) Get metadata about the current firmware version OTAMetadata_t current_firmware; get_current_metadata( ¤t_firmware ); printf("\nCurrent Firmware\n"); print_metadata( ¤t_firmware ); ext_flash_init(); int ota_slot; OTAMetadata_t ota_metadata; printf("\nNewest Firmware:\n"); ota_slot = find_newest_ota_image(); while( get_ota_slot_metadata( ota_slot, &ota_metadata ) ); print_metadata( &ota_metadata ); printf("\nOldest Firmware:\n"); ota_slot = find_oldest_ota_image(); while( get_ota_slot_metadata( ota_slot, &ota_metadata ) ); print_metadata( &ota_metadata ); int empty_slot = find_empty_ota_slot(); printf("\nEmpty OTA slot: #%u\n", empty_slot); // (4) OTA Download! process_start(ota_download_th_p, NULL); PROCESS_END(); }
void initSensors(void){ // pressor -> ..-sensor.c enable_bmp_280(1); // set register for sensor init_bmp_280(); // set up I2C for bmp, config and clear // enable_bmp_280(0); configure_tmp_007(0); init_hdc_1000(); ext_flash_init(); //includes power down instruction // Power down not needed Sensors // Gyro IOCPinTypeGpioOutput(BOARD_IOID_MPU_POWER); GPIOPinClear(BOARD_MPU_POWER); // Mic IOCPinTypeGpioOutput(BOARD_IOID_MIC_POWER); GPIOPinClear(1 << BOARD_IOID_MIC_POWER); // OPT3001 configure_opt_3001(0); /* //Power off Serial domain (Powered on in sensor configurations!) PRCMPowerDomainOff(PRCM_DOMAIN_SERIAL); while((PRCMPowerDomainStatus(PRCM_DOMAIN_SERIAL) != PRCM_DOMAIN_POWER_OFF)); //Shut down I2C board_i2c_shutdown(); */ g_temp_active = false; g_pressure_set = false; g_humidity_acitve = false; }