General testings

Dependencies:   mbed

Fork of BEACON_CODE_NEW by Mohamed Azad

Files at this revision

API Documentation at this revision

Comitter:
shekhar
Date:
Thu Oct 22 09:05:26 2015 +0000
Parent:
16:cc5fdb4a8436
Child:
18:4113ef89cd78
Commit message:
reset_uC() function added, disable interrupts removed, values written to registers is checked again

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
tx.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Oct 22 04:44:41 2015 +0000
+++ b/main.cpp	Thu Oct 22 09:05:26 2015 +0000
@@ -231,14 +231,18 @@
     pc.printf("Long packet sent\r\n");
     writereg(RF22_REG_07_OPERATING_MODE1,0x00);        //standby mode
 }
-
+void reset_uC()
+{
+    printf("reset uC");
+}
 void writereg(uint8_t reg,uint8_t val)
 {
-    cs = 0;__disable_irq();spi.write(reg | 0x80);spi.write(val);__enable_irq();cs = 1;
+    int read_val =0; cs = 0;spi.write(reg | 0x80);spi.write(val);cs = 1;read_val = readreg(reg);if(read_val != val) reset_uC(); 
 }
+
 uint8_t readreg(uint8_t reg)
 {
-    int val;cs = 0;__disable_irq();spi.write(reg & ~0x80);val = spi.write(0);__enable_irq();cs = 1;return val;
+    int val;cs = 0;spi.write(reg & ~0x80);val = spi.write(0);cs = 1;return val;
 }
 void clearTxBuf()
 {
--- a/tx.h	Thu Oct 22 04:44:41 2015 +0000
+++ b/tx.h	Thu Oct 22 09:05:26 2015 +0000
@@ -38,6 +38,7 @@
 void clearTxBuf();
 int setFrequency(double);
 bool Check_ACK_RECEIVED();
+void reset_uC();
 
 #define RF22_MAX_MESSAGE_LEN 255