Decouple hardware specific code from generic, agnostic code

This commit is contained in:
Allen Hill
2026-06-23 17:20:59 -07:00
parent fb130559e2
commit 0b0c9335f9
24 changed files with 768 additions and 910 deletions
+12 -14
View File
@@ -16,27 +16,25 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Media-control actuator: emulates play/pause and skip button presses on the
// audio source by toggling MIC_CONTROL (PB1/WO1) with TCA0 in FRQ mode.
// Media-control: route/handle head-unit button presses to the audio source.
#ifndef MEDIACONTROL_H
#define MEDIACONTROL_H
#include <stdbool.h>
#include <stdint.h>
// One-time hardware bring-up for the mic/button-press driver (TCA0 + PB1).
// Actions list
typedef enum : uint8_t {
MEDIA_PLAY_PAUSE = 0,
MEDIA_SKIP_FORWARD,
MEDIA_SKIP_BACKWARD,
} AVCLAN_media_fn_t;
// One-time hardware bring-up for the media driver.
void mediacontrol_init();
// Emulate a single play/pause button press on the source device.
void AVCLAN_micPlayPause();
// Emulate skip-forward/backward button presses
void AVCLAN_micSkipForward();
void AVCLAN_micSkipBackward();
// Keep the press waveform roughly in sync while a bus transaction has masked
// interrupts. MUST be called with interrupts disabled (e.g. from within the
// frame layer's AVCLAN_stopEvent ATOMIC_BLOCK).
void mediacontrol_syncDuringMask();
// Emulate a button press on the source device.
void AVCLAN_mediaFunction(AVCLAN_media_fn_t fn);
#ifndef NDEBUG
bool AVCLAN_micToggle();