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:
8:7a9c61242e2f
Parent:
7:e634eeafc4d2
Child:
10:d077bb12d259
--- a/DW1000/DW1000.h	Tue Nov 18 14:06:48 2014 +0000
+++ b/DW1000/DW1000.h	Tue Nov 18 15:41:33 2014 +0000
@@ -51,8 +51,7 @@
 #define DW1000_SUBADDRESS_FLAG      0x40 // if we have a sub address second Bit has to be 1
 #define DW1000_2_SUBADDRESS_FLAG    0x80 // if we have a long sub adress (more than 7 Bit) we set this Bit in the first part
 
-class DW1000
-{
+class DW1000 {
     public:            
         DW1000(PinName MOSI, PinName MISO, PinName SCLK, PinName CS, PinName IRQ);                           // constructor, uses SPI class
 
@@ -63,6 +62,7 @@
         float getVoltage();
         
         void sendFrame(char* message, int length);
+        void receiveFrame();
         
     //private:
         // Interrupt
@@ -76,6 +76,8 @@
         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 writeRegister8(uint8_t reg, uint16_t subaddress, uint8_t buffer);                  // expressive to write just one byte
+        
         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);
         void setupTransaction(uint8_t reg, uint16_t subaddress, bool write);                    // writes bytes to SPI to setup a write or read transaction the register address and subaddress