You can control from iPhone and put some command. h=show commands help, v=show TY51822r3 VDD data, t=show chip temperature, q=you can make deep sleep condition.
Dependencies: BLE_API mbed nRF51822 nRF51_Vdd nRF51_WakeUp nRF51_LowPwr
Fork of BLE_LoopbackUART by
Please refer follows.
/users/kenjiArai/notebook/ty51822r3-current-consumption-using-nrf51_wakeup-l/#
Diff: main.cpp
- Revision:
- 16:c8f4e56fa239
- Parent:
- 15:d7764da3f37c
--- a/main.cpp Sat Jun 11 00:56:56 2016 +0000 +++ b/main.cpp Sat Jun 11 04:25:54 2016 +0000 @@ -42,6 +42,15 @@ #include "nRF51_lowpwr.h" // Definition ------------------------------------------------------------------------------------ +// Before using this function, please specify your program are used following functions or not. +#define USE_DEVICE_STDIO_MESSAGES 0 // printf +#define USE_DEVICE_SERIAL 0 // Serial or DEBUG & etc. +#define USE_DEVICE_I2C 0 // Sensors with I2C, LCD, EEPROM, Driver chips & etc. +#define USE_DEVICE_SPI 0 // Sensors with SOI, LCD, EEPROM, Driver chips & etc. +#define USE_DEVICE_SPISLAVE 0 // Communication with master vis SPI +#define USE_DEVICE_PWMOUT 0 // PWM duty output, Serve & etc. +#define USE_DEVICE_ANALOGIN 0 // Analog adc + #if USE_DEVICE_STDIO_MESSAGES // See disable_cpu_functions.h #define DEBUG(...) { printf(__VA_ARGS__); } #else @@ -86,6 +95,44 @@ RADIO_TXPOWER_TXPOWER_0dBm, /*!< 0dBm. */ RADIO_TXPOWER_TXPOWER_Pos4dBm, /*!< +4dBm. */ }; +const nRF51_LOWPWR_TypeDef lowpwr_table = + { + #if USE_DEVICE_STDIO_MESSAGES + true, + #else + false, + #endif + #if USE_DEVICE_SERIAL + true, + #else + false, + #endif + #if USE_DEVICE_I2C + true, + #else + false, + #endif + #if USE_DEVICE_SPI + true, + #else + false, + #endif + #if USE_DEVICE_SPISLAVE + true, + #else + false, + #endif + #if USE_DEVICE_PWMOUT + true, + #else + false, + #endif + #if USE_DEVICE_ANALOGIN + true + #else + false + #endif + }; // RAM ------------------------------------------------------------------------------------------- uint8_t tx_buf[TXRX_BUF_LEN]; @@ -120,7 +167,7 @@ // Control Program //------------------------------------------------------------------------------------------------- int main(void){ -// disable_cpu_functions(); // Disable unneeded CPU functions + LowPwr set_lowpwr(&lowpwr_table); myled = 1; ticker.attach(periodicCallback, 1); // Interrupt by switch