Matthias Hemmer / Mbed 2 deprecated PCF8563_RealTimeClock_MatthiasHemmer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers myi2c.h Source File

myi2c.h

00001 #ifndef MBED_PCF8563_H
00002 #define MBED_PCF8563_H
00003 
00004 #include "mbed.h"
00005 
00006 #define PCF8563_FREQ     400000  // bus speed 400 kHz
00007 
00008 class PCF8563
00009 {
00010 public:
00011     //define the i2c pins
00012     PCF8563(PinName sda, PinName scl);
00013     /**read from an I2C address
00014      *@para: the read address of the I2C device
00015      *@param: for only one i2c address of the device
00016      */
00017     uint8_t read(int i2c_r,int address);  //read class
00018     /**read from an I2C address
00019      * for two different parameters
00020      *@param: the write address of the I2C device
00021      *@param: the read address of the I2C device
00022      *@param: the register where you will read from
00023      */ 
00024     uint8_t read(int i2c_w, int i2c_r, int address);  //read class
00025     /**wirte from an I2C address
00026      *@param: the write address of the I2C device
00027      *@param: a register address of the I2C device
00028      *@param: set a value to this address of th I2C device
00029      */
00030     void write(int i2c_w, int address, int value);  //write class
00031     /**convert from Binary Coded Decimal to Decimal
00032      *@param: set a value which must be converted
00033      *returns a Decimal value
00034      */
00035     uint8_t bcdToDec(uint8_t val);  //convertation from bcd to dec
00036 
00037 private:
00038     I2C i2c;    //unsing the i2c library
00039 };
00040 #endif