Skip to content

Stand‐Alone: Custom Boards

Phil Schatzmann edited this page Feb 8, 2024 · 4 revisions

You can also easily define your custom boards by defining the driver and your specifc pins

#include "AudioBoard.h"

DriverPins my_pins;
AudioBoard board(AudioDriverES8388, my_pins);

void setup() {
  // add i2c codec pins: scl, sda, port
  my_pins.addI2C(PinFunction::CODEC, 32, 22, 0x20);
  // add i2s pins: mclk, bclk, ws, data_out, data_in
  my_pins.addI2S(PinFunction::CODEC, 0, 27, 26, 25, 35);
  // add other pins: PA on gpio 21
  my_pins.addPin(PinFunction::PA, 21, PinLogic::Output);

  // configure codec
  CodecConfig cfg;
  cfg.adc_input = ADC_INPUT_LINE1;
  cfg.dac_output = DAC_OUTPUT_ALL;
  cfg.i2s.bits = BIT_LENGTH_16BITS;
  cfg.i2s.rate = RATE_44K;
  //cfg.i2s.fmt = I2S_NORMAL;
  //cfg.i2s.mode = MODE_SLAVE; 
  board.begin(cfg);   
}
Clone this wiki locally