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/

DevErrorReporter.h

Committer:
wbeaumont
Date:
2019-09-10
Revision:
7:b091a268b726

File content as of revision 7:b091a268b726:

#ifndef __DEVERRORREPORTER__
#define __DEVERRORREPORTER__

//#include "getVersion.h"

#define DEVERRORREPORTER_HDR_VER "2.00"


/*
 *  This is a the Error reporter it stores the last errors etc.  
 *  No getVersion support for the moment. 
 *  This file make part of the PeriperalDevice package see repository  
 *  https://github.com/wimbeaumont/PeripheralDevices
 *  For more info see   the README.md in the top of repository 
 *
 *  ver  0:10  initial 
 *  ver  0.20  needed static before const
 *  ver  0.30  device error int 
 * (C) Wim Beaumont Universiteit Antwerpen 2019
 *
 * License see
 * https://github.com/wimbeaumont/PeripheralDevices/blob/master/LICENSE
*/ 


class DevErrorReporter {

protected :
     static const int notsupportederrno = -1999;    
     bool   ack; // last ack status 
     bool   notsupported;
     int    comerr; // reported Deverr 
     bool   devinit; //  if the device is initialized 
     bool setnotsupported(void) { comerr=notsupportederrno; notsupported=true;return comerr;}
     int  deverr;
     DevErrorReporter(void){
      ack=false;comerr=0; devinit=false; notsupported=false;    
     }  
public:

// status info 
virtual bool getLastAckStatus(void) { return ack; }
virtual bool getDeviceInitStatus(void) { return devinit; }
virtual int getLastComError(void) {return comerr;}
virtual bool getNotSupported(void) {return notsupported;}
virtual int getDeviceError(void) { return deverr; }


};
#endif