Skip to content

Commit

Permalink
Rename sound task
Browse files Browse the repository at this point in the history
  • Loading branch information
gdepuille committed Apr 11, 2024
1 parent cafc6ab commit e96e34f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions Core/Src/app_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ const osTimerAttr_t adcTimer_attributes = {
.name = "adcTimer"
};
/* Definitions for soundTime */
osTimerId_t soundTimeHandle;
const osTimerAttr_t soundTime_attributes = {
.name = "soundTime"
osTimerId_t soundTimerHandle;
const osTimerAttr_t soundTimer_attributes = {
.name = "soundTimer"
};

/* Private function prototypes -----------------------------------------------*/
Expand All @@ -86,7 +86,7 @@ double lipoCellPercent(double tension);
void StartDefaultTask(void *argument);
void heartBeatCallback(void *argument);
void adcCallback(void *argument);
void soundTimeCallback(void *argument);
void soundCallback(void *argument);

void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */

Expand Down Expand Up @@ -115,8 +115,8 @@ void MX_FREERTOS_Init(void) {
/* creation of adcTimer */
adcTimerHandle = osTimerNew(adcCallback, osTimerPeriodic, NULL, &adcTimer_attributes);

/* creation of soundTime */
soundTimeHandle = osTimerNew(soundTimeCallback, osTimerOnce, NULL, &soundTime_attributes);
/* creation of soundTimer */
soundTimerHandle = osTimerNew(soundCallback, osTimerOnce, NULL, &soundTimer_attributes);

/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
Expand Down Expand Up @@ -152,9 +152,9 @@ void StartDefaultTask(void *argument)
/* USER CODE BEGIN StartDefaultTask */
LOG_INFO("mainTask: Start");

// Buzzer sound works
// Buzzer sounds works
__HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_1, 27450);
osTimerStart(soundTimeHandle, 0);
osTimerStart(soundTimerHandle, 0);

LOG_INFO("mainTask: Init variables");
configuration.monitoredInternalAlim = false;
Expand Down Expand Up @@ -244,7 +244,7 @@ void StartDefaultTask(void *argument)

} else if (RxHeader.Identifier == GET_SOUND) {
LOG_INFO("mainTask: Sound");
osTimerStart(soundTimeHandle, 0);
osTimerStart(soundTimerHandle, 0);

} else if (RxHeader.Identifier == SET_CONFIG) {
configuration.monitoredInternalAlim = RxData[0] & 0x01;
Expand Down Expand Up @@ -432,10 +432,10 @@ void adcCallback(void *argument)
/* USER CODE END adcCallback */
}

/* soundTimeCallback function */
void soundTimeCallback(void *argument)
/* soundCallback function */
void soundCallback(void *argument)
{
/* USER CODE BEGIN soundTimeCallback */
/* USER CODE BEGIN soundCallback */
for (int i = 0 ; i < 10 ; i++) {
if (i % 2) {
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
Expand All @@ -445,7 +445,7 @@ void soundTimeCallback(void *argument)
osDelay(100);
}
HAL_TIM_PWM_Stop(&htim2, TIM_CHANNEL_1);
/* USER CODE END soundTimeCallback */
/* USER CODE END soundCallback */
}

/* Private application code --------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion alim-controller.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FDCAN1.NominalPrescaler=30
FDCAN1.StdFiltersNbr=1
FREERTOS.IPParameters=Tasks01,configUSE_NEWLIB_REENTRANT,Timers01
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
FREERTOS.Timers01=heartBeatTimer,heartBeatCallback,osTimerPeriodic,Default,NULL,Dynamic,NULL;adcTimer,adcCallback,osTimerPeriodic,Default,NULL,Dynamic,NULL;soundTime,soundTimeCallback,osTimerOnce,Default,NULL,Dynamic,NULL
FREERTOS.Timers01=heartBeatTimer,heartBeatCallback,osTimerPeriodic,Default,NULL,Dynamic,NULL;adcTimer,adcCallback,osTimerPeriodic,Default,NULL,Dynamic,NULL;soundTimer,soundCallback,osTimerOnce,Default,NULL,Dynamic,NULL
FREERTOS.configUSE_NEWLIB_REENTRANT=1
File.Version=6
GPIO.groupedBy=Group By Peripherals
Expand Down

0 comments on commit e96e34f

Please sign in to comment.