Skip to content

Commit

Permalink
Fixed a couple of issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dnakhooda committed Oct 20, 2024
1 parent 811a7c8 commit 68311ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
11 changes: 7 additions & 4 deletions Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ void can1_callback(CAN_HandleTypeDef *hcan)
new_msg.len = rx_header.DLC;
new_msg.id = rx_header.StdId;

queue_and_set_flag(can_inbound_queue, &new_msg, can_receive_thread,
NEW_CAN_MSG_FLAG);
//queue_and_set_flag(can_inbound_queue, &new_msg, can_receive_thread,
// NEW_CAN_MSG_FLAG);

/* Print Callback Messages */
printf("Callback: %s", new_msg.data);
if (new_msg.id == 2)
printf("Callback: %s", new_msg.data);
}

int8_t queue_can_msg(can_msg_t msg)
Expand All @@ -106,7 +107,7 @@ void vCanDispatch(void *pv_params)
.severity = DEFCON1 };

can_msg_t msg_from_queue = {
.id = 0x069,
.id = 0x002,
.len = 4,
.data = { 69 }
};
Expand All @@ -115,6 +116,8 @@ void vCanDispatch(void *pv_params)
CAN_HandleTypeDef *hcan = (CAN_HandleTypeDef *)pv_params;

for (;;) {
osDelay(500);

/* Wait if CAN outbound queue is full */
while (HAL_CAN_GetTxMailboxesFreeLevel(hcan) == 0) {
osDelay(1);
Expand Down
18 changes: 9 additions & 9 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ static void MX_DMA_Init(void);*/
static void MX_CAN1_Init(void);
/*static void MX_I2C1_Init(void);
static void MX_I2C2_Init(void);
static void MX_ADC1_Init(void);
static void MX_ADC1_Init(void);*/
static void MX_USART3_UART_Init(void);
static void MX_ADC3_Init(void);
/*static void MX_ADC3_Init(void);
static void MX_IWDG_Init(void);*/
void StartDefaultTask(void *argument);

Expand Down Expand Up @@ -160,9 +160,9 @@ int main(void)
MX_CAN1_Init();
/*MX_I2C1_Init();
MX_I2C2_Init();
MX_ADC1_Init();
MX_ADC1_Init();*/
MX_USART3_UART_Init();
MX_ADC3_Init();
/*MX_ADC3_Init();
MX_IWDG_Init();
USER CODE BEGIN 2
Expand Down Expand Up @@ -584,8 +584,8 @@ static void MX_CAN1_Init(void)
* @param None
* @retval None
*/
/*static void MX_USART3_UART_Init(void)
{*/
static void MX_USART3_UART_Init(void)
{

/* USER CODE BEGIN USART3_Init 0 */

Expand All @@ -594,7 +594,7 @@ static void MX_CAN1_Init(void)
/* USER CODE BEGIN USART3_Init 1 */

/* USER CODE END USART3_Init 1 */
/*huart3.Instance = USART3;
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
Expand All @@ -605,12 +605,12 @@ static void MX_CAN1_Init(void)
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}*/
}
/* USER CODE BEGIN USART3_Init 2 */

/* USER CODE END USART3_Init 2 */

//}
}

/**
* Enable DMA controller clock
Expand Down

0 comments on commit 68311ac

Please sign in to comment.