IoT - Kubus / Mbed 2 deprecated Kubus

Dependencies:   mbed nRF24L01P

Revision:
7:e51d0fbb1a25
Parent:
6:98401b545e0c
Child:
10:869163c7929d
--- a/master.cpp	Thu Jan 05 11:25:21 2017 +0000
+++ b/master.cpp	Thu Jan 05 13:13:28 2017 +0000
@@ -1,12 +1,12 @@
 #include "common.h"
-
-const unsigned long long RX_ADDRESS = MASTER_ADDRESS;
-const unsigned long long TX_ADDRESS = PIR1_ADDRESS;
+#include "master.h"
 
-Serial pc(USBTX, USBRX); // tx, rx
-nRF24L01P radio(PB_15, PB_14, PB_13, PB_12, PB_1, PB_2);    // mosi, miso, sck, csn, ce, irq
-
-int main() {
+int master_loop() {
+    Serial pc(USBTX, USBRX); // tx, rx
+    nRF24L01P radio(PB_15, PB_14, PB_13, PB_12, PB_1, PB_2);    // mosi, miso, sck, csn, ce, irq
+    
+    const unsigned long long RX_ADDRESS = MASTER_ADDRESS;
+    const unsigned long long TX_ADDRESS = PIR1_ADDRESS;
 
     char rxData[TRANSFER_SIZE];
 
@@ -23,7 +23,7 @@
     pc.printf( "nRF24L01+ RX1 Address   : 0x%010llX\r\n", radio.getRxAddress(NRF24L01P_PIPE_P1) );
 
     while (1) {
-        int rx_bytes=  0;
+        int rx_bytes = 0;
         if(radio.readable(NRF24L01P_PIPE_P1)){
 
             rx_bytes = radio.read(NRF24L01P_PIPE_P1, rxData, sizeof(rxData));