mirror of
https://github.com/juribeparada/MMDVM_HS.git
synced 2025-12-06 07:12:08 +01:00
tested with gcc4.9.3 Ubuntu 16.10 (did not work before change, every second TX was lost) tested also with gcc arm embedded q4 2016 on Ubuntu 16.10 (here original code worked as well) No test with Arduino & other architectures yet
125 lines
3.1 KiB
C++
125 lines
3.1 KiB
C++
/*
|
|
* Copyright (C) 2015, 2016 by Jonathan Naylor G4KLX
|
|
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#if !defined(CIO_H)
|
|
#define CIO_H
|
|
|
|
#include "Globals.h"
|
|
#include "BitRB.h"
|
|
|
|
#define LOW 0
|
|
#define HIGH 1
|
|
|
|
#define VHF1_MIN 144000000
|
|
#define VHF1_MAX 148000000
|
|
#define VHF2_MIN 219000000
|
|
#define VHF2_MAX 225000000
|
|
#define UHF1_MIN 420000000
|
|
#define UHF1_MAX 475000000
|
|
#define UHF2_MIN 842000000
|
|
#define UHF2_MAX 950000000
|
|
|
|
#define SCAN_TIME 960
|
|
#define SCAN_PAUSE 10000
|
|
|
|
extern uint32_t m_frequency_rx;
|
|
extern uint32_t m_frequency_tx;
|
|
extern uint8_t m_power;
|
|
|
|
class CIO {
|
|
|
|
public:
|
|
CIO();
|
|
|
|
// Platform API
|
|
void Init(void);
|
|
void SCLK_pin(bool on);
|
|
void SDATA_pin(bool on);
|
|
bool SREAD_pin(void);
|
|
void SLE_pin(bool on);
|
|
void CE_pin(bool on);
|
|
bool RXD_pin(void);
|
|
bool CLK_pin(void);
|
|
|
|
#if defined(BIDIR_DATA_PIN)
|
|
void RXD_pin_write(bool on);
|
|
#endif
|
|
|
|
void TXD_pin(bool on);
|
|
void PTT_pin(bool on);
|
|
void LED_pin(bool on);
|
|
void DEB_pin(bool on);
|
|
void DSTAR_pin(bool on);
|
|
void DMR_pin(bool on);
|
|
void YSF_pin(bool on);
|
|
void P25_pin(bool on);
|
|
void COS_pin(bool on);
|
|
void interrupt(void);
|
|
void resetWatchdog(void);
|
|
|
|
#if defined(BIDIR_DATA_PIN)
|
|
void Data_dir_out(bool dir);
|
|
#endif
|
|
|
|
// IO API
|
|
void write(uint8_t* data, uint16_t length);
|
|
uint16_t getSpace(void) const;
|
|
void process(void);
|
|
bool hasTXOverflow(void);
|
|
bool hasRXOverflow(void);
|
|
uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx);
|
|
void setMode(MMDVM_STATE modemState);
|
|
void setDecode(bool dcd);
|
|
void setLoDevYSF(bool ysfLoDev);
|
|
|
|
// RF interface API
|
|
void setTX(void);
|
|
void setRX(void);
|
|
void ifConf(MMDVM_STATE modemState, bool reset);
|
|
void start(void);
|
|
void startInt(void);
|
|
|
|
#if defined(SEND_RSSI_DATA)
|
|
uint16_t readRSSI(void);
|
|
#endif
|
|
|
|
// Misc functions
|
|
void dlybit(void);
|
|
void delay_rx(void);
|
|
|
|
private:
|
|
|
|
bool m_started;
|
|
CBitRB m_rxBuffer;
|
|
CBitRB m_txBuffer;
|
|
bool m_LoDevYSF;
|
|
uint32_t m_ledCount;
|
|
bool m_scanEnable;
|
|
uint32_t m_modeTimerCnt;
|
|
uint32_t m_scanPauseCnt;
|
|
uint8_t m_scanPos;
|
|
uint8_t m_TotalModes;
|
|
MMDVM_STATE m_Modes[4];
|
|
bool m_ledValue;
|
|
volatile uint32_t m_watchdog;
|
|
|
|
};
|
|
|
|
#endif
|