Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of L3GD20_SPI by
L3GD20 Class Reference
L3GD20(SPI) class. More...
#include <L3GD20.h>
Public Types | |
| enum | DIRECTION |
enable direction | |
| enum | FIFO_mode |
FIFO mode | |
| enum | FIFOstatus |
FIFO status for cause of interruption | |
Public Member Functions | |
| void | start (DIRECTION enable) |
| Start command send to module. | |
| void | start (DIRECTION enable, void(*func)(anglerrates *)) |
| Start with interrupt. | |
| void | stop () |
| stop sampling command send | |
| void | sleep () |
| sleep command send | |
| void | read (anglerrates *val, DIRECTION direction) |
| read angler rates with direction(L3GD20::XY) This is read and calcurate dps, reading value is set to class instanse | |
| int | readTemperature () |
| read temperature without format (I don't know meaning of value.) | |
| void | enableFIFO (FIFO_mode mode, FIFOstatus interrupt, const int threshold=0) |
| L3GD20mode need to reset(to bypass mode) when filled FIFObuffor. | |
| int | updateFIFO (void) |
| Update FIFO status. | |
Data Fields | |
| anglerrates | value |
| latest angler rates | |
| FIFOstatus | status |
| Type of status is enum "FIFOstatus". cause of interruption(none,empty,watermark,overrun) | |
| int | level |
| FIFO buffer level. | |
Detailed Description
L3GD20(SPI) class.
This is the L3GD20 class.
#include "mbed.h" #include "L3GD20.h" Serial pc(USBTX,USBRX);//tx,rx L3GD20 L3GD20(p11,p12,p13,p14,p15);//miso,mosi,sck,cs,interrupt void interruption(anglerrates *val) { printf("X:%+05d\tY:%+05d\tZ:%+05d level:%02d\r\n",(val->X),(val->Y),(val->Z),(L3GD20.FIFO.level)); } int main() { L3GD20.start(L3GD20::XYZ,&interruption); while(1) { sleep(); } }
Definition at line 28 of file L3GD20.h.
Member Enumeration Documentation
| enum DIRECTION |
| enum FIFO_mode |
| enum FIFOstatus |
Member Function Documentation
| void enableFIFO | ( | FIFO_mode | mode, |
| FIFOstatus | interrupt, | ||
| const int | threshold = 0 |
||
| ) |
L3GD20mode need to reset(to bypass mode) when filled FIFObuffor.
- Parameters:
-
mode FIFOmode(L3GD20::BYPASSmode,FIFOmode,STREAMmode,STREAMtoFIFOmode,BYPASStoSTREAMmode) interrupt cause of interrupt(L3GD20::none,empty,watermark,overrun) threshold interruption threshold(1 to 30 vaild)
Definition at line 118 of file L3GD20.cpp.
| void read | ( | anglerrates * | val, |
| DIRECTION | direction | ||
| ) |
read angler rates with direction(L3GD20::XY)
This is read and calcurate dps, reading value is set to class instanse
Definition at line 79 of file L3GD20.cpp.
| int readTemperature | ( | ) |
read temperature without format (I don't know meaning of value.)
Definition at line 113 of file L3GD20.cpp.
| void sleep | ( | ) |
sleep command send
Definition at line 69 of file L3GD20.cpp.
| void start | ( | DIRECTION | enable, |
| void(*)(anglerrates *) | func | ||
| ) |
Start with interrupt.
- Parameters:
-
enable L3GD20 channel func user function(call by InterrtptIn)
Definition at line 47 of file L3GD20.cpp.
| void start | ( | DIRECTION | enable ) |
| void stop | ( | ) |
stop sampling command send
Definition at line 64 of file L3GD20.cpp.
| int updateFIFO | ( | void | ) |
Field Documentation
Generated on Wed Jul 13 2022 09:18:54 by
1.7.2
