Ted Grosch
/
Nucleo_TOF_I2C_DISCO
Export to MBED Studio for DISCO Board
Diff: i2cHandler.cpp
- Revision:
- 1:8567a29d4699
- Parent:
- 0:62b846b3988a
diff -r 62b846b3988a -r 8567a29d4699 i2cHandler.cpp --- a/i2cHandler.cpp Sun Oct 25 00:58:24 2020 +0000 +++ b/i2cHandler.cpp Sun Oct 25 01:51:13 2020 +0000 @@ -27,6 +27,7 @@ } void I2C::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. // this->i2cParam.i2cClk = UCS_getSMCLK(); @@ -59,6 +60,7 @@ this->updateSlaveAddress(); state=true; + //TODO this is the I2C write // USCI_B_I2C_setMode(USCI_B1_BASE,USCI_B_I2C_TRANSMIT_MODE); // cnt=this->timeOut; @@ -75,7 +77,7 @@ // state&=USCI_B_I2C_masterSendMultiByteStopWithTimeout(USCI_B1_BASE,this->timeOut); // Function returns 1 for success // while (USCI_B_I2C_masterIsStopSent(USCI_B1_BASE)); // USCI_B_I2C_setMode(USCI_B1_BASE,USCI_B_I2C_TRANSMIT_MODE); -// return state; + return state; } @@ -103,6 +105,7 @@ static uint32_t cnt; this->updateSlaveAddress(); state=true; + //TODO put in the I2C read // cnt=this->timeOut; // while((USCI_B_I2C_isBusBusy(USCI_B1_BASE)) & cnt--); // if(!cnt) @@ -129,6 +132,7 @@ static uint8_t c; state=true; + //TODO Put is the continiuos read of continouseReadByteCount bytes here // if(USCI_B_I2C_isBusBusy(USCI_B1_BASE)) // return false; // state&=USCI_B_I2C_masterSendSingleByteWithTimeout(USCI_B1_BASE,this->continousReadRegisterAddress,this->timeOut); // Function returns 1 for success