Updated GPIO keyer with enable/disable functionality.

This commit is contained in:
Rob French 2020-02-28 23:34:44 -06:00
parent 1b4775f452
commit 39293c4130
4 changed files with 26 additions and 5 deletions

View File

@ -1 +1 @@
#Quisk version 4.1.52-upr1
#Quisk version 4.1.52

View File

@ -145,6 +145,7 @@ static sem_t cw_event;
static int cw_hangtime_msec = 250;
static int running, keyer_out = 0;
static int cw_keyer_enabled = 1;
// Function prototypes
@ -217,10 +218,10 @@ void clear_memory() {
static void set_keyer_out(int state) {
if (state && tr_switch_gpio) {
digitalWrite(tr_switch_gpio, 1);
digitalWrite(tr_switch_gpio, 1 & cw_keyer_enabled);
}
keyer_out = state;
digitalWrite(keyer_out_gpio, keyer_out);
digitalWrite(keyer_out_gpio, keyer_out & cw_keyer_enabled);
}
static void* keyer_thread(void *arg) {
@ -502,7 +503,7 @@ void close_key_gpiokeyer(void)
int is_key_down_gpiokeyer(void)
{
static int retval;
retval = keyer_out;
retval = keyer_out & cw_keyer_enabled;
return retval;
}
@ -542,4 +543,9 @@ void quisk_set_gpio_keyer_strict(int flag)
cw_keyer_spacing = (flag == 0 ? 0 : 1);
}
void quisk_set_gpio_keyer_enabled(int flag)
{
cw_keyer_enabled = (flag == 0 ? 0 : 1);
}
#endif

12
quisk.c
View File

@ -5231,6 +5231,17 @@ static PyObject * set_gpio_keyer_strict(PyObject * self, PyObject * args)
Py_INCREF (Py_None);
return Py_None;
}
static PyObject * set_gpio_keyer_enabled(PyObject * self, PyObject * args)
{
int enabled;
if (!PyArg_ParseTuple (args, "i", &enabled))
return NULL;
quisk_set_gpio_keyer_enabled(enabled);
Py_INCREF (Py_None);
return Py_None;
}
#endif
static PyMethodDef QuiskMethods[] = {
@ -5339,6 +5350,7 @@ static PyMethodDef QuiskMethods[] = {
{"set_gpio_keyer_weight", set_gpio_keyer_weight, METH_VARARGS, "Change the CW keyer symbol weight."},
{"set_gpio_keyer_reversed", set_gpio_keyer_reversed, METH_VARARGS, "Enabled/disable reversed paddles."},
{"set_gpio_keyer_strict", set_gpio_keyer_strict, METH_VARARGS, "Enable/disable strict character spacing."},
{"set_gpio_keyer_enabled", set_gpio_keyer_enabled, METH_VARARGS, "Enable/disable the CW keyer"},
#endif
{NULL, NULL, 0, NULL} /* Sentinel */
};

View File

@ -288,6 +288,7 @@ void quisk_set_gpio_keyer_speed(int);
void quisk_set_gpio_keyer_weight(int);
void quisk_set_gpio_keyer_reversed(int);
void quisk_set_gpio_keyer_strict(int);
void quisk_set_gpio_keyer_enabled(int);
#endif
// Functions supporting digital voice codecs
@ -347,6 +348,7 @@ int import_quisk_api(void); // used to initialize Quisk_API
//#define quisk_set_gpio_keyer_weight (*( void (*) (int) )Quisk_API[13])
//#define quisk_set_gpio_keyer_reversed (*( void (*) (int) )Quisk_API[14])
//#define quisk_set_gpio_keyer_strict (*( void (*) (int) )Quisk_API[15])
//#define quisk_set_gpio_keyer_enabled (*( void (*) (int) )Quisk_API[16])
//#endif
#else
@ -368,6 +370,7 @@ void quisk_sample_source4(ty_sample_start, ty_sample_stop, ty_sample_read, ty_sa
//void quisk_set_gpio_keyer_weight(int);
//void quisk_set_gpio_keyer_reversed(int);
//void quisk_set_gpio_keyer_strict(int);
//void quisk_set_gpio_keyer_enabled(int);
//#endif
//#if defined(ENABLE_GPIO_KEYER)
@ -375,7 +378,7 @@ void quisk_sample_source4(ty_sample_start, ty_sample_stop, ty_sample_read, ty_sa
// &quisk_sound_state, &QuiskGetConfigInt, &QuiskGetConfigDouble, &QuiskGetConfigString, &QuiskTimeSec, \
// &QuiskSleepMicrosec, &QuiskPrintTime, &quisk_sample_source, &quisk_dvoice_freedv, &quisk_is_key_down, \
// &quisk_sample_source4, &quisk_set_gpio_keyer_mode, &quisk_set_gpio_keyer_speed, \
// &quisk_set_gpio_keyer_weight, &quisk_set_gpio_keyer_reversed, &quisk_set_gpio_keyer_strict \
// &quisk_set_gpio_keyer_weight, &quisk_set_gpio_keyer_reversed, &quisk_set_gpio_keyer_strict, &quisk_set_gpio_keyer_enabled \
// }
//#else
#define QUISK_API_INIT { \