Compare commits

...

4 Commits

3 changed files with 62 additions and 14 deletions

View File

@ -23,7 +23,7 @@
// Compile Option
//==============================================================================
//Ubitx Board Version
#define UBITX_BOARD_VERSION 2 //v1 ~ v4 : 4, v5: 5
#define UBITX_BOARD_VERSION 5 //v1 ~ v4 : 4, v5: 5
//Depending on the type of LCD mounted on the uBITX, uncomment one of the options below.
//You must select only one.
@ -39,9 +39,12 @@
#define I2C_LCD_SECOND_ADDRESS_DEFAULT 0x3F //0x27 //only using Dual LCD Mode
//Select betwen Analog S-Meter and DSP (I2C) Meter
#define USE_I2CSMETER
//#define USE_I2CSMETER
#define EXTEND_KEY_GROUP1 //MODE, BAND(-), BAND(+), STEP
// Use alternate keyer?
#define USE_ALTKEYER
//#define EXTEND_KEY_GROUP1 //MODE, BAND(-), BAND(+), STEP
//#define EXTEND_KEY_GROUP2 //Numeric (0~9), Point(.), Enter //Not supported in Version 1.0x
//Custom LPF Filter Mod
@ -219,6 +222,12 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define ANALOG_SPARE (A7)
#define ANALOG_SMETER (A7) //by KD8CEC
#ifdef USE_ALTKEYER
#define DIGITAL_DOT (12)
#define DIGITAL_DASH (11)
#define DIGITAL_KEY (A3)
#endif
/**
* The second set of 16 pins on the Raduino's bottom connector are have the three clock outputs and the digital lines to control the rig.
* This assignment is as follows :

View File

@ -1292,6 +1292,12 @@ void initPorts(){
pinMode(ANALOG_KEYER, INPUT_PULLUP);
pinMode(ANALOG_SMETER, INPUT); //by KD8CEC
#ifdef USE_ALTKEYER
pinMode(DIGITAL_DOT, INPUT_PULLUP);
pinMode(DIGITAL_DASH, INPUT_PULLUP);
if (DIGITAL_KEY != PTT) pinMode(DIGITAL_KEY, INPUT_PULLUP);
#endif
#ifdef USE_CUSTOM_LPF_FILTER
if (isCustomFilter_A7)
{
@ -1460,6 +1466,13 @@ void checkAutoSaveFreqMode()
void loop(){
if (isCWAutoMode == 0){ //when CW AutoKey Mode, disable this process
#ifdef USE_ALTKEYER
// when using the alternate keyer, don't check the PTT if we're in CW mode--assuming the pin is the same as PTT
if (DIGITAL_KEY == PTT) {
if (!txCAT && (cwMode == 0))
checkPTT();
} else
#endif
if (!txCAT)
checkPTT();
checkButton();

View File

@ -38,7 +38,21 @@
char lastPaddle = 0;
//reads the analog keyer pin and reports the paddle
byte getPaddle(){
byte getPaddle() {
#ifdef USE_ALTKEYER
// Alternate keyer
if ((DIGITAL_KEY != PTT) || ((DIGITAL_KEY == PTT) && (cwMode > 0))) {
if (digitalRead(DIGITAL_KEY) == LOW) {
return PADDLE_STRAIGHT;
}
}
// paddles work whether or not CW mode is actually selected
int rv = 0;
rv |= digitalRead(DIGITAL_DOT) == LOW ? PADDLE_DOT : 0;
rv |= digitalRead(DIGITAL_DASH) == LOW ? PADDLE_DASH : 0;
return rv;
#else
int paddle = analogRead(ANALOG_KEYER);
if (paddle > 800) // above 4v is up
@ -52,6 +66,7 @@ byte getPaddle(){
return PADDLE_BOTH; //both are between 1 and 2v
else
return PADDLE_STRAIGHT; //less than 1v is the straight key
#endif
}
/**
@ -97,8 +112,21 @@ unsigned char keyerState = IDLE;
//create by KD8CEC for compatible with new CW Logic
char update_PaddleLatch(byte isUpdateKeyState) {
unsigned char tmpKeyerControl = 0;
int paddle = analogRead(ANALOG_KEYER);
#ifdef USE_ALTKEYER
// One big note... I have no idea how debounce does or doesn't affect this... but there is no debounce right now. It's conceivable
// that the normal uBITX use of an analog input for this masks bouncing...
if ((digitalRead(DIGITAL_DASH) == LOW)) tmpKeyerControl |= DAH_L;
if (Iambic_Key) {
if (digitalRead(DIGITAL_DOT) == LOW) tmpKeyerControl |= DIT_L;
} else {
// I really would like to have the PTT (during CW mode) just result in key down regardless of Iambic, but this doesn't do that yet...
if ((DIGITAL_KEY != PTT) || ((DIGITAL_KEY == PTT) && (cwMode > 0))) {
if (digitalRead(DIGITAL_KEY) == LOW) tmpKeyerControl |= DAH_L;
}
}
#else
int paddle = analogRead(ANALOG_KEYER);
if (paddle >= cwAdcDashFrom && paddle <= cwAdcDashTo)
tmpKeyerControl |= DAH_L;
else if (paddle >= cwAdcDotFrom && paddle <= cwAdcDotTo)
@ -114,6 +142,7 @@ char update_PaddleLatch(byte isUpdateKeyState) {
else
tmpKeyerControl = 0 ;
}
#endif
if (isUpdateKeyState == 1)
keyerControl |= tmpKeyerControl;
@ -224,10 +253,9 @@ void cwKeyer(void){
Check_Cat(2);
} //end of while
}
else{
} else {
while(1){
if (update_PaddleLatch(0) == DIT_L) {
if (update_PaddleLatch(0) == DAH_L) {
// if we are here, it is only because the key is pressed
if (!inTx){
//DelayTime Option
@ -239,7 +267,7 @@ void cwKeyer(void){
}
cwKeydown();
while ( update_PaddleLatch(0) == DIT_L )
while ( update_PaddleLatch(0) == DAH_L )
delay_background(1, 3);
cwKeyUp();
@ -365,5 +393,3 @@ void cwKeyer(){
}
}
*/