L3GD20 Library using FIFO and Interrupt

Fork of L3GD20_SPI by Tatsuki Fukuda

Revision:
3:6e935e7cec72
Parent:
2:be6daa938101
--- a/L3GD20.h	Mon May 12 11:47:43 2014 +0000
+++ b/L3GD20.h	Tue May 13 09:56:43 2014 +0000
@@ -28,7 +28,7 @@
 class L3GD20
 {
 public:
-    L3GD20(PinName miso, PinName mosi, PinName scl, PinName cs,PinName interrupt2=NC);
+    L3GD20(PinName mosi, PinName miso, PinName scl, PinName cs,PinName interrupt2=NC);
     typedef enum {
         null=0x00,WhoAmI=0x0F,CtrlReg1=0x20,CtrlReg2=0x21,CtrlReg3=0x22,CtrlReg4=0x23,CtrlReg5=0x24,Reference=0x25,OutTemp=0x26,StatusReg=0x27,OutXL=0x28,OutXH=0x29,OutYL=0x2A,OutYH=0x2B,OutZL=0x2C,OutZH=0x2D,FIFOCtrlReg=0x2E,FIFOSrcReg=0x2F,INT1Cfg=0x30,INT1Src=0x31,INT1ThsXH=0x32,INT1ThsXL=0x33,INT1ThsYH=0x34,INT1ThsYL=0x35,INT1ThsZH=0x36,INT1ThsZL=0x37,INT1Duration=0x38,READ=0x80
     } RESISTER;
@@ -53,7 +53,7 @@
     typedef enum {
         BYPASSmode=0x0,FIFOmode,STREAMmode,STREAMtoFIFOmode,BYPASStoSTREAMmode
     } FIFO_mode;
-    /** @enum FIFOstatus
+    /**
     *   FIFO status for cause of interruption\n
     *   Example...L3GD20::watermark\n
     *   See Datasheet 7.4_CTRL_REG3(p.33/44)
@@ -61,9 +61,12 @@
     typedef enum {
         none=0,empty,watermark,overrun
     } FIFOstatus;
-    struct tagFIFO {
-        FIFOstatus status;
-        int level;
+    /** 
+    *   @brief  FIFO status info
+    */
+    struct {
+        FIFOstatus status;///< Type of status is enum "FIFOstatus". cause of interruption(none,empty,watermark,overrun)
+        int level;        ///< FIFO buffer level
     } FIFO;
     struct config {
 //read and write resister
@@ -123,17 +126,18 @@
     */
     int readTemperature();
     /** @fn void L3GD20::enableFIFO(FIFO_mode mode,FIFOstatus interrupt,const int threshold)
-    *   @bref   L3GD20mode need to reset(to bypass mode) when filled FIFObuffor
+    *   @brief   L3GD20mode need to reset(to bypass mode) when filled FIFObuffor
     *   @param mode        FIFOmode(L3GD20::BYPASSmode,FIFOmode,STREAMmode,STREAMtoFIFOmode,BYPASStoSTREAMmode)
     *   @param interrupt   cause of interrupt(L3GD20::none,empty,watermark,overrun)
     *   @param threshold   interruption threshold(1 to 30 vaild)
     */
-    void enableFIFO(FIFO_mode mode,FIFOstatus interrupt,const int threshold=30);
+    void enableFIFO(FIFO_mode mode,FIFOstatus interrupt,const int threshold=0);
     /** @fn int L3GD20::updateFIFO(void)
-    *   @bref   Update FIFO status
+    *   @brief   Update FIFO status
     *   @return FIFO buffer level
     */
     int updateFIFO(void);
+    void allReadOut();
     anglerrates value;///< @brief latest angler rates
 protected:
     //write command to resister