or shefi / Mbed 2 deprecated Valiber_Demo_newoptics

Dependencies:   mbed BLE_API nRF51822 X_NUCLEO_IDB0XA1

Files at this revision

API Documentation at this revision

Comitter:
orshefi
Date:
Thu Oct 31 18:50:07 2019 +0000
Parent:
80:4fbfa09ac26c
Commit message:
init

Changed in this revision

Refrect.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Refrect.h	Sat Feb 16 15:01:30 2019 +0000
+++ b/Refrect.h	Thu Oct 31 18:50:07 2019 +0000
@@ -7,7 +7,7 @@
 
 DigitalOut measure_led(P0_15);
 DigitalOut alive_led(P0_17);
-PwmOut main_power(P0_25);
+DigitalIn main_power(P0_5);
 DigitalOut V33ON(P0_20);
 DigitalOut LCDON(P0_19);
 DigitalOut scl(P0_22);
@@ -15,7 +15,7 @@
 AnalogIn a0(P0_4);//analog input
 DigitalOut clk(P0_7);//sensor clk
 AnalogIn ref(P0_6);//serial input flag
-InterruptIn wake_up(P0_24);//wake up button
+DigitalOut wake_up(P0_24);//wake up button
 DigitalIn swl(P0_16,PullUp);//secondry click
 
 
--- a/main.cpp	Sat Feb 16 15:01:30 2019 +0000
+++ b/main.cpp	Thu Oct 31 18:50:07 2019 +0000
@@ -170,7 +170,7 @@
     NRF_POWER->SYSTEMOFF = 0;
     start_up();
     alive_led = 0;
-    while(wake_up == 0)
+    while(main_power == 1)
     {
         swbg++;
         wait_ms(2);
@@ -178,9 +178,10 @@
         {
             unsigned char Name1[12]={35,65,76,73,66,82,65,84,69,31,96,0};
             Show_String(1,Name1,14,55);
-//            alive_led = 1;
-//            wait_ms(50);
-//            alive_led = 0;      
+            blink();
+            blink();
+            blink();
+            blink();      
         }
         if(swbg > 1000)
         {
@@ -195,14 +196,23 @@
 
 int main(void)
 {
-    main_power = 1;
+    wake_up = 1;
+    alive_led = 1;
+//    while(1){
+//        if(main_power.read()){
+//            alive_led = 0;
+//        }
+//        else{
+//            alive_led = 1;
+//        }
+//    }
     V33ON = 1;
     LCDON = 1;
     measure_led = 1;
     wdt_init();
-    wake_up.mode(PullUp);
-    wake_up.rise(&btnrise);
-    wake_up.fall(&btnfall);
+//    main_power.mode(PullUp);
+//    main_power.rise(&btnrise);
+//    main_power.fall(&btnfall);
     OLED_initial();
     oledwrite(0,0,0,0);//oled structure initialization
     BLE& ble = BLE::Instance(BLE::DEFAULT_INSTANCE);
@@ -240,36 +250,36 @@
         } 
         else 
         {
-            NRF_WDT->RR[0] = WDT_RR_RR_Reload;
-            if(shut_down == 1)
-            {
-                LCDON = 0;
-                V33ON = 0;
-                measure_led = 0;
-                alive_led = 1;
-                clk = 0;
-                SCLK = 0;
-                SDIN = 0;
-                RES = 0;
-                CS = 0;
-                DC = 0;
-                scl = 1;
-                sda = 1;
-                wait_ms(100);
-                NRF_RADIO->POWER = 0;
-                NRF_POWER->SYSTEMOFF =POWER_SYSTEMOFF_SYSTEMOFF_Enter;
-            }
+            //NRF_WDT->RR[0] = WDT_RR_RR_Reload;
+//            if(shut_down == 1)
+//            {
+//                LCDON = 0;
+//                V33ON = 0;
+//                measure_led = 0;
+//                alive_led = 1;
+//                clk = 0;
+//                SCLK = 0;
+//                SDIN = 0;
+//                RES = 0;
+//                CS = 0;
+//                DC = 0;
+//                scl = 1;
+//                sda = 1;
+//                wait_ms(100);
+//                NRF_RADIO->POWER = 0;
+//                NRF_POWER->SYSTEMOFF =POWER_SYSTEMOFF_SYSTEMOFF_Enter;
+//            }
         }
     }
 }
 
 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
 {
-    BLE::Instance(BLE::DEFAULT_INSTANCE).gap().startAdvertising(); // restart advertisin
-    blink();
-    blink();
-    blink();
-    blink();
-    blink();
-    blink();
+//    BLE::Instance(BLE::DEFAULT_INSTANCE).gap().startAdvertising(); // restart advertisin
+//    blink();
+//    blink();
+//    blink();
+//    blink();
+//    blink();
+//    blink();
 }
\ No newline at end of file