1818
1919/* Includes ------------------------------------------------------------------*/
2020#include "platform.h"
21+ #include "interfaces_conf.h"
2122#include "openbl_core.h"
2223#include "openbl_fdcan_cmd.h"
2324#include "fdcan_interface.h"
2425#include "iwdg_interface.h"
25- #include "interfaces_conf.h"
2626
2727/* Private typedef -----------------------------------------------------------*/
2828/* Private define ------------------------------------------------------------*/
2929/* Private macro -------------------------------------------------------------*/
3030/* Private variables ---------------------------------------------------------*/
31- FDCAN_HandleTypeDef hfdcan ;
32- FDCAN_FilterTypeDef sFilterConfig ;
33- FDCAN_TxHeaderTypeDef TxHeader ;
34- FDCAN_RxHeaderTypeDef RxHeader ;
31+ static FDCAN_HandleTypeDef hfdcan ;
32+ static FDCAN_FilterTypeDef sFilterConfig ;
33+ static FDCAN_TxHeaderTypeDef TxHeader ;
34+ static FDCAN_RxHeaderTypeDef RxHeader ;
3535static uint8_t FdcanDetected = 0U ;
3636
3737/* Exported variables --------------------------------------------------------*/
@@ -42,7 +42,10 @@ uint8_t RxData[FDCAN_RAM_BUFFER_SIZE];
4242static void OPENBL_FDCAN_Init (void );
4343
4444/* Private functions ---------------------------------------------------------*/
45-
45+ /**
46+ * @brief This function is used to initialize the used FDCAN instance.
47+ * @retval None.
48+ */
4649static void OPENBL_FDCAN_Init (void )
4750{
4851 /* Bit time configuration:
@@ -116,9 +119,7 @@ void OPENBL_FDCAN_Configuration(void)
116119{
117120 /* Enable all resources clocks --------------------------------------------*/
118121 /* Enable used GPIOx clocks */
119- __HAL_RCC_GPIOD_CLK_ENABLE ();
120- /* Enable FDCAN clock */
121- __HAL_RCC_FDCAN_CLK_ENABLE ();
122+ FDCANx_GPIO_CLK_ENABLE ();
122123
123124 OPENBL_FDCAN_Init ();
124125}
@@ -143,7 +144,7 @@ void OPENBL_FDCAN_DeInit(void)
143144
144145/**
145146 * @brief This function is used to detect if there is any activity on FDCAN protocol.
146- * @retval None .
147+ * @retval Returns 1 if interface is detected else 0. .
147148 */
148149uint8_t OPENBL_FDCAN_ProtocolDetection (void )
149150{
@@ -196,7 +197,7 @@ uint8_t OPENBL_FDCAN_GetCommandOpcode(void)
196197 */
197198uint8_t OPENBL_FDCAN_ReadByte (void )
198199{
199- uint8_t byte = 0x0 ;
200+ uint8_t byte ;
200201
201202 /* check if FIFO 0 receive at least one message */
202203 while (HAL_FDCAN_GetRxFifoFillLevel (& hfdcan , FDCAN_RX_FIFO0 ) < 1 )
@@ -212,7 +213,7 @@ uint8_t OPENBL_FDCAN_ReadByte(void)
212213
213214/**
214215 * @brief This function is used to read bytes from FDCAN pipe.
215- * @retval Returns the read byte .
216+ * @retval None .
216217 */
217218void OPENBL_FDCAN_ReadBytes (uint8_t * Buffer , uint32_t BufferSize )
218219{
0 commit comments