Added quisk_close_key to the list of publicly available functions, so I can close the existing key and open a new one if desired. Also added some debug updates to the GPIO keyer.
This commit is contained in:
parent
39293c4130
commit
c7125fe21d
10
gpiokeyer.c
10
gpiokeyer.c
@ -437,6 +437,10 @@ static void* keyer_thread(void *arg) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
fprintf(stdout, "[GPIO Keyer] thread should be ending now\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int open_key_gpiokeyer(const char * name)
|
||||
@ -494,10 +498,16 @@ int open_key_gpiokeyer(const char * name)
|
||||
|
||||
void close_key_gpiokeyer(void)
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
fprintf(stdout, "[GPIO Keyer] closing key\n");
|
||||
#endif
|
||||
running = 0;
|
||||
sem_post(&cw_event);
|
||||
pthread_join(keyer_thread_id, 0);
|
||||
sem_destroy(&cw_event);
|
||||
#if defined(DEBUG)
|
||||
fprintf(stdout, "[GPIO Keyer] keyer closed\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int is_key_down_gpiokeyer(void)
|
||||
|
10
quisk.c
10
quisk.c
@ -3045,6 +3045,15 @@ static PyObject * open_key(PyObject * self, PyObject * args)
|
||||
return PyInt_FromLong(quisk_open_key(name));
|
||||
}
|
||||
|
||||
static PyObject * close_key(PyObject * self, PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple (args, ""))
|
||||
return NULL;
|
||||
quisk_close_key();
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static void close_udp(void)
|
||||
{
|
||||
short msg = 0x7373; // shutdown
|
||||
@ -5332,6 +5341,7 @@ static PyMethodDef QuiskMethods[] = {
|
||||
{"start_sound", start_sound, METH_VARARGS, "Start the soundcard."},
|
||||
{"mixer_set", mixer_set, METH_VARARGS, "Set microphone mixer parameters such as volume."},
|
||||
{"open_key", open_key, METH_VARARGS, "Open access to the state of the key (CW or PTT)."},
|
||||
{"close_key", close_key, METH_VARARGS, "Close the currently selected key."},
|
||||
{"open_rx_udp", open_rx_udp, METH_VARARGS, "Open a UDP port for capture."},
|
||||
{"close_rx_udp", close_rx_udp, METH_VARARGS, "Close the UDP port used for capture."},
|
||||
{"add_rx_samples", add_rx_samples, METH_VARARGS, "Record the Rx samples received by Python code."},
|
||||
|
Loading…
Reference in New Issue
Block a user