YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
dac8311_rp2350_drv.h
1// ---------------------------------------------
2// This file is part of
3// _ _ __ _ _ __ __
4// ( \/ ) /__\ ( )_( ) /__\ ( )
5// \ / /(__)\ ) _ ( /(__)\ )(__
6// (__)(__)(__)(_) (_)(__)(__)(____)
7//
8// Yet Another HW Abstraction Library
9// Copyright (C) Andreas Terstegge
10// BSD Licensed (see file LICENSE)
11//
12// ---------------------------------------------
13//
14// Driver for the DAC8311 (TI)
15//
16#ifndef _DAC8311_RP2350_DRV_H_
17#define _DAC8311_RP2350_DRV_H_
18
19#include <cstdint>
20#include "pcm_audio_interface.h"
21#include "gpio_rp2350.h"
22#include "pio_rp2350.h"
23#include "FIFO.h"
24
26{
27public:
28 dac8311_rp2350_drv(gpio_pin_t mosi_pin,
29 gpio_pin_t sclk_pin,
30 gpio_pin_t sync_pin,
31 gpio_pin_t enable);
32
33 virtual ~dac8311_rp2350_drv() = default;
34
35 inline void enable_output(bool v) {
36 _enable.gpioWrite(!v);
37 }
38
39 void setPcmRate(uint32_t Hz) override;
40
41private:
42 gpio_rp2350 _enable; // Audio enable Pin
43 SM * _pcm_sm; // The PIO State Machine
44};
45
46#endif // _DAC8311_RP2350_DRV_H_