diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-02-19 06:47:43 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-02-19 06:47:43 +0100 |
commit | 6666a131ab36b1d96a854da80524d860f9a3884b (patch) | |
tree | 5039423cb8c5592c20f8dd3aec417158ac058484 /code/fe310/eos/wifi.c | |
parent | 15bddabc5cbe0e751fadcaaa7f7c7c36bca61331 (diff) |
eve long press/double tap/inertial scroll
spi flush bugfix
resolved dependecies: spi -> net; event -> net
renamed various handlers
Diffstat (limited to 'code/fe310/eos/wifi.c')
-rw-r--r-- | code/fe310/eos/wifi.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/code/fe310/eos/wifi.c b/code/fe310/eos/wifi.c index 688e675..c6b1d73 100644 --- a/code/fe310/eos/wifi.c +++ b/code/fe310/eos/wifi.c @@ -8,25 +8,25 @@ #include "wifi.h" -static eos_evt_fptr_t evt_handler[EOS_WIFI_MAX_MTYPE]; +static eos_evt_handler_t evt_handler[EOS_WIFI_MAX_MTYPE]; static uint16_t evt_handler_flags_buf_free = 0; static uint16_t evt_handler_flags_buf_acq = 0; -static void wifi_handler_evt(unsigned char type, unsigned char *buffer, uint16_t len) { +static void wifi_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) { if ((buffer == NULL) || (len < 1)) { eos_evtq_bad_handler(type, buffer, len); eos_net_free(buffer, 0); return; } - uint8_t mtype = buffer[0]; - if (mtype >= EOS_WIFI_MAX_MTYPE) { + unsigned char mtype = buffer[0]; + if (mtype < EOS_WIFI_MAX_MTYPE) { + evt_handler[mtype](type, buffer, len); + } else { eos_evtq_bad_handler(type, buffer, len); eos_net_free(buffer, 0); return; } - - _eos_net_handle(type, buffer, len, mtype, evt_handler, &evt_handler_flags_buf_free, &evt_handler_flags_buf_acq); } void eos_wifi_init(void) { @@ -35,14 +35,12 @@ void eos_wifi_init(void) { for (i=0; i<EOS_WIFI_MAX_MTYPE; i++) { evt_handler[i] = eos_evtq_bad_handler; } - eos_net_set_handler(EOS_NET_MTYPE_WIFI, wifi_handler_evt, 0); + eos_net_set_handler(EOS_NET_MTYPE_WIFI, wifi_handle_evt); } -void eos_wifi_set_handler(int mtype, eos_evt_fptr_t handler, uint8_t flags) { - if (mtype >= EOS_WIFI_MAX_MTYPE) { - return; - } - _eos_net_set_handler(mtype, handler, evt_handler, flags, &evt_handler_flags_buf_free, &evt_handler_flags_buf_acq); +void eos_wifi_set_handler(unsigned char mtype, eos_evt_handler_t handler) { + if (handler == NULL) handler = eos_evtq_bad_handler; + if (mtype < EOS_WIFI_MAX_MTYPE) evt_handler[mtype] = handler; } void eos_wifi_connect(const char *ssid, const char *pass) { |