Arduino AudioKit HAL
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudioKit Class Reference

AudioKit API using the audio_hal. More...

#include <AudioKitHAL.h>

Public Member Functions

AudioKitConfig defaultConfig (AudioKitInOut inout=AudioInputOutput)
 Provides the default configuration for input or output.
 
bool begin (AudioKitConfig cnfg)
 Starts the codec.
 
bool end ()
 Stops the CODEC.
 
AudioKitConfig config ()
 Provides the actual configuration.
 
bool setActive (bool active)
 Sets the codec active / inactive.
 
bool setMute (bool mute)
 Mutes the output.
 
bool setVolume (int vol)
 Defines the Volume.
 
int volume ()
 Determines the volume.
 
int8_t pinAuxin ()
 Get the gpio number for auxin detection. More...
 
int8_t pinHeadphoneDetect ()
 Get the gpio number for headphone detection. More...
 
int8_t pinPaEnable ()
 Get the gpio number for PA enable. More...
 
int8_t pinAdcDetect ()
 Get the gpio number for adc detection. More...
 
int8_t pinEs7243Mclk ()
 Get the mclk gpio number of es7243. More...
 
int8_t pinInputRec ()
 Get the record-button id for adc-button. More...
 
int8_t pinInputMode ()
 Get the number for mode-button. More...
 
int8_t pinInputSet ()
 Get number for set function. More...
 
int8_t pinInputPlay ()
 Get number for play function. More...
 
int8_t pinVolumeUp ()
 number for volume up function More...
 
int8_t pinVolumeDown ()
 Get number for volume down function. More...
 
int8_t pinResetCodec ()
 Get reset codec gpio number. More...
 
int8_t pinResetBoard ()
 Get gpio number to reset the board. More...
 
int8_t pinGreenLed ()
 Get gpio number for green led. More...
 
int8_t pinBlueLed ()
 Get blue led gpio number. More...
 
int8_t pinSpiCs ()
 SPI CS Pin for SD Drive. More...
 
void setSpeakerActive (bool active)
 Activates/deactivates the speaker amplifier output This is working only if the driver is supporting the functionality. More...
 
bool headphoneStatus ()
 Returns true if the headphone was detected. More...
 
bool isSDActive ()
 checks if the SD is active
 

Static Public Member Functions

static void actionHeadphoneDetection ()
 Switch off the PA if the headphone in plugged in and switch it on again if the headphone is unplugged.
 

Protected Member Functions

void setupHeadphoneDetection ()
 Setup the headphone detection.
 
void setupSPI ()
 Setup the SPI so that we can access the SD Drive.
 

Protected Attributes

AudioKitConfig cfg
 
audio_hal_codec_config_t audio_hal_conf
 
audio_hal_handle_t hal_handle = 0
 
audio_hal_codec_i2s_iface_t iface
 
int8_t spi_cs_pin
 
bool headphoneIsConnected = false
 
unsigned long speakerChangeTimeout = 0
 
int8_t headphonePin = -1
 
bool setup_sd_spi = true
 

Detailed Description

AudioKit API using the audio_hal.

Definition at line 194 of file AudioKitHAL.h.

Member Function Documentation

◆ headphoneStatus()

bool AudioKit::headphoneStatus ( )
inline

Returns true if the headphone was detected.

Returns
true
false

Definition at line 525 of file AudioKitHAL.h.

525  {
526  return headphonePin>0 ? !digitalRead(headphonePin) : false;
527  }

◆ pinAdcDetect()

int8_t AudioKit::pinAdcDetect ( )
inline

Get the gpio number for adc detection.

Returns
-1 non-existent Others gpio number

Definition at line 383 of file AudioKitHAL.h.

383 { return get_adc_detect_gpio(); }

◆ pinAuxin()

int8_t AudioKit::pinAuxin ( )
inline

Get the gpio number for auxin detection.

Returns
-1 non-existent Others gpio number

Definition at line 359 of file AudioKitHAL.h.

359 { return get_auxin_detect_gpio(); }

◆ pinBlueLed()

int8_t AudioKit::pinBlueLed ( )
inline

