This is modified program from original CC1101_Transceiver. CC1101 Test succeeded STM32-F407 platform. Feature are improved little bit.

Dependencies:   mbed

TI CC1101 chip is embedded along with STM32-F407 MCU. /media/uploads/hillkim7/cc1101-test.png

Revision:
1:e96096a7b90b
Parent:
0:9df942ea84f4
Child:
2:54c832c68208
--- a/CC1101.h	Sun Nov 21 11:37:56 2010 +0000
+++ b/CC1101.h	Tue Mar 31 07:48:52 2015 +0000
@@ -100,18 +100,18 @@
 // Strobe commands
 #define CCxxx0_SRES         0x30        // Reset chip.
 #define CCxxx0_SFSTXON      0x31        // Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1).
-                                        // If in RX/TX: Go to a wait state where only the synthesizer is
-                                        // running (for quick RX / TX turnaround).
+// If in RX/TX: Go to a wait state where only the synthesizer is
+// running (for quick RX / TX turnaround).
 #define CCxxx0_SXOFF        0x32        // Turn off crystal oscillator.
 #define CCxxx0_SCAL         0x33        // Calibrate frequency synthesizer and turn it off
-                                        // (enables quick start).
+// (enables quick start).
 #define CCxxx0_SRX          0x34        // Enable RX. Perform calibration first if coming from IDLE and
-                                        // MCSM0.FS_AUTOCAL=1.
+// MCSM0.FS_AUTOCAL=1.
 #define CCxxx0_STX          0x35        // In IDLE state: Enable TX. Perform calibration first if
-                                        // MCSM0.FS_AUTOCAL=1. If in RX state and CCA is enabled:
-                                        // Only go to TX if channel is clear.
+// MCSM0.FS_AUTOCAL=1. If in RX state and CCA is enabled:
+// Only go to TX if channel is clear.
 #define CCxxx0_SIDLE        0x36        // Exit RX / TX, turn off frequency synthesizer and exit
-                                        // Wake-On-Radio mode if applicable.
+// Wake-On-Radio mode if applicable.
 #define CCxxx0_SAFC         0x37        // Perform AFC adjustment of the frequency synthesizer
 #define CCxxx0_SWOR         0x38        // Start automatic RX polling sequence (Wake-on-Radio)
 #define CCxxx0_SPWD         0x39        // Enter power down mode when CSn goes high.
@@ -119,7 +119,7 @@
 #define CCxxx0_SFTX         0x3B        // Flush the TX FIFO buffer.
 #define CCxxx0_SWORRST      0x3C        // Reset real time clock.
 #define CCxxx0_SNOP         0x3D        // No operation. May be used to pad strobe commands to two
-                                        // bytes for simpler software.
+// bytes for simpler software.
 
 #define CCxxx0_PARTNUM          0x30
 #define CCxxx0_VERSION          0x31
@@ -141,8 +141,7 @@
 #define CCxxx0_RXFIFO           0x3F
 ///////////////////////////////////////////////////////////////////////////////////////
 // RF_SETTINGS is a data structure which contains all relevant CCxxx0 registers
-typedef struct S_RF_SETTINGS
-{
+typedef struct S_RF_SETTINGS {
     unsigned char FSCTRL1;   // Frequency synthesizer control.
     unsigned char IOCFG0;    // GDO0 output pin configuration
     unsigned char FSCTRL0;   // Frequency synthesizer control.
@@ -208,7 +207,7 @@
  * CC1101 Low-Power Sub-1 GHz RF Transceiver .
  */
 
-class CC1101 
+class CC1101
 {
 public:
     /**
@@ -220,7 +219,7 @@
      * @param csn mbed pin to use for not chip select line of SPI interface.
      * @param RDmiso mbed pin connected to SPI MISO pin for CC1101 RDY read.
      */
-    CC1101(PinName mosi, PinName miso, PinName clk, PinName csn, PinName RDmiso);
+    CC1101(PinName mosi, PinName miso, PinName clk, PinName csn, PinName RDmiso, PinName gdo0, PinName gdo1);
 
     /**
      * Initialize CC1101 parameters.
@@ -269,7 +268,7 @@
      * @param *txBuffer Pointer to a buffer containing the data that are going to be transmitted
      * @param size The size of the txBuffer
      */
-    void SendPacket(unsigned char *txBuffer, unsigned char size);
+    void SendPacket(const unsigned char *txBuffer, unsigned char size);
 
     /**
      * This function check if the TX FIFO is empty
@@ -339,18 +338,32 @@
      */
     void RXMode(void);
 
+    /**
+     * This function return GDO0 input pin status.
+     */
+    int GetGDO0(void);
+
+    /**
+     * This function return GDO1 input pin status.
+     */
+    int GetGDO1(void);
+
+
+    unsigned char ReadStatus(unsigned char addr);
 protected:
     void RESET_CCxxx0(void);
     void POWER_UP_RESET_CCxxx0(void);
-    unsigned char ReadStatus(unsigned char addr);
     unsigned char Strobe(unsigned char strobe);
     void WriteRfSettings(RF_SETTINGS *pRfSettings);
-    
+
     SPI _spi;
     DigitalOut _csn;
     DigitalIn _RDmiso;
     unsigned char rssi;
     unsigned char lqi;
+    DigitalIn _gdo0;
+    DigitalIn _gdo1;
 };
 ///////////////////////////////////////////////////////////////////////////////////////
-#endif
\ No newline at end of file
+#endif
+