key lock and rear light
Dependencies: BLE_API BMA250E mbed nRF51822
MtConnect04S Bike Proximity Lock
We have full tutorial, please visit our blog
Diff: BMA250/BMA250.h
- Revision:
- 0:3eeefb743ce3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BMA250/BMA250.h Wed Nov 23 05:49:30 2016 +0000 @@ -0,0 +1,37 @@ +#ifndef BMA250_h +#define BMA250_h + +#include "mbed.h" + + +#define BMA250_SLAVE_ADDR 0x30 + + +class BMA250 { +public: + BMA250(PinName sda, PinName scl, PinName int1 = NC, PinName int2 = NC); + + void ReadXYZ(int16_t *xyz); + + void NewData (void(*fptr)(void), int int_n); + void AnyMotion (void(*fptr)(void), int int_n); + void TapSening (void(*fptr)(void), int int_n, bool double_tap); + void OrientationRecognition (void(*fptr)(void), int int_n); + void FlatDetection (void(*fptr)(void), int int_n); + void LowHighGDetection (void(*fptr)(void), int int_n, bool high_g); + void ShakeDetection (void(*fptr)(void), int int_n); + + void EnterStandbyMode(void); + void LeaveStandbyMode(void); + +private: + I2C _i2c; + InterruptIn _int1; + InterruptIn _int2; + + void RegWrite(char reg, char val); + void RegRead (char reg, char *val, int len); + void RegReadModifyWrite(char reg, char clr_mask, char set_mask); +}; + +#endif