lib para o framework sgam
Dependencies: MPU6050 Grove_temperature
Dependents: example_smart-grid
peripheral/impl/Gyroscope.cpp
- Committer:
- AndersonIctus
- Date:
- 2019-06-02
- Revision:
- 3:f998244e9f80
- Child:
- 4:f21aab30658a
File content as of revision 3:f998244e9f80:
#include "mbed.h" #include "MPU6050.h" #include "Gyroscope.h" #define LOG(args...) // printf(args) Gyroscope::Gyroscope(I2C i2c): mpu(i2c, MPU6050_ADDRESS_AD0_LOW) { mpu.initialize(); if(mpu.testConnection()) { LOG("MPU6050 test passed !!\r\n"); } else { LOG("MPU6050 test failed !!\r\n"); } } Gyroscope::~Gyroscope() { // mpu. } void Gyroscope::getMotion(GyroscopeData* data) { mpu.getMotion6( &data->ax, &data->ay, &data->az, &data->gx, &data->gy, &data->gz ); } GyroscopeData* Gyroscope::getValue() { getMotion(&value); return &value; } void Gyroscope::readOcurred(void* (*callBack)(GyroscopeData* value), float timeout) { if(callBack != NULL) callBack(&value); }