Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API nRF51822 mbed
Fork of KS7 by
Diff: main.cpp
- Revision:
- 11:be439189e3f7
- Parent:
- 10:95c1e5a218d5
- Child:
- 12:880400fa5c44
--- a/main.cpp Fri Dec 04 09:30:43 2015 +0000 +++ b/main.cpp Sat Dec 05 01:14:00 2015 +0000 @@ -255,42 +255,24 @@ #endif #ifndef PCB_VER1 // set XTAL=32MHz for TaiyoYuden's module - DEBUG("Initializing XTALFREQ\n\r"); - SystemCoreClock = 32000000; - DEBUG("UICR->XTALFREQ=%x\r\n", NRF_UICR->XTALFREQ); - if (NRF_UICR->XTALFREQ == 0xffffffff){ - DEBUG("updating UICR->XTALFREQ..."); - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - *(uint32_t *)0x10001008 = 0xFFFFFF00; - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - DEBUG("done"); - NVIC_SystemReset(); - } - DEBUG("UICR->XTALFREQ=%x\r\n", NRF_UICR->XTALFREQ); + // is moved to mbed-src/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c + DEBUG("UICR->XTALFREQ=%x\r\n", NRF_UICR->XTALFREQ); // this should be 0xffffff00, not 0xffffffff #endif BleInitialize(); tk.attach_us(&ticker_callback, LED_INTERVAL_NSEC); /* - io.display(0.5); - io.display_value = 1111; - for (int i = 0; i < 10; i++){ - wait(0.1); - io.display_value += 1111; - } + // test for Full Power Consumption + io.display(1); + io.analog_pow(1); + io.display_value = 8888; */ + io.display(0.5); io.display_value = 1111; + io.analog_pow(1); while(1){ -/* - int ch; - ch = 0; pc.printf("%02x\r\n", 0xc4 | (ch << 4)); - ch = 1; pc.printf("%02x\r\n", 0xc4 | (ch << 4)); - ch = 2; pc.printf("%02x\r\n", 0xc4 | (ch << 4)); -*/ -// DEBUG("%f %f %f\r\n", io._get_adc(0), io._get_adc(1), io._get_adc(2)); - DEBUG("%x %x %x\r\n", io._get_adc(0), io._get_adc(1), io._get_adc(2)); + DEBUG("%f %f %f\r\n", io._get_adc(0), io._get_adc(1), io._get_adc(2)); + io.display_value = io._get_adc_raw(0) % 10000; } for (;; ) { ble.waitForEvent();