This are general defs and base class interfaces. ( DACInterface, I2CInterface) to be used with I2C devices

Dependents:   MCP23009tst AT30TSE752TST MCP4728setaddrProg mbedSerialInterface_talkback2 ... more

The DevInterfaces class is used for a more general support of a number of I2C devices.

For the moment this is MCP4728 Quad DAC.

The idea is to write a libs for the I2C devices (and perhaps later SPI , ... devices) not restricted to a certain hardware platform.

So there is the I2CInterface. This is a ( not pure) virtual class. A pointer to this class is used for the I2C device lib (like the MCP4728 class https://developer.mbed.org/users/wbeaumont/code/MCP4728/ ) to communicate with the I2C interface. The I2C interface is kept simple as possible. So it has to be applied for "tested environments". I2C Bus timeouts etc. are hard to debug with such a simple interface. This kind of interface is also not suitable for optimal performance. The user has to take care of issues of blocking devices, parallel processes etc. This can be dealt with in the implementation of the I2CInterface class

The aim of this project is to generate code for these devices on different platforms without doing the painstaking work of looking up all the register details.

There is an implementation of the I2CInterface for the MBED , tested with the FRDM-KL05Z platform. https://developer.mbed.org/users/wbeaumont/code/I2Cinterfaces/

A very simple application on a MBED can be found in https://developer.mbed.org/users/wbeaumont/code/MCP4728test/

Committer:
wbeaumont
Date:
Tue Sep 10 11:20:07 2019 +0000
Revision:
7:b091a268b726
Parent:
6:93106e899445
to make it compatible for other platforms see; https://github.com/wimbeaumont/peripheral_dev_tst; ( mbed os5  based)  but this still works for mbed os2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wbeaumont 6:93106e899445 1 #ifndef __ADCNTERFACE__
wbeaumont 6:93106e899445 2 #define __ADCINTERFACE__
wbeaumont 6:93106e899445 3
wbeaumont 6:93106e899445 4
wbeaumont 6:93106e899445 5 #define VERSION_ADCINTERFACE_HDR "0.10"
wbeaumont 6:93106e899445 6 #include "getVersion.h"
wbeaumont 6:93106e899445 7
wbeaumont 6:93106e899445 8 class ADCInterface: public virtual getVersion{
wbeaumont 6:93106e899445 9 private:
wbeaumont 6:93106e899445 10
wbeaumont 6:93106e899445 11
wbeaumont 6:93106e899445 12 public :
wbeaumont 6:93106e899445 13 ADCInterface():getVersion( VERSION_ADCINTERFACE_HDR ,VERSION_ADCINTERFACE_HDR , __TIME__, __DATE__){};
wbeaumont 6:93106e899445 14
wbeaumont 6:93106e899445 15 virtual int getADCvalue (int& dacvalue , int ch=0){return 0;};
wbeaumont 6:93106e899445 16 virtual int getVoltage (float& voltage, int ch=0){ return 0;};
wbeaumont 6:93106e899445 17 virtual int update() {return 0;}; // general update by example readout all registers in the device to the class storage.
wbeaumont 6:93106e899445 18
wbeaumont 6:93106e899445 19 virtual int startConversion(int ch=0){return 0;};
wbeaumont 6:93106e899445 20 virtual int statusConversion( int& status, int ch=0){status=1; return 0;};
wbeaumont 6:93106e899445 21 virtual int getFullRange( ){return 256;}
wbeaumont 6:93106e899445 22
wbeaumont 6:93106e899445 23 };
wbeaumont 6:93106e899445 24
wbeaumont 6:93106e899445 25 #endif