Ted Grosch
/
Nucleo_TOF_I2C
Export to MBED Studio
Revision 1:8567a29d4699, committed 2020-10-25
- Comitter:
- tgrosch
- Date:
- Sun Oct 25 01:51:13 2020 +0000
- Parent:
- 0:62b846b3988a
- Commit message:
- Transfer to MBED Studio
Changed in this revision
diff -r 62b846b3988a -r 8567a29d4699 hostController.cpp --- a/hostController.cpp Sun Oct 25 00:58:24 2020 +0000 +++ b/hostController.cpp Sun Oct 25 01:51:13 2020 +0000 @@ -242,7 +242,7 @@ } -void hostController::printf(const char *fmt, ...){ +void hostController::printf(const char *fmt, ...){ //TODO use the Serial pc(SERIAL_TX, SERIAL_RX) here #ifdef VERBOSE_MODE va_list args; va_start(args, fmt);
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
diff -r 62b846b3988a -r 8567a29d4699 main.cpp --- a/main.cpp Sun Oct 25 00:58:24 2020 +0000 +++ b/main.cpp Sun Oct 25 01:51:13 2020 +0000 @@ -3,7 +3,7 @@ // Read temperature from LM75BD I2C i2c(D14, D15); -Serial pc(SERIAL_TX, SERIAL_RX); +Serial pc(SERIAL_TX, SERIAL_RX); //TODo fice this pc host iissue #include "OPT3101device.h"