Self test boot program for testing icarus sensors

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_UARTConsole by Bluetooth Low Energy

ADXL362Sensor.h

Committer:
smigielski
Date:
2015-01-27
Revision:
8:e9ae7a01d866
Child:
9:ed3636e1873f

File content as of revision 8:e9ae7a01d866:

#ifndef MBED_ADXL362_SENSOR_H
#define MBED_ADXL362_SENSOR_H
 
#include "mbed.h"

#include "BaseSensor.h"

// ACC Registers
#define DEVID_AD 0x00
#define DEVID_MST 0x01
#define PART_ID 0x02
#define REV_ID 0x03

//Three following addresses
#define DATA 0x08

#define STATUS 0x0b
#define FIFO_ENTRIES_L 0x0c
#define FIFO_ENTRIES_H 0x0d

//Six following address as L & H
#define DATA_12 0x0E

//Two following bytes
#define TEMP_12 0x14


#define SOFT_RESET 0x1f
#define THRESH_ACT_11 0x20
#define TIME_ACT 0x22
#define THRESH_INACT_11 0x20
#define TIME_INACT_16 0x22
#define ACT_INACT_CTL 0x27
#define FIFO_CONTROL 0x28
#define FIFO_SAMPLES 0x29
#define INTMAP1 0x2a
#define INTMAP2 0x2b
#define FILTER_CTL 0x2c
#define POWER_CTL 0x2d
#define SELF_TEST 0x2e
 
/**The ADXL362 command set is
• 0x0A: write register
• 0x0B: read register
• 0x0D: read FIFO
*/ 
#define WRITE_REGISTER 0x0a
#define READ_REGISTER 0x0b
#define READ_FIFO 0x0d
 
class ADXL362Sensor : public BaseSensor {
public:
//The recommended SPI clock speeds are 1 MHz to 5 MHz, with 12 pF maximum loading.
    ADXL362Sensor(SPI*,DigitalOut*);
    virtual char* getSimpleName();
    virtual void getSensorDetails(sensor_t*);
    //verify basic integrity of underlining hardware
    virtual int verifyIntegrity(int*);  
private:  
    SPI* spi; 
    DigitalOut* cs;
};
 
#endif