mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-10-16 16:54:12 +02:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07e18ffcfb | ||
|
|
0092d6d9c3 |
@@ -60,9 +60,6 @@
|
|||||||
// Use separate mode pins to switch external filters/bandwidth for example
|
// Use separate mode pins to switch external filters/bandwidth for example
|
||||||
// #define STM32F4_NUCLEO_MODE_PINS
|
// #define STM32F4_NUCLEO_MODE_PINS
|
||||||
|
|
||||||
// For the VK6MST Pi3 Shield communicating over i2c. i2c address & speed defined in i2cTeensy.cpp
|
|
||||||
// #define VK6MST_TEENSY_PI3_SHIELD_I2C
|
|
||||||
|
|
||||||
// Pass RSSI information to the host
|
// Pass RSSI information to the host
|
||||||
// #define SEND_RSSI_DATA
|
// #define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
|||||||
-235
@@ -1,235 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*
|
|
||||||
* 28-4-2017 Created for MMDVM Pi shield for Teensy by Chris Huitema
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Config.h"
|
|
||||||
#include "Globals.h"
|
|
||||||
|
|
||||||
#if defined(VK6MST_TEENSY_PI3_SHIELD_I2C)
|
|
||||||
|
|
||||||
#include <i2c_t3.h> //available here https://github.com/nox771/i2c_t3 or maybe the normal wire will work #include <wire.h> justs need to test i guess
|
|
||||||
|
|
||||||
#define I2C_ADDRESS 0x22
|
|
||||||
#define I2C_SPEED 100000
|
|
||||||
|
|
||||||
// Function prototypes
|
|
||||||
void receiveEvent(size_t count);
|
|
||||||
void requestEvent(void);
|
|
||||||
|
|
||||||
#define TX_FIFO_SIZE 512U
|
|
||||||
#define RX_FIFO_SIZE 512U
|
|
||||||
|
|
||||||
volatile uint8_t TXfifo[TX_FIFO_SIZE];
|
|
||||||
volatile uint8_t RXfifo[RX_FIFO_SIZE];
|
|
||||||
volatile uint16_t TXfifohead, TXfifotail;
|
|
||||||
volatile uint16_t RXfifohead, RXfifotail;
|
|
||||||
|
|
||||||
// Init queues
|
|
||||||
void TXfifoinit(void)
|
|
||||||
{
|
|
||||||
TXfifohead = 0U;
|
|
||||||
TXfifotail = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RXfifoinit()
|
|
||||||
{
|
|
||||||
RXfifohead = 0U;
|
|
||||||
RXfifotail = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How full is queue
|
|
||||||
|
|
||||||
uint16_t TXfifolevel(void)
|
|
||||||
{
|
|
||||||
uint32_t tail = TXfifotail;
|
|
||||||
uint32_t head = TXfifohead;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return TX_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t RXfifolevel(void)
|
|
||||||
{
|
|
||||||
uint32_t tail = RXfifotail;
|
|
||||||
uint32_t head = RXfifohead;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return RX_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t TXfifoput(uint8_t next)
|
|
||||||
{
|
|
||||||
if (TXfifolevel() < TX_FIFO_SIZE) {
|
|
||||||
TXfifo[TXfifohead] = next;
|
|
||||||
|
|
||||||
TXfifohead++;
|
|
||||||
if (TXfifohead >= TX_FIFO_SIZE)
|
|
||||||
TXfifohead = 0U;
|
|
||||||
return 1U;
|
|
||||||
} else {
|
|
||||||
return 0U; // signal an overflow occurred by returning a zero count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2Cbegin(void)
|
|
||||||
{
|
|
||||||
// Setup for Slave mode, address 0x22, pins 18/19, external pullups, speed in hz
|
|
||||||
Wire.begin(I2C_SLAVE, I2C_ADDRESS, I2C_PINS_18_19, I2C_PULLUP_EXT, I2C_SPEED);
|
|
||||||
|
|
||||||
// register events
|
|
||||||
Wire.onReceive(receiveEvent);
|
|
||||||
Wire.onRequest(requestEvent);
|
|
||||||
|
|
||||||
// initialize the fifos
|
|
||||||
TXfifoinit();
|
|
||||||
RXfifoinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int I2Cavailable(void)
|
|
||||||
{
|
|
||||||
if (RXfifolevel() > 0U)
|
|
||||||
return 1U;
|
|
||||||
else
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t I2Cread(void)
|
|
||||||
{
|
|
||||||
uint8_t data_c = RXfifo[RXfifotail];
|
|
||||||
|
|
||||||
RXfifotail++;
|
|
||||||
if (RXfifotail >= RX_FIFO_SIZE)
|
|
||||||
RXfifotail = 0U;
|
|
||||||
|
|
||||||
return data_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void I2Cwrite(const uint8_t* data, uint16_t length)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0U; i < length; i++)
|
|
||||||
TXfifoput(data[i]); //puts it in the fifo
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// handle Rx Event (incoming I2C data)
|
|
||||||
//
|
|
||||||
void receiveEvent(size_t count)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0U; i < count; i++)
|
|
||||||
{
|
|
||||||
if (RXfifolevel() < RX_FIFO_SIZE) {
|
|
||||||
RXfifo[RXfifohead] = Wire.readByte();
|
|
||||||
if (RXfifo[RXfifohead] != -1){
|
|
||||||
RXfifohead++;
|
|
||||||
if (RXfifohead >= RX_FIFO_SIZE) RXfifohead = 0U;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Wire.readByte(); // drop data if mem full.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// handle Tx Event (outgoing I2C data)
|
|
||||||
//
|
|
||||||
void requestEvent(void)
|
|
||||||
{
|
|
||||||
if (TXfifolevel() > 0) {
|
|
||||||
if (Wire.write(TXfifo[TXfifotail])){ //write to i2c
|
|
||||||
TXfifotail++;
|
|
||||||
if (TXfifotail >= TX_FIFO_SIZE) TXfifotail = 0U;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
|
||||||
|
|
||||||
void CSerialPort::beginInt(uint8_t n, int speed)
|
|
||||||
{
|
|
||||||
switch (n) {
|
|
||||||
case 1U:
|
|
||||||
return I2Cbegin();
|
|
||||||
case 3U:
|
|
||||||
Serial3.begin(speed);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSerialPort::availableInt(uint8_t n)
|
|
||||||
{
|
|
||||||
switch (n) {
|
|
||||||
case 1U:
|
|
||||||
return I2Cavailable();
|
|
||||||
case 3U:
|
|
||||||
return Serial3.available();
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
case 1U:
|
|
||||||
return I2Cread();
|
|
||||||
case 3U:
|
|
||||||
return Serial3.read();
|
|
||||||
default:
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool flush)
|
|
||||||
{
|
|
||||||
switch (n) {
|
|
||||||
case 1U:
|
|
||||||
I2Cwrite(data, length);
|
|
||||||
break;
|
|
||||||
case 3U:
|
|
||||||
Serial3.write(data, length);
|
|
||||||
if (flush)
|
|
||||||
Serial3.flush();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -101,13 +101,9 @@ void CIO::initInt()
|
|||||||
pinMode(PIN_DMR, OUTPUT);
|
pinMode(PIN_DMR, OUTPUT);
|
||||||
pinMode(PIN_YSF, OUTPUT);
|
pinMode(PIN_YSF, OUTPUT);
|
||||||
pinMode(PIN_P25, OUTPUT);
|
pinMode(PIN_P25, OUTPUT);
|
||||||
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
|
||||||
pinMode(PIN_NXDN, OUTPUT);
|
pinMode(PIN_NXDN, OUTPUT);
|
||||||
#endif
|
|
||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
|
||||||
pinMode(PIN_POCSAG, OUTPUT);
|
pinMode(PIN_POCSAG, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::startInt()
|
void CIO::startInt()
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ DMR PC8 output
|
|||||||
YSF PA8 output
|
YSF PA8 output
|
||||||
P25 PC9 output
|
P25 PC9 output
|
||||||
NXDN PB1 output
|
NXDN PB1 output
|
||||||
POCSAG PB12 output
|
|
||||||
|
|
||||||
RX PA0 analog input
|
RX PA0 analog input
|
||||||
RSSI PA7 analog input
|
RSSI PA7 analog input
|
||||||
@@ -146,10 +145,6 @@ EXT_CLK PA15 input
|
|||||||
#define PORT_NXDN GPIOB
|
#define PORT_NXDN GPIOB
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_7
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
#define PORT_DSTAR GPIOC
|
#define PORT_DSTAR GPIOC
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
@@ -193,7 +188,6 @@ DMR PC8 output
|
|||||||
YSF PA8 output
|
YSF PA8 output
|
||||||
P25 PC9 output
|
P25 PC9 output
|
||||||
NXDN PB1 output
|
NXDN PB1 output
|
||||||
POCSAG PB12 output
|
|
||||||
|
|
||||||
RX PA0 analog input
|
RX PA0 analog input
|
||||||
RSSI PA7 analog input
|
RSSI PA7 analog input
|
||||||
@@ -226,10 +220,6 @@ EXT_CLK PA15 input
|
|||||||
#define PORT_NXDN GPIOB
|
#define PORT_NXDN GPIOB
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_7
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
#define PORT_DSTAR GPIOC
|
#define PORT_DSTAR GPIOC
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
@@ -273,7 +263,6 @@ DMR PC8 output
|
|||||||
YSF PA8 output
|
YSF PA8 output
|
||||||
P25 PC9 output
|
P25 PC9 output
|
||||||
NXDN PB1 output
|
NXDN PB1 output
|
||||||
POCSAG PB12 output
|
|
||||||
|
|
||||||
RX PA0 analog input
|
RX PA0 analog input
|
||||||
RSSI PA7 analog input
|
RSSI PA7 analog input
|
||||||
@@ -306,10 +295,6 @@ EXT_CLK PA15 input
|
|||||||
#define PORT_NXDN GPIOB
|
#define PORT_NXDN GPIOB
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_7
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
#define PORT_DSTAR GPIOC
|
#define PORT_DSTAR GPIOC
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
@@ -353,7 +338,6 @@ DMR PC8 output
|
|||||||
YSF PA8 output
|
YSF PA8 output
|
||||||
P25 PC9 output
|
P25 PC9 output
|
||||||
NXDN PB1 output
|
NXDN PB1 output
|
||||||
POCSAG PB12 output
|
|
||||||
|
|
||||||
RX PA0 analog input
|
RX PA0 analog input
|
||||||
RSSI PA7 analog input
|
RSSI PA7 analog input
|
||||||
@@ -386,10 +370,6 @@ EXT_CLK PA15 input
|
|||||||
#define PORT_NXDN GPIOB
|
#define PORT_NXDN GPIOB
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_7
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
#define PORT_DSTAR GPIOC
|
#define PORT_DSTAR GPIOC
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
@@ -419,119 +399,6 @@ EXT_CLK PA15 input
|
|||||||
#define PIN_TX GPIO_Pin_4
|
#define PIN_TX GPIO_Pin_4
|
||||||
#define PIN_TX_CH DAC_Channel_1
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
#elif defined(STM32F722_F7HAT)
|
|
||||||
/*
|
|
||||||
Pin definitions for MMDVM-F7Hat Pi-Hat F0DEI DB9MAT DF2ET board:
|
|
||||||
|
|
||||||
PTT PB14 output
|
|
||||||
COSLED PB13 output
|
|
||||||
LED PB12 output
|
|
||||||
COS PC0 input
|
|
||||||
|
|
||||||
DSTAR PB15 output
|
|
||||||
DMR PC6 output
|
|
||||||
YSF PC7 output
|
|
||||||
P25 PC8 output
|
|
||||||
NXDN PC9 output
|
|
||||||
POCSAG PA8 output
|
|
||||||
|
|
||||||
MDSTAR PC10 output
|
|
||||||
MDMR PC4 output
|
|
||||||
MYSF PC13 output
|
|
||||||
MP25 PC14 output
|
|
||||||
MNXDN PC15 output
|
|
||||||
MPOCSAG PC11 output
|
|
||||||
|
|
||||||
RX PA0 analog input
|
|
||||||
RSSI PA7 analog input
|
|
||||||
TX PA4 analog output
|
|
||||||
|
|
||||||
EXT_CLK PA15 input
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PIN_COS GPIO_Pin_0
|
|
||||||
#define PORT_COS GPIOC
|
|
||||||
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_PTT GPIO_Pin_14
|
|
||||||
#define PORT_PTT GPIOB
|
|
||||||
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_COSLED GPIO_Pin_13
|
|
||||||
#define PORT_COSLED GPIOB
|
|
||||||
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_LED GPIO_Pin_12
|
|
||||||
#define PORT_LED GPIOB
|
|
||||||
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_P25 GPIO_Pin_8
|
|
||||||
#define PORT_P25 GPIOC
|
|
||||||
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_NXDN GPIO_Pin_9
|
|
||||||
#define PORT_NXDN GPIOC
|
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#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
|
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DMR GPIO_Pin_6
|
|
||||||
#define PORT_DMR GPIOC
|
|
||||||
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_YSF GPIO_Pin_7
|
|
||||||
#define PORT_YSF GPIOC
|
|
||||||
#define RCC_Per_YSF RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS)
|
|
||||||
#define PIN_MP25 GPIO_Pin_14
|
|
||||||
#define PORT_MP25 GPIOC
|
|
||||||
#define RCC_Per_MP25 RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_MNXDN GPIO_Pin_15
|
|
||||||
#define PORT_MNXDN GPIOC
|
|
||||||
#define RCC_Per_MNXDN RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_MDSTAR GPIO_Pin_10
|
|
||||||
#define PORT_MDSTAR GPIOC
|
|
||||||
#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_MDMR GPIO_Pin_4
|
|
||||||
#define PORT_MDMR GPIOC
|
|
||||||
#define RCC_Per_MDMR RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_MYSF GPIO_Pin_13
|
|
||||||
#define PORT_MYSF GPIOC
|
|
||||||
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_MPOCSAG GPIO_Pin_11
|
|
||||||
#define PORT_MPOCSAG GPIOC
|
|
||||||
#define RCC_Per_MPOCSAG RCC_AHB1Periph_GPIOC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PIN_EXT_CLK GPIO_Pin_15
|
|
||||||
#define SRC_EXT_CLK GPIO_PinSource15
|
|
||||||
#define PORT_EXT_CLK GPIOA
|
|
||||||
|
|
||||||
#define PIN_RX GPIO_Pin_0
|
|
||||||
#define PIN_RX_CH ADC_Channel_0
|
|
||||||
#define PORT_RX GPIOA
|
|
||||||
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
|
||||||
|
|
||||||
#define PIN_RSSI GPIO_Pin_7
|
|
||||||
#define PIN_RSSI_CH ADC_Channel_7
|
|
||||||
#define PORT_RSSI GPIOA
|
|
||||||
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
|
||||||
|
|
||||||
#define PIN_TX GPIO_Pin_4
|
|
||||||
#define PIN_TX_CH DAC_Channel_1
|
|
||||||
|
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO)
|
||||||
|
|
||||||
#if defined(STM32F4_NUCLEO_MORPHO_HEADER)
|
#if defined(STM32F4_NUCLEO_MORPHO_HEADER)
|
||||||
@@ -548,14 +415,12 @@ DMR PB4 output CN10 Pin27
|
|||||||
YSF PB5 output CN10 Pin29
|
YSF PB5 output CN10 Pin29
|
||||||
P25 PB3 output CN10 Pin31
|
P25 PB3 output CN10 Pin31
|
||||||
NXDN PA10 output CN10 Pin33
|
NXDN PA10 output CN10 Pin33
|
||||||
POCSAG PB12 output
|
|
||||||
|
|
||||||
MDSTAR PC4 output CN10 Pin34
|
MDSTAR PC4 output CN10 Pin34
|
||||||
MDMR PC5 output CN10 Pin6
|
MDMR PC5 output CN10 Pin6
|
||||||
MYSF PC2 output CN7 Pin35
|
MYSF PC2 output CN7 Pin35
|
||||||
MP25 PC3 output CN7 Pin37
|
MP25 PC3 output CN7 Pin37
|
||||||
MNXDN PC6 output CN10 Pin4
|
MNXDN PC6 output CN10 Pin4
|
||||||
MPOCSAG PC7 output CN10 Pin19
|
|
||||||
|
|
||||||
RX PA0 analog input CN7 Pin28
|
RX PA0 analog input CN7 Pin28
|
||||||
RSSI PA1 analog input CN7 Pin30
|
RSSI PA1 analog input CN7 Pin30
|
||||||
@@ -588,10 +453,6 @@ EXT_CLK PA15 input CN7 Pin17
|
|||||||
#define PORT_NXDN GPIOA
|
#define PORT_NXDN GPIOA
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_10
|
#define PIN_DSTAR GPIO_Pin_10
|
||||||
#define PORT_DSTAR GPIOB
|
#define PORT_DSTAR GPIOB
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
@@ -624,10 +485,6 @@ EXT_CLK PA15 input CN7 Pin17
|
|||||||
#define PIN_MYSF GPIO_Pin_2
|
#define PIN_MYSF GPIO_Pin_2
|
||||||
#define PORT_MYSF GPIOC
|
#define PORT_MYSF GPIOC
|
||||||
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
#define PIN_MPOCSAG GPIO_Pin_7
|
|
||||||
#define PORT_MPOCSAG GPIOC
|
|
||||||
#define RCC_Per_MPOCSAG RCC_AHB1Periph_GPIOC
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PIN_EXT_CLK GPIO_Pin_15
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
@@ -661,7 +518,6 @@ DMR PA4 output CN8 Pin3
|
|||||||
YSF PB0 output CN8 Pin4
|
YSF PB0 output CN8 Pin4
|
||||||
P25 PC1 output CN8 Pin5
|
P25 PC1 output CN8 Pin5
|
||||||
NXDN PA3 output CN9 Pin1
|
NXDN PA3 output CN9 Pin1
|
||||||
POCSAG PB12 output
|
|
||||||
|
|
||||||
RX PA0 analog input CN8 Pin1
|
RX PA0 analog input CN8 Pin1
|
||||||
RSSI PC0 analog input CN8 Pin6
|
RSSI PC0 analog input CN8 Pin6
|
||||||
@@ -694,10 +550,6 @@ EXT_CLK PB8 input CN5 Pin10
|
|||||||
#define PORT_NXDN GPIOA
|
#define PORT_NXDN GPIOA
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_1
|
#define PIN_DSTAR GPIO_Pin_1
|
||||||
#define PORT_DSTAR GPIOA
|
#define PORT_DSTAR GPIOA
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOA
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOA
|
||||||
@@ -745,7 +597,6 @@ DMR PB4 output CN12 Pin27
|
|||||||
YSF PB5 output CN12 Pin29
|
YSF PB5 output CN12 Pin29
|
||||||
P25 PB3 output CN12 Pin31
|
P25 PB3 output CN12 Pin31
|
||||||
NXDN PA10 output CN12 Pin33
|
NXDN PA10 output CN12 Pin33
|
||||||
POCSAG PB12 output CN12 Pin16
|
|
||||||
|
|
||||||
MDSTAR PC4 output CN12 Pin34
|
MDSTAR PC4 output CN12 Pin34
|
||||||
MDMR PC5 output CN12 Pin6
|
MDMR PC5 output CN12 Pin6
|
||||||
@@ -784,10 +635,6 @@ EXT_CLK PA15 input CN11 Pin17
|
|||||||
#define PORT_NXDN GPIOA
|
#define PORT_NXDN GPIOA
|
||||||
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_12
|
|
||||||
#define PORT_POCSAG GPIOB
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
|
||||||
|
|
||||||
#define PIN_DSTAR GPIO_Pin_10
|
#define PIN_DSTAR GPIO_Pin_10
|
||||||
#define PORT_DSTAR GPIOB
|
#define PORT_DSTAR GPIOB
|
||||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
@@ -853,7 +700,6 @@ NXDN PB9 output
|
|||||||
DSTAR PB6 output
|
DSTAR PB6 output
|
||||||
DMR PB5 output
|
DMR PB5 output
|
||||||
YSF PB7 output
|
YSF PB7 output
|
||||||
POCSAG PC10 output
|
|
||||||
|
|
||||||
RX PB0 analog input
|
RX PB0 analog input
|
||||||
RSSI PB1 analog input
|
RSSI PB1 analog input
|
||||||
@@ -899,10 +745,6 @@ EXT_CLK PA15 input
|
|||||||
#define PORT_YSF GPIOB
|
#define PORT_YSF GPIOB
|
||||||
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
#define PIN_POCSAG GPIO_Pin_10
|
|
||||||
#define PORT_POCSAG GPIOC
|
|
||||||
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIN_EXT_CLK GPIO_Pin_15
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
#define SRC_EXT_CLK GPIO_PinSource15
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
#define PORT_EXT_CLK GPIOA
|
#define PORT_EXT_CLK GPIOA
|
||||||
@@ -995,7 +837,6 @@ void CIO::initInt()
|
|||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_Init(PORT_P25, &GPIO_InitStruct);
|
GPIO_Init(PORT_P25, &GPIO_InitStruct);
|
||||||
|
|
||||||
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
|
||||||
// NXDN pin
|
// NXDN pin
|
||||||
RCC_AHB1PeriphClockCmd(RCC_Per_NXDN, ENABLE);
|
RCC_AHB1PeriphClockCmd(RCC_Per_NXDN, ENABLE);
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_NXDN;
|
GPIO_InitStruct.GPIO_Pin = PIN_NXDN;
|
||||||
@@ -1003,16 +844,7 @@ void CIO::initInt()
|
|||||||
GPIO_Init(PORT_NXDN, &GPIO_InitStruct);
|
GPIO_Init(PORT_NXDN, &GPIO_InitStruct);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
// POCSAG pin
|
|
||||||
RCC_AHB1PeriphClockCmd(RCC_Per_POCSAG, ENABLE);
|
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_POCSAG;
|
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
|
||||||
GPIO_Init(PORT_POCSAG, &GPIO_InitStruct);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
|
||||||
// DSTAR mode pin
|
// DSTAR mode pin
|
||||||
RCC_AHB1PeriphClockCmd(RCC_Per_MDSTAR, ENABLE);
|
RCC_AHB1PeriphClockCmd(RCC_Per_MDSTAR, ENABLE);
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_MDSTAR;
|
GPIO_InitStruct.GPIO_Pin = PIN_MDSTAR;
|
||||||
@@ -1037,22 +869,12 @@ void CIO::initInt()
|
|||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_Init(PORT_MP25, &GPIO_InitStruct);
|
GPIO_Init(PORT_MP25, &GPIO_InitStruct);
|
||||||
|
|
||||||
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
|
||||||
// NXDN mode pin
|
// NXDN mode pin
|
||||||
RCC_AHB1PeriphClockCmd(RCC_Per_MNXDN, ENABLE);
|
RCC_AHB1PeriphClockCmd(RCC_Per_MNXDN, ENABLE);
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_MNXDN;
|
GPIO_InitStruct.GPIO_Pin = PIN_MNXDN;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_Init(PORT_MNXDN, &GPIO_InitStruct);
|
GPIO_Init(PORT_MNXDN, &GPIO_InitStruct);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
|
||||||
// POCSAG mode pin
|
|
||||||
RCC_AHB1PeriphClockCmd(RCC_Per_MPOCSAG, ENABLE);
|
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_MPOCSAG;
|
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
|
||||||
GPIO_Init(PORT_MPOCSAG, &GPIO_InitStruct);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::startInt()
|
void CIO::startInt()
|
||||||
@@ -1262,7 +1084,7 @@ void CIO::setCOSInt(bool on)
|
|||||||
void CIO::setDStarInt(bool on)
|
void CIO::setDStarInt(bool on)
|
||||||
{
|
{
|
||||||
GPIO_WriteBit(PORT_DSTAR, PIN_DSTAR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_DSTAR, PIN_DSTAR, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MDSTAR, PIN_MDSTAR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MDSTAR, PIN_MDSTAR, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1270,7 +1092,7 @@ void CIO::setDStarInt(bool on)
|
|||||||
void CIO::setDMRInt(bool on)
|
void CIO::setDMRInt(bool on)
|
||||||
{
|
{
|
||||||
GPIO_WriteBit(PORT_DMR, PIN_DMR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_DMR, PIN_DMR, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MDMR, PIN_MDMR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MDMR, PIN_MDMR, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1278,7 +1100,7 @@ void CIO::setDMRInt(bool on)
|
|||||||
void CIO::setYSFInt(bool on)
|
void CIO::setYSFInt(bool on)
|
||||||
{
|
{
|
||||||
GPIO_WriteBit(PORT_YSF, PIN_YSF, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_YSF, PIN_YSF, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MYSF, PIN_MYSF, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MYSF, PIN_MYSF, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1286,7 +1108,7 @@ void CIO::setYSFInt(bool on)
|
|||||||
void CIO::setP25Int(bool on)
|
void CIO::setP25Int(bool on)
|
||||||
{
|
{
|
||||||
GPIO_WriteBit(PORT_P25, PIN_P25, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_P25, PIN_P25, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MP25, PIN_MP25, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MP25, PIN_MP25, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1296,13 +1118,13 @@ void CIO::setNXDNInt(bool on)
|
|||||||
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
GPIO_WriteBit(PORT_YSF, PIN_YSF, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_YSF, PIN_YSF, on ? Bit_SET : Bit_RESET);
|
||||||
GPIO_WriteBit(PORT_P25, PIN_P25, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_P25, PIN_P25, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MYSF, PIN_MYSF, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MYSF, PIN_MYSF, on ? Bit_SET : Bit_RESET);
|
||||||
GPIO_WriteBit(PORT_MP25, PIN_MP25, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MP25, PIN_MP25, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
GPIO_WriteBit(PORT_NXDN, PIN_NXDN, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_NXDN, PIN_NXDN, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MNXDN, PIN_MNXDN, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MNXDN, PIN_MNXDN, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1312,16 +1134,11 @@ void CIO::setPOCSAGInt(bool on)
|
|||||||
{
|
{
|
||||||
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
GPIO_WriteBit(PORT_DSTAR, PIN_DSTAR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_DSTAR, PIN_DSTAR, on ? Bit_SET : Bit_RESET);
|
||||||
GPIO_WriteBit(PORT_DMR, PIN_DMR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_DMR, PIN_DMR, on ? Bit_SET : Bit_RESET);
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && defined(STM32F4_NUCLEO)
|
||||||
GPIO_WriteBit(PORT_MDSTAR, PIN_MDSTAR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MDSTAR, PIN_MDSTAR, on ? Bit_SET : Bit_RESET);
|
||||||
GPIO_WriteBit(PORT_MDMR, PIN_MDMR, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_MDMR, PIN_MDMR, on ? Bit_SET : Bit_RESET);
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
GPIO_WriteBit(PORT_POCSAG, PIN_POCSAG, on ? Bit_SET : Bit_RESET);
|
|
||||||
#if defined(STM32F4_NUCLEO_MODE_PINS) && defined(STM32F4_NUCLEO_MORPHO_HEADER) && (defined(STM32F4_NUCLEO) || defined(STM32F722_F7HAT))
|
|
||||||
GPIO_WriteBit(PORT_MPOCSAG, PIN_MPOCSAG, on ? Bit_SET : Bit_RESET);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -222,13 +222,9 @@ static inline void GPIOInit()
|
|||||||
GPIOConfigPin(PORT_DMR, PIN_DMR, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_DMR, PIN_DMR, GPIO_CRL_MODE0_1);
|
||||||
GPIOConfigPin(PORT_YSF, PIN_YSF, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_YSF, PIN_YSF, GPIO_CRL_MODE0_1);
|
||||||
GPIOConfigPin(PORT_P25, PIN_P25, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_P25, PIN_P25, GPIO_CRL_MODE0_1);
|
||||||
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
|
||||||
GPIOConfigPin(PORT_NXDN, PIN_NXDN, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_NXDN, PIN_NXDN, GPIO_CRL_MODE0_1);
|
||||||
#endif
|
|
||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
|
||||||
GPIOConfigPin(PORT_POCSAG, PIN_POCSAG, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_POCSAG, PIN_POCSAG, GPIO_CRL_MODE0_1);
|
||||||
#endif
|
|
||||||
|
|
||||||
GPIOConfigPin(PORT_RX, PIN_RX, 0);
|
GPIOConfigPin(PORT_RX, PIN_RX, 0);
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
GPIOConfigPin(PORT_RSSI, PIN_RSSI, 0);
|
GPIOConfigPin(PORT_RSSI, PIN_RSSI, 0);
|
||||||
|
|||||||
@@ -70,13 +70,9 @@ void CIO::initInt()
|
|||||||
pinMode(PIN_DMR, OUTPUT);
|
pinMode(PIN_DMR, OUTPUT);
|
||||||
pinMode(PIN_YSF, OUTPUT);
|
pinMode(PIN_YSF, OUTPUT);
|
||||||
pinMode(PIN_P25, OUTPUT);
|
pinMode(PIN_P25, OUTPUT);
|
||||||
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
|
||||||
pinMode(PIN_NXDN, OUTPUT);
|
pinMode(PIN_NXDN, OUTPUT);
|
||||||
#endif
|
|
||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
|
||||||
pinMode(PIN_POCSAG, OUTPUT);
|
pinMode(PIN_POCSAG, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::startInt()
|
void CIO::startInt()
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void loop()
|
|||||||
if (m_nxdnEnable && m_modemState == STATE_NXDN)
|
if (m_nxdnEnable && m_modemState == STATE_NXDN)
|
||||||
nxdnTX.process();
|
nxdnTX.process();
|
||||||
|
|
||||||
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
if (m_pocsagEnable && m_modemState == STATE_POCSAG)
|
||||||
pocsagTX.process();
|
pocsagTX.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_DSTARCAL)
|
if (m_modemState == STATE_DSTARCAL)
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void loop()
|
|||||||
if (m_nxdnEnable && m_modemState == STATE_NXDN)
|
if (m_nxdnEnable && m_modemState == STATE_NXDN)
|
||||||
nxdnTX.process();
|
nxdnTX.process();
|
||||||
|
|
||||||
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
if (m_pocsagEnable && m_modemState == STATE_POCSAG)
|
||||||
pocsagTX.process();
|
pocsagTX.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_DSTARCAL)
|
if (m_modemState == STATE_DSTARCAL)
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ DEFS_NUCLEO_F767=-DUSE_HAL_DRIVER -DSTM32F767xx -DSTM32F7XX -DSTM32F7_NUCLEO -DH
|
|||||||
DEFS_PI_F722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_PI_F722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
# MMDVM-F7M F0DEI board:
|
# MMDVM-F7M F0DEI board:
|
||||||
DEFS_F7M=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7M -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_F7M=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7M -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
# MMDVM-F7-Hat F0DEI, DB9MAT, DF2ET board:
|
|
||||||
DEFS_F7HAT=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7HAT -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
|
||||||
# STM32F4 DVM board:
|
# STM32F4 DVM board:
|
||||||
DEFS_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
|
||||||
@@ -150,7 +148,7 @@ CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -fno-builtin -f
|
|||||||
LDFLAGS=-Os --specs=nano.specs
|
LDFLAGS=-Os --specs=nano.specs
|
||||||
|
|
||||||
# Build Rules
|
# Build Rules
|
||||||
.PHONY: all release dis pi pi-f722 f4m nucleo f767 dvm clean
|
.PHONY: all release dis pi pi_f722 f4m nucleo f767 dvm clean
|
||||||
|
|
||||||
# Default target: Nucleo-64 F446RE board
|
# Default target: Nucleo-64 F446RE board
|
||||||
all: nucleo
|
all: nucleo
|
||||||
@@ -179,12 +177,6 @@ f7m: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_F7M)
|
|||||||
f7m: LDFLAGS+=$(LDFLAGS_F722)
|
f7m: LDFLAGS+=$(LDFLAGS_F722)
|
||||||
f7m: release_f7
|
f7m: release_f7
|
||||||
|
|
||||||
f7hat: GitVersion.h
|
|
||||||
f7hat: CFLAGS+=$(CFLAGS_F7) $(DEFS_F7HAT)
|
|
||||||
f7hat: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_F7HAT)
|
|
||||||
f7hat: LDFLAGS+=$(LDFLAGS_F722)
|
|
||||||
f7hat: release_f7
|
|
||||||
|
|
||||||
nucleo: GitVersion.h
|
nucleo: GitVersion.h
|
||||||
nucleo: CFLAGS+=$(CFLAGS_F4) $(DEFS_NUCLEO)
|
nucleo: CFLAGS+=$(CFLAGS_F4) $(DEFS_NUCLEO)
|
||||||
nucleo: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_NUCLEO)
|
nucleo: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_NUCLEO)
|
||||||
@@ -344,8 +336,7 @@ ifneq ($(wildcard /usr/bin/stm32flash),)
|
|||||||
/usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
deploy-f7m: deploy-pi-f7
|
deploy-f7m: deploy-pi-f7
|
||||||
deploy-f7hat: deploy-pi-f7
|
|
||||||
|
|
||||||
# Export the current git version if the index file exists, else 000...
|
# Export the current git version if the index file exists, else 000...
|
||||||
GitVersion.h:
|
GitVersion.h:
|
||||||
|
|||||||
+7
-11
@@ -57,9 +57,11 @@ void CPOCSAGTX::process()
|
|||||||
|
|
||||||
if (m_poLen == 0U) {
|
if (m_poLen == 0U) {
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
|
DEBUG1("MMDVM, sending preamble");
|
||||||
for (uint16_t i = 0U; i < m_txDelay; i++)
|
for (uint16_t i = 0U; i < m_txDelay; i++)
|
||||||
m_poBuffer[m_poLen++] = POCSAG_SYNC;
|
m_poBuffer[m_poLen++] = POCSAG_SYNC;
|
||||||
} else {
|
} else {
|
||||||
|
DEBUG2("MMDVM, sending", m_buffer.get());
|
||||||
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
|
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
|
||||||
uint8_t c = m_buffer.get();
|
uint8_t c = m_buffer.get();
|
||||||
m_poBuffer[m_poLen++] = c;
|
m_poBuffer[m_poLen++] = c;
|
||||||
@@ -87,24 +89,18 @@ 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)
|
uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (length != POCSAG_FRAME_LENGTH_BYTES)
|
if (length != (POCSAG_FRAME_LENGTH_BYTES + 1U))
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
uint16_t space = m_buffer.getSpace();
|
uint16_t space = m_buffer.getSpace();
|
||||||
if (space < POCSAG_FRAME_LENGTH_BYTES)
|
if (space < (POCSAG_FRAME_LENGTH_BYTES + 1U))
|
||||||
return 5U;
|
return 5U;
|
||||||
|
|
||||||
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++)
|
DEBUG2("MMDVM, queueing", data[0U]);
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < (POCSAG_FRAME_LENGTH_BYTES + 1U); i++)
|
||||||
m_buffer.put(data[i]);
|
m_buffer.put(data[i]);
|
||||||
|
|
||||||
return 0U;
|
return 0U;
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ public:
|
|||||||
|
|
||||||
uint8_t getSpace() const;
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
bool busy();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_buffer;
|
CSerialRB m_buffer;
|
||||||
arm_fir_instance_q15 m_modFilter;
|
arm_fir_instance_q15 m_modFilter;
|
||||||
|
|||||||
+1
-4
@@ -21,10 +21,7 @@
|
|||||||
|
|
||||||
#include "SerialPort.h"
|
#include "SerialPort.h"
|
||||||
|
|
||||||
#if defined(VK6MST_TEENSY_PI3_SHIELD_I2C)
|
#if defined(__SAM3X8E__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
//it will load I2CTeensy.cpp
|
|
||||||
|
|
||||||
#elif defined(__SAM3X8E__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
|
||||||
|
|
||||||
void CSerialPort::beginInt(uint8_t n, int speed)
|
void CSerialPort::beginInt(uint8_t n, int speed)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
|||||||
#define TCXO "NO TCXO"
|
#define TCXO "NO TCXO"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DESCRIPTION "MMDVM 20180723 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG)"
|
#define DESCRIPTION "MMDVM 20180327 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG)"
|
||||||
|
|
||||||
#if defined(GITVERSION)
|
#if defined(GITVERSION)
|
||||||
#define concat(a, b, c) a " " b " GitID #" c ""
|
#define concat(a, b, c) a " " b " GitID #" c ""
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ Boston, MA 02110-1301, USA.
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint16_t SERIAL_RINGBUFFER_SIZE = 1000U;
|
const uint16_t SERIAL_RINGBUFFER_SIZE = 2000U;
|
||||||
|
|
||||||
class CSerialRB {
|
class CSerialRB {
|
||||||
public:
|
public:
|
||||||
|
|||||||
+6
-6
@@ -50,7 +50,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ************* USART1 ***************** */
|
/* ************* USART1 ***************** */
|
||||||
#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
||||||
|
|
||||||
volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE];
|
volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE];
|
||||||
volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE];
|
volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE];
|
||||||
@@ -841,7 +841,7 @@ void CSerialPort::beginInt(uint8_t n, int speed)
|
|||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
InitUSART3(speed);
|
InitUSART3(speed);
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F4_DVM)
|
||||||
InitUSART1(speed);
|
InitUSART1(speed);
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO)
|
||||||
InitUSART2(speed);
|
InitUSART2(speed);
|
||||||
@@ -865,7 +865,7 @@ int CSerialPort::availableInt(uint8_t n)
|
|||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
return AvailUSART3();
|
return AvailUSART3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F4_DVM)
|
||||||
return AvailUSART1();
|
return AvailUSART1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO)
|
||||||
return AvailUSART2();
|
return AvailUSART2();
|
||||||
@@ -887,7 +887,7 @@ int CSerialPort::availableForWriteInt(uint8_t n)
|
|||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
return AvailForWriteUSART3();
|
return AvailForWriteUSART3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F4_DVM)
|
||||||
return AvailForWriteUSART1();
|
return AvailForWriteUSART1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO)
|
||||||
return AvailForWriteUSART2();
|
return AvailForWriteUSART2();
|
||||||
@@ -909,7 +909,7 @@ uint8_t CSerialPort::readInt(uint8_t n)
|
|||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
return ReadUSART3();
|
return ReadUSART3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F4_DVM)
|
||||||
return ReadUSART1();
|
return ReadUSART1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO)
|
||||||
return ReadUSART2();
|
return ReadUSART2();
|
||||||
@@ -933,7 +933,7 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
|||||||
WriteUSART3(data, length);
|
WriteUSART3(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush3();
|
TXSerialFlush3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F4_DVM)
|
||||||
WriteUSART1(data, length);
|
WriteUSART1(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush1();
|
TXSerialFlush1();
|
||||||
|
|||||||
Reference in New Issue
Block a user