From 17e13de0071a935fdb18f31b3989fe23de6d635c Mon Sep 17 00:00:00 2001 From: unicod Date: Sat, 2 Aug 2025 13:51:42 +0200 Subject: [PATCH] todo pincfg --- pincfg.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/pincfg.h b/pincfg.h index 7779f64..892dd1f 100644 --- a/pincfg.h +++ b/pincfg.h @@ -2,10 +2,11 @@ #define __PINCFG_H__ typedef enum: uint8_t { - PIN_MODE_DIG_IN, + PIN_MODE_DIG_IN = 0, PIN_MODE_ANA_IN, PIN_MODE_DIG_OUT, - PIN_MODE_ANA_OUT + PIN_MODE_ANA_OUT, + PIN_MODE_UNUSED = 0xFF } PIN_MODES; typedef enum: uint8_t { @@ -13,11 +14,55 @@ typedef enum: uint8_t { PULLUP_ON } PULLUP_MODES; +typedef enum: uint8_t { + EDGE_RISING, + EDGE_FALLING +} EDGE_POLARITY; + +typedef enum: uint8_t { + MIDI_CMD_SNAPSHOT = 0, // call snapshot + MIDI_CMD_FADER_ABS, // direct set fader value + MIDI_CMD_FADER_REL, // inc/dec fader value + MIDI_CMD_MUTE, // direct set mute state + MIDI_CMD_MUTE_TOGGLE, // toggle mute state + MIDI_CMD_PAN, // direct set panorama + MIDI_CMD_NONE = 0xFF // no command assigned +} MIDI_CMD_TYPES; + +struct MidiSelVal { + uint8_t chsel; // control element select (channel ID) + uint8_t val; // value of control element +}; + +struct MidiFaderRel { + uint8_t chsel; // fader chan ID + int8_t step; // step size (neg:downward, pos:upward) + uint8_t min; // lowest fader value + uint8_t max; // highest fader value +}; + +struct MidiMute { + uint8_t chsel; // mute chan ID + uint8_t edgecfg; // -1: +}; + +union MidiCmdCfg { + uint8_t Snapshot; + MidiSelVal FaderAbs; + MidiSelVal Mute; + MidiSelVal Pan; + MidiFaderRel FaderRel; + MidiMuteToggle MuteToggle; +}; + + struct PinCfg { + uint8_t PinSel; PIN_MODES Mode; union { struct { PULLUP_MODES Pullup; + MIDI_CMD_TYPES MidiCmd; } CfgDigIn; struct { uint8_t todo;