Improve JVS bus life cycle handling

This commit is contained in:
Tau
2019-11-03 13:01:03 -05:00
parent 93fcdf8f6d
commit 0e1cfb66db
24 changed files with 164 additions and 65 deletions

View File

@ -14,7 +14,7 @@ static uint16_t diva_io_coins;
static HANDLE diva_io_slider_thread;
static bool diva_io_slider_stop_flag;
HRESULT diva_io_init(void)
HRESULT diva_io_jvs_init(void)
{
return S_OK;
}
@ -68,6 +68,11 @@ void diva_io_jvs_read_coin_counter(uint16_t *out)
void diva_io_jvs_set_coin_blocker(bool open)
{}
HRESULT diva_io_slider_init(void)
{
return S_OK;
}
void diva_io_slider_start(diva_io_slider_callback_t callback)
{
if (diva_io_slider_thread != NULL) {

View File

@ -1,10 +1,11 @@
LIBRARY divaio
EXPORTS
diva_io_init
diva_io_jvs_init
diva_io_jvs_poll
diva_io_jvs_read_coin_counter
diva_io_jvs_set_coin_blocker
diva_io_slider_init
diva_io_slider_set_leds
diva_io_slider_start
diva_io_slider_stop

View File

@ -5,15 +5,15 @@
#include <stdbool.h>
#include <stdint.h>
/* Initialize the Project Diva IO provider DLL. This is the first function to be
called on this DLL. Returning failure from this function will cause the main
application to immediately exit.
/* Initialize JVS-based input. This function will be called before any other
diva_io_jvs_*() function calls. Errors returned from this function will
manifest as a disconnected JVS bus.
All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is
your responsibility. */
HRESULT diva_io_init(void);
HRESULT diva_io_jvs_init(void);
/* Poll JVS input.
@ -38,6 +38,15 @@ void diva_io_jvs_read_coin_counter(uint16_t *out);
void diva_io_jvs_set_coin_blocker(bool open);
/* Initialize touch slider emulation. This function will be called before any
other diva_io_slider_*() function calls.
All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is
your responsibility. */
HRESULT diva_io_slider_init(void);
/* Project Diva touch sliders consist of 32 pressure sensitive cells, where
cell 1 (array index 0) is the rightmost cell and cell 32 (array index 31) is
the leftmost cell. */