Skip to content

Commit

Permalink
add:添加tm8211
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozingfiretruck committed Jan 23, 2024
1 parent 8343b53 commit 6007626
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions components/multimedia/luat_audio_tm8211.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include "luat_base.h"
#include "luat_gpio.h"
#include "luat_audio.h"
#include "luat_rtos.h"

#define LUAT_LOG_TAG "tm8211"
#include "luat_log.h"

static int tm8211_codec_channels(luat_audio_codec_conf_t* conf,uint8_t channels){
return 0;
}

static int tm8211_codec_init(luat_audio_codec_conf_t* conf,uint8_t mode){
return 0;
}

static int tm8211_codec_deinit(luat_audio_codec_conf_t* conf){
return 0;
}

static void tm8211_codec_pa(luat_audio_codec_conf_t* conf,uint8_t on){
if (conf->pa_pin == LUAT_CODEC_PA_NONE) return;
if (on){
if (conf->dummy_time_len)
luat_rtos_task_sleep(conf->dummy_time_len);
luat_gpio_set(conf->pa_pin, conf->pa_on_level);
if (conf->pa_delay_time)
luat_rtos_task_sleep(conf->pa_delay_time);
}else{
luat_gpio_set(conf->pa_pin, !conf->pa_on_level);
}
}

static int tm8211_codec_control(luat_audio_codec_conf_t* conf,luat_audio_codec_ctl_t cmd,uint32_t data){
switch (cmd){
case LUAT_CODEC_SET_PA:
tm8211_codec_pa(conf,(uint8_t)data);
break;
default:
break;
}
return 0;
}

static int tm8211_codec_start(luat_audio_codec_conf_t* conf){
return 0;
}

static int tm8211_codec_stop(luat_audio_codec_conf_t* conf){
return 0;
}

luat_audio_codec_opts_t codec_opts_tm8211 = {
.name = "tm8211",
.init = tm8211_codec_init,
.deinit = tm8211_codec_deinit,
.control = tm8211_codec_control,
.start = tm8211_codec_start,
.stop = tm8211_codec_stop,
};
































0 comments on commit 6007626

Please sign in to comment.