diff --git a/I2CTeensy.cpp b/I2CTeensy.cpp index f034724..cfa5bb1 100644 --- a/I2CTeensy.cpp +++ b/I2CTeensy.cpp @@ -194,6 +194,16 @@ int CSerialPort::availableInt(uint8_t n) } } +int CSerialPort::availableForWriteInt(uint8_t n) +{ + switch (n) { + case 3U: + return Serial3.availableForWrite(); + default: + return false; + } +} + uint8_t CSerialPort::readInt(uint8_t n) { switch (n) { diff --git a/IOSTM.cpp b/IOSTM.cpp index e76fd65..1b32560 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -433,6 +433,7 @@ DMR PC6 output YSF PC7 output P25 PC8 output NXDN PC9 output +POCSAG PA8 output RX PA0 analog input RSSI PA7 analog input @@ -465,9 +466,9 @@ EXT_CLK PA15 input #define PORT_NXDN GPIOC #define RCC_Per_NXDN RCC_AHB1Periph_GPIOC -#define PIN_POCSAG GPIO_Pin_12 -#define PORT_POCSAG GPIOB -#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB +#define PIN_POCSAG GPIO_Pin_8 +#define PORT_POCSAG GPIOA +#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOA #define PIN_DSTAR GPIO_Pin_15 #define PORT_DSTAR GPIOB diff --git a/MMDVM.cpp b/MMDVM.cpp index 639a068..6fd894c 100644 --- a/MMDVM.cpp +++ b/MMDVM.cpp @@ -102,7 +102,7 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); - if (m_pocsagEnable && m_modemState == STATE_POCSAG) + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); if (m_modemState == STATE_DSTARCAL) diff --git a/MMDVM.ino b/MMDVM.ino index ff317eb..ff392e1 100644 --- a/MMDVM.ino +++ b/MMDVM.ino @@ -99,7 +99,7 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); - if (m_pocsagEnable && m_modemState == STATE_POCSAG) + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); if (m_modemState == STATE_DSTARCAL) diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 8306410..d53f9b7 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -87,6 +87,14 @@ void CPOCSAGTX::process() } } +bool CPOCSAGTX::busy() +{ + if (m_poLen > 0U || m_buffer.getData() > 0U) + return true; + else + return false; +} + uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) { if (length != POCSAG_FRAME_LENGTH_BYTES) diff --git a/POCSAGTX.h b/POCSAGTX.h index ea41b7f..8cd75f7 100644 --- a/POCSAGTX.h +++ b/POCSAGTX.h @@ -35,6 +35,8 @@ public: uint8_t getSpace() const; + bool busy(); + private: CSerialRB m_buffer; arm_fir_instance_q15 m_modFilter; diff --git a/SerialRB.h b/SerialRB.h index 4378cc9..22667d5 100644 --- a/SerialRB.h +++ b/SerialRB.h @@ -32,7 +32,7 @@ Boston, MA 02110-1301, USA. #include #endif -const uint16_t SERIAL_RINGBUFFER_SIZE = 2000U; +const uint16_t SERIAL_RINGBUFFER_SIZE = 1000U; class CSerialRB { public: