Tobi's ubw test branch

Dependencies:   mavlink_bridge mbed

Fork of AIT_UWB_Range by Benjamin Hepp

Revision:
26:a65c6f26c458
Parent:
25:d58b0595b300
Child:
28:a830131560e8
--- a/DW1000/DW1000.h	Thu Nov 27 17:51:54 2014 +0000
+++ b/DW1000/DW1000.h	Thu Nov 27 19:19:35 2014 +0000
@@ -54,6 +54,7 @@
 class DW1000 {
     public:            
         DW1000(PinName MOSI, PinName MISO, PinName SCLK, PinName CS, PinName IRQ);              // constructor, uses SPI class
+        void setCallbacks(void (*callbackRX)(int framelength), void (*callbackTX)());           // setter for callback function pointer fields
 
         // Device API
         uint32_t getDeviceID();                                                                 // gets the Device ID which should be 0xDECA0130 (good for testing SPI!)
@@ -61,6 +62,9 @@
         void setEUI(uint64_t EUI);                                                              // sets 64 bit Extended Unique Identifier according to IEEE standard
         float getVoltage();                                                                     // gets the current chip voltage measurement form the A/D converter
         uint64_t getStatus();                                                                   // get the 40 bit device status
+        void setInterrupt(bool RX, bool TX);                                                    // set Interrupt for received a good frame (CRC ok) or transmission done
+        uint64_t getRXTimestamp();
+        uint64_t getTXTimestamp();
         
         void sendString(char* message);                                                         // to send String with arbitrary length
         void receiveString(char* message);                                                      // to receive char string (length of the buffer must be 1021 to be safe)
@@ -68,15 +72,15 @@
         void startRX();                                                                         // start listening for frames
         void stopTRX();                                                                         // disable tranceiver go back to idle mode
         
-    //private:
+    private:
         void loadLDE();                                                                         // load the leading edge detection algorithm to RAM, [IMPORTANT because receiving malfunction may occur] see User Manual LDELOAD on p22 & p158
         void resetRX();                                                                         // soft reset only the tranciever part of DW1000
         void resetAll();                                                                        // soft reset the entire DW1000 (some registers stay as they were see User Manual)
 
         // Interrupt
         InterruptIn irq;                                                                        // Pin used to handle Events from DW1000 by an Interrupthandler
-        void (*callbackRX) (int framelength);                                                   // function pointer to callback which is called when successfull RX took place
-        void (*callbackTX) ();                                                                  // function pointer to callback which is called when successfull TX took place
+        void (*callbackRX)(int framelength);                                                    // function pointer to callback which is called when successfull RX took place
+        void (*callbackTX)();                                                                   // function pointer to callback which is called when successfull TX took place
         void ISR();                                                                             // interrupt handling method (also calls according callback methods)
         uint16_t getFramelength();                                                              // to get the framelength of the received frame from the PHY header
         
@@ -90,9 +94,9 @@
         void writeRegister8(uint8_t reg, uint16_t subaddress, uint8_t buffer);
         void writeRegister16(uint8_t reg, uint16_t subaddress, uint16_t buffer);
         
-        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
+        void readRegister(uint8_t reg, uint16_t subaddress, uint8_t *buffer, int length);       // reads the selected part of a slave register into the buffer memory
+        void writeRegister(uint8_t reg, uint16_t subaddress, uint8_t *buffer, int length);      // writes the buffer memory to the selected slave register
+        void setupTransaction(uint8_t reg, uint16_t subaddress, bool write);                    // sets up an SPI read or write transaction with correct register address and offset
         void select();                                                                          // selects the only slave for a transaction
         void deselect();                                                                        // deselects the only slave after transaction
 };