linux串口数据发不出,Linux下串口发送数据一段数据后发送不出去(可以正常接收)...

#include

#include

#include

#include

#include

#include

#include

#include "gw_debug.h"

#include "uart.h"

//#define UART_DEBUG

static int support_baud[] = {

0, 50, 75, 110, 134, 150, 200,

300, 600, 1200, 1800, 2400, 4800, 9600,

19200, 38400, 57600, 115200, 230400,

};

int is_support_baud(int baud)

{

int i = 0;

for (i = 0; i < ARRAY_SIZE(support_baud); i++)

if (support_baud[i] == baud)

return 1;

return 0;

}

static speed_t int_to_speed(int baud)

{

if (is_support_baud(baud)) {

switch (baud) {

case 0:

return B0;

case 50:

return B50;

case 75:

return B75;

case 110:

return B110;

case 134:

return B134;

case 150:

return B150;

case 200:

return B200;

case 300:

return B300;

case 600:

return B600;

case 1200:

return B1200;

case 1800:

return B1800;

case 2400:

return B2400;

case 4800:

return B4800;

case 9600:

return B9600;

case 19200:

return B19200;

case 38400:

return B38400;

case 57600:

return B57600;

case 115200:

return B115200;

case 230400:

return B230400;

default:

return GW_FAIL;

}

}

retu

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值