Skip to content

Commit 5b9d535

Browse files
raiden00plAlan C. Assis
authored andcommitted
boards/b-g431b-esc1: configure CAN_TERM pin also for SocketCAN interface
boards/b-g431b-esc1: configure CAN_TERM pin also for SocketCAN interface Signed-off-by: raiden00pl <raiden00@railab.me>
1 parent 2e21426 commit 5b9d535

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

boards/arm/stm32/b-g431b-esc1/src/stm32_cansock.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@
2929
#include <debug.h>
3030

3131
#include "stm32_fdcan.h"
32+
#include "b-g431b-esc1.h"
33+
34+
/****************************************************************************
35+
* Pre-processor Definitions
36+
****************************************************************************/
37+
38+
/* Configuration ************************************************************/
39+
40+
#if !defined(CONFIG_STM32_FDCAN1)
41+
# error "No CAN is enable. Please eneable at least one CAN device"
42+
#endif
43+
44+
#ifdef CONFIG_BOARD_STM32_BG431BESC1_CANTERM
45+
# define BG431BESC1_CANTERM (true)
46+
#else
47+
# define BG431BESC1_CANTERM (false)
48+
#endif
3249

3350
/****************************************************************************
3451
* Public Functions
@@ -55,5 +72,13 @@ int stm32_cansock_setup(void)
5572
return ret;
5673
}
5774

75+
/* Configure CAN_TERM pin for output */
76+
77+
stm32_configgpio(GPIO_CANTERM);
78+
79+
/* Set CAN_TERM pin high or low */
80+
81+
stm32_gpiowrite(GPIO_CANTERM, BG431BESC1_CANTERM);
82+
5883
return OK;
5984
}

0 commit comments

Comments
 (0)