Most of the I2C work completed, now need to review the low-level I2C code.

This commit is contained in:
Jonathan Naylor
2020-11-23 14:24:14 +00:00
parent 112a136060
commit 6c8cf7a838
10 changed files with 133 additions and 16 deletions
+7 -7
View File
@@ -21,6 +21,7 @@
#if defined(MODE_OLED)
#include "I2COLED.h"
#include "I2CPort.h"
#include "Globals.h"
@@ -304,7 +305,6 @@ const uint8_t FONT[] = {
CI2COLED::CI2COLED() :
m_i2c(3U),
m_oledBuffer(NULL)
{
m_oledBuffer = new uint8_t[OLED_BUFFER_SIZE];
@@ -314,7 +314,7 @@ m_oledBuffer(NULL)
bool CI2COLED::init()
{
bool ret = m_i2c.init();
bool ret = i2C3.init();
if (!ret)
return false;
@@ -409,7 +409,7 @@ void CI2COLED::sendCommand(uint8_t c0, uint8_t c1, uint8_t c2)
buff[4U] = c2;
// Write Data on I2C
m_i2c.write(buff, 5U);
i2C3.write(buff, 5U);
}
void CI2COLED::sendCommand(uint8_t c0, uint8_t c1)
@@ -422,7 +422,7 @@ void CI2COLED::sendCommand(uint8_t c0, uint8_t c1)
buff[3U] = c1;
// Write Data on I2C
m_i2c.write(buff, 4U);
i2C3.write(buff, 4U);
}
void CI2COLED::sendCommand(uint8_t c)
@@ -434,7 +434,7 @@ void CI2COLED::sendCommand(uint8_t c)
buff[2U] = c;
// Write Data on I2C
m_i2c.write(buff, 3U);
i2C3.write(buff, 3U);
}
void CI2COLED::sendData(const uint8_t* data, uint16_t length)
@@ -445,8 +445,8 @@ void CI2COLED::sendData(const uint8_t* data, uint16_t length)
buff[1U] = SSD_Data_Mode;
// Write Data on I2C
m_i2c.write(buff, 2U);
m_i2c.write(data, length);
i2C3.write(buff, 2U);
i2C3.write(data, length);
}
void CI2COLED::clear()