wk2114 modified

develop
esea_info 2 years ago
parent 03295ed99f
commit addec922b7
  1. 33
      device/Src/wk2114_port.c

@ -598,12 +598,7 @@ void WK2114_Task(void * argument )
// log_w("Tx Fifo Trigger Int ..... subuart_sendqueue_count %d ",subuart_sendqueue_count);
if (subuart_sendqueue_count >= 0){
if ( (p_sub_uart->send_record_p-subuart_sendqueue_count-1) > 0)
{
current_record_p = p_sub_uart->send_record_p-subuart_sendqueue_count;
}else{
current_record_p = p_sub_uart->send_record_p + 8 -subuart_sendqueue_count ;
}
current_record_p =( p_sub_uart->send_record_p + 8 -subuart_sendqueue_count) % 8;
// log_d(" p_sub_uart->send_buf_p %d" , p_sub_uart->send_buf_p);
// log_d(" record size %d" , p_sub_uart->send_record[current_record_p]);
// 当前record数据发完,取出队列, 状态回到 state_ok
@ -796,11 +791,33 @@ void WK2114_Task(void * argument )
case WK2114_WORK_STATE_EXTI_READ_REG:
log_d(" read reg for check .... ");
// 写入软复位
osSemaphoreRelease(wk2xxx_idle_lockHandle );
osSemaphoreAcquire(wk2xxx_idle_lockHandle, osWaitForever);
wk2114->cmd = WK2114_S_REG_FCR ;
wk2114_read_global_reg( wk2114, wk2114->cmd );
osSemaphoreAcquire(wk2xxx_idle_lockHandle, 0xFF);
log_d("WK2114 subuart FCR .... 0x%02X", wk2xxx_rcvbuf[0]);
// // 写入FCR复位
// osSemaphoreRelease(wk2xxx_idle_lockHandle );
// osSemaphoreAcquire(wk2xxx_idle_lockHandle, osWaitForever);
// wk2114->cmd = WK2114_S_REG_FCR ;
// wk2114_write_global_reg( wk2114, wk2114->cmd, 0x0E );
// osSemaphoreAcquire(wk2xxx_idle_lockHandle, 0xFF);
// TODO 写入软复位 , 需要串口中断使能位,否则接收中断没了
osSemaphoreRelease(wk2xxx_idle_lockHandle );
osSemaphoreAcquire(wk2xxx_idle_lockHandle, osWaitForever);
wk2114->cmd = WK2114_G_REG_GRST ;
wk2114_write_global_reg( wk2114, wk2114->cmd, 0x0F );
wk2114_write_global_reg( wk2114, wk2114->cmd, 1<<wk2114->it_sub_uart_index );
osSemaphoreAcquire(wk2xxx_idle_lockHandle, 0xFF);
// TODO 写入子串口中断类型 接收 错误
osSemaphoreRelease(wk2xxx_idle_lockHandle );
osSemaphoreAcquire(wk2xxx_idle_lockHandle, osWaitForever);
wk2114->reg = WK2114_S_REG_SIER ;
wk2114->cmd = WK2114_S_REG_SIFR_MASK_RFTRIG_INT|WK2114_S_REG_SIFR_MASK_RXOVT_INT|WK2114_S_REG_SIFR_MASK_FERR_INT; ;
wk2114_write_subuart_reg( wk2114, wk2114->it_sub_uart_index , wk2114->reg, wk2114->cmd );
osSemaphoreAcquire(wk2xxx_idle_lockHandle, 0xFF);
osSemaphoreRelease(wk2xxx_idle_lockHandle );

Loading…
Cancel
Save