mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #1889 from openmv/refactor_common_header
misc: Rename common header.
This commit is contained in:
commit
d85935e787
@ -16,7 +16,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "omv_gpio.h"
|
#include "omv_gpio.h"
|
||||||
#include "omv_spi.h"
|
#include "omv_spi.h"
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "winc.h"
|
#include "winc.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
// WINC's includes
|
// WINC's includes
|
||||||
#include "driver/include/nmasic.h"
|
#include "driver/include/nmasic.h"
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "dma_alloc.h"
|
#include "dma_alloc.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
typedef union block block_t;
|
typedef union block block_t;
|
||||||
union block {
|
union block {
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include "extmod/vfs.h"
|
#include "extmod/vfs.h"
|
||||||
#include "extmod/vfs_fat.h"
|
#include "extmod/vfs_fat.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "fb_alloc.h"
|
#include "fb_alloc.h"
|
||||||
#include "ff_wrapper.h"
|
#include "ff_wrapper.h"
|
||||||
#define FF_MIN(x, y) (((x) < (y))?(x):(y))
|
#define FF_MIN(x, y) (((x) < (y))?(x):(y))
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "vospi.h"
|
#include "vospi.h"
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "omv_spi.h"
|
#include "omv_spi.h"
|
||||||
|
|
||||||
#define VOSPI_LINE_PIXELS (80)
|
#define VOSPI_LINE_PIXELS (80)
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#include <arm_math.h>
|
#include <arm_math.h>
|
||||||
#include "fb_alloc.h"
|
#include "fb_alloc.h"
|
||||||
#include "ff_wrapper.h"
|
#include "ff_wrapper.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
// http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input
|
// http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
* Fast approximate math functions.
|
* Fast approximate math functions.
|
||||||
*/
|
*/
|
||||||
#include "fmath.h"
|
#include "fmath.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
#define M_PI 3.14159265f
|
#define M_PI 3.14159265f
|
||||||
#define M_PI_2 1.57079632f
|
#define M_PI_2 1.57079632f
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "imlib.h"
|
#include "imlib.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
// DMA Buffers need to be aligned by cache lines or 16 bytes.
|
// DMA Buffers need to be aligned by cache lines or 16 bytes.
|
||||||
#ifndef __DCACHE_PRESENT
|
#ifndef __DCACHE_PRESENT
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "ff_wrapper.h"
|
#include "ff_wrapper.h"
|
||||||
#include "imlib.h"
|
#include "imlib.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
|
|
||||||
void imlib_init_all() {
|
void imlib_init_all() {
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
#include "mimxrt_hal.h"
|
#include "mimxrt_hal.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "omv_gpio.h"
|
#include "omv_gpio.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
#define IOMUXC_SET_REG(base, reg, val) *((volatile uint32_t *) ((((uint32_t) base) << 16) | reg)) = (val)
|
#define IOMUXC_SET_REG(base, reg, val) *((volatile uint32_t *) ((((uint32_t) base) << 16) | reg)) = (val)
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
#include CLOCK_CONFIG_H
|
#include CLOCK_CONFIG_H
|
||||||
|
|
||||||
#include "mimxrt_hal.h"
|
#include "mimxrt_hal.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "omv_spi.h"
|
#include "omv_spi.h"
|
||||||
|
|
||||||
typedef struct dma_descr {
|
typedef struct dma_descr {
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
#include "py_helper.h"
|
#include "py_helper.h"
|
||||||
#include "fb_alloc.h"
|
#include "fb_alloc.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "nrfx_pdm.h"
|
#include "nrfx_pdm.h"
|
||||||
#include "hal/nrf_gpio.h"
|
#include "hal/nrf_gpio.h"
|
||||||
|
|
||||||
@ -30,11 +30,11 @@
|
|||||||
#define PDM_IRQ_PRIORITY (7)
|
#define PDM_IRQ_PRIORITY (7)
|
||||||
#define PDM_BUFFER_SIZE (256)
|
#define PDM_BUFFER_SIZE (256)
|
||||||
|
|
||||||
#define NRF_PDM_FREQ_1280K (nrf_pdm_freq_t)(0x0A000000UL) // PDM_CLK= 1.280 MHz (32 MHz / 25) => Fs= 20000 Hz
|
#define NRF_PDM_FREQ_1280K (nrf_pdm_freq_t) (0x0A000000UL) // PDM_CLK= 1.280 MHz (32 MHz / 25) => Fs= 20000 Hz
|
||||||
#define NRF_PDM_FREQ_2000K (nrf_pdm_freq_t)(0x10000000UL) // PDM_CLK= 2.000 MHz (32 MHz / 16) => Fs= 31250 Hz
|
#define NRF_PDM_FREQ_2000K (nrf_pdm_freq_t) (0x10000000UL) // PDM_CLK= 2.000 MHz (32 MHz / 16) => Fs= 31250 Hz
|
||||||
#define NRF_PDM_FREQ_2667K (nrf_pdm_freq_t)(0x15000000UL) // PDM_CLK= 2.667 MHz (32 MHz / 12) => Fs= 41667 Hz
|
#define NRF_PDM_FREQ_2667K (nrf_pdm_freq_t) (0x15000000UL) // PDM_CLK= 2.667 MHz (32 MHz / 12) => Fs= 41667 Hz
|
||||||
#define NRF_PDM_FREQ_3200K (nrf_pdm_freq_t)(0x19000000UL) // PDM_CLK= 3.200 MHz (32 MHz / 10) => Fs= 50000 Hz
|
#define NRF_PDM_FREQ_3200K (nrf_pdm_freq_t) (0x19000000UL) // PDM_CLK= 3.200 MHz (32 MHz / 10) => Fs= 50000 Hz
|
||||||
#define NRF_PDM_FREQ_4000K (nrf_pdm_freq_t)(0x20000000UL) // PDM_CLK= 4.000 MHz (32 MHz / 8) => Fs= 62500 Hz
|
#define NRF_PDM_FREQ_4000K (nrf_pdm_freq_t) (0x20000000UL) // PDM_CLK= 4.000 MHz (32 MHz / 8) => Fs= 62500 Hz
|
||||||
#define RAISE_OS_EXCEPTION(msg) mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT(msg))
|
#define RAISE_OS_EXCEPTION(msg) mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT(msg))
|
||||||
|
|
||||||
static mp_obj_array_t *g_pcmbuf = NULL;
|
static mp_obj_array_t *g_pcmbuf = NULL;
|
||||||
@ -45,13 +45,13 @@ static int16_t PDM_BUFFERS[2][PDM_BUFFER_SIZE];
|
|||||||
static mp_sched_node_t audio_task_sched_node;
|
static mp_sched_node_t audio_task_sched_node;
|
||||||
static void audio_task_callback(mp_sched_node_t *node);
|
static void audio_task_callback(mp_sched_node_t *node);
|
||||||
|
|
||||||
static void nrfx_pdm_event_handler(nrfx_pdm_evt_t const *evt)
|
static void nrfx_pdm_event_handler(nrfx_pdm_evt_t const *evt) {
|
||||||
{
|
|
||||||
if (evt->error == NRFX_PDM_NO_ERROR) {
|
if (evt->error == NRFX_PDM_NO_ERROR) {
|
||||||
if (evt->buffer_requested) {
|
if (evt->buffer_requested) {
|
||||||
if (evt->buffer_released == PDM_BUFFERS[0]) {
|
if (evt->buffer_released == PDM_BUFFERS[0]) {
|
||||||
nrfx_pdm_buffer_set(PDM_BUFFERS[1], PDM_BUFFER_SIZE);
|
nrfx_pdm_buffer_set(PDM_BUFFERS[1], PDM_BUFFER_SIZE);
|
||||||
} else { // NULL (first buffer request) or second buffer is full.
|
} else {
|
||||||
|
// NULL (first buffer request) or second buffer is full.
|
||||||
nrfx_pdm_buffer_set(PDM_BUFFERS[0], PDM_BUFFER_SIZE);
|
nrfx_pdm_buffer_set(PDM_BUFFERS[0], PDM_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,8 +64,7 @@ static void nrfx_pdm_event_handler(nrfx_pdm_evt_t const *evt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||||
{
|
|
||||||
// Read Args.
|
// Read Args.
|
||||||
g_channels = py_helper_keyword_int(n_args, args, 0, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_channels), 2);
|
g_channels = py_helper_keyword_int(n_args, args, 0, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_channels), 2);
|
||||||
uint32_t frequency = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_frequency), 16000);
|
uint32_t frequency = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_frequency), 16000);
|
||||||
@ -125,8 +124,7 @@ static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar
|
|||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void py_audio_deinit()
|
void py_audio_deinit() {
|
||||||
{
|
|
||||||
// Disable PDM and IRQ
|
// Disable PDM and IRQ
|
||||||
nrfx_pdm_uninit();
|
nrfx_pdm_uninit();
|
||||||
|
|
||||||
@ -141,15 +139,13 @@ void py_audio_deinit()
|
|||||||
g_audio_callback = mp_const_none;
|
g_audio_callback = mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void audio_task_callback(mp_sched_node_t *node)
|
static void audio_task_callback(mp_sched_node_t *node) {
|
||||||
{
|
|
||||||
memcpy(g_pcmbuf->items, PDM_BUFFERS[g_buf_index], PDM_BUFFER_SIZE * sizeof(int16_t));
|
memcpy(g_pcmbuf->items, PDM_BUFFERS[g_buf_index], PDM_BUFFER_SIZE * sizeof(int16_t));
|
||||||
// Call user callback
|
// Call user callback
|
||||||
mp_call_function_1(g_audio_callback, MP_OBJ_FROM_PTR(g_pcmbuf));
|
mp_call_function_1(g_audio_callback, MP_OBJ_FROM_PTR(g_pcmbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj)
|
static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj) {
|
||||||
{
|
|
||||||
g_audio_callback = callback_obj;
|
g_audio_callback = callback_obj;
|
||||||
|
|
||||||
if (!mp_obj_is_callable(g_audio_callback)) {
|
if (!mp_obj_is_callable(g_audio_callback)) {
|
||||||
@ -166,8 +162,7 @@ static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj)
|
|||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mp_obj_t py_audio_stop_streaming()
|
static mp_obj_t py_audio_stop_streaming() {
|
||||||
{
|
|
||||||
// Stop PDM.
|
// Stop PDM.
|
||||||
nrfx_pdm_stop();
|
nrfx_pdm_stop();
|
||||||
g_audio_callback = mp_const_none;
|
g_audio_callback = mp_const_none;
|
||||||
@ -189,7 +184,7 @@ STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
|
|||||||
|
|
||||||
const mp_obj_module_t audio_module = {
|
const mp_obj_module_t audio_module = {
|
||||||
.base = { &mp_type_module },
|
.base = { &mp_type_module },
|
||||||
.globals = (mp_obj_t)&globals_dict,
|
.globals = (mp_obj_t) &globals_dict,
|
||||||
};
|
};
|
||||||
|
|
||||||
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module);
|
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module);
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "omv_i2c.h"
|
#include "omv_i2c.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
#define I2C_TIMEOUT (1000)
|
#define I2C_TIMEOUT (1000)
|
||||||
#define I2C_SCAN_TIMEOUT (100)
|
#define I2C_SCAN_TIMEOUT (100)
|
||||||
|
|||||||
@ -58,7 +58,7 @@ typedef struct _audio_data_t {
|
|||||||
uint8_t dma_buf_idx;
|
uint8_t dma_buf_idx;
|
||||||
mp_obj_t user_callback;
|
mp_obj_t user_callback;
|
||||||
TPDMFilter_InitStruct pdm_filter; // OpenPDM filter used to convert PDM into PCM
|
TPDMFilter_InitStruct pdm_filter; // OpenPDM filter used to convert PDM into PCM
|
||||||
void (*pdm_filter_func) (uint8_t*, int16_t*, uint16_t, TPDMFilter_InitStruct*);
|
void (*pdm_filter_func) (uint8_t *, int16_t *, uint16_t, TPDMFilter_InitStruct *);
|
||||||
} audio_data_t;
|
} audio_data_t;
|
||||||
|
|
||||||
MP_REGISTER_ROOT_POINTER(struct _audio_data_t *audio_data);
|
MP_REGISTER_ROOT_POINTER(struct _audio_data_t *audio_data);
|
||||||
@ -71,8 +71,7 @@ static mp_sched_node_t audio_task_sched_node;
|
|||||||
static volatile bool audio_task_scheduled = false;
|
static volatile bool audio_task_scheduled = false;
|
||||||
static bool irq_handler_installed = false;
|
static bool irq_handler_installed = false;
|
||||||
|
|
||||||
static void audio_task_callback(mp_sched_node_t *node)
|
static void audio_task_callback(mp_sched_node_t *node) {
|
||||||
{
|
|
||||||
if (audio_data->streaming == false) {
|
if (audio_data->streaming == false) {
|
||||||
audio_task_scheduled = false;
|
audio_task_scheduled = false;
|
||||||
return;
|
return;
|
||||||
@ -100,8 +99,7 @@ static void audio_task_callback(mp_sched_node_t *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dma_irq_handler()
|
static void dma_irq_handler() {
|
||||||
{
|
|
||||||
if (dma_irqn_get_channel_status(PDM_DMA, audio_data->dma_channel)) {
|
if (dma_irqn_get_channel_status(PDM_DMA, audio_data->dma_channel)) {
|
||||||
// Clear the interrupt request.
|
// Clear the interrupt request.
|
||||||
dma_irqn_acknowledge_channel(PDM_DMA, audio_data->dma_channel);
|
dma_irqn_acknowledge_channel(PDM_DMA, audio_data->dma_channel);
|
||||||
@ -147,9 +145,10 @@ static void dma_irq_handler()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
|
static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||||
{
|
enum {
|
||||||
enum { ARG_channels, ARG_frequency, ARG_gain_db, ARG_buffers, ARG_overflow, ARG_clkdiv };
|
ARG_channels, ARG_frequency, ARG_gain_db, ARG_buffers, ARG_overflow, ARG_clkdiv
|
||||||
|
};
|
||||||
static const mp_arg_t allowed_args[] = {
|
static const mp_arg_t allowed_args[] = {
|
||||||
{ MP_QSTR_channels, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
|
{ MP_QSTR_channels, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
|
||||||
{ MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PDM_DEFAULT_FREQ} },
|
{ MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PDM_DEFAULT_FREQ} },
|
||||||
@ -287,20 +286,17 @@ static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *k
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init);
|
||||||
|
|
||||||
static mp_obj_t py_audio_samples()
|
static mp_obj_t py_audio_samples() {
|
||||||
{
|
|
||||||
return mp_obj_new_int(audio_data->t_samples);
|
return mp_obj_new_int(audio_data->t_samples);
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_samples_obj, py_audio_samples);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_samples_obj, py_audio_samples);
|
||||||
|
|
||||||
static mp_obj_t py_audio_overflow()
|
static mp_obj_t py_audio_overflow() {
|
||||||
{
|
|
||||||
return mp_obj_new_bool(audio_data->overflow);
|
return mp_obj_new_bool(audio_data->overflow);
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_overflow_obj, py_audio_overflow);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_overflow_obj, py_audio_overflow);
|
||||||
|
|
||||||
static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj)
|
static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj) {
|
||||||
{
|
|
||||||
audio_data->head = 0;
|
audio_data->head = 0;
|
||||||
audio_data->tail = 0;
|
audio_data->tail = 0;
|
||||||
#if PDM_TIME_CONV
|
#if PDM_TIME_CONV
|
||||||
@ -327,8 +323,7 @@ static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj)
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming);
|
||||||
|
|
||||||
static mp_obj_t py_audio_stop_streaming()
|
static mp_obj_t py_audio_stop_streaming() {
|
||||||
{
|
|
||||||
if (audio_data->streaming) {
|
if (audio_data->streaming) {
|
||||||
// Disable PDM and IRQ
|
// Disable PDM and IRQ
|
||||||
dma_channel_abort(audio_data->dma_channel);
|
dma_channel_abort(audio_data->dma_channel);
|
||||||
@ -347,7 +342,9 @@ static mp_obj_t py_audio_stop_streaming()
|
|||||||
audio_data->streaming = false;
|
audio_data->streaming = false;
|
||||||
for (mp_uint_t start = mp_hal_ticks_ms();
|
for (mp_uint_t start = mp_hal_ticks_ms();
|
||||||
audio_task_scheduled && (mp_hal_ticks_ms() - start) < 1500;
|
audio_task_scheduled && (mp_hal_ticks_ms() - start) < 1500;
|
||||||
mp_hal_delay_ms(10));
|
mp_hal_delay_ms(10)) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
#if PDM_TIME_CONV
|
#if PDM_TIME_CONV
|
||||||
mp_printf(&mp_plat_print, "Average conversion time:%ld us\n",
|
mp_printf(&mp_plat_print, "Average conversion time:%ld us\n",
|
||||||
@ -359,9 +356,10 @@ static mp_obj_t py_audio_stop_streaming()
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming);
|
||||||
|
|
||||||
static mp_obj_t py_audio_get_buffer(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
|
static mp_obj_t py_audio_get_buffer(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||||
{
|
enum {
|
||||||
enum { ARG_timeout };
|
ARG_timeout
|
||||||
|
};
|
||||||
static const mp_arg_t allowed_args[] = {
|
static const mp_arg_t allowed_args[] = {
|
||||||
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||||
};
|
};
|
||||||
@ -399,8 +397,7 @@ static mp_obj_t py_audio_get_buffer(uint n_args, const mp_obj_t *pos_args, mp_ma
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_get_buffer_obj, 0, py_audio_get_buffer);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_get_buffer_obj, 0, py_audio_get_buffer);
|
||||||
|
|
||||||
void py_audio_deinit()
|
void py_audio_deinit() {
|
||||||
{
|
|
||||||
if (audio_initialized) {
|
if (audio_initialized) {
|
||||||
py_audio_stop_streaming();
|
py_audio_stop_streaming();
|
||||||
audio_data->head = 0;
|
audio_data->head = 0;
|
||||||
@ -439,7 +436,7 @@ STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
|
|||||||
|
|
||||||
const mp_obj_module_t audio_module = {
|
const mp_obj_module_t audio_module = {
|
||||||
.base = { &mp_type_module },
|
.base = { &mp_type_module },
|
||||||
.globals = (mp_obj_t)&globals_dict,
|
.globals = (mp_obj_t) &globals_dict,
|
||||||
};
|
};
|
||||||
|
|
||||||
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module);
|
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module);
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
|
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "dma_utils.h"
|
#include "dma_utils.h"
|
||||||
|
|
||||||
// Defined in micropython/ports/stm32/dma.c
|
// Defined in micropython/ports/stm32/dma.c
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
#include "pdm2pcm_glo.h"
|
#include "pdm2pcm_glo.h"
|
||||||
#include "fb_alloc.h"
|
#include "fb_alloc.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "dma_utils.h"
|
#include "dma_utils.h"
|
||||||
|
|
||||||
#if MICROPY_PY_AUDIO
|
#if MICROPY_PY_AUDIO
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "libtf.h"
|
#include "libtf.h"
|
||||||
#include "py_tf.h"
|
#include "py_tf.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
#if MICROPY_PY_MICRO_SPEECH
|
#if MICROPY_PY_MICRO_SPEECH
|
||||||
#define kMaxAudioSampleSize (512)
|
#define kMaxAudioSampleSize (512)
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "extmod/modnetwork.h"
|
#include "extmod/modnetwork.h"
|
||||||
#include "pin.h"
|
#include "pin.h"
|
||||||
#include "genhdr/pins.h"
|
#include "genhdr/pins.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "py_helper.h"
|
#include "py_helper.h"
|
||||||
#include "ff_wrapper.h"
|
#include "ff_wrapper.h"
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
|
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "omv_gpio.h"
|
#include "omv_gpio.h"
|
||||||
#include "omv_i2c.h"
|
#include "omv_i2c.h"
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "dma_utils.h"
|
#include "dma_utils.h"
|
||||||
#include "omv_spi.h"
|
#include "omv_spi.h"
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#include "imlib.h"
|
#include "imlib.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
// Define pin objects in this file.
|
// Define pin objects in this file.
|
||||||
#define OMV_GPIO_DEFINE_PINS (1)
|
#define OMV_GPIO_DEFINE_PINS (1)
|
||||||
#include "omv_gpio.h"
|
#include "omv_gpio.h"
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
#include "vospi.h"
|
#include "vospi.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "common.h"
|
#include "omv_common.h"
|
||||||
#include "omv_gpio.h"
|
#include "omv_gpio.h"
|
||||||
#include "omv_i2c.h"
|
#include "omv_i2c.h"
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user