From 335c32c540a5219eac26f3e767d6a33ca462f332 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 15 Nov 2020 17:51:10 +0000 Subject: [PATCH] I2C support is write only. --- SerialPort.cpp | 40 +--------------------------------------- SerialPort.h | 6 ------ Version.h | 2 +- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index 72608ba..9898584 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -135,9 +135,7 @@ m_debug(false), m_serialData(), m_lastSerialAvail(0), m_lastSerialAvailCount(0U), -m_i2CData(), -m_lastI2CAvail(0), -m_lastI2CAvailCount(0U) +m_i2CData() { } @@ -956,23 +954,6 @@ void CSerialPort::process() writeInt(10U, &c, 1U); } } - - // Read any incoming serial data, and send out in batches - int i2CAvail = availableForReadInt(10U); - if ((i2CAvail > 0 && i2CAvail == m_lastI2CAvail && m_lastI2CAvailCount >= MAX_SERIAL_COUNT) || (i2CAvail >= MAX_SERIAL_DATA)) { - uint8_t buffer[MAX_SERIAL_DATA]; - for (int i = 0; i < i2CAvail && i < MAX_SERIAL_DATA; i++) { - buffer[i] = readInt(10U); - m_lastI2CAvail--; - } - writeI2CData(buffer, i2CAvail - m_lastI2CAvail); - m_lastI2CAvailCount = 0U; - } else if (i2CAvail > 0U && i2CAvail == m_lastI2CAvail) { - m_lastI2CAvailCount++; - } else { - m_lastI2CAvail = i2CAvail; - m_lastI2CAvailCount = 0U; - } #endif } @@ -1803,25 +1784,6 @@ void CSerialPort::writeSerialData(const uint8_t* data, uint8_t length) } #endif -#if defined(I2C_REPEATER) -void CSerialPort::writeI2CData(const uint8_t* data, uint8_t length) -{ - uint8_t reply[255U]; - - reply[0U] = MMDVM_FRAME_START; - reply[1U] = 0U; - reply[2U] = MMDVM_I2C_DATA; - - uint8_t count = 3U; - for (uint8_t i = 0U; i < length; i++, count++) - reply[count] = data[i]; - - reply[1U] = count; - - writeInt(1U, reply, count); -} -#endif - void CSerialPort::writeCalData(const uint8_t* data, uint8_t length) { if (m_modemState != STATE_DSTARCAL) diff --git a/SerialPort.h b/SerialPort.h index d4845b4..d173c2c 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -83,10 +83,6 @@ public: void writeSerialData(const uint8_t* data, uint8_t length); #endif -#if defined(I2C_REPEATER) - void writeI2CData(const uint8_t* data, uint8_t length); -#endif - void writeCalData(const uint8_t* data, uint8_t length); void writeRSSIData(const uint8_t* data, uint8_t length); @@ -105,8 +101,6 @@ private: int m_lastSerialAvail; uint16_t m_lastSerialAvailCount; CRingBuffer m_i2CData; - int m_lastI2CAvail; - uint16_t m_lastI2CAvailCount; void sendACK(); void sendNAK(uint8_t err); diff --git a/Version.h b/Version.h index e5129d5..137d42b 100644 --- a/Version.h +++ b/Version.h @@ -19,7 +19,7 @@ #if !defined(VERSION_H) #define VERSION_H -#define VERSION "20201110" +#define VERSION "20201115" #endif