Fix variable name mismatch
This commit is contained in:
+2
-2
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
extern osMessageQueueId_t xCAN1RxQueue;
|
extern osMessageQueueId_t xCAN1RxQueue;
|
||||||
extern osMessageQueueId_t xCAN2RxQueue;
|
extern osMessageQueueId_t xCAN2RxQueue;
|
||||||
extern osSemaphoreId_t xLEDSemaphoreCAN1;
|
extern osSemaphoreId_t xSemaphoreCAN1;
|
||||||
extern osSemaphoreId_t xLEDSemaphoreCAN2;
|
extern osSemaphoreId_t xSemaphoreCAN2;
|
||||||
|
|
||||||
/* USER CODE BEGIN PTD */
|
/* USER CODE BEGIN PTD */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
+6
-6
@@ -111,7 +111,7 @@ void vCANLoggerListen(void *argument)
|
|||||||
{
|
{
|
||||||
if (osMessageQueueGet(queue, &message, NULL, osWaitForever) == osOK)
|
if (osMessageQueueGet(queue, &message, NULL, osWaitForever) == osOK)
|
||||||
{
|
{
|
||||||
osSemaphoreRelease( (hcan->Instance == CAN1) ? xSemaphoreCAN1 : xLEDSemaphoreCAN2 );
|
osSemaphoreRelease( (hcan->Instance == CAN1) ? xSemaphoreCAN1 : xSemaphoreCAN2 );
|
||||||
// TODO: use this semaphore
|
// TODO: use this semaphore
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,16 +129,16 @@ void vCANLoggerListen(void *argument)
|
|||||||
void vLEDHeartbeat(void *argument)
|
void vLEDHeartbeat(void *argument)
|
||||||
{
|
{
|
||||||
/* CODE BEGIN */
|
/* CODE BEGIN */
|
||||||
LEDContext *ctx = (LEDContext*)argument;
|
LEDContext *context = (LEDContext*)argument;
|
||||||
|
|
||||||
if (osSemaphoreAcquire(ctx->sem, 0U) == osOK)
|
if (osSemaphoreAcquire(context->semaphore, 0U) == osOK)
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(ctx->led->port, ctx->led->pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(context->led->port, context->led->pin, GPIO_PIN_SET);
|
||||||
osTimerStart(ctx->timer, 25U);
|
osTimerStart(context->timer, 25U);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(ctx->led->port, ctx->led->pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(context->led->port, context->led->pin, GPIO_PIN_RESET);
|
||||||
}
|
}
|
||||||
/* CODE END */
|
/* CODE END */
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -56,7 +56,7 @@ LEDContext ledContextCAN1;
|
|||||||
LEDContext ledContextCAN2;
|
LEDContext ledContextCAN2;
|
||||||
|
|
||||||
osSemaphoreId_t xSemaphoreCAN1;
|
osSemaphoreId_t xSemaphoreCAN1;
|
||||||
osSemaphoreId_t xLEDSemaphoreCAN2;
|
osSemaphoreId_t xSemaphoreCAN2;
|
||||||
|
|
||||||
osTimerId_t xHeartbeatTimerCAN1;
|
osTimerId_t xHeartbeatTimerCAN1;
|
||||||
osTimerId_t xHeartbeatTimerCAN2;
|
osTimerId_t xHeartbeatTimerCAN2;
|
||||||
@@ -143,14 +143,14 @@ int main(void)
|
|||||||
|
|
||||||
/* USER CODE BEGIN RTOS_SEMAPHORES */
|
/* USER CODE BEGIN RTOS_SEMAPHORES */
|
||||||
xSemaphoreCAN1 = osSemaphoreNew(10, 0, NULL);
|
xSemaphoreCAN1 = osSemaphoreNew(10, 0, NULL);
|
||||||
xLEDSemaphoreCAN2 = osSemaphoreNew(10, 0, NULL);
|
xSemaphoreCAN2 = osSemaphoreNew(10, 0, NULL);
|
||||||
|
|
||||||
if (xSemaphoreCAN1 == NULL || xLEDSemaphoreCAN2 == NULL) Error_Handler();
|
if (xSemaphoreCAN1 == NULL || xSemaphoreCAN2 == NULL) Error_Handler();
|
||||||
|
|
||||||
ledContextCAN1.led = &led_can1;
|
ledContextCAN1.led = &led_can1;
|
||||||
ledContextCAN1.semaphore = xSemaphoreCAN1;
|
ledContextCAN1.semaphore = xSemaphoreCAN1;
|
||||||
ledContextCAN2.led = &led_can2;
|
ledContextCAN2.led = &led_can2;
|
||||||
ledContextCAN2.semaphore = xLEDSemaphoreCAN2;
|
ledContextCAN2.semaphore = xSemaphoreCAN2;
|
||||||
/* USER CODE END RTOS_SEMAPHORES */
|
/* USER CODE END RTOS_SEMAPHORES */
|
||||||
|
|
||||||
/* USER CODE BEGIN RTOS_TIMERS */
|
/* USER CODE BEGIN RTOS_TIMERS */
|
||||||
@@ -188,7 +188,7 @@ int main(void)
|
|||||||
ledContextCAN1.timer = xHeartbeatTimerCAN1;
|
ledContextCAN1.timer = xHeartbeatTimerCAN1;
|
||||||
|
|
||||||
ledContextCAN2.led = &led_can2;
|
ledContextCAN2.led = &led_can2;
|
||||||
ledContextCAN2.semaphore = xLEDSemaphoreCAN2;
|
ledContextCAN2.semaphore = xSemaphoreCAN2;
|
||||||
ledContextCAN2.timer = xHeartbeatTimerCAN2;
|
ledContextCAN2.timer = xHeartbeatTimerCAN2;
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user