This is the DW1000 driver and our self developed distance measurement application based on it. We do this as a semester thesis at ETH Zürich under the Automatic Control Laboratory in the Department of electrical engineering.

Dependencies:   mbed

Revision:
7:e634eeafc4d2
Parent:
4:6240b9c7a033
Child:
8:7a9c61242e2f
--- a/DW1000/DW1000.h	Tue Nov 18 13:39:50 2014 +0000
+++ b/DW1000/DW1000.h	Tue Nov 18 14:06:48 2014 +0000
@@ -54,7 +54,7 @@
 class DW1000
 {
     public:            
-        DW1000(PinName MOSI, PinName MISO, PinName SCLK, PinName CS);                           // constructor, uses SPI class
+        DW1000(PinName MOSI, PinName MISO, PinName SCLK, PinName CS, PinName IRQ);                           // constructor, uses SPI class
 
         // Device API
         uint32_t getDeviceID();
@@ -63,13 +63,18 @@
         float getVoltage();
         
         void sendFrame(char* message, int length);
-        void resetRX();
         
     //private:
+        // Interrupt
+        void (*callbackRX) ();
+        void ISR();
+    
+        void resetRX();
         
         // SPI Inteface
         SPI spi;                                                                                // SPI Bus
         DigitalOut cs;                                                                          // Slave selector for SPI-Bus (here explicitly needed to start and end SPI transactions also usable to wake up DW1000)
+        InterruptIn irq;                                                                        // Pin used to handle Events from DW1000 by an Interrupthandler
         
         void readRegister(uint8_t reg, uint16_t subaddress, uint8_t *buffer, int length);
         void writeRegister(uint8_t reg, uint16_t subaddress, uint8_t *buffer, int length);
@@ -78,34 +83,4 @@
         void deselect();                                                                        // deselects the only slave after transaction
 };
 
-#endif
-
-// -------------------------------------------------------------------------------------------------------------------
-// structure from original Driver to hold device data (to be REMOVED!)
-typedef struct
-{
-    uint32_t      deviceID;
-    uint32_t      partID ;
-    uint32_t      lotID ;
-    uint8_t       chan;               // added chan here - used in the reading of acc
-    uint8_t       longFrames ;        // flag in non-standard long frame mode
-    uint32_t      txFCTRL ;           // keep TX_FCTRL register config
-    uint16_t      rfrxDly;            // rf delay (delay though the RF blocks before the signal comes out of the antenna i.e. "antenna delay")
-    uint16_t      rftxDly;            // rf delay (delay though the RF blocks before the signal comes out of the antenna i.e. "antenna delay")
-    uint32_t      antennaDly;         // antenna delay read from OTP 64 PRF value is in high 16 bits and 16M PRF in low 16 bits
-    uint8_t       xtrim;              // xtrim value read from OTP
-    uint32_t      sysCFGreg ;         // local copy of system config register
-    uint32_t      txPowCfg[12];       // stores the Tx power configuration read from OTP (6 channels consecutively with PRF16 then 64, e.g. Ch 1 PRF16 is index 0 and 64 index 1)
-    uint8_t       dblbuffon;          // double rx buffer mode flag
-                                    // the dwt_isr() will only process the events that "enabled" (i.e. the ones that generate interrupt)
-    //dwt_callback_data_t cdata;      // callback data structure
-
-    uint32_t      states[3] ;         //MP workaround debug states register
-    uint8_t       statescount ;
-    uint8_t       wait4resp ;         //wait 4 response was set with last TX start command
-    int         prfIndex ;
-
-    //void (*dwt_txcallback)(const dwt_callback_data_t *txd);
-    //void (*dwt_rxcallback)(const dwt_callback_data_t *rxd);
-
-} dwt_local_data_t ;
\ No newline at end of file
+#endif
\ No newline at end of file