projects/C7C.Atamo.Dusty.Mote_0_0_2/C7C.Atamo.Dusty.Mote/main/sample/sensor.cpp
//TODO: move to separate file - one each for each sensor driver/type
move to separate file - one each for each sensor driver/type
move to separate file - one each for each sensor driver / type
uint8_t sensor_drive_accel_magno(uint8_t sensor_addr, uint16_t *buf)
{
    if (sizeof(buf) < 6) {
        return FAILURE;
    }
    AccelMagno sensor_AccMag(sensor_addr);
    sensor_AccMag.begin();
    sensor_AccMag.lowPowerMode(false);
    sensor_AccMag.setAccelFullScale(ACCEL_2G);
    sensor_AccMag.setMagnoFullScale(MAGNO_2GAUSS);
    sensor_AccMag.enableAccel();
    sensor_AccMag.enableMagno();
    buf[0] = static_cast<uint16_t>(sensor_AccMag.accelX());
    buf[1] = static_cast<uint16_t>(sensor_AccMag.accelY());
    buf[2] = static_cast<uint16_t>(sensor_AccMag.accelZ());
    buf[3] = static_cast<uint16_t>(sensor_AccMag.magnoX());
    buf[4] = static_cast<uint16_t>(sensor_AccMag.magnoY());
    buf[5] = static_cast<uint16_t>(sensor_AccMag.magnoZ());
    sensor_AccMag.lowPowerMode(true);
    return SUCCESS;
}
uint8_t sensor_drive_accel_magno ( uint8_t sensor_addr , uint16_t * buf ) { if ( sizeof ( buf ) < 6 ) { return FAILURE ; } AccelMagno sensor_AccMag ( sensor_addr ) ; sensor_AccMag . begin ( ) ; sensor_AccMag . lowPowerMode ( false ) ; sensor_AccMag . setAccelFullScale ( ACCEL_2G ) ; sensor_AccMag . setMagnoFullScale ( MAGNO_2GAUSS ) ; sensor_AccMag . enableAccel ( ) ; sensor_AccMag . enableMagno ( ) ; buf [ 0 ] = static_cast < uint16_t > ( sensor_AccMag . accelX ( ) ) ; buf [ 1 ] = static_cast < uint16_t > ( sensor_AccMag . accelY ( ) ) ; buf [ 2 ] = static_cast < uint16_t > ( sensor_AccMag . accelZ ( ) ) ; buf [ 3 ] = static_cast < uint16_t > ( sensor_AccMag . magnoX ( ) ) ; buf [ 4 ] = static_cast < uint16_t > ( sensor_AccMag . magnoY ( ) ) ; buf [ 5 ] = static_cast < uint16_t > ( sensor_AccMag . magnoZ ( ) ) ; sensor_AccMag . lowPowerMode ( true ) ; return SUCCESS ; }
TODO: move to separate file - one each for each sensor driver/type
TODO : move to separate file - one each for each sensor driver / type
/*Check if the buffer is large enough*/ /*Initiate connection to Accel/Magno sensor and exit low power mode*/ /*Set and enable accelerometer and magnetometer at full scales*/ //TODO: ask client if it is desirable to be able operate in different modes? e.g. accel but not not mag /*Acquire sensor data*/ /*Put sensor into low power mode*/