mirror of
https://github.com/g4klx/MMDVM_HS.git
synced 2026-01-20 23:40:19 +01:00
Serial repeater port changes
Enables neater connection to erroneous boards with only 3 pins on USART2 like the one I have! USART1 is now the default for Nextion serial repeater unless you define STM32_USART1_HOST or ZUMSPOT_LIBRE in Config.h Needed to specify ZUMSPOT_LIBRE as separate board in Config.h as this only has a header for USART2 - Libre Kit will not use these changes. All other boards appear to break out all USARTs in some form or other (specifically USART1) EA7GIB's boards will now have a minor labelling error in that the header labelled Nextion (USART2) is no longer the Nextion port unless you define STM32_USART1_HOST or ZUMSPOT_LIBRE in Config.h. If like me your OCD triggers with this, define ZUMSPOT_LIBRE and the nextion will be forced to USART2 (as labelled!)
This commit is contained in:
parent
438cfc2b82
commit
f69805f247
4
Config.h
4
Config.h
|
|
@ -24,7 +24,9 @@
|
|||
// #define PI_HAT_7021_REV_02
|
||||
// 2) ZUM-Spot USB and ZUM-Spot Pi HAT:
|
||||
// #define PI_HAT_7021_REV_03
|
||||
// 3) ZUM-Spot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103
|
||||
// 3) ZUM-Spot Libre Kit
|
||||
// #define ZUMSPOT_LIBRE
|
||||
// 4) board with modified RF7021SE and Blue Pill STM32F103
|
||||
#define ADF7021_CARRIER_BOARD
|
||||
|
||||
// Enable ADF7021 support:
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
#define PIN_PTT_LED PB14
|
||||
#define PIN_COS_LED PB15
|
||||
|
||||
#elif defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
|
||||
#define PIN_SCLK PB5
|
||||
#define PIN_SREAD PB7
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
#define PIN_COS_LED PB15
|
||||
|
||||
#else
|
||||
#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, or ADF7021_CARRIER_BOARD need to be defined"
|
||||
#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, ZUMSPOT_LIBRE or ADF7021_CARRIER_BOARD need to be defined"
|
||||
#endif
|
||||
|
||||
#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
|
|
@ -150,7 +150,7 @@ void CIO::Init()
|
|||
|
||||
#if defined(PI_HAT_7021_REV_02)
|
||||
afio_cfg_debug_ports(AFIO_DEBUG_NONE);
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
12
IOSTM.cpp
12
IOSTM.cpp
|
|
@ -139,7 +139,7 @@
|
|||
#define PIN_COS_LED GPIO_Pin_15
|
||||
#define PORT_COS_LED GPIOB
|
||||
|
||||
#elif defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
|
||||
#define PIN_SCLK GPIO_Pin_5
|
||||
#define PORT_SCLK GPIOB
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
#define PORT_COS_LED GPIOB
|
||||
|
||||
#else
|
||||
#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, or ADF7021_CARRIER_BOARD need to be defined"
|
||||
#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, ZUMSPOT_LIBRE or ADF7021_CARRIER_BOARD need to be defined"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -219,7 +219,7 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
|
||||
#if defined(BIDIR_DATA_PIN)
|
||||
void EXTI3_IRQHandler(void) {
|
||||
|
|
@ -247,7 +247,7 @@ void CIO::Init()
|
|||
|
||||
#if defined(PI_HAT_7021_REV_02)
|
||||
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
|
||||
#endif
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ void CIO::Init()
|
|||
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
|
||||
#endif
|
||||
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
|
||||
#if defined(BIDIR_DATA_PIN)
|
||||
// Connect EXTI3 Line
|
||||
|
|
@ -421,7 +421,7 @@ void CIO::startInt()
|
|||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
|
||||
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD)
|
||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE)
|
||||
|
||||
#if defined(BIDIR_DATA_PIN)
|
||||
// Enable and set EXTI3 Interrupt
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ USART2 - TXD PA2 - RXD PA3
|
|||
#define TX_SERIAL_FIFO_SIZE 256U
|
||||
#define RX_SERIAL_FIFO_SIZE 256U
|
||||
|
||||
#if defined(STM32_USART1_HOST)
|
||||
#if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER)
|
||||
|
||||
extern "C" {
|
||||
void USART1_IRQHandler();
|
||||
|
|
@ -439,10 +439,14 @@ void CSerialPort::beginInt(uint8_t n, int speed)
|
|||
usbserial.begin();
|
||||
#endif
|
||||
break;
|
||||
#if defined(SERIAL_REPEATER)
|
||||
#if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE))
|
||||
case 3U:
|
||||
InitUSART2(speed);
|
||||
break;
|
||||
#elif defined(SERIAL_REPEATER)
|
||||
case 3U:
|
||||
InitUSART1(speed);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
|
@ -458,9 +462,12 @@ int CSerialPort::availableInt(uint8_t n)
|
|||
#elif defined(STM32_USB_HOST)
|
||||
return usbserial.available();
|
||||
#endif
|
||||
#if defined(SERIAL_REPEATER)
|
||||
#if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE))
|
||||
case 3U:
|
||||
return AvailUSART2();
|
||||
#elif defined(SERIAL_REPEATER)
|
||||
case 3U:
|
||||
return AvailUSART1();
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
|
|
@ -476,9 +483,12 @@ uint8_t CSerialPort::readInt(uint8_t n)
|
|||
#elif defined(STM32_USB_HOST)
|
||||
return usbserial.read();
|
||||
#endif
|
||||
#if defined(SERIAL_REPEATER)
|
||||
#if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE))
|
||||
case 3U:
|
||||
return ReadUSART2();
|
||||
#elif defined(SERIAL_REPEATER)
|
||||
case 3U:
|
||||
return ReadUSART1();
|
||||
#endif
|
||||
default:
|
||||
return 0U;
|
||||
|
|
@ -499,12 +509,18 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
|||
usbserial.flush();
|
||||
#endif
|
||||
break;
|
||||
#if defined(SERIAL_REPEATER)
|
||||
#if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE))
|
||||
case 3U:
|
||||
WriteUSART2(data, length);
|
||||
if (flush)
|
||||
TXSerialFlush2();
|
||||
break;
|
||||
#elif defined(SERIAL_REPEATER)
|
||||
case 3U:
|
||||
WriteUSART1(data, length);
|
||||
if (flush)
|
||||
TXSerialFlush1();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue