mirror of https://github.com/g4klx/MMDVM.git
Rename the I2 port class.
This commit is contained in:
parent
c83879d89d
commit
4aa30664b9
|
@ -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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -100,12 +100,12 @@ enum MMDVM_STATE {
|
||||||
#include "CalNXDN.h"
|
#include "CalNXDN.h"
|
||||||
#include "CalPOCSAG.h"
|
#include "CalPOCSAG.h"
|
||||||
#include "CalRSSI.h"
|
#include "CalRSSI.h"
|
||||||
#include "I2CPort.h"
|
|
||||||
#include "I2COLED.h"
|
#include "I2COLED.h"
|
||||||
#include "CWIdTX.h"
|
#include "CWIdTX.h"
|
||||||
#include "AX25RX.h"
|
#include "AX25RX.h"
|
||||||
#include "AX25TX.h"
|
#include "AX25TX.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
|
#include "I2C3.h"
|
||||||
#include "IO.h"
|
#include "IO.h"
|
||||||
#include "FM.h"
|
#include "FM.h"
|
||||||
|
|
||||||
|
|
|
@ -20,17 +20,17 @@
|
||||||
|
|
||||||
#if defined(MODE_OLED)
|
#if defined(MODE_OLED)
|
||||||
|
|
||||||
#include "I2CPort.h"
|
#include "I2C3.h"
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
const uint16_t MAX_NBYTES_SIZE = 255U;
|
const uint16_t MAX_NBYTES_SIZE = 255U;
|
||||||
|
|
||||||
CI2CPort::CI2CPort()
|
CI2C3::CI2C3()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CI2CPort::init()
|
bool CI2C3::init()
|
||||||
{
|
{
|
||||||
// Enable I2C3
|
// Enable I2C3
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C3, ENABLE);
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C3, ENABLE);
|
||||||
|
@ -77,7 +77,7 @@ bool CI2CPort::init()
|
||||||
return true;
|
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
|
// Wait for the I2C transmitter to become free
|
||||||
if (waitISRFlagsSet(I2C_ISR_BUSY))
|
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;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CI2CPort::waitISRFlagsSet(uint32_t flags)
|
bool CI2C3::waitISRFlagsSet(uint32_t flags)
|
||||||
{
|
{
|
||||||
// Wait till the specified ISR Bits are set
|
// Wait till the specified ISR Bits are set
|
||||||
// More than 1 Flag can be "or"ed.
|
// More than 1 Flag can be "or"ed.
|
||||||
|
@ -136,7 +136,7 @@ bool CI2CPort::waitISRFlagsSet(uint32_t flags)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CI2CPort::configureDataTransfer(uint8_t size)
|
void CI2C3::configureDataTransfer(uint8_t size)
|
||||||
{
|
{
|
||||||
I2C3->CR2 &= ~(I2C_CR2_SADD |
|
I2C3->CR2 &= ~(I2C_CR2_SADD |
|
||||||
I2C_CR2_NBYTES |
|
I2C_CR2_NBYTES |
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
#if defined(MODE_OLED)
|
#if defined(MODE_OLED)
|
||||||
|
|
||||||
#if !defined(I2CPORT_H)
|
#if !defined(I2C3_H)
|
||||||
#define I2CPORT_H
|
#define I2C3_H
|
||||||
|
|
||||||
#if defined(STM32F7XX)
|
#if defined(STM32F7XX)
|
||||||
#include "stm32f7xx.h"
|
#include "stm32f7xx.h"
|
||||||
|
@ -29,9 +29,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class CI2CPort {
|
class CI2C3 {
|
||||||
public:
|
public:
|
||||||
CI2CPort();
|
CI2C3();
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#if defined(MODE_OLED)
|
#if defined(MODE_OLED)
|
||||||
|
|
||||||
#include "I2COLED.h"
|
#include "I2COLED.h"
|
||||||
#include "I2CPort.h"
|
#include "I2C3.h"
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
#if !defined(I2COLED_H)
|
#if !defined(I2COLED_H)
|
||||||
#define I2COLED_H
|
#define I2COLED_H
|
||||||
|
|
||||||
#include "I2CPort.h"
|
#include "I2C3.h"
|
||||||
|
|
||||||
class CI2COLED {
|
class CI2COLED {
|
||||||
public:
|
public:
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
void setMode(int state);
|
void setMode(int state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CI2CPort m_i2c;
|
CI2C3 m_i2c;
|
||||||
uint8_t* m_oledBuffer;
|
uint8_t* m_oledBuffer;
|
||||||
|
|
||||||
void write(const char* text);
|
void write(const char* text);
|
||||||
|
|
|
@ -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
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -42,10 +42,6 @@ bool m_dcd = false;
|
||||||
CI2COLED oled;
|
CI2COLED oled;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(I2C_REPEATER)
|
|
||||||
CI2CPort i2C1(1U);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MODE_DSTAR)
|
#if defined(MODE_DSTAR)
|
||||||
CDStarRX dstarRX;
|
CDStarRX dstarRX;
|
||||||
CDStarTX dstarTX;
|
CDStarTX dstarTX;
|
||||||
|
|
Loading…
Reference in New Issue