Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_dac.h
1 #ifndef _BC_DAC_H
2 #define _BC_DAC_H
3 
4 #include <bc_common.h>
5 #include <bc_dma.h>
6 
10 
12 
13 typedef enum
14 {
17 
20 
22 
24 
25 typedef enum
26 {
29 
32 
35 
37 
39 
40 typedef enum
41 {
44 
47 
49 
51 
52 typedef enum
53 {
56 
59 
61 
63 
64 typedef enum
65 {
68 
71 
73 
75 
76 typedef enum
77 {
80 
83 
85 
87 
88 typedef struct
89 {
90  void *buffer;
91  uint16_t length;
92  bc_dac_data_size_t data_size;
93  bc_dac_sample_rate_t sample_rate;
94  bc_dac_mode_t mode;
95 
97 
100 
101 void bc_dac_init(bc_dac_channel_t channel);
102 
105 
106 void bc_dac_deinit(bc_dac_channel_t channel);
107 
112 
113 void bc_dac_set_output(bc_dac_channel_t channel, const void *raw, bc_dac_format_t format);
114 
119 
120 void bc_dac_set_event_handler(bc_dac_channel_t channel, void (*event_handler)(bc_dac_channel_t, bc_dac_event_t, void *), void *event_param);
121 
130 
132 
137 
138 bool bc_dac_async_run(bc_dac_channel_t channel);
139 
142 
143 void bc_dac_async_stop(bc_dac_channel_t channel);
144 
146 
147 #endif // _BC_DAC_H
DAC channel DAC1.
Definition: bc_dac.h:19
Raw value format is 16-bit.
Definition: bc_dac.h:31
void bc_dac_set_output(bc_dac_channel_t channel, const void *raw, bc_dac_format_t format)
Set DAC channel output as raw value.
Definition: bc_dac.c:104
Raw value format is float.
Definition: bc_dac.h:34
void bc_dac_set_event_handler(bc_dac_channel_t channel, void(*event_handler)(bc_dac_channel_t, bc_dac_event_t, void *), void *event_param)
Set callback function.
Definition: bc_dac.c:137
void bc_dac_init(bc_dac_channel_t channel)
Initialize DAC channel.
Definition: bc_dac.c:43
Data size is 16b.
Definition: bc_dac.h:58
bc_dac_channel_t
DAC channel.
Definition: bc_dac.h:13
bc_dac_sample_rate_t
Sample rate.
Definition: bc_dac.h:40
Event is done.
Definition: bc_dac.h:79
bc_dac_data_size_t
Data size.
Definition: bc_dac.h:52
Event is done.
Definition: bc_dac.h:82
Data sample-rate is 16kHz.
Definition: bc_dac.h:46
bc_dac_format_t
Raw value format.
Definition: bc_dac.h:25
Data size is 8b.
Definition: bc_dac.h:55
void bc_dac_deinit(bc_dac_channel_t channel)
Deitialize DAC channel.
Definition: bc_dac.c:73
Raw value format is 8-bit.
Definition: bc_dac.h:28
Data sample-rate is 8kHz.
Definition: bc_dac.h:43
void bc_dac_async_stop(bc_dac_channel_t channel)
Stop asynchronous DAC channel operation.
Definition: bc_dac.c:264
bool bc_dac_async_run(bc_dac_channel_t channel)
Start asynchronous DAC channel operation.
Definition: bc_dac.c:191
bc_dac_mode_t
Mode.
Definition: bc_dac.h:64
bc_dac_event_t
DAC channel event.
Definition: bc_dac.h:76
bool bc_dac_async_config(bc_dac_channel_t channel, bc_dac_config_t *config)
Configure image of DAC DMA channel.
Definition: bc_dac.c:143
Mode circular (repeate playing buffer)
Definition: bc_dac.h:70
DAC channel DAC0.
Definition: bc_dac.h:16
DAC channel event.
Definition: bc_dac.h:88
Mode single.
Definition: bc_dac.h:67