26 AudioBoardAction(AudioBoard &
board, AudioDriverKey key) {
28 this->p_board = &
board;
32 int id()
override {
return (
int) key | 0x400; }
33 bool readValue()
override {
return p_board->isKeyPressed((
int)key); }
70 void *ref =
nullptr) {
71 AudioBoardAction *abo =
new AudioBoardAction(
board(), key);
73 LOGE(
"Failed to allocate AudioBoardAction");
76 abo->actionOn = action;
77 abo->ref = (ref ==
nullptr) ?
this : ref;
86 void *ref =
nullptr) {
88 AudioBoardAction *abo =
new AudioBoardAction(
board(), key);
90 LOGE(
"Failed to allocate AudioBoardAction");
93 abo->actionOn = actionOn;
94 abo->actionOff = actionOff;
95 abo->ref = (ref ==
nullptr) ?
this : ref;
108 void *ref =
nullptr) {
112 actions.
add(pin, action, activeLogic, ref ==
nullptr ?
this : ref);
127 actions.
add(pin, action, activeLogic, ref ==
nullptr ?
this : ref);
142 float new_volume = current_volume + inc;
143 LOGI(
"incrementVolume: %f -> %f", current_volume, new_volume);
219 bool powerActive = !isConnected;
220 LOGW(
"Headphone jack has been %s",
221 isConnected ?
"inserted" :
"removed");
243 return getPinID(PinFunction::HEADPHONE_DETECT);
344 LOGD(
"actionInputMode")
357 (!
cfg.
sd_active || (vol_down != sd_cs && vol_up != sd_cs))) {
358 LOGD(
"actionVolumeDown")
360 LOGD(
"actionVolumeUp")
363 LOGW(
"Volume Buttons ignored because of conflict");
396 if (!
board())
return false;
397 return board().isKeyPressed(key);
418 auto sd_opt =
getPins().getSPIPins(PinFunction::SD);
420 sd_cs = sd_opt.value().cs;
423 LOGI(
"No sd defined -> sd_active=false")
432 auto opt =
board().getPins().getPin(pin);
433 PinLogic logic = PinLogic::Input;
434 if (opt) logic = opt.value().pin_logic;
436 case PinLogic::Input:
437 case PinLogic::InputActiveLow:
439 case PinLogic::InputActiveHigh:
441 case PinLogic::InputActiveTouch:
static void * p_lastAudioBoardStream
global reference to access from static callback methods
Definition AudioBoardStream.h:8
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACEI()
Definition AudioLoggerIDF.h:32
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30