-
Notifications
You must be signed in to change notification settings - Fork 0
/
esp32_i2s_parallel.h
54 lines (42 loc) · 1.19 KB
/
esp32_i2s_parallel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef I2S_PARALLEL_H
#define I2S_PARALLEL_H
#if defined(ESP32)
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "soc/i2s_struct.h"
#include "rom/lldesc.h"
typedef enum {
I2S_PARALLEL_BITS_8=8, // BUG: Doesn't work.
I2S_PARALLEL_BITS_16=16,
I2S_PARALLEL_BITS_32=32,
} i2s_parallel_cfg_bits_t;
typedef struct {
void *memory;
size_t size;
} i2s_parallel_buffer_desc_t;
typedef struct {
int gpio_bus[24];
int gpio_clk;
int clkspeed_hz;
i2s_parallel_cfg_bits_t bits;
i2s_parallel_buffer_desc_t *bufa;
i2s_parallel_buffer_desc_t *bufb;
int desccount_a;
int desccount_b;
lldesc_t * lldesc_a;
lldesc_t * lldesc_b;
} i2s_parallel_config_t;
void i2s_parallel_setup(i2s_dev_t *dev, const i2s_parallel_config_t *cfg);
void i2s_parallel_setup_without_malloc(i2s_dev_t *dev, const i2s_parallel_config_t *cfg);
void i2s_parallel_flip_to_buffer(i2s_dev_t *dev, int bufid);
bool i2s_parallel_is_previous_buffer_free();
void link_dma_desc(volatile lldesc_t *dmadesc, volatile lldesc_t *prevdmadesc, void *memory, size_t size);
typedef void (*callback)(void);
void setShiftCompleteCallback(callback f);
#ifdef __cplusplus
}
#endif
#endif
#endif