mirror of https://github.com/g4klx/MMDVM.git
Merge pull request #279 from F4FXL/FM_Ext
Remove SerialUSB for Arduino and remove uneeded class
This commit is contained in:
commit
96e1a765f9
5
Config.h
5
Config.h
|
@ -52,11 +52,6 @@
|
||||||
#define ARDUINO_DUE_ZUM_V10
|
#define ARDUINO_DUE_ZUM_V10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use the native USB port instead of the programming port
|
|
||||||
// The native port is recommended when using FM network
|
|
||||||
// as the rpogramming port does not have the required throughput
|
|
||||||
// #define ARDUINO_DUE_USE_NATIVE_USB_PORT
|
|
||||||
|
|
||||||
// For the SP8NTH board
|
// For the SP8NTH board
|
||||||
// #define ARDUINO_DUE_NTH
|
// #define ARDUINO_DUE_NTH
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,7 @@ void CSerialPort::beginInt(uint8_t n, int speed)
|
||||||
{
|
{
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(ARDUINO_DUE_USE_NATIVE_USB_PORT)
|
|
||||||
SerialUSB.begin(speed);
|
|
||||||
#else
|
|
||||||
Serial.begin(speed);
|
Serial.begin(speed);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 2U:
|
case 2U:
|
||||||
Serial2.begin(speed);
|
Serial2.begin(speed);
|
||||||
|
@ -51,11 +47,7 @@ int CSerialPort::availableInt(uint8_t n)
|
||||||
{
|
{
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(ARDUINO_DUE_USE_NATIVE_USB_PORT)
|
|
||||||
return SerialUSB.available();
|
|
||||||
#else
|
|
||||||
return Serial.available();
|
return Serial.available();
|
||||||
#endif
|
|
||||||
case 2U:
|
case 2U:
|
||||||
return Serial2.available();
|
return Serial2.available();
|
||||||
case 3U:
|
case 3U:
|
||||||
|
@ -69,11 +61,7 @@ int CSerialPort::availableForWriteInt(uint8_t n)
|
||||||
{
|
{
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(ARDUINO_DUE_USE_NATIVE_USB_PORT)
|
|
||||||
return SerialUSB.availableForWrite();
|
|
||||||
#else
|
|
||||||
return Serial.availableForWrite();
|
return Serial.availableForWrite();
|
||||||
#endif
|
|
||||||
case 2U:
|
case 2U:
|
||||||
return Serial2.availableForWrite();
|
return Serial2.availableForWrite();
|
||||||
case 3U:
|
case 3U:
|
||||||
|
@ -87,11 +75,7 @@ uint8_t CSerialPort::readInt(uint8_t n)
|
||||||
{
|
{
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(ARDUINO_DUE_USE_NATIVE_USB_PORT)
|
|
||||||
return SerialUSB.read();
|
|
||||||
#else
|
|
||||||
return Serial.read();
|
return Serial.read();
|
||||||
#endif
|
|
||||||
case 2U:
|
case 2U:
|
||||||
return Serial2.read();
|
return Serial2.read();
|
||||||
case 3U:
|
case 3U:
|
||||||
|
@ -105,17 +89,10 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
||||||
{
|
{
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(ARDUINO_DUE_USE_NATIVE_USB_PORT)
|
|
||||||
SerialUSB.write(data, length);
|
|
||||||
if (flush)
|
|
||||||
SerialUSB.flush();
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
Serial.write(data, length);
|
Serial.write(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case 2U:
|
case 2U:
|
||||||
Serial2.write(data, length);
|
Serial2.write(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
|
|
36
SerialRB.cpp
36
SerialRB.cpp
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
Serial RB control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SerialRB.h"
|
|
||||||
|
|
||||||
CSerialRB::CSerialRB(uint16_t length) :
|
|
||||||
CRingBuffer<uint8_t>(length)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t CSerialRB::get()
|
|
||||||
{
|
|
||||||
uint8_t value;
|
|
||||||
if(CRingBuffer<uint8_t>::get(value))
|
|
||||||
return value;
|
|
||||||
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
|
|
36
SerialRB.h
36
SerialRB.h
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
Serial fifo control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(SERIALRB_H)
|
|
||||||
#define SERIALRB_H
|
|
||||||
|
|
||||||
#include "RingBuffer.h"
|
|
||||||
|
|
||||||
const uint16_t SERIAL_RINGBUFFER_SIZE = 370U;
|
|
||||||
|
|
||||||
class CSerialRB : public CRingBuffer<uint8_t>{
|
|
||||||
public:
|
|
||||||
CSerialRB(uint16_t length = SERIAL_RINGBUFFER_SIZE);
|
|
||||||
|
|
||||||
uint8_t get();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue