libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
sai.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_SAI_H
3#define DSY_SAI_H
4
5#include "util/hal_map.h"
6#include "daisy_core.h"
7
8namespace daisy
9{
44{
45 public:
47 struct Config
48 {
50 enum class Peripheral
51 {
52 SAI_1,
53 SAI_2,
54 };
55
57 enum class SampleRate
58 {
64 };
65
67 enum class BitDepth
68 {
72 };
73
78 enum class Sync
79 {
80 MASTER,
81 SLAVE,
82 };
83
85 enum class Direction
86 {
88 RECEIVE,
89 };
90
92 struct
93 {
100 };
101
103 enum class Result
104 {
105 OK,
106 ERR,
107 };
108
109 SaiHandle() : pimpl_(nullptr) {}
110 SaiHandle(const SaiHandle& other) = default;
111 SaiHandle& operator=(const SaiHandle& other) = default;
112
115
118
120 const Config& GetConfig() const;
121
129
136 size_t size,
138
141
144
147 size_t GetBlockSize();
148
153
155 size_t GetOffset() const;
156
157 inline bool IsInitialized() const
158 {
159 return pimpl_ == nullptr ? false : true;
160 }
161
162 class Impl;
164 private:
165 Impl* pimpl_;
166};
167
168} // namespace daisy
169
170#endif
Definition leddriver.h:33
Definition sai.h:44
Result StartDma(int32_t *buffer_rx, int32_t *buffer_tx, size_t size, CallbackFunctionPtr callback)
const Config & GetConfig() const
float GetBlockRate()
SaiHandle(const SaiHandle &other)=default
Result
Definition sai.h:104
size_t GetBlockSize()
size_t GetOffset() const
SaiHandle()
Definition sai.h:109
float GetSampleRate()
bool IsInitialized() const
Definition sai.h:157
void(* CallbackFunctionPtr)(int32_t *in, int32_t *out, size_t size)
Definition sai.h:128
SaiHandle & operator=(const SaiHandle &other)=default
Result Init(const Config &config)
Hardware defines and helpers for daisy field platform.
Definition index.h:2
representation of hardware port/pin combination
Definition daisy_core.h:193
Definition sai.h:48
SampleRate sr
Definition sai.h:96
BitDepth bit_depth
Definition sai.h:97
Pin sck
Definition sai.h:94
Sync
Definition sai.h:79
Direction a_dir
Definition sai.h:99
Pin sa
Definition sai.h:94
Direction b_dir
Definition sai.h:99
Pin fs
Definition sai.h:94
Peripheral
Definition sai.h:51
Direction
Definition sai.h:86
struct daisy::SaiHandle::Config::@17 pin_config
Pin sb
Definition sai.h:94
BitDepth
Definition sai.h:68
Sync a_sync
Definition sai.h:98
Peripheral periph
Definition sai.h:91
SampleRate
Definition sai.h:58
Sync b_sync
Definition sai.h:98
Pin mclk
Definition sai.h:94