Skip to content

Commit

Permalink
fix: pwm.capture的DMA通道如果一直没触发就不会释放
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Dec 11, 2023
1 parent 60c5cf4 commit 330da49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/port/luat_pwm_air101.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ uint32_t pwmDmaCap0[10]={0};
uint32_t pwmDmaCap4[10]={0};

static luat_pwm_conf_t pwm_confs[5];
static uint8_t dmaCh;

int l_pwm_dma_capture(lua_State *L, void* ptr) {
int pwmH,pwmL,pulse;
int pwmH = 0,pwmL = 0,pulse = 0;
// 给 sys.publish方法发送数据
rtos_msg_t* msg = (rtos_msg_t*)lua_topointer(L, -1);
int channel = msg->arg1;
Expand Down Expand Up @@ -52,7 +53,8 @@ static void pwm_dma_callback(void * channel)
{
u8 ch = (u8)(channel);
tls_pwm_stop(ch);
tls_dma_free(1);
tls_dma_free(dmaCh);
dmaCh = 0;
rtos_msg_t msg={0};
msg.handler = l_pwm_dma_capture;
msg.arg1 = ch;
Expand Down Expand Up @@ -206,10 +208,13 @@ int luat_pwm_setup(luat_pwm_conf_t* conf) {
}

int luat_pwm_capture(int channel,int freq) {
uint8_t dmaCh;
struct tls_dma_descriptor DmaDesc;
tls_sys_clk sysclk;
tls_sys_clk_get(&sysclk);
if (dmaCh) {
tls_dma_free(dmaCh);
dmaCh = 0;
}
switch (channel){
// #ifdef AIR101
// case 0:
Expand Down

0 comments on commit 330da49

Please sign in to comment.