asad patel / stm-spirit1-rf-driver

Dependents:   DISCO_IOT-wifi_client

Fork of stm-spirit1-rf-driver by ST

Revision:
2:45642c5198a2
Parent:
0:4fb29d9ee571
Child:
3:0df38cfb1e53
--- a/SimpleSpirit1.h	Fri Oct 14 08:57:51 2016 +0200
+++ b/SimpleSpirit1.h	Fri Oct 14 10:42:56 2016 +0200
@@ -26,7 +26,7 @@
 	static SimpleSpirit1 *_singleton;
 
     /** Communication Interface Instance Variables **/
-	SPI _spi; // betzw - NOTE: Arduino pins are valid for NUCLEO-F401RE
+	SPI _spi; // betzw - NOTE: Arduino pins are valid only for NUCLEO-F401RE
               // mosi: PA_7 (D11)
               // miso: PA_6 (D12)
               // sclk: PB_3 (D3) or
@@ -36,10 +36,10 @@
               // mode: 0
               // ordr: MSB
               // freq: max 10MHz
-    InterruptIn _irq; // PC_7 (falling)
-    DigitalOut _chip_select; // PB_6 ('1' == chip unselected)
-    DigitalOut _shut_down; // PA_10 ('1' == shut_down) 
-    DigitalOut _led; // PB_4 (optional)
+    InterruptIn _irq; // PC_7 (D9) (falling)
+    DigitalOut _chip_select; // PB_6 (D10) ('1' == chip unselected)
+    DigitalOut _shut_down; // PA_10 (D2) ('1' == shut_down)
+    DigitalOut _led; // PB_4 (D5) (optional)
 
     /** Static Variables from Cube Implementation **/
     /*
@@ -193,6 +193,9 @@
     	enable_irq();
     }
 
+    /** Init Instance Method **/
+    void init(void);
+
     /** Constructor **/
     SimpleSpirit1(PinName mosi, PinName miso, PinName sclk,
 		  PinName irq, PinName cs, PinName sdn,
@@ -209,8 +212,9 @@
     	if(_singleton == NULL) {
     		_singleton = new SimpleSpirit1(mosi, miso, sclk,
     				irq, cs, sdn, led);
+    		_singleton->init();
     	} else {
-    		error("SimpleSpirit1 singleton already created!");
+    		error("SimpleSpirit1 singleton already created!\n");
     	}
 
     	return *_singleton;
@@ -218,7 +222,7 @@
 
     static SimpleSpirit1& Instance() {
     	if(_singleton == NULL) {
-    		error("SimpleSpirit1 must be created before used!");
+    		error("SimpleSpirit1 must be created before used!\n");
     	}
 
     	return *_singleton;