A collection of Analog Devices drivers for the mbed platform

For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all

Committer:
Suciu
Date:
Wed Mar 30 17:35:04 2016 +0300
Revision:
1:c1f0670bb370
Child:
3:1a8c14043a4e
Added CN0357-example project and related drivers

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Suciu 1:c1f0670bb370 1 /**
Suciu 1:c1f0670bb370 2 * @file AD7790.h
Suciu 1:c1f0670bb370 3 * @brief Header file for AD7790 ADC
Suciu 1:c1f0670bb370 4 * @version V0.1
Suciu 1:c1f0670bb370 5 * @author ADI
Suciu 1:c1f0670bb370 6 * @date March 2015
Suciu 1:c1f0670bb370 7 **/
Suciu 1:c1f0670bb370 8
Suciu 1:c1f0670bb370 9 #ifndef AD7790_H
Suciu 1:c1f0670bb370 10 #define AD7790_H
Suciu 1:c1f0670bb370 11
Suciu 1:c1f0670bb370 12 #include "mbed.h"
Suciu 1:c1f0670bb370 13
Suciu 1:c1f0670bb370 14 /**
Suciu 1:c1f0670bb370 15 * @brief Analog Devices AD7790 SPI 16-bit Buffered Sigma-Delta ADC
Suciu 1:c1f0670bb370 16 */
Suciu 1:c1f0670bb370 17 class AD7790
Suciu 1:c1f0670bb370 18 {
Suciu 1:c1f0670bb370 19 public:
Suciu 1:c1f0670bb370 20 /// AD7790 registers
Suciu 1:c1f0670bb370 21 typedef enum {
Suciu 1:c1f0670bb370 22 COMMUNICATION_REG = 0, ///< Communication register
Suciu 1:c1f0670bb370 23 STATUS_REG = 0, ///< Status register
Suciu 1:c1f0670bb370 24 MODE_REG, ///< Mode register
Suciu 1:c1f0670bb370 25 FILTER_REG, ///< Filter Register
Suciu 1:c1f0670bb370 26 DATA_REG ///< Data register
Suciu 1:c1f0670bb370 27 } AD7790Registers_t;
Suciu 1:c1f0670bb370 28
Suciu 1:c1f0670bb370 29 /// AD7790 channel configuration
Suciu 1:c1f0670bb370 30 typedef enum {
Suciu 1:c1f0670bb370 31 DIFFERENTIAL, ///< AIN(+)-AIN(-)
Suciu 1:c1f0670bb370 32 RESERVED, ///< reserved
Suciu 1:c1f0670bb370 33 SHORT, ///< AIN(-)-AIN(-)
Suciu 1:c1f0670bb370 34 VDDMONITOR ///< Monitor VDD
Suciu 1:c1f0670bb370 35 } AD7790Channel_t;
Suciu 1:c1f0670bb370 36
Suciu 1:c1f0670bb370 37 AD7790(PinName CS=SPI_CS, PinName MOSI=SPI_MOSI,PinName MISO=SPI_MISO,PinName SCK=SPI_SCK);
Suciu 1:c1f0670bb370 38 void frequency(int hz);
Suciu 1:c1f0670bb370 39 void reset(void);
Suciu 1:c1f0670bb370 40 void write_reg(AD7790Registers_t regAddress, uint8_t regValue);
Suciu 1:c1f0670bb370 41 uint16_t write_spi(uint16_t data);
Suciu 1:c1f0670bb370 42 uint16_t read_reg (AD7790Registers_t regAddress);
Suciu 1:c1f0670bb370 43 uint16_t read_data(void);
Suciu 1:c1f0670bb370 44
Suciu 1:c1f0670bb370 45 SPI ad7790; ///< SPI instance of the AD7790
Suciu 1:c1f0670bb370 46 DigitalOut cs; ///< DigitalOut instance for the chipselect of the AD7790
Suciu 1:c1f0670bb370 47
Suciu 1:c1f0670bb370 48 private:
Suciu 1:c1f0670bb370 49
Suciu 1:c1f0670bb370 50 const static int _RESET = 0xFF;
Suciu 1:c1f0670bb370 51 const static int _DUMMY_BYTE = 0xAA;
Suciu 1:c1f0670bb370 52 const static int _READ_FLAG = 0x0800;
Suciu 1:c1f0670bb370 53 const static int _DATA_READ = 0x38; // Read from the Data Register
Suciu 1:c1f0670bb370 54 };
Suciu 1:c1f0670bb370 55
Suciu 1:c1f0670bb370 56 #endif