update Wii EC

This commit is contained in:
VerstreuteSeele
2023-01-11 01:51:39 +01:00
parent 5eb43403eb
commit de8bdd4469
116 changed files with 3220 additions and 3885 deletions

View File

@@ -1,16 +1,16 @@
//! udraw support is NOT written - this is just notes about the init function
#include <stdint.h>
#include <furi.h> // Core API
#include <stdint.h>
#include <furi.h> // Core API
#include "wii_anal.h"
#include "wii_ec.h"
#include "bc_logging.h"
#include "wii_anal.h"
#include "wii_ec.h"
#include "bc_logging.h"
#include "i2c_workaround.h" //! temporary workaround for a bug in furi i2c [see header]
#include "i2c_workaround.h" //! temporary workaround for a bug in furi i2c [see header]
// ** If you want to see what this source code looks like with all the MACROs expanded
// ** grep -v '#include ' wii_ec_udraw.c | gcc -E -o /dev/stdout -xc -
#include "wii_ec_macros.h"
# include "wii_ec_macros.h"
//+============================================================================ ========================================
// https://github.com/madhephaestus/WiiChuck/blob/master/src/Drawsome.cpp#L3
@@ -27,12 +27,13 @@
// read 6 bytes starting from 0x00 (#3)
// read 6 bytes starting from 0x00 (#4)
//
bool udraw_init(wiiEC_t* const pec) {
ENTER;
bool rv = true;
bool udraw_init (wiiEC_t* const pec)
{
ENTER;
bool rv = true;
(void)pec;
/*
(void)pec;
/*
//! this is the Drawsome code, NOT the uDraw code !!
static const uint8_t reg[9] = {0x20, 0x28, 0x30, 0x38, 0x00, 0x00, 0xFB, 0x00, 0x00}; // 0..8
const uint8_t* p = reg;
@@ -71,79 +72,74 @@ fail:
done:
*/
LEAVE;
return rv;
LEAVE;
return rv;
}
//+============================================================================ ========================================
bool udraw_key(const eventMsg_t* const msg, state_t* const state) {
(void)state;
bool run = true;
bool udraw_key (const eventMsg_t* const msg, state_t* const state)
{
(void)state;
bool run = true;
switch(msg->input.type) {
case InputTypeShort: //# <! After InputTypeRelease within INPUT_LONG_PRESS interval
switch(msg->input.key) {
case InputKeyUp: //# <U [ SHORT-UP ]
case InputKeyDown: //# <D [ SHORT-DOWN ]
case InputKeyLeft: //# <L [ SHORT-LEFT ]
case InputKeyRight: //# <R [ SHORT-RIGHT ]
case InputKeyOk: //# <O [ SHORT-OK ]
case InputKeyBack: //# <B [ SHORT-BACK ]
default:
break; //# <?
}
break;
case InputTypeLong: //# >! After INPUT_LONG_PRESS interval, asynch to InputTypeRelease
switch(msg->input.key) {
case InputKeyUp: //# >U [ LONG-UP ]
case InputKeyDown: //# >D [ LONG-DOWN ]
case InputKeyLeft: //# >L [ LONG-LEFT ]
case InputKeyRight: //# >R [ LONG-RIGHT ]
case InputKeyOk: //# >O [ LONG-OK ]
case InputKeyBack: //# >B [ LONG-BACK ]
default:
break; //# >?
}
break;
case InputTypePress: //# +! After debounce
switch(msg->input.key) {
case InputKeyUp: //# +U [ SHORT-UP ]
case InputKeyDown: //# +D [ SHORT-DOWN ]
case InputKeyLeft: //# +L [ SHORT-LEFT ]
case InputKeyRight: //# +R [ SHORT-RIGHT ]
case InputKeyOk: //# +O [ SHORT-OK ]
case InputKeyBack: //# +B [ SHORT-BACK ]
default:
break; //# +?
}
break;
case InputTypeRepeat: //# *! With INPUT_REPEATE_PRESS period after InputTypeLong event
switch(msg->input.key) {
case InputKeyUp: //# *U [ REPEAT-UP ]
case InputKeyDown: //# *D [ REPEAT-DOWN ]
case InputKeyLeft: //# *L [ REPEAT-LEFT ]
case InputKeyRight: //# *R [ REPEAT-RIGHT ]
case InputKeyOk: //# *O [ REPEAT-OK ]
case InputKeyBack: //# *B [ REPEAT-BACK ]
default:
break; //# *?
}
break;
case InputTypeRelease: //# -! After debounce
switch(msg->input.key) {
case InputKeyUp: //# -U [ RELEASE-UP ]
case InputKeyDown: //# -D [ RELEASE-DOWN ]
case InputKeyLeft: //# -L [ RELEASE-LEFT ]
case InputKeyRight: //# -R [ RELEASE-RIGHT ]
case InputKeyOk: //# -O [ RELEASE-OK ]
case InputKeyBack: //# -B [ RELEASE-BACK ]
default:
break; //# -?
}
break;
default:
return true;
}
switch (msg->input.type) {
case InputTypeShort: //# <! After InputTypeRelease within INPUT_LONG_PRESS interval
switch (msg->input.key) {
case InputKeyUp: //# <U [ SHORT-UP ]
case InputKeyDown: //# <D [ SHORT-DOWN ]
case InputKeyLeft: //# <L [ SHORT-LEFT ]
case InputKeyRight: //# <R [ SHORT-RIGHT ]
case InputKeyOk: //# <O [ SHORT-OK ]
case InputKeyBack: //# <B [ SHORT-BACK ]
default: break ; //# <?
}
break;
case InputTypeLong: //# >! After INPUT_LONG_PRESS interval, asynch to InputTypeRelease
switch (msg->input.key) {
case InputKeyUp: //# >U [ LONG-UP ]
case InputKeyDown: //# >D [ LONG-DOWN ]
case InputKeyLeft: //# >L [ LONG-LEFT ]
case InputKeyRight: //# >R [ LONG-RIGHT ]
case InputKeyOk: //# >O [ LONG-OK ]
case InputKeyBack: //# >B [ LONG-BACK ]
default: break ; //# >?
}
break;
case InputTypePress: //# +! After debounce
switch (msg->input.key) {
case InputKeyUp: //# +U [ SHORT-UP ]
case InputKeyDown: //# +D [ SHORT-DOWN ]
case InputKeyLeft: //# +L [ SHORT-LEFT ]
case InputKeyRight: //# +R [ SHORT-RIGHT ]
case InputKeyOk: //# +O [ SHORT-OK ]
case InputKeyBack: //# +B [ SHORT-BACK ]
default: break ; //# +?
}
break;
case InputTypeRepeat: //# *! With INPUT_REPEATE_PRESS period after InputTypeLong event
switch (msg->input.key) {
case InputKeyUp: //# *U [ REPEAT-UP ]
case InputKeyDown: //# *D [ REPEAT-DOWN ]
case InputKeyLeft: //# *L [ REPEAT-LEFT ]
case InputKeyRight: //# *R [ REPEAT-RIGHT ]
case InputKeyOk: //# *O [ REPEAT-OK ]
case InputKeyBack: //# *B [ REPEAT-BACK ]
default: break ; //# *?
}
break;
case InputTypeRelease: //# -! After debounce
switch (msg->input.key) {
case InputKeyUp: //# -U [ RELEASE-UP ]
case InputKeyDown: //# -D [ RELEASE-DOWN ]
case InputKeyLeft: //# -L [ RELEASE-LEFT ]
case InputKeyRight: //# -R [ RELEASE-RIGHT ]
case InputKeyOk: //# -O [ RELEASE-OK ]
case InputKeyBack: //# -B [ RELEASE-BACK ]
default: break ; //# -?
}
break;
default: return true ;
}
return run;
return run;
}