New Version with OS5

Committer:
tgrosch
Date:
Sun Oct 25 00:58:24 2020 +0000
Revision:
0:62b846b3988a
Child:
3:0eb6a9927171
First successful compile.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tgrosch 0:62b846b3988a 1 /*
tgrosch 0:62b846b3988a 2 * i2cHandler.hpp
tgrosch 0:62b846b3988a 3 *
tgrosch 0:62b846b3988a 4 * Created on: Nov 19, 2017
tgrosch 0:62b846b3988a 5 * Author: a0875461
tgrosch 0:62b846b3988a 6 */
tgrosch 0:62b846b3988a 7
tgrosch 0:62b846b3988a 8
tgrosch 0:62b846b3988a 9
tgrosch 0:62b846b3988a 10 #ifndef I2CHANDLER_HPP_
tgrosch 0:62b846b3988a 11 #define I2CHANDLER_HPP_
tgrosch 0:62b846b3988a 12 //extern "C"
tgrosch 0:62b846b3988a 13 //{
tgrosch 0:62b846b3988a 14 //#include "hal.h"
tgrosch 0:62b846b3988a 15 //}
tgrosch 0:62b846b3988a 16 #include <stdio.h>
tgrosch 0:62b846b3988a 17 typedef unsigned char uint8_t;
tgrosch 0:62b846b3988a 18 typedef unsigned int uint32_t;
tgrosch 0:62b846b3988a 19 typedef unsigned short uint16_t;
tgrosch 0:62b846b3988a 20
tgrosch 0:62b846b3988a 21 namespace I2C {
tgrosch 0:62b846b3988a 22 class i2cHandler {
tgrosch 0:62b846b3988a 23 private:
tgrosch 0:62b846b3988a 24 uint8_t *dataTx;
tgrosch 0:62b846b3988a 25 uint8_t *dataRx;
tgrosch 0:62b846b3988a 26 uint8_t address;
tgrosch 0:62b846b3988a 27 bool write();
tgrosch 0:62b846b3988a 28 bool read();
tgrosch 0:62b846b3988a 29 public:
tgrosch 0:62b846b3988a 30 //USCI_B_I2C_initMasterParam i2cParam;
tgrosch 0:62b846b3988a 31 uint8_t slaveAddress;
tgrosch 0:62b846b3988a 32 void updateSlaveAddress();
tgrosch 0:62b846b3988a 33 uint8_t slaveAddress_;
tgrosch 0:62b846b3988a 34 uint8_t continousReadRegisterAddress;
tgrosch 0:62b846b3988a 35 uint8_t continousReadByteCount;
tgrosch 0:62b846b3988a 36 uint8_t regBankSize;
tgrosch 0:62b846b3988a 37 uint32_t timeOut;
tgrosch 0:62b846b3988a 38 bool write(uint8_t,uint8_t*);
tgrosch 0:62b846b3988a 39 bool write(uint8_t,uint32_t);
tgrosch 0:62b846b3988a 40 bool write(uint8_t*);
tgrosch 0:62b846b3988a 41 uint8_t* read(uint8_t);
tgrosch 0:62b846b3988a 42 bool read(uint8_t,uint8_t*);
tgrosch 0:62b846b3988a 43 bool read(uint8_t,uint32_t*);
tgrosch 0:62b846b3988a 44 bool read(uint8_t*);
tgrosch 0:62b846b3988a 45 bool continuousRead(uint8_t*);
tgrosch 0:62b846b3988a 46
tgrosch 0:62b846b3988a 47 void init(void);
tgrosch 0:62b846b3988a 48 i2cHandler(void);
tgrosch 0:62b846b3988a 49 ~i2cHandler(void);
tgrosch 0:62b846b3988a 50 };
tgrosch 0:62b846b3988a 51 }
tgrosch 0:62b846b3988a 52
tgrosch 0:62b846b3988a 53 #endif /* I2CHANDLER_HPP_ */
tgrosch 0:62b846b3988a 54