From e8f0161e3245681619687e0136c022e773f60fb7 Mon Sep 17 00:00:00 2001 From: yelvlab Date: Thu, 3 Apr 2025 09:10:52 +0800 Subject: [PATCH] RS485 --- inc/board_config.h | 2 ++ src/rs485.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/inc/board_config.h b/inc/board_config.h index c8a2284..b265b3f 100644 --- a/inc/board_config.h +++ b/inc/board_config.h @@ -9,6 +9,8 @@ // #define DEBUG_VERBOES +#define RS485_MAX13487 + /******************************************************************************/ #define RCU_GPIO_I2C RCU_GPIOF diff --git a/src/rs485.c b/src/rs485.c index 9021a89..97f0ee7 100644 --- a/src/rs485.c +++ b/src/rs485.c @@ -8,6 +8,7 @@ uint8_t package_header[3] = {0xB5, 0xF0, 0x04}; uint8_t package_data[4] = {0}; void rs485_config(void) { +#ifdef RS485_MAX13487 rcu_periph_clock_enable(RS485_GPIO_RCU); rcu_periph_clock_enable(RS485_RCU); @@ -43,6 +44,10 @@ void rs485_config(void) { nvic_irq_enable(USART0_IRQn, 0); usart_interrupt_enable(RS485_PHY, USART_INT_RBNE); usart_interrupt_enable(RS485_PHY, USART_INT_IDLE); +#else + +#endif + } void process_command(uint8_t *cmd, size_t length) {