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:
4:8cbf46e5e3e5
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 0:da1fb7dd363f 1 #ifndef GETVERSION_H
wbeaumont 0:da1fb7dd363f 2 #define GETVERSION_H
wbeaumont 0:da1fb7dd363f 3
wbeaumont 0:da1fb7dd363f 4 /* getVersion class
wbeaumont 0:da1fb7dd363f 5 * to get version number ( compile date etc) of a module
wbeaumont 0:da1fb7dd363f 6 * to be used to verify module version used by a main program
wbeaumont 0:da1fb7dd363f 7 * can be used as inheritance class
wbeaumont 0:da1fb7dd363f 8 * written for the SOLID SM1 control module firmware
wbeaumont 0:da1fb7dd363f 9 *
wbeaumont 0:da1fb7dd363f 10 * author Wim.Beaumont@Uantwerpen.be
wbeaumont 0:da1fb7dd363f 11 * (C) Universiteit Antwerpen 5 October 2014
wbeaumont 0:da1fb7dd363f 12 *
wbeaumont 0:da1fb7dd363f 13 * version history
wbeaumont 0:da1fb7dd363f 14 * v 0.10 intial development vesion
wbeaumont 4:8cbf46e5e3e5 15 * v 0.30 added dev_interface version
wbeaumont 0:da1fb7dd363f 16 *
wbeaumont 0:da1fb7dd363f 17 */
wbeaumont 0:da1fb7dd363f 18
wbeaumont 4:8cbf46e5e3e5 19 #define GETVERSION_HDR_VER "0.30"
wbeaumont 0:da1fb7dd363f 20
wbeaumont 0:da1fb7dd363f 21
wbeaumont 0:da1fb7dd363f 22
wbeaumont 0:da1fb7dd363f 23 class getVersion {
wbeaumont 0:da1fb7dd363f 24
wbeaumont 0:da1fb7dd363f 25 const char* hver;
wbeaumont 0:da1fb7dd363f 26 const char* sver;
wbeaumont 0:da1fb7dd363f 27 const char* ctime;
wbeaumont 0:da1fb7dd363f 28 const char* cdate;
wbeaumont 2:58f1d5a3f850 29 char infostr[100]; // 100 is not precise nr.
wbeaumont 0:da1fb7dd363f 30
wbeaumont 0:da1fb7dd363f 31 public:
wbeaumont 2:58f1d5a3f850 32 getVersion(const char* ver_h,const char* ver_s=0, const char* time=0,const char* date=0) ;
wbeaumont 2:58f1d5a3f850 33 getVersion();
wbeaumont 0:da1fb7dd363f 34
wbeaumont 0:da1fb7dd363f 35 // returns the version number of hdr of the module in hex code
wbeaumont 0:da1fb7dd363f 36 unsigned short getHdrVersion();
wbeaumont 0:da1fb7dd363f 37 // returns the version number of the src of the module in hex code
wbeaumont 0:da1fb7dd363f 38 unsigned short getSrcVersion();
wbeaumont 0:da1fb7dd363f 39 // returns the compile time using __TIME__ in hex code 0xHHMM ver 0.1 returns always 0
wbeaumont 0:da1fb7dd363f 40 unsigned short getCompileTime();
wbeaumont 0:da1fb7dd363f 41 // returns the compile date using __DATE__ 0xMMDD ver 0.1 returns always 0
wbeaumont 0:da1fb7dd363f 42 unsigned short getCompileDate();
wbeaumont 0:da1fb7dd363f 43 // returns the compile year using __DATE__ 2014 0x140C ver 0.1 returns always 0
wbeaumont 0:da1fb7dd363f 44 unsigned short getCompileYear();
wbeaumont 0:da1fb7dd363f 45 // takes a version nr of the type "2.32" and convert it to a hex nr 0x0220 ( 0x20== 33 dec)
wbeaumont 0:da1fb7dd363f 46 void get_dec_version( unsigned short hexversion , unsigned char & version, unsigned char& subversion);
wbeaumont 0:da1fb7dd363f 47 // translate "2.32" to 0x0222
wbeaumont 0:da1fb7dd363f 48 unsigned short get_hex_version_nr(const char * vers);
wbeaumont 2:58f1d5a3f850 49 // give a string with the HDR and SRC version
wbeaumont 2:58f1d5a3f850 50 char* getversioninfo();
wbeaumont 4:8cbf46e5e3e5 51 // result in a string with the version of the dev_interface_def
wbeaumont 4:8cbf46e5e3e5 52 // @resultstring : pointer to a cstring of at least 50 chars
wbeaumont 4:8cbf46e5e3e5 53 void dev_interface_def_version( char* resultstring);
wbeaumont 0:da1fb7dd363f 54 };
wbeaumont 0:da1fb7dd363f 55
wbeaumont 0:da1fb7dd363f 56
wbeaumont 0:da1fb7dd363f 57 #endif