ubitx-v5x/TeensyDSP/Nextion.h

127 lines
3.6 KiB
C

#ifndef __Nextion_h__
#define __Nextion_h__
#include <Arduino.h>
#include "Debug.h"
#define SWS_HEADER_CHAR_TYPE 'c' //1Byte Protocol Prefix
#define SWS_HEADER_INT_TYPE 'v' //Numeric Protocol Prefex
#define SWS_HEADER_STR_TYPE 's' //for TEXT Line compatiable Character LCD Control
//===================================================================
//Begin of Nextion LCD Protocol
//
// v0~v9, va~vz : Numeric (Transceiver -> Nextion LCD)
// s0~s9 : String (Text) (Transceiver -> Nextion LCD)
// vlSendxxx, vloxxx: Reserve for Nextion (Nextion LCD -> Transceiver)
//
//===================================================================
#define CMD_NOW_DISP '0' //c0
extern char L_nowdisp; //Sended nowdisp
#define CMD_VFO_TYPE 'v' //cv
extern char L_vfoActive; //vfoActive
#define CMD_CURR_FREQ 'c' //vc
extern unsigned long L_vfoCurr; //vfoA
#define CMD_CURR_MODE 'c' //cc
extern byte L_vfoCurr_mode; //vfoA_mode
#define CMD_VFOA_FREQ 'a' //va
extern unsigned long L_vfoA; //vfoA
#define CMD_VFOA_MODE 'a' //ca
extern byte L_vfoA_mode; //vfoA_mode
#define CMD_VFOB_FREQ 'b' //vb
extern unsigned long L_vfoB; //vfoB
#define CMD_VFOB_MODE 'b' //cb
extern byte L_vfoB_mode; //vfoB_mode
#define CMD_IS_RIT 'r' //cr
extern char L_ritOn;
#define CMD_RIT_FREQ 'r' //vr
extern unsigned long L_ritTxFrequency; //ritTxFrequency
#define CMD_IS_TX 't' //ct
extern char L_inTx;
#define CMD_IS_DIALLOCK 'l' //cl
extern byte L_isDialLock; //byte isDialLock
#define CMD_IS_SPLIT 's' //cs
extern byte L_Split; //isTxType
#define CMD_IS_TXSTOP 'x' //cx
extern byte L_TXStop; //isTxType
#define CMD_TUNEINDEX 'n' //cn
extern byte L_tuneStepIndex; //byte tuneStepIndex
#define CMD_SMETER 'p' //cs
extern byte L_scaledSMeter; //scaledSMeter
#define CMD_SIDE_TONE 't' //vt
extern unsigned long L_sideTone; //sideTone
#define CMD_KEY_TYPE 'k' //ck
extern byte L_cwKeyType; //L_cwKeyType 0: straight, 1 : iambica, 2: iambicb
#define CMD_CW_SPEED 's' //vs
extern unsigned int L_cwSpeed; //cwSpeed
#define CMD_CW_DELAY 'y' //vy
extern byte L_cwDelayTime; //cwDelayTime
#define CMD_CW_STARTDELAY 'e' //ve
extern byte L_delayBeforeCWStartTime; //byte delayBeforeCWStartTime
#define CMD_ATT_LEVEL 'f' //vf
extern byte L_attLevel;
extern byte L_isIFShift; //1 = ifShift, 2 extend
#define CMD_IS_IFSHIFT 'i' //ci
extern int L_ifShiftValue;
#define CMD_IFSHIFT_VALUE 'i' //vi
extern byte L_sdrModeOn;
#define CMD_SDR_MODE 'j' //cj
#define CMD_UBITX_INFO 'm' //cm Complete Send uBITX Information
//Once Send Data, When boot
//arTuneStep, When boot, once send
//long arTuneStep[5];
#define CMD_AR_TUNE1 '1' //v1
#define CMD_AR_TUNE2 '2' //v2
#define CMD_AR_TUNE3 '3' //v3
#define CMD_AR_TUNE4 '4' //v4
#define CMD_AR_TUNE5 '5' //v5
//int idleStep = 0;
extern byte scaledSMeter;
extern float calcVSWR;
extern float L_calcVSWR;
extern byte scaledVSWR;
extern byte L_scaledVSWR;
extern float fwdPower;
extern float L_fwdPower;
extern float revPower;
extern float L_revPower;
void sendHeader(char varType, char varIndex);
void sendCommandUL(char varIndex, unsigned long sendValue);
void sendCommandL(char varIndex, long sendValue);
void sendCommandStr(char varIndex, const char* sendValue);
void sendCommand1Num(char varIndex, char sendValue);
//=======================================================
//END OF Nextion Protocol
//=======================================================
#endif