diff --git a/Globals.h b/Globals.h index 07e6123..d5c637c 100644 --- a/Globals.h +++ b/Globals.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,12 +100,12 @@ enum MMDVM_STATE { #include "CalNXDN.h" #include "CalPOCSAG.h" #include "CalRSSI.h" -#include "I2CPort.h" #include "I2COLED.h" #include "CWIdTX.h" #include "AX25RX.h" #include "AX25TX.h" #include "Debug.h" +#include "I2C3.h" #include "IO.h" #include "FM.h" diff --git a/I2CPort.cpp b/I2C3.cpp similarity index 94% rename from I2CPort.cpp rename to I2C3.cpp index fde3215..397c834 100644 --- a/I2CPort.cpp +++ b/I2C3.cpp @@ -20,17 +20,17 @@ #if defined(MODE_OLED) -#include "I2CPort.h" +#include "I2C3.h" #include "Globals.h" const uint16_t MAX_NBYTES_SIZE = 255U; -CI2CPort::CI2CPort() +CI2C3::CI2C3() { } -bool CI2CPort::init() +bool CI2C3::init() { // Enable I2C3 RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C3, ENABLE); @@ -77,7 +77,7 @@ bool CI2CPort::init() return true; } -uint8_t CI2CPort::write(uint8_t addr, const uint8_t* data, uint16_t length) +uint8_t CI2C3::write(uint8_t addr, const uint8_t* data, uint16_t length) { // Wait for the I2C transmitter to become free if (waitISRFlagsSet(I2C_ISR_BUSY)) @@ -122,7 +122,7 @@ uint8_t CI2CPort::write(uint8_t addr, const uint8_t* data, uint16_t length) return 0U; } -bool CI2CPort::waitISRFlagsSet(uint32_t flags) +bool CI2C3::waitISRFlagsSet(uint32_t flags) { // Wait till the specified ISR Bits are set // More than 1 Flag can be "or"ed. @@ -136,7 +136,7 @@ bool CI2CPort::waitISRFlagsSet(uint32_t flags) return true; } -void CI2CPort::configureDataTransfer(uint8_t size) +void CI2C3::configureDataTransfer(uint8_t size) { I2C3->CR2 &= ~(I2C_CR2_SADD | I2C_CR2_NBYTES | diff --git a/I2CPort.h b/I2C3.h similarity index 93% rename from I2CPort.h rename to I2C3.h index 2096999..b9e84fa 100644 --- a/I2CPort.h +++ b/I2C3.h @@ -20,8 +20,8 @@ #if defined(MODE_OLED) -#if !defined(I2CPORT_H) -#define I2CPORT_H +#if !defined(I2C3_H) +#define I2C3_H #if defined(STM32F7XX) #include "stm32f7xx.h" @@ -29,9 +29,9 @@ #endif -class CI2CPort { +class CI2C3 { public: - CI2CPort(); + CI2C3(); bool init(); diff --git a/I2COLED.cpp b/I2COLED.cpp index 93a1960..bc4ef34 100644 --- a/I2COLED.cpp +++ b/I2COLED.cpp @@ -21,7 +21,7 @@ #if defined(MODE_OLED) #include "I2COLED.h" -#include "I2CPort.h" +#include "I2C3.h" #include "Globals.h" diff --git a/I2COLED.h b/I2COLED.h index e196a68..21795c7 100644 --- a/I2COLED.h +++ b/I2COLED.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 by Jonathan Naylor G4KLX + * Copyright (C) 2020,2021 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ #if !defined(I2COLED_H) #define I2COLED_H -#include "I2CPort.h" +#include "I2C3.h" class CI2COLED { public: @@ -34,7 +34,7 @@ public: void setMode(int state); private: - CI2CPort m_i2c; + CI2C3 m_i2c; uint8_t* m_oledBuffer; void write(const char* text); diff --git a/MMDVM.ino b/MMDVM.ino index cd63b42..64f9f9d 100644 --- a/MMDVM.ino +++ b/MMDVM.ino @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML * * This program is free software; you can redistribute it and/or modify @@ -42,10 +42,6 @@ bool m_dcd = false; CI2COLED oled; #endif -#if defined(I2C_REPEATER) -CI2CPort i2C1(1U); -#endif - #if defined(MODE_DSTAR) CDStarRX dstarRX; CDStarTX dstarTX;