From 4a1e646cdb0b5b45bbc6c5bf77013205386f2da6 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 16 Jan 2023 16:57:17 +0100 Subject: [PATCH] bxcan: can_enable(): fix disabling of standby pin The binary inverse of 0x1 is 0xfe not 0x0. Fix this by using a logic negation instead. Fixes: f4f1586dbf56 ("can.c: use GPIO_INIT_STATE to set CANSTBY pin") --- src/can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/can.c b/src/can.c index d2ff1f0..b55c07c 100644 --- a/src/can.c +++ b/src/can.c @@ -124,7 +124,7 @@ void can_enable(can_data_t *hcan, bool loop_back, bool listen_only, bool one_sho can->FMR &= ~CAN_FMR_FINIT; #ifdef nCANSTBY_Pin - HAL_GPIO_WritePin(nCANSTBY_Port, nCANSTBY_Pin, ~GPIO_INIT_STATE(nCANSTBY_Active_High)); + HAL_GPIO_WritePin(nCANSTBY_Port, nCANSTBY_Pin, !GPIO_INIT_STATE(nCANSTBY_Active_High)); #endif }