Default_Castum_AppFOTA4_Working

Dependencies:   mbed BLE_API nRF51822

Revision:
6:85f68f27170c
Parent:
5:ac98ff227ad7
Child:
7:8459cadf45fc
--- a/main.cpp	Fri Jan 30 10:45:47 2015 +0000
+++ b/main.cpp	Fri Feb 20 00:41:18 2015 +0000
@@ -23,15 +23,18 @@
 #define D_EK        2  // nRF51822-EK 
 #define D_BEACON    3  // nRF51822-Beacon 
 #define D_ATOMWEAR  4  // Atomwear  
+
 //==============================
 // Compile Options:
-#define D_BLE_UART  1           // Include BLE UART functionality?
-#define D_PING_SEC  1           // Ping Rate in Seconds
+#define D_BLE_UART  1  // Include BLE UART functionality?
+#define D_PING_SEC  1  // Ping Rate in Seconds
 
 #define D_PCB    D_MKIT         // Select target PCB
+//#define D_MkitPROBING 1         // Option: Drive pwm on select header signals to aid probing with scope, comment out this line to disable
 //#define D_PCB    D_EK           // Select target PCB
 //#define D_PCB    D_BEACON       // Select target PCB
 //#define D_PCB    D_ATOMWEAR     // Select target PCB
+//#define D_AtomPROBING   1     // Option: Drive pwm on select Debug Header signals to support probing with scope (PWM 10%~80%), comment out this line to disable **Disconnect all modules except Main/Debug/Battery**
 
 //==============================
 #include "mbed.h"
@@ -39,9 +42,9 @@
 
 //============================== Process PCB Options:
 #if D_PCB==D_MKIT
-    const char *pcDeviceName    = "FOTA4r5m";
-    const char *pcPingBLE       = "m4\n";       // May need "\n" to push BLE Tx
-    const char *pcPingUART      = "u4\n";
+    const char *pcDeviceName = "FOTA4r6m";
+    const char *pcPingBLE  = "m4\n";            // May need "\n" to push BLE Tx
+    const char *pcPingUART = "u4\n";
 
     #define DEBUG(...) { printf(__VA_ARGS__); } //UART: p0.08~p0.11, Debug OK over USB Serial
     DigitalIn       bB1in(BUTTON1);             //p0.16 =Button1
@@ -61,7 +64,7 @@
     #define D_OPERATION_LED   "mkit: LED1=Ticker+Button1, LED2=Button2"
  
 #elif D_PCB==D_EK
-    const char *pcDeviceName = "FOTA4r5e";
+    const char *pcDeviceName = "FOTA4r6e";
     const char *pcPingBLE  = "e4\n";            // May need "\n" to push BLE Tx
 
     #define DEBUG(...) {}                       //Serial Debug not connected 
@@ -82,7 +85,7 @@
     #define D_OPERATION_LED   "EK: LED0=Ticker+Button0, LED1=Button1"
 
  #elif D_PCB==D_BEACON
-    const char *pcDeviceName = "FOTA4r5b";
+    const char *pcDeviceName = "FOTA4r6b";
     const char *pcPingBLE  = "b4\n";            // May need "\n" to push BLE Tx
  
     #define DEBUG(...) {}                       //Serial Debug not connected 
@@ -105,7 +108,7 @@
     #define D_OPERATION_LED   "Beacon: Red=Ticker, Green=SW1, Blue=SW2"
   
 #elif D_PCB==D_ATOMWEAR     //  USBSerial=None, ButtonLED=atomwear, LEDx=Buttonx, LEDw=Buttony|Ticker
-    const char *pcDeviceName = "FOTA4r5a";
+    const char *pcDeviceName = "FOTA4r6a";
     const char *pcPingBLE  = "a\n";            // May need "\n" to push BLE Tx
  
     #define DEBUG(...) {}                       //Serial Debug not connected 
@@ -117,7 +120,7 @@
     //PwmOut fLWpwm(p18); float fLWlevel = 0.1; //p0.18 =LEDW, BrightnessFloat(0.0~1.0)
     //AnalogIn      adcA(p1);                   //p0.01 =AIN2
     //AnalogIn      adcB(p2);                   //p0.02 =AIN3
-
+  
     #define D_0_LED_TICKER    { bLBout=((uTicker1++)&0x01);}    // LED Follows Ticker (May also follow a button)
     #define D_1_LED_BUTTON    { bLWout = bB1in;}                // LED Follows Button
     #define D_OPERATION_LED   "Atomwear: Blue=Ticker, White=S1"
@@ -230,7 +233,47 @@
 #ifdef D_2_LED_BUTTON
     B2int.fall(&onButton); B2int.rise(&onButton); // Button2
 #endif
-    for (;;) {
+
+#if D_PCB==D_MKIT
+  #ifdef D_MkitPROBING
+    //**Warning:As of 20150219 nRF appears to have max 3 PwmOut channels, others don't output but compile OK. (Maybe see SoftPWM or FastPWM for more channels)
+
+    //For IO Pinout check: PWM 10%~80% on Debug Header pins to allow probing verification:
+    // Signals by schematic (User guide has typos), arranged by header rows from PCB edge
+    //     nRF51                 PWM  //mkit    
+    PwmOut pwm_p30(p30); pwm_p30=0.1; //P6.7
+  #endif
+#endif
+
+#if D_PCB==D_ATOMWEAR
+  #ifdef D_AtomPROBING
+    //**Disconnect all modules except Main/Debug/Battery**
+
+    //**Warning:As of 20150219 nRF appears to have max 3 PwmOut channels, others don't output but compile OK. (Maybe see SoftPWM or FastPWM for more channels)
+
+    //For IO Pinout check: PWM 10%~80% on Debug Header pins to allow probing verification:
+    // Signals by schematic (User guide has typos), arranged by header rows from PCB edge
+    //     nRF51                 PWM // Schematic //Header Bus //Silkscreen     
+    PwmOut pwm_p13(p13); pwm_p13=0.1;// SPI_SCK1  //P17.2  22  //8
+    PwmOut pwm_p14(p14); pwm_p14=0.2;// SPI_MOSI1 //P17.4  23  //10
+    PwmOut pwm_p15(p15); pwm_p15=0.3;// SPI_MISO1 //P17.6  24  //12
+
+//    PwmOut pwm_p0(p0);   pwm_p0=0.4;// GPIO1     //P17.1  11  //7
+//    PwmOut pwm_p2(p2);   pwm_p2=0.5;// GPIO2     //P17.3  10  //9
+//    PwmOut pwm_p3(p3);   pwm_p3=0.6;// GPIO3     //P17.5  9   //11
+
+//    PwmOut pwm_p12(p12); pwm_p12=0.7;// UART_RX   //P15.2  21  //2
+//    PwmOut pwm_p11(p11); pwm_p11=0.8;// UART_TX   //P15.4  20  //4 
+    //     ----         // VCC Unreg //P15.6  13  //6    ==Unregulated Power from Battery (Regulator on nRF PCB)
+
+    //     SWDIO        // SWDIO     //P15.1  19  //1
+    //     SWCLK        // SWDCLK    //P15.3  18  //3
+    //     GND          // GND       //P15.5  15  //5
+  #endif
+#endif
+
+
+   for (;;) {
         ble.waitForEvent();
    }
 }