libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
dac.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_DAC_H
3#define DSY_DAC_H
4#include "stm32h7xx_hal.h"
5#include "daisy_core.h"
6
7namespace daisy
8{
22{
23 public:
25 enum class Result
26 {
27 OK,
28 ERR,
29 };
30
32 enum class Channel
33 {
34 ONE,
35 TWO,
36 BOTH,
37 };
38
46 enum class Mode
47 {
48 POLLING,
49 DMA,
50 };
51
56 enum class BitDepth
57 {
58 BITS_8,
60 };
61
63 enum class BufferState
64 {
65 ENABLED,
67 };
68
83
84 DacHandle() : pimpl_(nullptr) {}
85 DacHandle(const DacHandle &other) = default;
86 DacHandle &operator=(const DacHandle &other) = default;
87
96 typedef void (*DacCallback)(uint16_t **out, size_t size);
97
100 const Config &GetConfig() const;
101
108
111 Result
113
116
120
122 class Impl;
123
124 private:
125 Impl *pimpl_;
126};
127} // namespace daisy
128
129#endif
DAC handle for Built-in DAC Peripheral.
Definition dac.h:22
BitDepth
Definition dac.h:57
Result Start(uint16_t *buffer_1, uint16_t *buffer_2, size_t size, DacCallback cb)
DacHandle()
Definition dac.h:84
BufferState
Definition dac.h:64
Channel
Definition dac.h:33
Result Start(uint16_t *buffer, size_t size, DacCallback cb)
Result
Definition dac.h:26
const Config & GetConfig() const
Result Init(const Config &config)
DacHandle(const DacHandle &other)=default
DacHandle & operator=(const DacHandle &other)=default
Mode
Definition dac.h:47
Result WriteValue(Channel chn, uint16_t val)
void(* DacCallback)(uint16_t **out, size_t size)
Definition dac.h:96
Definition leddriver.h:33
Hardware defines and helpers for daisy field platform.
Definition index.h:2
Definition dac.h:71
BitDepth bitdepth
Definition dac.h:80
Mode mode
Definition dac.h:79
BufferState buff_state
Definition dac.h:81
Channel chn
Definition dac.h:78
uint32_t target_samplerate
Definition dac.h:76