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 mbed nRF51822 nRF51_Vdd nRF51_WakeUp nRF51_LowPwr
Fork of BLE_LoopbackUART by
Revision 16:c8f4e56fa239, committed 2016-06-11
- Comitter:
- kenjiArai
- Date:
- Sat Jun 11 04:25:54 2016 +0000
- Parent:
- 15:d7764da3f37c
- Commit message:
- put function table
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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
