Ted Grosch / Mbed 2 deprecated Nucleo_TOF_I2C

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers i2cHandler.h Source File

i2cHandler.h

00001 /*
00002  * i2cHandler.hpp
00003  *
00004  *  Created on: Nov 19, 2017
00005  *      Author: a0875461
00006  */
00007 
00008 
00009 
00010 #ifndef I2CHANDLER_HPP_
00011 #define I2CHANDLER_HPP_
00012 //extern "C"
00013 //{
00014 //#include "hal.h"
00015 //}
00016 #include <stdio.h>
00017 typedef unsigned char uint8_t;
00018 typedef unsigned int uint32_t;
00019 typedef unsigned short uint16_t;
00020 
00021 namespace I2C {
00022     class i2cHandler {
00023         private:
00024             uint8_t *dataTx;
00025             uint8_t *dataRx;
00026             uint8_t address;
00027             bool write();
00028             bool read();
00029         public:
00030             //USCI_B_I2C_initMasterParam i2cParam;
00031             uint8_t slaveAddress;
00032             void updateSlaveAddress();
00033             uint8_t slaveAddress_;
00034             uint8_t continousReadRegisterAddress;
00035             uint8_t continousReadByteCount;
00036             uint8_t regBankSize;
00037             uint32_t timeOut;
00038             bool write(uint8_t,uint8_t*);
00039             bool write(uint8_t,uint32_t);
00040             bool write(uint8_t*);
00041             uint8_t* read(uint8_t);
00042             bool read(uint8_t,uint8_t*);
00043             bool read(uint8_t,uint32_t*);
00044             bool read(uint8_t*);
00045             bool continuousRead(uint8_t*);
00046 
00047             void init(void);
00048             i2cHandler(void);
00049             ~i2cHandler(void);
00050     };
00051 }
00052 
00053 #endif /* I2CHANDLER_HPP_ */
00054