[update] openamp and rs485 driver

This commit is contained in:
thread-liu 2020-10-27 11:44:29 +08:00
parent 5f911c6dc2
commit d2d6fc47af
2 changed files with 7 additions and 6 deletions

View File

@ -236,7 +236,7 @@ int rt_hw_openamp_init(void)
rt_hw_openamp_register(&dev_openamp, "openamp", 0, NULL);
if (rt_strcmp(RT_CONSOLE_DEVICE_NAME, "openamp") == 0)
if (RT_CONSOLE_DEVICE_NAME == "openamp")
{
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
}

View File

@ -19,14 +19,13 @@
static rt_device_t serial = {0};
static struct rt_semaphore rx_sem = {0};
/* rs485 send data callback function */
/* uart send data callback function */
static rt_err_t rs485_output(rt_device_t dev, void * buffer)
{
RS485_IN;
return RT_EOK;
}
/* uart receive data callback function */
static rt_err_t rs485_input(rt_device_t dev, rt_size_t size)
{
rt_sem_release(&rx_sem);
@ -37,12 +36,13 @@ static rt_err_t rs485_input(rt_device_t dev, rt_size_t size)
/* send string */
int rs485_send_data(char *tbuf, rt_uint16_t t_len)
{
/* set rs485 mode */
/* change rs485 mode */
RS485_OUT;
/* send data */
rt_device_write(serial, 0, tbuf, t_len);
/* change rs485 mode */
RS485_IN;
return RT_EOK;
@ -63,6 +63,7 @@ static void rs485_thread_entry(void *parameter)
/* The data read through the serial port output dislocation */
ch = ch + 1;
/* send char */
rs485_send_data(&ch, 1);
}
}