1、【修改】RTT的GPIO设备的配置。解决了FreeModbus主机串口与RTT的GPIO冲突的问题。
Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
parent
59ea5bb1ab
commit
c3d21aec43
|
@ -30,7 +30,7 @@ struct pin_index
|
||||||
static const struct pin_index pins[] =
|
static const struct pin_index pins[] =
|
||||||
{
|
{
|
||||||
{ 0, RCC_APB2Periph_GPIOA, GPIOA, GPIO_Pin_1},
|
{ 0, RCC_APB2Periph_GPIOA, GPIOA, GPIO_Pin_1},
|
||||||
{ 1, RCC_APB2Periph_GPIOA, GPIOA, GPIO_Pin_2},
|
{ 1, RCC_APB2Periph_GPIOB, GPIOB, GPIO_Pin_1},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ITEM_NUM(items) sizeof(items)/sizeof(items[0])
|
#define ITEM_NUM(items) sizeof(items)/sizeof(items[0])
|
||||||
|
|
|
@ -386,8 +386,8 @@ void stm32_hw_usart_init(void)
|
||||||
|
|
||||||
#if defined(RT_USING_UART2)
|
#if defined(RT_USING_UART2)
|
||||||
uart = &uart2;
|
uart = &uart2;
|
||||||
|
|
||||||
config.baud_rate = BAUD_RATE_115200;
|
config.baud_rate = BAUD_RATE_115200;
|
||||||
|
|
||||||
serial2.ops = &stm32_uart_ops;
|
serial2.ops = &stm32_uart_ops;
|
||||||
serial2.config = config;
|
serial2.config = config;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ static rt_uint8_t serial_soft_trans_irq_stack[512];
|
||||||
static struct rt_thread thread_serial_soft_trans_irq;
|
static struct rt_thread thread_serial_soft_trans_irq;
|
||||||
/* serial event */
|
/* serial event */
|
||||||
static struct rt_event event_serial;
|
static struct rt_event event_serial;
|
||||||
/* modbus slave serial device */
|
/* modbus master serial device */
|
||||||
static rt_serial_t *serial;
|
static rt_serial_t *serial;
|
||||||
|
|
||||||
/* ----------------------- Defines ------------------------------------------*/
|
/* ----------------------- Defines ------------------------------------------*/
|
||||||
|
@ -109,14 +109,14 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
|
||||||
|
|
||||||
/* software initialize */
|
/* software initialize */
|
||||||
rt_thread_init(&thread_serial_soft_trans_irq,
|
rt_thread_init(&thread_serial_soft_trans_irq,
|
||||||
"slave trans",
|
"master trans",
|
||||||
serial_soft_trans_irq,
|
serial_soft_trans_irq,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
serial_soft_trans_irq_stack,
|
serial_soft_trans_irq_stack,
|
||||||
sizeof(serial_soft_trans_irq_stack),
|
sizeof(serial_soft_trans_irq_stack),
|
||||||
10, 5);
|
10, 5);
|
||||||
rt_thread_startup(&thread_serial_soft_trans_irq);
|
rt_thread_startup(&thread_serial_soft_trans_irq);
|
||||||
rt_event_init(&event_serial, "slave event", RT_IPC_FLAG_PRIO);
|
rt_event_init(&event_serial, "master event", RT_IPC_FLAG_PRIO);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue