![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
New Version with OS5
Diff: i2cHandler.cpp
- Revision:
- 3:0eb6a9927171
- Parent:
- 1:8567a29d4699
diff -r f30187bb3fbd -r 0eb6a9927171 i2cHandler.cpp --- a/i2cHandler.cpp Sun Oct 25 10:16:43 2020 +0000 +++ b/i2cHandler.cpp Sun Oct 25 10:45:04 2020 +0000 @@ -10,7 +10,7 @@ #include "hostController.h" #define OPT3101_I2C_SLAVEADDRESS 0x50 // TODO fix this slave address -I2C::i2cHandler::i2cHandler(void){ +I2C_A::i2cHandler::i2cHandler(void){ //#ifdef TIMSP430F5529_LAUNCHPAD_CALIBRATION_TOOL this->slaveAddress=OPT3101_I2C_SLAVEADDRESS; //#endif @@ -21,12 +21,12 @@ this->continousReadRegisterAddress=0x08; } -I2C::i2cHandler::~i2cHandler(void){ +I2C_A::i2cHandler::~i2cHandler(void){ delete [] this->dataRx; this->dataRx=NULL; } -void I2C::i2cHandler::init(void){ +void I2C_A::i2cHandler::init(void){ //TODO do platform initialization here // no reason to initalize mbed I2C // this->i2cParam.selectClockSource = USCI_B_I2C_CLOCKSOURCE_SMCLK; // Clecting the SMCLK For the I2C Clocks. @@ -46,14 +46,14 @@ } -void I2C::i2cHandler::updateSlaveAddress(){ +void I2C_A::i2cHandler::updateSlaveAddress(){ if(this->slaveAddress_!=this->slaveAddress){ this->slaveAddress_=this->slaveAddress; // USCI_B_I2C_setSlaveAddress(USCI_B1_BASE,this->slaveAddress); } } -bool I2C::i2cHandler::write(){ +bool I2C_A::i2cHandler::write(){ static uint32_t cnt; static uint8_t c; static bool state; @@ -81,25 +81,25 @@ } -bool I2C::i2cHandler::write(uint8_t address,uint8_t *data){ +bool I2C_A::i2cHandler::write(uint8_t address,uint8_t *data){ this->address=address; this->dataTx=data; return this->write(); } /* This is overloaded function of i2C Write. This makes the register interface simple */ -bool I2C::i2cHandler::write(uint8_t address,uint32_t data){ +bool I2C_A::i2cHandler::write(uint8_t address,uint32_t data){ this->address=address; this->dataTx=(uint8_t*) &data; return this->write(); } /* This is overloaded function of i2C Write. This makes the register interface simple */ -bool I2C::i2cHandler::write(uint8_t *data){ +bool I2C_A::i2cHandler::write(uint8_t *data){ this->address=data[0]; this->dataTx=&data[1]; return this->write(); } -bool I2C::i2cHandler::read(){ +bool I2C_A::i2cHandler::read(){ static bool state; static uint8_t c; static uint32_t cnt; @@ -127,7 +127,7 @@ return state; } -bool I2C::i2cHandler::continuousRead(uint8_t *data){ +bool I2C_A::i2cHandler::continuousRead(uint8_t *data){ static bool state; static uint8_t c; @@ -150,13 +150,13 @@ -uint8_t* I2C::i2cHandler::read(uint8_t address){ +uint8_t* I2C_A::i2cHandler::read(uint8_t address){ this->dataRx[0]=address; this->read(); return &this->dataRx[1]; } -bool I2C::i2cHandler::read(uint8_t address,uint8_t *data){ +bool I2C_A::i2cHandler::read(uint8_t address,uint8_t *data){ static bool state; static uint8_t c; @@ -167,7 +167,7 @@ return state; } -bool I2C::i2cHandler::read(uint8_t *data){ +bool I2C_A::i2cHandler::read(uint8_t *data){ static bool state; static uint8_t c; state=true; @@ -178,7 +178,7 @@ return state; } -bool I2C::i2cHandler::read(uint8_t address,uint32_t *data){ +bool I2C_A::i2cHandler::read(uint8_t address,uint32_t *data){ static bool state; static uint8_t c; static uint32_t addon;