Get blue led gpio number.

Returns
-1 non-existent Others gpio number

Definition at line 471 of file AudioKitHAL.h.

471 { return get_blue_led_gpio(); }

◆ pinEs7243Mclk()

int8_t AudioKit::pinEs7243Mclk ( )
inline

Get the mclk gpio number of es7243.

Returns
-1 non-existent Others gpio number

Definition at line 391 of file AudioKitHAL.h.

391 { return get_es7243_mclk_gpio(); }

◆ pinGreenLed()

int8_t AudioKit::pinGreenLed ( )
inline

Get gpio number for green led.

Returns
-1 non-existent Others gpio number

Definition at line 463 of file AudioKitHAL.h.

463 { return get_green_led_gpio(); }

◆ pinHeadphoneDetect()

int8_t AudioKit::pinHeadphoneDetect ( )
inline

Get the gpio number for headphone detection.

Returns
-1 non-existent Others gpio number

Definition at line 367 of file AudioKitHAL.h.

367 { return get_headphone_detect_gpio(); }

◆ pinInputMode()

int8_t AudioKit::pinInputMode ( )
inline

Get the number for mode-button.

Returns
-1 non-existent Others number

Definition at line 407 of file AudioKitHAL.h.

407 { return get_input_mode_id(); }

◆ pinInputPlay()

int8_t AudioKit::pinInputPlay ( )
inline

Get number for play function.

Returns
-1 non-existent Others number

Definition at line 423 of file AudioKitHAL.h.

423 { return get_input_play_id(); }

◆ pinInputRec()

int8_t AudioKit::pinInputRec ( )
inline

Get the record-button id for adc-button.

Returns
-1 non-existent Others button id

Definition at line 399 of file AudioKitHAL.h.

399 { return get_input_rec_id(); }

◆ pinInputSet()

int8_t AudioKit::pinInputSet ( )
inline

Get number for set function.

Returns
-1 non-existent Others number

Definition at line 415 of file AudioKitHAL.h.

415 { return get_input_set_id(); };

◆ pinPaEnable()

int8_t AudioKit::pinPaEnable ( )
inline

Get the gpio number for PA enable.

Returns
-1 non-existent Others gpio number

Definition at line 375 of file AudioKitHAL.h.

375 { return get_pa_enable_gpio(); }

◆ pinResetBoard()

int8_t AudioKit::pinResetBoard ( )
inline

Get gpio number to reset the board.

Returns
-1 non-existent Others gpio number

Definition at line 455 of file AudioKitHAL.h.

455 { return get_reset_board_gpio(); }

◆ pinResetCodec()

int8_t AudioKit::pinResetCodec ( )
inline

Get reset codec gpio number.

Returns
-1 non-existent Others gpio number

Definition at line 447 of file AudioKitHAL.h.

447 { return get_reset_codec_gpio(); }

◆ pinSpiCs()

int8_t AudioKit::pinSpiCs ( )
inline

SPI CS Pin for SD Drive.

Returns
int8_t

Definition at line 478 of file AudioKitHAL.h.

478  {
479  return spi_cs_pin;
480  }

◆ pinVolumeDown()

int8_t AudioKit::pinVolumeDown ( )
inline

Get number for volume down function.

Returns
-1 non-existent Others number

Definition at line 439 of file AudioKitHAL.h.

439 { return get_input_voldown_id(); }

◆ pinVolumeUp()

int8_t AudioKit::pinVolumeUp ( )
inline

number for volume up function

Returns
-1 non-existent Others number

Definition at line 431 of file AudioKitHAL.h.

431 { return get_input_volup_id(); }

◆ setSpeakerActive()

void AudioKit::setSpeakerActive ( bool  active)
inline

Activates/deactivates the speaker amplifier output This is working only if the driver is supporting the functionality.

Parameters
active

Definition at line 487 of file AudioKitHAL.h.

487  {
488  int paPin = get_pa_enable_gpio();
489  if (paPin>0){
490  digitalWrite(paPin, active);
491  } else {
492  KIT_LOGW("setSpeakerActive not supported");
493  }
494  }

The documentation for this class was generated from the following file: