Skip to content
Phil Schatzmann edited this page Jun 5, 2026 · 10 revisions

I am providing a DRAFT implementation for Zephyr.

In Arduino and other microcontroller frameworks the pins are defined as integers and this library is used to define all relevant devices and the corresponding pins. In Zephyr however, the pins and related device logic is represented in the device tree.

So when using Zephyr this project is used to link the devices with the corresponding device tree definitions and use those to manage the boards and setup the audio codecs.

Setting up your own Board

#include "AudioBoard.h"

DriverDeviceInfo my_info;
AudioBoard board(AudioDriverES8388, my_info);

void setup() {
  // add i2c codec
  my_pins.addI2C(PinFunction::CODEC, DEVICE_DT_GET(DT_ALIAS(i2c_1)));
  // add i2s 
  my_pins.addI2S(PinFunction::CODEC, DEVICE_DT_GET(DT_ALIAS(i2s_1)));
  // add other pins: PA on gpio 21
  my_pins.addPin(PinFunction::PA, GPIO_DT_SPEC_GET(DT_ALIAS(gpio_pa), gpios), 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);   
}

Using a Predefined Board

The predefined boards for zephyr can be found in the "DevicesZephyr" directory. You need to include the relevant board yourself:

#include "AudioBoard.h"
#include "AudioBoardZephyr/AudioKitEs8388v2.h"

Clone this wiki locally