From d21c4b2ea3ffa9b8ad630c128292a608ce1854af Mon Sep 17 00:00:00 2001 From: dimercur Date: Tue, 9 Jan 2024 16:59:52 +0100 Subject: [PATCH] Debut de documentation doxygen + renommage de module --- .gitignore | 3 + software/dumber3/Application/application.c | 233 +- software/dumber3/Application/application.h | 60 +- software/dumber3/Application/batterie.c | 273 -- software/dumber3/Application/batterie.h | 15 - software/dumber3/Application/battery.c | 373 +++ software/dumber3/Application/battery.h | 62 + software/dumber3/Application/commands.c | 176 +- software/dumber3/Application/commands.h | 146 +- software/dumber3/Application/config.h | 102 +- software/dumber3/Application/leds.c | 173 +- software/dumber3/Application/leds.h | 94 +- software/dumber3/Application/messages.c | 4 +- software/dumber3/Application/messages.h | 10 +- software/dumber3/Application/moteurs.c | 595 ----- software/dumber3/Application/moteurs.h | 22 - software/dumber3/Application/motors.c | 675 +++++ software/dumber3/Application/motors.h | 67 + software/dumber3/Application/panic.c | 30 +- software/dumber3/Core/Src/main.c | 2 +- software/dumber3/Doxyfile | 2744 ++++++++++++++++++++ 21 files changed, 4713 insertions(+), 1146 deletions(-) delete mode 100644 software/dumber3/Application/batterie.c delete mode 100644 software/dumber3/Application/batterie.h create mode 100644 software/dumber3/Application/battery.c create mode 100644 software/dumber3/Application/battery.h delete mode 100644 software/dumber3/Application/moteurs.c delete mode 100644 software/dumber3/Application/moteurs.h create mode 100644 software/dumber3/Application/motors.c create mode 100644 software/dumber3/Application/motors.h create mode 100644 software/dumber3/Doxyfile diff --git a/.gitignore b/.gitignore index c6df8d7..904782b 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ GUI /software/dumber3/Release/ /software/dumber3/Debug/ /software/dumber3/Tests/ +/software/dumber3/workspace/ + +/doc/Doc\ robot/doxygen/ diff --git a/software/dumber3/Application/application.c b/software/dumber3/Application/application.c index 1356d83..f7a5f81 100644 --- a/software/dumber3/Application/application.c +++ b/software/dumber3/Application/application.c @@ -1,8 +1,57 @@ -/* - * statemachine.c +/** + ****************************************************************************** + * @file application.c + * @brief application body + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 + * + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ + +/** + * @mainpage Dumber 3 + * + * Dumber is a robot used at INSA-GEI, Toulouse, France for realtime computer science teaching. + * Robot is basically controlled by a supervisor program and move depending on commands send by supervisor. + * Movements are controlled by a camera. + * + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Created on: Sep 12, 2022 - * Author: dimercur */ #include "application.h" @@ -10,48 +59,63 @@ #include "string.h" #include -#include "moteurs.h" #include "leds.h" #include "xbee.h" -#include "batterie.h" #include "messages.h" +#include "motors.h" +#include "battery.h" #include "panic.h" +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup APPLICATION + * @{ + */ + +/** @addtogroup APPLICATION_Private Private + * @{ + */ + +/** Enumeration class used by application state machine for defining current application state */ typedef enum { - stateStartup=0, - stateIdle, - stateRun, - stateInCharge, - stateInMouvement, - stateWatchdogDisable, - stateLowBatDisable + stateStartup=0, /**< Startup state, after system power on */ + stateIdle, /**< Idle state, after system has initialized all peripherals and is ready to handle commands */ + stateRun, /**< Run state, after system has received and accepted "StartWithWatchdog" or "StartWithoutWatchdog" command */ + stateInCharge, /**< In Charge state, when a charger is plugged */ + stateInMouvement, /**< In Movement state, when the robot is moving */ + stateWatchdogDisable, /**< Watchdog Disable state, after watchdog has expired */ + stateLowBatDisable /**< Low Bat Disable state, when battery is too low */ } APPLICATION_State; +/** Structure containing information about current system state */ typedef struct { - APPLICATION_State state; - uint8_t cmd; - uint16_t batteryState; - char batteryUpdate; - char inCharge; - int32_t distance; - int32_t turns; - int32_t motor_left; - int32_t motor_right; - char endOfMouvement; - char powerOffRequired; - uint16_t senderAddress; - uint8_t rfProblem; - + APPLICATION_State state; /**< Store current application state*/ + uint8_t cmd; /**< Current received command, CMD_NONE if no command was received */ + uint16_t batteryState; /**< Last battery message received from battery driver*/ + char batteryUpdate; /**< Battery state has changed and need to be processed*/ + char inCharge; /**< Robot is currently plugged for charging*/ + int32_t distance; /**< Distance of movement requested with a MOVE command*/ + int32_t turns; /**< Number of turn requested with a TURN command*/ + int32_t motor_left; /**< Speed to be applied for left motor */ + int32_t motor_right; /**< Speed to be applied for right motor*/ + char endOfMouvement; /**< Flag indicating last movement request has ended, ready for new movement*/ + char powerOffRequired; /**< Flag indicating system power off*/ + uint16_t senderAddress; /**< Xbee sender address (not used)*/ + uint8_t rfProblem; /**< Xbee RF quality (not used)*/ } APPLICATION_Infos; +/** Structure storing counters used for watchdog and system inactivity. + * Used notably to check if watchdog reset was missed or power down system because of inactivity */ typedef struct { - uint32_t startupCnt; - uint32_t inactivityCnt; - uint32_t watchdogCnt; - char watchdogEnabled; - char watchdogMissedCnt; - + uint32_t startupCnt; /**< Counter used during wake up, to allow couple of second for + battery animation to show up before system enters IDLE state*/ + uint32_t inactivityCnt; /**< Counter used to check system inactivity (no command received)*/ + uint32_t watchdogCnt; /**< Counter used for watchdog check. Reset when RESET_WATCHDOG command is received */ + char watchdogEnabled; /**< Flag used to know if watchdog is enabled or not*/ + char watchdogMissedCnt; /**< Counter used to store each time watchdog reset is missed*/ } APPLICATION_Timeout; StaticTask_t xTaskApplicationMain; @@ -66,18 +130,19 @@ StaticTimer_t xBufferTimerTimeout; TimerHandle_t xHandleTimerTimeout = NULL; void vTimerTimeoutCallback( TimerHandle_t xTimer ); -void LEDS_Tests(); - -void APPLICATION_MainThread(void* params); -void APPLICATION_TimeoutThread(void* params); +void APPLICATION_Thread(void* params); void APPLICATION_StateMachine(); -LEDS_State APPLICATION_BatteryLevel(uint8_t voltage, APPLICATION_State state); void APPLICATION_PowerOff(); void APPLICATION_TransitionToNewState(APPLICATION_State new_state); APPLICATION_Infos systemInfos = {0}; APPLICATION_Timeout systemTimeout = {0}; +/** + * @brief Initialization of drivers, modules and application. + * @param None + * @return None + */ void APPLICATION_Init(void) { /* Init des messages box */ MESSAGE_Init(); @@ -87,13 +152,13 @@ void APPLICATION_Init(void) { /* Init de la partie RF / reception des messages */ XBEE_Init(); - BATTERIE_Init(); - MOTEURS_Init(); + BATTERY_Init(); + MOTORS_Init(); /* Create the task without using any dynamic memory allocation. */ xHandleApplicationMain = xTaskCreateStatic( - APPLICATION_MainThread, /* Function that implements the task. */ - "APPLICATION Main", /* Text name for the task. */ + APPLICATION_Thread, /* Function that implements the task. */ + "APPLICATION Thread", /* Text name for the task. */ STACK_SIZE, /* Number of indexes in the xStack array. */ NULL, /* Parameter passed into the task. */ PriorityApplicationHandler,/* Priority at which the task is created. */ @@ -103,8 +168,8 @@ void APPLICATION_Init(void) { /* Create a periodic task without using any dynamic memory allocation. */ xHandleTimerTimeout = xTimerCreateStatic( - "Seq Timer", - pdMS_TO_TICKS(APPLICATION_PERIODE), + "Counters Timer", + pdMS_TO_TICKS(APPLICATION_COUNTERS_DELAY), pdTRUE, ( void * ) 0, vTimerTimeoutCallback, @@ -112,7 +177,16 @@ void APPLICATION_Init(void) { xTimerStart(xHandleTimerTimeout,0 ); } -void APPLICATION_MainThread(void* params) { +/** + * @brief Application thread (main thread) + * + * This thread mainly waits for messages from others threads or drivers, store informations, set various flags + * and then call state machine function (APPLICATION_StateMachine()) for processing actions. + * + * @param[in] params startup parameters for task (not used) + * @return None + */ +void APPLICATION_Thread(void* params) { MESSAGE_Typedef msg; char* receivedCMD; CMD_Generic* decodedCmd; @@ -206,7 +280,7 @@ void APPLICATION_MainThread(void* params) { systemInfos.inCharge=0; systemInfos.batteryState = msg.id; break; - case MSG_ID_MOTEURS_END_OF_MOUVMENT: + case MSG_ID_MOTORS_END_OF_MOUVMENT: systemInfos.endOfMouvement= 1; break; @@ -219,7 +293,16 @@ void APPLICATION_MainThread(void* params) { } } -void APPLICATION_StateMachine() { +/** + * @brief State machine processing function + * + * This function processes received messages depending on current system state. + * In case of state transition, function APPLICATION_TransitionToNewState will be called at end for transition and clean up + * + * @param None + * @return None + */ +void APPLICATION_StateMachine(void) { LEDS_State ledState = leds_off; if (systemInfos.powerOffRequired) @@ -359,9 +442,16 @@ void APPLICATION_StateMachine() { systemInfos.powerOffRequired=0; } +/** + * @brief State machine transition clean up + * + * This function is part of statemachine processing. It's job is to process and cleanup statemachine transition. + * + * @param[in] new_state New state to apply to system + * @return None + */ void APPLICATION_TransitionToNewState(APPLICATION_State new_state) { LEDS_State ledState = leds_off; - //int32_t data; switch (new_state) { case stateStartup: @@ -371,7 +461,7 @@ void APPLICATION_TransitionToNewState(APPLICATION_State new_state) { ledState = leds_idle; LEDS_Set(ledState); - MOTEURS_Stop(); + MOTORS_Stop(); systemTimeout.inactivityCnt=0; systemTimeout.watchdogEnabled=0; break; @@ -383,21 +473,21 @@ void APPLICATION_TransitionToNewState(APPLICATION_State new_state) { LEDS_Set(ledState); - MOTEURS_Stop(); + MOTORS_Stop(); break; case stateInMouvement: ledState = leds_run; LEDS_Set(ledState); if (systemInfos.cmd == CMD_MOVE) { - MOTEURS_Avance( systemInfos.distance); + MOTORS_Move( systemInfos.distance); } else { /* obviously, cmd is CMD_TURN */ - MOTEURS_Tourne(systemInfos.turns); + MOTORS_Turn(systemInfos.turns); } break; case stateInCharge: /* les leds sont gerées dans APPLICATION_StateMachine */ - MOTEURS_Stop(); + MOTORS_Stop(); systemTimeout.watchdogEnabled=0; break; case stateWatchdogDisable: @@ -424,7 +514,15 @@ void APPLICATION_TransitionToNewState(APPLICATION_State new_state) { systemInfos.state = new_state; } -void APPLICATION_PowerOff() { +/** + * @brief Power off robot + * + * Disable main regulator and power off system. Used after inactivity or when user press on/off button. + * + * @param None + * @return None + */ +void APPLICATION_PowerOff(void) { /* * TODO: a decommenter quand le code sera debuggé */ @@ -435,10 +533,17 @@ void APPLICATION_PowerOff() { } } -/* - * This task is called every 100 ms - * RQ: les constante de temps sont exprimé en ms, d'où la division par 100 - */ +/** + * @brief Periodic task used for system counter update + * + * This periodic task is called every 100 ms and is used for updating inactivity, startup and watchdog counters, + * sending messages or triggering transition if necessary. + * + * @remark Time constants are expressed in ms, thus explaining the division by 100 used in comparison. + * + * @param[in] xTimer Handler for periodic task + * @return None + */ void vTimerTimeoutCallback( TimerHandle_t xTimer ) { if (systemInfos.state == stateStartup) { systemTimeout.startupCnt++; @@ -465,3 +570,15 @@ void vTimerTimeoutCallback( TimerHandle_t xTimer ) { } } } + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ diff --git a/software/dumber3/Application/application.h b/software/dumber3/Application/application.h index 53784dc..971d2d4 100644 --- a/software/dumber3/Application/application.h +++ b/software/dumber3/Application/application.h @@ -1,10 +1,32 @@ -/* - * statemachine.h +/** + ****************************************************************************** + * @file application.h + * @brief application header + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 * - * Created on: Sep 12, 2022 - * Author: dimercur - */ + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ #ifndef INC_APPLICATION_H_ #define INC_APPLICATION_H_ @@ -14,13 +36,37 @@ #include "messages.h" #include "leds.h" -#include "moteurs.h" -#include "batterie.h" +#include "battery.h" +#include "motors.h" #include "xbee.h" #include "commands.h" #include "main.h" +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup APPLICATION + * @{ + */ + +/** @addtogroup APPLICATION_Public Public + * @{ + */ + void APPLICATION_Init(void); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + #endif /* INC_APPLICATION_H_ */ diff --git a/software/dumber3/Application/batterie.c b/software/dumber3/Application/batterie.c deleted file mode 100644 index b3c5cb5..0000000 --- a/software/dumber3/Application/batterie.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * batterie.c - * - * Created on: Sep 12, 2022 - * Author: dimercur - */ - -#include "batterie.h" -#include "stm32l0xx.h" -#include "stm32l0xx_ll_gpio.h" -#include "timers.h" - -typedef enum { - CHARGEUR_NOT_PLUGGED, - CHARGEUR_IN_CHARGE, - CHARGEUR_CHARGE_COMPLETE, - CHARGEUR_ERROR -} BATTERIE_StatusChargerTypedef; - -#define BATTERIE_MAX_ERROR 3 - -extern ADC_HandleTypeDef hadc; -uint8_t conversion_complete; -uint16_t adc_raw_value; - -StaticTask_t xTaskBatterie; - -/* Buffer that the task being created will use as its stack. Note this is - an array of StackType_t variables. The size of StackType_t is dependent on - the RTOS port. */ -StackType_t xStackBatterie[ STACK_SIZE ]; -TaskHandle_t xHandleBatterie = NULL; -TaskHandle_t task_handler; -TaskHandle_t charger_thread_handler; - -/* TimerButton sert à attendre ~ 3secondes avant de prendre en compte les IT bouton - * En effet, au demarrage, le bouton est appuyé pour lancer le systeme. ceci genere alors une IT bouton, - * ammenant à envoyer le message MSG_ID_BUTTON_PRESSED, demandant l'arret du systeme - * - * De ce fait, avec cette tempo, on s'assure de ne pas prendre en compte les IT dans les 3 premieres secondes. - */ -StaticTimer_t xBufferTimerButton; -TimerHandle_t xHandleTimerButton = NULL; -void vTimerButtonCallback( TimerHandle_t xTimer ); -uint8_t BUTTON_Inactivity=1; //start with button on/off inactive - -void BATTERIE_VoltageThread(void* params); - -void BATTERIE_Init(void) { - //task_handler = NULL; - //charger_thread_handler = NULL; - - /* Create the task without using any dynamic memory allocation. */ - xHandleBatterie = xTaskCreateStatic( - BATTERIE_VoltageThread, /* Function that implements the task. */ - "BATTERIE Voltage", /* Text name for the task. */ - STACK_SIZE, /* Number of indexes in the xStack array. */ - NULL, /* Parameter passed into the task. */ - PriorityBatterieHandler,/* Priority at which the task is created. */ - xStackBatterie, /* Array to use as the task's stack. */ - &xTaskBatterie); /* Variable to hold the task's data structure. */ - - /* Create a periodic task without using any dynamic memory allocation. */ - xHandleTimerButton = xTimerCreateStatic( - "Inactivity Button Timer", - pdMS_TO_TICKS(BUTTON_INACTIVITY_PERIODE), - pdTRUE, - ( void * ) 0, - vTimerButtonCallback, - &xBufferTimerButton); - - xTimerStart(xHandleTimerButton,0 ); - vTaskResume(xHandleBatterie); -} - -/* - * Lit les pins GPIO - */ -BATTERIE_StatusChargerTypedef BATTERIE_LireStatusChargeur(void) { - uint32_t st2 = LL_GPIO_ReadInputPort(CHARGER_ST2_GPIO_Port) & CHARGER_ST2_Pin; - uint32_t st1 = LL_GPIO_ReadInputPort(CHARGER_ST1_GPIO_Port) & CHARGER_ST1_Pin; - - BATTERIE_StatusChargerTypedef status; - - if (st1 && st2) - status = CHARGEUR_NOT_PLUGGED; - else if (st1 && !st2) - status = CHARGEUR_CHARGE_COMPLETE; - else if (!st1 && st2) - status = CHARGEUR_IN_CHARGE; - else /* !st1 && !st2 */ - status = CHARGEUR_ERROR; - - return status; -} - -int BATTERIE_LireTension(uint16_t *val) { - uint32_t ulNotificationValue; - conversion_complete = 0; - adc_raw_value = 0; - - task_handler = xTaskGetCurrentTaskHandle(); - - if (HAL_ADC_Start_IT(&hadc) != HAL_OK) - return -1; - - ulNotificationValue = ulTaskNotifyTake( pdTRUE, pdMS_TO_TICKS(100)); // wait max 100 ms - - if (ulNotificationValue == 1) { - /* The transmission ended as expected. */ - *val = adc_raw_value; - } else { - /* The call to ulTaskNotifyTake() timed out. */ - return -2; - } - - task_handler = NULL; - - return 0; -} - -/* - * Il faut considerer ces valeurs comme les seuils de baculement dans une categorie - * ou une autre - * - * Seuil : critical low high - * Tension batterie: 2.9 critic 3.1 low 3.3 med 3.6 high 4.2 - * - */ -#ifdef TESTS -uint8_t BATTERIE_LEVEL_CRITICAL=135; -uint8_t BATTERIE_LEVEL_LOW=145; -uint8_t BATTERIE_LEVEL_HIGH=155; - -uint8_t BATTERIE_LEVEL_CHARGE_LOW=150; -uint8_t BATTERIE_LEVEL_CHARGE_HIGH=170; - -uint8_t BATTERIE_currentValue; -#else -#define BATTERIE_LEVEL_CRITICAL 135 -#define BATTERIE_LEVEL_LOW 145 -#define BATTERIE_LEVEL_HIGH 155 - -#define BATTERIE_LEVEL_CHARGE_LOW 150 -#define BATTERIE_LEVEL_CHARGE_HIGH 170 -#endif /* TESTS */ - -uint16_t BATTERIE_BatteryLevel(uint8_t voltage, BATTERIE_StatusChargerTypedef chargerStatus) { - uint16_t msgId=0; - -#ifdef TESTS - BATTERIE_currentValue=voltage; -#endif /* TESTS */ - - switch (chargerStatus) { - case CHARGEUR_CHARGE_COMPLETE: - msgId = MSG_ID_BAT_CHARGE_COMPLETE; - break; - case CHARGEUR_IN_CHARGE: - if (voltage<=BATTERIE_LEVEL_CHARGE_LOW) - msgId = MSG_ID_BAT_CHARGE_LOW; - else if (voltage>=BATTERIE_LEVEL_CHARGE_HIGH) - msgId = MSG_ID_BAT_CHARGE_HIGH; - else - msgId = MSG_ID_BAT_CHARGE_MED; - break; - case CHARGEUR_NOT_PLUGGED: - if (voltage<=BATTERIE_LEVEL_CRITICAL) - msgId = MSG_ID_BAT_CRITICAL_LOW; - else if (voltage<=BATTERIE_LEVEL_LOW) - msgId = MSG_ID_BAT_LOW; - else if (voltage>=BATTERIE_LEVEL_HIGH) - msgId = MSG_ID_BAT_HIGH; - else - msgId = MSG_ID_BAT_MED; - break; - default: - msgId = MSG_ID_BAT_CHARGE_ERR; - } - - return msgId; -} - -void BATTERIE_VoltageThread(void* params) { - static uint16_t tension; - static uint8_t batteryErrorCnt=0; - BATTERIE_StatusChargerTypedef currentStatus; - uint16_t messageID; - - TickType_t xLastWakeTime; - - // Initialise the xLastWakeTime variable with the current time. - xLastWakeTime = xTaskGetTickCount(); - - while (1) { - if (BATTERIE_LireTension(&tension) ==0) { - currentStatus = BATTERIE_LireStatusChargeur(); - if (currentStatus == CHARGEUR_ERROR) { - batteryErrorCnt++; - - if (batteryErrorCnt>=BATTERIE_MAX_ERROR) - MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_BAT_CHARGE_ERR, (QueueHandle_t)0x0, (void*)NULL); - } else { - messageID = BATTERIE_BatteryLevel(tension, currentStatus); - MESSAGE_SendMailbox(APPLICATION_Mailbox, messageID, (QueueHandle_t)0x0, (void*)NULL); - } -#ifdef TESTS - MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_BAT_LEVEL, (QueueHandle_t)0x0, (void*)&tension); -#endif /* TESTS*/ - } else { - MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_BAT_ADC_ERR, (QueueHandle_t)0x0, (void*)0x0); - } - - // Wait for the next cycle. - vTaskDelayUntil( &xLastWakeTime, pdMS_TO_TICKS(BATTERIE_PERIODE_SCRUTATION)); - } -} - -void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc) { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - - adc_raw_value = HAL_ADC_GetValue(hadc); - - if (task_handler != NULL) { - /* Notify the task that an event has been emitted. */ - vTaskNotifyGiveFromISR(task_handler, &xHigherPriorityTaskWoken ); - - /* There are no more eventin progress, so no tasks to notify. */ - task_handler = NULL; - - /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch - should be performed to ensure the interrupt returns directly to the highest - priority task. The macro used for this purpose is dependent on the port in - use and may be called portEND_SWITCHING_ISR(). */ - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); - } -} - -void vTimerButtonCallback( TimerHandle_t xTimer ) { - BUTTON_Inactivity=0; - - xTimerStop(xHandleTimerButton,0 ); -} - -/** - * @brief This function handles EXTI line0 interrupt. - */ -void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - - // if (GPIO_Pin == USB_SENSE_Pin) { // Le chargeur vient d'etre branché ou debranché - // if (HAL_GPIO_ReadPin(USB_SENSE_GPIO_Port, GPIO_Pin)==GPIO_PIN_SET) // le chargeur est branché - // MESSAGE_SendMailboxFromISR(APPLICATION_Mailbox, MSG_ID_BAT_CHARGE_ON, (QueueHandle_t)0x0, 0x0, &xHigherPriorityTaskWoken); - // else - // MESSAGE_SendMailboxFromISR(APPLICATION_Mailbox, MSG_ID_BAT_CHARGE_OFF, (QueueHandle_t)0x0, 0x0, &xHigherPriorityTaskWoken); - // } - // else - - if (GPIO_Pin == BUTTON_SENSE_Pin) { // on vient d'appuyer sur le bouton on/off - if (!BUTTON_Inactivity) { - if (HAL_GPIO_ReadPin(BUTTON_SENSE_GPIO_Port, GPIO_Pin)==GPIO_PIN_RESET) // GPIOB.3 = 0 => le bouton est appuyé - MESSAGE_SendMailboxFromISR(APPLICATION_Mailbox, MSG_ID_BUTTON_PRESSED, (QueueHandle_t)0x0, 0x0, &xHigherPriorityTaskWoken); - } - } - - if (xHigherPriorityTaskWoken) { - /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch - should be performed to ensure the interrupt returns directly to the highest - priority task. The macro used for this purpose is dependent on the port in - use and may be called portEND_SWITCHING_ISR(). */ - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); - } -} diff --git a/software/dumber3/Application/batterie.h b/software/dumber3/Application/batterie.h deleted file mode 100644 index 79313c9..0000000 --- a/software/dumber3/Application/batterie.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * batterie.h - * - * Created on: Sep 12, 2022 - * Author: dimercur - */ - -#ifndef INC_BATTERIE_H_ -#define INC_BATTERIE_H_ - -#include "application.h" - -void BATTERIE_Init(void); - -#endif /* INC_BATTERIE_H_ */ diff --git a/software/dumber3/Application/battery.c b/software/dumber3/Application/battery.c new file mode 100644 index 0000000..c5c0bfd --- /dev/null +++ b/software/dumber3/Application/battery.c @@ -0,0 +1,373 @@ +/** + ****************************************************************************** + * @file battery.c + * @brief battery driver body + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 + * + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ + +#include "battery.h" +#include "stm32l0xx.h" +#include "stm32l0xx_ll_gpio.h" +#include "timers.h" + +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup BATTERY + * Battery driver is in charge of monitoring battery voltage, checking for state change in charger, + * sending message when new events or new voltage acquisitions happened and monitor on/off button + * @{ + */ + +/** @addtogroup BATTERY_Private Private + * @{ + */ + +/** Enumeration class defining ST601E battery charger chip states */ +typedef enum { + CHARGER_NOT_PLUGGED, /**< Charger is idle, no USB cable is plugged */ + CHARGER_IN_CHARGE, /**< Charger is currently charging battery, USB cable is plugged */ + CHARGER_CHARGE_COMPLETE, /**< Battery charging is finished, charge has ended but USB cable is still plugged */ + CHARGER_ERROR /**< An error occured during battery charging: charge has ended and USB cable is plugged */ +} BATTERY_StatusChargerTypedef; + +/** Constant used to removed spurious "CHARGER_ERROR" events */ +#define BATTERY_MAX_ERROR 3 + +extern ADC_HandleTypeDef hadc; +uint8_t conversion_complete; +uint16_t adc_raw_value; + +StaticTask_t xTaskBattery; + +/* Buffer that the task being created will use as its stack. Note this is + an array of StackType_t variables. The size of StackType_t is dependent on + the RTOS port. */ +StackType_t xStackBattery[ STACK_SIZE ]; +TaskHandle_t xHandleBattery = NULL; +TaskHandle_t task_handler; +TaskHandle_t charger_thread_handler; + +/* TimerButton sert à attendre ~ 1.5 secondes avant de prendre en compte les IT bouton + * En effet, au demarrage, le bouton est appuyé pour lancer le systeme. Ceci genere alors une IT bouton, + * ammenant à envoyer le message MSG_ID_BUTTON_PRESSED, demandant l'arret du systeme + * + * De ce fait, avec cette tempo, on s'assure de ne pas prendre en compte les IT dans les 3 premieres secondes. + */ +StaticTimer_t xBufferTimerButton; +TimerHandle_t xHandleTimerButton = NULL; +void vTimerButtonCallback( TimerHandle_t xTimer ); +uint8_t BUTTON_Inactivity=1; //start with button on/off inactive + +void BATTERY_Thread(void* params); + +/** + * @brief Function for initializing battery and on/off button monitoring + * + * @param None + * @retval None + */ +void BATTERY_Init(void) { + /* Create the task without using any dynamic memory allocation. */ + xHandleBattery = xTaskCreateStatic( + BATTERY_Thread, /* Function that implements the task. */ + "BATTERY Task", /* Text name for the task. */ + STACK_SIZE, /* Number of indexes in the xStack array. */ + NULL, /* Parameter passed into the task. */ + PriorityBatteryHandler,/* Priority at which the task is created. */ + xStackBattery, /* Array to use as the task's stack. */ + &xTaskBattery); /* Variable to hold the task's data structure. */ + + /* Create a one-shot timer without using any dynamic memory allocation. */ + xHandleTimerButton = xTimerCreateStatic( + "Inactivity Button Timer", + pdMS_TO_TICKS(BUTTON_INACTIVITY_DELAY), + pdTRUE, + ( void * ) 0, + vTimerButtonCallback, + &xBufferTimerButton); + + xTimerStart(xHandleTimerButton,0 ); + vTaskResume(xHandleBattery); +} + +/** + * @brief Read charger status pins and return corresponding charger inner state + * + * @param None + * @retval Charger current state + */ +BATTERY_StatusChargerTypedef BATTERY_GetChargerStatus(void) { + uint32_t st2 = LL_GPIO_ReadInputPort(CHARGER_ST2_GPIO_Port) & CHARGER_ST2_Pin; + uint32_t st1 = LL_GPIO_ReadInputPort(CHARGER_ST1_GPIO_Port) & CHARGER_ST1_Pin; + + BATTERY_StatusChargerTypedef status; + + if (st1 && st2) + status = CHARGER_NOT_PLUGGED; + else if (st1 && !st2) + status = CHARGER_CHARGE_COMPLETE; + else if (!st1 && st2) + status = CHARGER_IN_CHARGE; + else /* !st1 && !st2 */ + status = CHARGER_ERROR; + + return status; +} + +/** + * @brief Start a voltage acquisition and wait for conversion to end + * + * @param[out] val Battery voltage (raw adc value) + * @return + * - 0 in case of success + * - -1 if unable to start ADC + * - -2 if timeout occured waiting for conversion to end + */ +int BATTERY_GetVoltage(uint16_t *val) { + uint32_t ulNotificationValue; + conversion_complete = 0; + adc_raw_value = 0; + + task_handler = xTaskGetCurrentTaskHandle(); + + if (HAL_ADC_Start_IT(&hadc) != HAL_OK) + return -1; + + ulNotificationValue = ulTaskNotifyTake( pdTRUE, pdMS_TO_TICKS(100)); // wait max 100 ms + + if (ulNotificationValue == 1) { + /* The transmission ended as expected. */ + *val = adc_raw_value; + } else { + /* The call to ulTaskNotifyTake() timed out. */ + return -2; + } + + task_handler = NULL; + + return 0; +} + +/* + * Il faut considerer ces valeurs comme les seuils de baculement dans une categorie + * ou une autre + * + * Seuil : critical low high + * Tension batterie: 2.9 critic 3.1 low 3.3 med 3.6 high 4.2 + * + */ +#ifdef TESTS +uint8_t BATTERY_LEVEL_CRITICAL=135; +uint8_t BATTERY_LEVEL_LOW=145; +uint8_t BATTERY_LEVEL_HIGH=155; + +uint8_t BATTERY_LEVEL_CHARGE_LOW=150; +uint8_t BATTERY_LEVEL_CHARGE_HIGH=170; + +uint8_t BATTERIE_currentValue; +#else +#define BATTERY_LEVEL_CRITICAL 135 +#define BATTERY_LEVEL_LOW 145 +#define BATTERY_LEVEL_HIGH 155 + +#define BATTERY_LEVEL_CHARGE_LOW 150 +#define BATTERY_LEVEL_CHARGE_HIGH 170 +#endif /* TESTS */ + +/** + * @brief Convert battery voltage into several ranges (level) depending on current charger status (charging or not) + * and return corresponding message id to send to application. + * + * @param[in] voltage Battery voltage (raw adc value) + * @param[in] charger status + * @return message id to be sent to application mailbox + */ +uint16_t BATTERY_BatteryLevel(uint8_t voltage, BATTERY_StatusChargerTypedef chargerStatus) { + uint16_t msgId=0; + +#ifdef TESTS + BATTERY_currentValue=voltage; +#endif /* TESTS */ + + switch (chargerStatus) { + case CHARGER_CHARGE_COMPLETE: + msgId = MSG_ID_BAT_CHARGE_COMPLETE; + break; + case CHARGER_IN_CHARGE: + if (voltage<=BATTERY_LEVEL_CHARGE_LOW) + msgId = MSG_ID_BAT_CHARGE_LOW; + else if (voltage>=BATTERY_LEVEL_CHARGE_HIGH) + msgId = MSG_ID_BAT_CHARGE_HIGH; + else + msgId = MSG_ID_BAT_CHARGE_MED; + break; + case CHARGER_NOT_PLUGGED: + if (voltage<=BATTERY_LEVEL_CRITICAL) + msgId = MSG_ID_BAT_CRITICAL_LOW; + else if (voltage<=BATTERY_LEVEL_LOW) + msgId = MSG_ID_BAT_LOW; + else if (voltage>=BATTERY_LEVEL_HIGH) + msgId = MSG_ID_BAT_HIGH; + else + msgId = MSG_ID_BAT_MED; + break; + default: + msgId = MSG_ID_BAT_CHARGE_ERR; + } + + return msgId; +} + +/** + * @brief Battery main thread. Periodically , check charger status and battery level. + * In case of any change (level or charger status), send a message to application mailbox. + * Delay is provided by BATTERY_POLLING_DELAY constant (1 second) + * + * @param[in] params startup parameters for task (not used) + * @return None + */ +void BATTERY_Thread(void* params) { + static uint16_t voltage; + static uint8_t batteryErrorCnt=0; + BATTERY_StatusChargerTypedef currentStatus; + uint16_t messageID; + + TickType_t xLastWakeTime; + + // Initialise the xLastWakeTime variable with the current time. + xLastWakeTime = xTaskGetTickCount(); + + while (1) { + if (BATTERY_GetVoltage(&voltage) ==0) { + currentStatus = BATTERY_GetChargerStatus(); + if (currentStatus == CHARGER_ERROR) { + batteryErrorCnt++; + + if (batteryErrorCnt>=BATTERY_MAX_ERROR) + MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_BAT_CHARGE_ERR, (QueueHandle_t)0x0, (void*)NULL); + } else { + messageID = BATTERY_BatteryLevel(voltage, currentStatus); + MESSAGE_SendMailbox(APPLICATION_Mailbox, messageID, (QueueHandle_t)0x0, (void*)NULL); + } +#ifdef TESTS + MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_BAT_LEVEL, (QueueHandle_t)0x0, (void*)&voltage); +#endif /* TESTS*/ + } else { + MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_BAT_ADC_ERR, (QueueHandle_t)0x0, (void*)0x0); + } + + // Wait for the next cycle. + vTaskDelayUntil( &xLastWakeTime, pdMS_TO_TICKS(BATTERY_POLLING_DELAY)); + } +} + +/** + * @brief Callback when ADC conversion end. Store converted value + * + * @param[in] hadc ADC informations + * @return None + */ +void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc) { + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + + adc_raw_value = HAL_ADC_GetValue(hadc); + + if (task_handler != NULL) { + /* Notify the task that an event has been emitted. */ + vTaskNotifyGiveFromISR(task_handler, &xHigherPriorityTaskWoken ); + + /* There are no more eventin progress, so no tasks to notify. */ + task_handler = NULL; + + /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch + should be performed to ensure the interrupt returns directly to the highest + priority task. The macro used for this purpose is dependent on the port in + use and may be called portEND_SWITCHING_ISR(). */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + } +} + +/** + * @brief One-shot timer used to avoid on-off button to trigger event at startup + * + * When system power-up, user may still press on/off button while corresponding EXTI is enabled, triggering an interruption that + * will send a power-off event, disabling system. To avoid this behavior, button events are not accounted during the first 1.5s. + * This timer is used to disable "BUTTON_Inactivity" flag, restoring normal behavior + * @param None + * @retval None + */ +void vTimerButtonCallback( TimerHandle_t xTimer ) { + BUTTON_Inactivity=0; + + xTimerStop(xHandleTimerButton,0 ); +} + +/** + * @brief Interrupt handler for external IT (raised by on/off button). + * + * @param[in] GPIO_Pin GPIO pin number that raised interruption + * @return None + */ +void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + + // if (GPIO_Pin == USB_SENSE_Pin) { // Le chargeur vient d'etre branché ou debranché + // if (HAL_GPIO_ReadPin(USB_SENSE_GPIO_Port, GPIO_Pin)==GPIO_PIN_SET) // le chargeur est branché + // MESSAGE_SendMailboxFromISR(APPLICATION_Mailbox, MSG_ID_BAT_CHARGE_ON, (QueueHandle_t)0x0, 0x0, &xHigherPriorityTaskWoken); + // else + // MESSAGE_SendMailboxFromISR(APPLICATION_Mailbox, MSG_ID_BAT_CHARGE_OFF, (QueueHandle_t)0x0, 0x0, &xHigherPriorityTaskWoken); + // } + // else + + if (GPIO_Pin == BUTTON_SENSE_Pin) { // on vient d'appuyer sur le bouton on/off + if (!BUTTON_Inactivity) { + if (HAL_GPIO_ReadPin(BUTTON_SENSE_GPIO_Port, GPIO_Pin)==GPIO_PIN_RESET) // GPIOB.3 = 0 => le bouton est appuyé + MESSAGE_SendMailboxFromISR(APPLICATION_Mailbox, MSG_ID_BUTTON_PRESSED, (QueueHandle_t)0x0, 0x0, &xHigherPriorityTaskWoken); + } + } + + if (xHigherPriorityTaskWoken) { + /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch + should be performed to ensure the interrupt returns directly to the highest + priority task. The macro used for this purpose is dependent on the port in + use and may be called portEND_SWITCHING_ISR(). */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + } +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ diff --git a/software/dumber3/Application/battery.h b/software/dumber3/Application/battery.h new file mode 100644 index 0000000..4e74c27 --- /dev/null +++ b/software/dumber3/Application/battery.h @@ -0,0 +1,62 @@ +/** + ****************************************************************************** + * @file battery.c + * @brief battery driver header + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 + * + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ + +#ifndef INC_BATTERY_H_ +#define INC_BATTERY_H_ + +#include "application.h" + +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup BATTERY + * @{ + */ + +/** @addtogroup BATTERY_Public Public + * @{ + */ + +void BATTERY_Init(void); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* INC_BATTERY_H_ */ diff --git a/software/dumber3/Application/commands.c b/software/dumber3/Application/commands.c index 8bf7e56..7423565 100644 --- a/software/dumber3/Application/commands.c +++ b/software/dumber3/Application/commands.c @@ -1,8 +1,31 @@ -/* - * cmd.c +/** + ****************************************************************************** + * @file commands.c + * @brief commands handler body + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 * - * Created on: 3 oct. 2022 - * Author: dimercur + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** */ #include "commands.h" @@ -10,8 +33,23 @@ #include #include -/* Definition des commandes */ +/** @addtogroup Application_Software + * @{ + */ +/** @addtogroup COMMANDS + * Commands handler is in charge of decoding received commands and building answer frames. + * @{ + */ + +/** @addtogroup COMMANDS_Private Private + * @{ + */ + +/** @name Commands definition + * List of accepted command identifiers + */ +///@{ #define PingCMD 'p' #define ResetCMD 'r' #define SetMotorCMD 'm' @@ -26,28 +64,34 @@ #define TestCMD 't' #define DebugCMD 'a' #define PowerOffCMD 'z' +///@} +/** @name Answers definition + * List of available answers + */ +///@{ #define OK_ANS "O\r" #define ERR_ANS "E\r" #define UNKNOW_ANS "C\r" #define BAT_OK "2\r" #define BAT_LOW "1\r" #define BAT_EMPTY "0\r" +///@} char* cmdAddChecksum(const char* str); char cmdVerifyChecksum(char* str); -/** @addtogroup Checksum - * @{ - */ /** - * @brief Inclut le checksum à sendString + * @brief Add checksum to a string * - * Parcours str pour y calculer le checksum ( xor sur chaque caractére) - * et inclut le resultat en fin de chaine. + * Make a copy of a string and add checksum at its end (xor based). * - * @param string sans checksum - * @retval string avec checksum + * @warning This function use memory allocation for creating a copy of the original string. Be sure to free memory after use. + * + * @todo Error related to memory allocation (allocation failed) is not managed -> should generate a Panic + * + * @param[in] str string without checksum + * @return string with checksum added * */ char* cmdAddChecksum(const char* str) { @@ -70,14 +114,15 @@ char* cmdAddChecksum(const char* str) { } /** - * @brief Verifie le checksum de la variable global recepitString + * @brief Verify checksum of given string * - * Vérifie le dernier carctére de str sensé être le checksum. - * Si celui-ci est bon, ll retournera 0 et supprimera le checksum de str - * sinon il retournera 1 sans faire de modification. - * @param None - * @retval 0 si le checksum est faux, 1 sinon + * Verify if checksum of given string is correct or not. In case of success, + * function will suppress checksum from the string, otherwise string is not modified. * + * @param[in] str string to verify checksum + * @return + * - 0 if checksum is not correct + * - 1 if successful */ char cmdVerifyChecksum(char* str) { uint16_t j; @@ -112,9 +157,25 @@ char cmdVerifyChecksum(char* str) { } /** - * @} + * @brief Decode received command + * + * Command string is processed and a command structure is filled with information found in string. + * + * @warning This function use memory allocation for returning structure. Be sure to release memory after use. + * + * @param[in] cmd string with command received + * @param[in] length length of command string + * @return + * - NULL if memory allocation has failed + * - CMD_Move if string contains MOVE command + * - CMD_Turn if string contains TURN command + * - CMD_Generic for each other command + * + * Generic structure returned may contains CMD_NONE if command is unknown or CMD_INVALID_CHECKSUM if checksum is not valid + * + * @remark Returned value is always cast on a CMD_Generic type, but may contains CMD_Move or CMD_Turn structure. It is + * user responsibility to check type field inside structure and cast accordingly returned value to correct structure. */ - CMD_Generic* cmdDecode(char* cmd, uint8_t length) { CMD_Generic* decodedCmd; char cmd_type = cmd[0]; @@ -214,6 +275,19 @@ CMD_Generic* cmdDecode(char* cmd, uint8_t length) { return decodedCmd; } +/** + * @brief Add correct checksum to provided answer and send it to XBEE mailbox + * + * @warning This function use cmdAddChecksum, so indirectly make use of memory allocation for sending message to XBEE mailbox. + * Be sure to release memory in XBEE driver after retrieving message from mailbox. + * + * @todo Error related to memory allocation (allocation failed) is not managed -> should generate a Panic + * + * @todo Maybe duplication between this function and cmdSendString: see if only one function with a macro/wrapper could be used + * + * @param[in] ans string containing answer to send, without checksum + * @return None + */ void cmdSendAnswer(uint8_t ans) { char* answer; @@ -232,6 +306,19 @@ void cmdSendAnswer(uint8_t ans) { MESSAGE_SendMailbox(XBEE_Mailbox, MSG_ID_XBEE_ANS, APPLICATION_Mailbox, (char*) answer); } +/** + * @brief Send arbitrary answer to XBEE driver and add checksum before + * + * @warning This function use cmdAddChecksum, so indirectly make use of memory allocation for sending message to XBEE mailbox. + * Be sure to release memory in XBEE driver after retrieving message from mailbox. + * + * @todo Error related to memory allocation (allocation failed) is not managed -> should generate a Panic + * + * @todo Maybe duplication between this function and cmdSendAnswer: see if only one function with a macro/wrapper could be used + * + * @param[in] str string containing answer to send without checksum + * @return None + */ void cmdSendString(char *str) { char* answer; int strlength = strlen(str); @@ -247,6 +334,19 @@ void cmdSendString(char *str) { MESSAGE_SendMailbox(XBEE_Mailbox, MSG_ID_XBEE_ANS, APPLICATION_Mailbox, (char*) answer); } +/** + * @brief Send battery level answer with correct checksum to XBEE driver + * + * @warning This function use cmdAddChecksum, so indirectly make use of memory allocation for sending message to XBEE mailbox. + * Be sure to release memory in XBEE driver after retrieving message from mailbox. + * + * @todo Error related to memory allocation (allocation failed) is not managed -> should generate a Panic + * + * @todo Check batterystate type used here: seems a bit overkill (16bit for only 6 states) -> enum should be better + * + * @param[in] batteryState current battery state + * @return None + */ void cmdSendBatteryLevel(uint16_t batteryState) { char* answer; @@ -268,6 +368,17 @@ void cmdSendBatteryLevel(uint16_t batteryState) { MESSAGE_SendMailbox(XBEE_Mailbox, MSG_ID_XBEE_ANS, APPLICATION_Mailbox, (char*) answer); } +/** + * @brief Send version number answer with correct checksum to XBEE driver + * + * @warning This function use cmdAddChecksum, so indirectly make use of memory allocation for sending message to XBEE mailbox. + * Be sure to release memory in XBEE driver after retrieving message from mailbox. + * + * @todo Error related to memory allocation (allocation failed) is not managed -> should generate a Panic + * + * @param None + * @return None + */ void cmdSendVersion(void) { int versionlength = strlen(SYSTEM_VERSION_STR); char versionstr[versionlength+2]; @@ -282,6 +393,17 @@ void cmdSendVersion(void) { MESSAGE_SendMailbox(XBEE_Mailbox, MSG_ID_XBEE_ANS, APPLICATION_Mailbox, (char*) answer); } +/** + * @brief Send if robot is busy (moving) or not XBEE driver + * + * @warning This function use cmdAddChecksum, so indirectly make use of memory allocation for sending message to XBEE mailbox. + * Be sure to release memory in XBEE driver after retrieving message from mailbox. + * + * @todo Error related to memory allocation (allocation failed) is not managed -> should generate a Panic + * + * @param[in] state current robot state + * @return None + */ void cmdSendBusyState(uint8_t state) { char* answer; @@ -292,3 +414,15 @@ void cmdSendBusyState(uint8_t state) { MESSAGE_SendMailbox(XBEE_Mailbox, MSG_ID_XBEE_ANS, APPLICATION_Mailbox, (char*) answer); } + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ diff --git a/software/dumber3/Application/commands.h b/software/dumber3/Application/commands.h index da961f1..ef37cf0 100644 --- a/software/dumber3/Application/commands.h +++ b/software/dumber3/Application/commands.h @@ -1,8 +1,31 @@ -/* - * cmd.h +/** + ****************************************************************************** + * @file commands.h + * @brief commands handler header + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 * - * Created on: 3 oct. 2022 - * Author: dimercur + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** */ #ifndef INC_CMD_H_ @@ -10,74 +33,83 @@ #include "application.h" +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup COMMANDS + * @{ + */ + +/** @addtogroup COMMANDS_Public Public + * @{ + */ + +/** Enumeration class defining commands to be used in \ref CMD_Generic, \ref CMD_Move, \ref CMD_Turn structures */ typedef enum { - CMD_NONE=0x0, - CMD_PING, - CMD_RESET, - CMD_START_WITH_WATCHDOG, - CMD_RESET_WATCHDOG, - CMD_GET_BATTERY, - CMD_GET_VERSION, - CMD_START_WITHOUT_WATCHDOG, - CMD_MOVE, - CMD_TURN, - CMD_GET_BUSY_STATE, - CMD_TEST, - CMD_DEBUG, - CMD_POWER_OFF, - CMD_INVALID_CHECKSUM=0xFF + CMD_NONE=0x0, /**< Command is unknown */ + CMD_PING, /**< PING command */ + CMD_RESET, /**< RESET command */ + CMD_START_WITH_WATCHDOG, /**< START_WITH_WATCHDOG command */ + CMD_RESET_WATCHDOG, /**< RESET_WATCHDOG command */ + CMD_GET_BATTERY, /**< GET_BATTERY command */ + CMD_GET_VERSION, /**< GET_VERSION command */ + CMD_START_WITHOUT_WATCHDOG, /**< START_WITHOUT_WATCHDOG command */ + CMD_MOVE, /**< MOVE command */ + CMD_TURN, /**< TURN command */ + CMD_GET_BUSY_STATE, /**< GET_BUSY_STATE command */ + CMD_TEST, /**< TEST command (not used yet) */ + CMD_DEBUG, /**< DEBUG command (not used yet) */ + CMD_POWER_OFF, /**< POWER_OFF command */ + CMD_INVALID_CHECKSUM=0xFF /**< Received command string has an invalid checksum*/ } CMD_CommandsType; +/** Enumeration class defining possible generic answers */ typedef enum { - ANS_OK=0x80, - ANS_ERR, - ANS_UNKNOWN + ANS_OK=0x80, /**< Answer OK, for a correct and processed command */ + ANS_ERR, /**< Answer ERR, for rejected command (not accepted in current state), or invalid parameters */ + ANS_UNKNOWN /**< Answer UNKNOWN, for unknown command */ } CMD_AnswersType; +/** Enumeration class defining battery levels */ typedef enum { - ANS_BAT_EMPTY=0, - ANS_BAT_LOW, - ANS_BAT_OK + ANS_BAT_EMPTY=0, /**< Battery is empty, system will power off in seconds */ + ANS_BAT_LOW, /**< Battery is low, should plug charger quickly */ + ANS_BAT_OK /**< Charger is in correct state, charge is not required yet */ } CMD_BatteryLevelType; +/** Enumeration class defining busty states */ typedef enum { - ANS_STATE_NOT_BUSY=0, - ANS_STATE_BUSY + ANS_STATE_NOT_BUSY=0, /**< Robot is not moving, ready for processing new movement */ + ANS_STATE_BUSY /**< Robot is moving, not accepting new movement requests */ } CMD_BusyType; +/** Structure class used by cmdDecode function for generic commands + * + * @todo type of "type" field should be \ref CMD_CommandsType and not uint8_t + */ typedef struct __attribute__((packed)) { - uint8_t type; + uint8_t type; /**< Command type, as found in \ref CMD_CommandsType enum */ } CMD_Generic; +/** Structure class used by cmdDecode function for MOVE command + * + * @todo type of "type" field should be \ref CMD_CommandsType and not uint8_t + */ typedef struct __attribute__((packed)) { - uint8_t type; - int16_t distance; + uint8_t type; /**< Command type, as found in \ref CMD_CommandsType enum (should be \ref CMD_MOVE)*/ + int16_t distance; /**< Distance for movement, positive for forward, negative for backward. Expressed in millimeters */ } CMD_Move; +/** Structure class used by cmdDecode function for TURN command + * + * @todo type of "type" field should be \ref CMD_CommandsType and not uint8_t + */ typedef struct __attribute__((packed)) { - uint8_t type; - int16_t turns; + uint8_t type; /**< Command type, as found in \ref CMD_CommandsType enum (should be \ref CMD_TURN)*/ + int16_t turns; /**< Angle of rotation, positive for clockwise and negative for counter-clockwise. Expressed in degree */ } CMD_Turn; -typedef struct __attribute__((packed)) { - uint8_t ans; -} ANS_Generic; - -typedef struct __attribute__((packed)) { - uint8_t ans; - uint16_t version; -} ANS_Version; - -typedef struct __attribute__((packed)) { - uint8_t ans; - uint8_t bat_level; -} ANS_Battery; - -typedef struct __attribute__((packed)) { - uint8_t ans; - uint8_t state; -} ANS_Busy_State; - CMD_Generic* cmdDecode(char* cmd, uint8_t length); void cmdSendAnswer(uint8_t ans); void cmdSendString(char* str); @@ -85,4 +117,16 @@ void cmdSendBatteryLevel(uint16_t batteryState); void cmdSendVersion(void); void cmdSendBusyState(uint8_t state); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + #endif /* INC_CMD_H_ */ diff --git a/software/dumber3/Application/config.h b/software/dumber3/Application/config.h index 31b2606..b9231b8 100644 --- a/software/dumber3/Application/config.h +++ b/software/dumber3/Application/config.h @@ -1,40 +1,90 @@ -/* - * config.h +/** + ****************************************************************************** + * @file config.h + * @brief global configuration header + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 * - * Created on: 14 sept. 2022 - * Author: dimercur + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** */ + #include "stm32l0xx_hal.h" #include "cmsis_os.h" -// current version is 2.1 +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup CONFIG + * Constants for global system configuration. + * @{ + */ + +/** @name System version + * Version in plain text and as a numeric value + */ +///@{ #define SYSTEM_VERSION_STR "2.1" #define SYSTEM_VERSION 0x0201 // Upper byte: major version, lower byte: minor version +///@} #define STACK_SIZE 0x100 +/** @name Tasks priority constants + * Priority is based on configMAX_PRIORITIES which represent highest task priority. + * Less priority task is \ref PriorityTestsHandler + */ +///@{ #define PriorityLedsAction (configMAX_PRIORITIES -1) #define PriorityXbeeRX (configMAX_PRIORITIES -2) #define PriorityXbeeTX (configMAX_PRIORITIES -3) #define PriorityLedsHandler (configMAX_PRIORITIES -4) -#define PriorityMoteursAsservissement (configMAX_PRIORITIES -5) -#define PriorityMoteursHandler (configMAX_PRIORITIES -6) -#define PriorityBatterieHandler (configMAX_PRIORITIES -7) +#define PriorityMotorsAsservissement (configMAX_PRIORITIES -5) +#define PriorityMotorsHandler (configMAX_PRIORITIES -6) +#define PriorityBatteryHandler (configMAX_PRIORITIES -7) #define PriorityApplicationHandler (configMAX_PRIORITIES -8) #define PrioritySequenceurTimeout (configMAX_PRIORITIES -9) - #define PriorityTestsHandler (configMAX_PRIORITIES -10) +///@} -/* Périodes des taches périodiques (en ms) */ -#define MOTEURS_PERIODE_ASSERVISSEMENT (2) -#define APPLICATION_PERIODE (100) -#define BATTERIE_PERIODE_SCRUTATION (1000) -#define LEDS_PERIODE (100) -#define BUTTON_INACTIVITY_PERIODE (1500) +/** @name Periodicities of tasks + * Periodicities are given in ms. + */ +///@{ +#define MOTORS_REGULATION_DELAY (2) +#define APPLICATION_COUNTERS_DELAY (100) +#define BATTERY_POLLING_DELAY (1000) +#define LEDS_DELAY (100) +#define BUTTON_INACTIVITY_DELAY (1500) -#define TESTS_PERIODE (5000) +#define TESTS_DELAY (5000) +///@} +/** @name Constants for to XBEE module + * Constants about timeout and buffer lengths + */ +///@{ #define XBEE_TX_SEMAPHORE_WAIT 500 #ifdef TESTS #define XBEE_RX_BUFFER_MAX_LENGTH 100 @@ -43,13 +93,12 @@ #define XBEE_RX_BUFFER_MAX_LENGTH 50 #define XBEE_TX_BUFFER_MAX_LENGTH 50 #endif /* TESTS */ +///@} -#define BATTERY_EMPTY_LEVEL 128 -#define BATTERY_LOW_LEVEL 140 - -/* - * Revoir les délais : c'est en 100 ms, pas ms +/** @name Constants relative to timeout + * Delays are given in ms. */ +///@{ #ifdef TESTS #define APPLICATION_INACTIVITY_TIMEOUT (0xFFFFFFFF) // Max U32, infinite timeout #else @@ -59,6 +108,15 @@ #define APPLICATION_WATCHDOG_MIN (900) // minimum time to wait before resetting watchdog, expressed in ms #define APPLICATION_WATCHDOG_MAX (1100) // maximum time to wait before resetting watchdog, expressed in ms #define APPLICATION_WATCHDOG_MISSED_MAX (3) // Maximum missed timeout reset before entering watchdog disabled state -#define APPLICATION_STARTUP_DELAY (3*1000) // Startup delay, expressed in ms +#define APPLICATION_STARTUP_DELAY (3*1000) // Startup delay before entering idle state (3s) +///@} TickType_t msToTicks(TickType_t ms); + +/** + * @} + */ + +/** + * @} + */ diff --git a/software/dumber3/Application/leds.c b/software/dumber3/Application/leds.c index 3212052..b6b78ec 100644 --- a/software/dumber3/Application/leds.c +++ b/software/dumber3/Application/leds.c @@ -1,39 +1,89 @@ -/* - * leds.h +/** + ****************************************************************************** + * @file leds.c + * @brief leds driver body + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 * - * Created on: Sep 12, 2022 - * Author: dimercur - */ + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ #include "leds.h" -#define LEDS_Allume_Seg_A() HAL_GPIO_WritePin(LED_SEG_A_GPIO_Port, LED_SEG_A_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_B() HAL_GPIO_WritePin(LED_SEG_B_GPIO_Port, LED_SEG_B_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_C() HAL_GPIO_WritePin(LED_SEG_C_GPIO_Port, LED_SEG_C_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_D() HAL_GPIO_WritePin(LED_SEG_D_GPIO_Port, LED_SEG_D_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_E() HAL_GPIO_WritePin(LED_SEG_E_GPIO_Port, LED_SEG_E_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_F() HAL_GPIO_WritePin(LED_SEG_F_GPIO_Port, LED_SEG_F_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_G() HAL_GPIO_WritePin(LED_SEG_G_GPIO_Port, LED_SEG_G_Pin, GPIO_PIN_SET) -#define LEDS_Allume_Seg_DP() HAL_GPIO_WritePin(LED_SEG_DP_GPIO_Port, LED_SEG_DP_Pin, GPIO_PIN_SET) +/** @addtogroup Application_Software + * @{ + */ -#define LEDS_Eteint_Seg_A() HAL_GPIO_WritePin(LED_SEG_A_GPIO_Port, LED_SEG_A_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_B() HAL_GPIO_WritePin(LED_SEG_B_GPIO_Port, LED_SEG_B_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_C() HAL_GPIO_WritePin(LED_SEG_C_GPIO_Port, LED_SEG_C_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_D() HAL_GPIO_WritePin(LED_SEG_D_GPIO_Port, LED_SEG_D_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_E() HAL_GPIO_WritePin(LED_SEG_E_GPIO_Port, LED_SEG_E_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_F() HAL_GPIO_WritePin(LED_SEG_F_GPIO_Port, LED_SEG_F_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_G() HAL_GPIO_WritePin(LED_SEG_G_GPIO_Port, LED_SEG_G_Pin, GPIO_PIN_RESET) -#define LEDS_Eteint_Seg_DP() HAL_GPIO_WritePin(LED_SEG_DP_GPIO_Port, LED_SEG_DP_Pin, GPIO_PIN_RESET) +/** @addtogroup LEDS + * Leds handler is in charge of leds animation. + * + * Leds module consiste of two threads: + * - \ref LEDS_HandlerThread in charge of waiting for message in mailbox from application. Depending of the message received, animation is started, modified or stop + * - \ref LEDS_ActionThread, periodic task in charge of animating leds with configured sprites for given animation + * @{ + */ -#define LEDS_Eteint_Tout() HAL_GPIO_WritePin(GPIOB, LED_SEG_A_Pin|LED_SEG_B_Pin|LED_SEG_C_Pin, GPIO_PIN_RESET);\ +/** @addtogroup LEDS_Private Private + * @{ + */ + +/** @name Macro for switching ON and OFF individual led segments + * + */ +///@{ +#define LEDS_On_Seg_A() HAL_GPIO_WritePin(LED_SEG_A_GPIO_Port, LED_SEG_A_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_B() HAL_GPIO_WritePin(LED_SEG_B_GPIO_Port, LED_SEG_B_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_C() HAL_GPIO_WritePin(LED_SEG_C_GPIO_Port, LED_SEG_C_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_D() HAL_GPIO_WritePin(LED_SEG_D_GPIO_Port, LED_SEG_D_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_E() HAL_GPIO_WritePin(LED_SEG_E_GPIO_Port, LED_SEG_E_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_F() HAL_GPIO_WritePin(LED_SEG_F_GPIO_Port, LED_SEG_F_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_G() HAL_GPIO_WritePin(LED_SEG_G_GPIO_Port, LED_SEG_G_Pin, GPIO_PIN_SET) +#define LEDS_On_Seg_DP() HAL_GPIO_WritePin(LED_SEG_DP_GPIO_Port, LED_SEG_DP_Pin, GPIO_PIN_SET) + +#define LEDS_Off_Seg_A() HAL_GPIO_WritePin(LED_SEG_A_GPIO_Port, LED_SEG_A_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_B() HAL_GPIO_WritePin(LED_SEG_B_GPIO_Port, LED_SEG_B_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_C() HAL_GPIO_WritePin(LED_SEG_C_GPIO_Port, LED_SEG_C_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_D() HAL_GPIO_WritePin(LED_SEG_D_GPIO_Port, LED_SEG_D_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_E() HAL_GPIO_WritePin(LED_SEG_E_GPIO_Port, LED_SEG_E_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_F() HAL_GPIO_WritePin(LED_SEG_F_GPIO_Port, LED_SEG_F_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_G() HAL_GPIO_WritePin(LED_SEG_G_GPIO_Port, LED_SEG_G_Pin, GPIO_PIN_RESET) +#define LEDS_Off_Seg_DP() HAL_GPIO_WritePin(LED_SEG_DP_GPIO_Port, LED_SEG_DP_Pin, GPIO_PIN_RESET) +///@} + +/** @name Macro for switching all display ON or OFF + * + */ +///@{ +#define LEDS_All_Off() HAL_GPIO_WritePin(GPIOB, LED_SEG_A_Pin|LED_SEG_B_Pin|LED_SEG_C_Pin, GPIO_PIN_RESET);\ HAL_GPIO_WritePin(GPIOA, LED_SEG_D_Pin|LED_SEG_E_Pin|LED_SEG_F_Pin|LED_SEG_G_Pin|LED_SEG_DP_Pin, GPIO_PIN_RESET) -#define LEDS_Allume_Tout() HAL_GPIO_WritePin(GPIOB, LED_SEG_A_Pin|LED_SEG_B_Pin|LED_SEG_C_Pin, GPIO_PIN_SET);\ +#define LEDS_All_On() HAL_GPIO_WritePin(GPIOB, LED_SEG_A_Pin|LED_SEG_B_Pin|LED_SEG_C_Pin, GPIO_PIN_SET);\ HAL_GPIO_WritePin(GPIOA, LED_SEG_D_Pin|LED_SEG_E_Pin|LED_SEG_F_Pin|LED_SEG_G_Pin|LED_SEG_DP_Pin, GPIO_PIN_SET) +///@} -#define LEDS_Allume_C() HAL_GPIO_WritePin(GPIOB, LED_SEG_A_Pin|LED_SEG_B_Pin|LED_SEG_C_Pin, GPIO_PIN_SET);\ - HAL_GPIO_WritePin(GPIOA, LED_SEG_D_Pin, GPIO_PIN_SET) - +/** @name List of single sprite (pattern) in animation + * + */ +///@{ #define LED_PATTERN_ALL_OFF 0 #define LED_PATTERN_BAT_SPRITE_0 1 #define LED_PATTERN_BAT_SPRITE_1 2 @@ -73,6 +123,7 @@ #define LED_PATTERN_DIGIT_UNKNOWN 36 #define LED_MAX_PATTERNS 37 +///@} /* * Relation entre segment et nom @@ -97,6 +148,9 @@ * */ +/** @brief Constant array defining led configuration for all possible sprites used in animation + * + */ uint16_t LEDS_Patterns [LED_MAX_PATTERNS][4]= { // GPIOA ON / GPIOB ON / GPIOA OFF / GPIOB OFF { 0, 0, LED_SEG_D_Pin|LED_SEG_E_Pin|LED_SEG_F_Pin|LED_SEG_G_Pin|LED_SEG_DP_Pin, LED_SEG_A_Pin|LED_SEG_B_Pin|LED_SEG_C_Pin}, // All Off @@ -162,8 +216,14 @@ void LEDS_ShowPattern(uint8_t pattern); void LEDS_Tests(void* params); void LEDS_HandlerThread(void* params); +/** + * @brief Function for initializing leds animation + * + * @param None + * @retval None + */ void LEDS_Init(void) { - LEDS_Eteint_Tout(); + LEDS_All_Off(); LEDS_Animation=leds_off; LEDS_AnimationAncien =LEDS_Animation; @@ -183,6 +243,15 @@ void LEDS_Init(void) { vTaskResume(xHandleLedsHandler); } +/** + * @brief Request an animation, given in parameter + * + * @remark This function wrap a message sending to leds mailbox. + * If multiple module request animation, only the laste requested animation will be taken into account + * + * @param[in] state Led animation requested + * @retval None + */ void LEDS_Set(LEDS_State state) { static LEDS_State leds_state; @@ -193,6 +262,12 @@ static LEDS_State leds_state; } } +/** + * @brief Apply a pattern to led + * + * @param[in] pattern Pattern to show, defined in \ref LEDS_Patterns. Use macro starting with LED_PATTERN_ as parameter + * @retval None + */ void LEDS_ShowPattern(uint8_t pattern) { if (pattern < LED_MAX_PATTERNS) { HAL_GPIO_WritePin(GPIOA, LEDS_Patterns[pattern][2], GPIO_PIN_RESET); @@ -205,10 +280,18 @@ void LEDS_ShowPattern(uint8_t pattern) { } } +/** + * @brief Test task for checking animation correctness + * + * @warning Do not use in normal running condition + * + * @param[in] params Initial task parameters + * @retval None + */ void LEDS_Tests(void* params) { LEDS_State ledState = leds_idle; - LEDS_Eteint_Tout(); + LEDS_All_Off(); while (1) { MESSAGE_SendMailbox(LEDS_Mailbox, MSG_ID_LED_ETAT, LEDS_Mailbox, (void*)&ledState); @@ -219,6 +302,16 @@ void LEDS_Tests(void* params) { } } +/** + * @brief Message handler task + * + * Get received animation message from application and start, stop or modify animation depending on animation requested + * by controlling \ref LEDS_ActionThread task. + * If requested animation is same of currently running, no modification is done. + * + * @param[in] params Initial task parameters + * @retval None + */ void LEDS_HandlerThread(void* params) { MESSAGE_Typedef msg; @@ -252,6 +345,14 @@ void LEDS_HandlerThread(void* params) { } } +/** + * @brief Animation task + * + * Periodic task (100 ms) used for animating led. Started and stopped from \ref LEDS_HandlerThread + * + * @param[in] params Initial task parameters + * @retval None + */ void LEDS_ActionThread(void* params) { uint8_t cnt=0; TickType_t xLastWakeTime; @@ -259,13 +360,13 @@ void LEDS_ActionThread(void* params) { // Initialise the xLastWakeTime variable with the current time. xLastWakeTime = xTaskGetTickCount(); - LEDS_Eteint_Tout(); + LEDS_All_Off(); while (1) { switch (LEDS_Animation) { case leds_off: - LEDS_Eteint_Tout(); + LEDS_All_Off(); break; case leds_idle: if (cnt<5) @@ -362,7 +463,7 @@ void LEDS_ActionThread(void* params) { else cnt=0; break; - case leds_erreur_1: + case leds_error_1: if (cnt<5) LEDS_ShowPattern(LED_PATTERN_ERROR); else if (cnt<10) @@ -370,7 +471,7 @@ void LEDS_ActionThread(void* params) { else cnt=0; break; - case leds_erreur_2: + case leds_error_2: if (cnt<5) LEDS_ShowPattern(LED_PATTERN_ERROR); else if (cnt<10) @@ -378,7 +479,7 @@ void LEDS_ActionThread(void* params) { else cnt=0; break; - case leds_erreur_3: + case leds_error_3: if (cnt<5) LEDS_ShowPattern(LED_PATTERN_ERROR); else if (cnt<10) @@ -386,7 +487,7 @@ void LEDS_ActionThread(void* params) { else cnt=0; break; - case leds_erreur_4: + case leds_error_4: if (cnt<5) LEDS_ShowPattern(LED_PATTERN_ERROR); else if (cnt<10) @@ -394,7 +495,7 @@ void LEDS_ActionThread(void* params) { else cnt=0; break; - case leds_erreur_5: + case leds_error_5: if (cnt<5) LEDS_ShowPattern(LED_PATTERN_ERROR); else if (cnt<10) @@ -415,7 +516,7 @@ void LEDS_ActionThread(void* params) { } // Wait for the next cycle. - vTaskDelayUntil( &xLastWakeTime, pdMS_TO_TICKS(LEDS_PERIODE)); + vTaskDelayUntil( &xLastWakeTime, pdMS_TO_TICKS(LEDS_DELAY)); cnt++; } diff --git a/software/dumber3/Application/leds.h b/software/dumber3/Application/leds.h index 3504152..e2abccb 100644 --- a/software/dumber3/Application/leds.h +++ b/software/dumber3/Application/leds.h @@ -1,8 +1,31 @@ -/* - * leds.h +/** + ****************************************************************************** + * @file leds.h + * @brief leds driver header + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 * - * Created on: Sep 12, 2022 - * Author: dimercur + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** */ #ifndef INC_LEDS_H_ @@ -10,29 +33,54 @@ #include "application.h" +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup LEDS + * @{ + */ + +/** @addtogroup LEDS_Public Public + * @{ + */ + +/** Enumeration class defining possible leds animations */ typedef enum { - leds_off=0, - leds_idle, - leds_run, - leds_run_with_watchdog, - leds_bat_critical_low, - leds_bat_low, - leds_bat_med, - leds_bat_high, - leds_bat_charge_low, - leds_bat_charge_med, - leds_bat_charge_high, - leds_bat_charge_complete, - leds_watchdog_expired, - leds_erreur_1, - leds_erreur_2, - leds_erreur_3, - leds_erreur_4, - leds_erreur_5, - leds_state_unknown + leds_off=0, /**< No animation */ + leds_idle, /**< Idle animation (only dot point blinking) */ + leds_run, /**< Run animation (leds animate in circle) */ + leds_run_with_watchdog, /**< Run with watchdog animation (leds animate in circle, with dot point blinking) */ + leds_bat_critical_low, /**< Critical low bat animation (C,L and B lettres) */ + leds_bat_low, /**< Low bat animation */ + leds_bat_med, /**< Medium charged bat animation */ + leds_bat_high, /**< Full charged bat animation */ + leds_bat_charge_low, /**< Charge in progress (low bat level) animation */ + leds_bat_charge_med, /**< Charge in progress (medium bat level) animation */ + leds_bat_charge_high, /**< Charge in progress (high bat level) animation */ + leds_bat_charge_complete, /**< Charge complete animation */ + leds_watchdog_expired, /**< Watchdog expired animation (squares moving) */ + leds_error_1, /**< Error 1 animation */ + leds_error_2, /**< Error 2 animation */ + leds_error_3, /**< Error 3 animation */ + leds_error_4, /**< Error 4 animation */ + leds_error_5, /**< Error 5 animation */ + leds_state_unknown /**< Unknown animation */ } LEDS_State; void LEDS_Init(void); void LEDS_Set(LEDS_State state); +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + #endif /* INC_LEDS_H_ */ diff --git a/software/dumber3/Application/messages.c b/software/dumber3/Application/messages.c index 1eb2b00..40a72d9 100644 --- a/software/dumber3/Application/messages.c +++ b/software/dumber3/Application/messages.c @@ -11,13 +11,13 @@ #define QUEUE_SIZE 5 QueueHandle_t LEDS_Mailbox; -QueueHandle_t MOTEURS_Mailbox; +QueueHandle_t MOTORS_Mailbox; QueueHandle_t APPLICATION_Mailbox; QueueHandle_t XBEE_Mailbox; void MESSAGE_Init(void) { LEDS_Mailbox = xQueueCreate(QUEUE_SIZE, sizeof(MESSAGE_Typedef)); - MOTEURS_Mailbox = xQueueCreate(QUEUE_SIZE, sizeof(MESSAGE_Typedef)); + MOTORS_Mailbox = xQueueCreate(QUEUE_SIZE, sizeof(MESSAGE_Typedef)); APPLICATION_Mailbox = xQueueCreate(QUEUE_SIZE, sizeof(MESSAGE_Typedef)); XBEE_Mailbox = xQueueCreate(QUEUE_SIZE, sizeof(MESSAGE_Typedef)); } diff --git a/software/dumber3/Application/messages.h b/software/dumber3/Application/messages.h index fe3f944..c78e10e 100644 --- a/software/dumber3/Application/messages.h +++ b/software/dumber3/Application/messages.h @@ -18,7 +18,7 @@ typedef struct { } MESSAGE_Typedef; extern QueueHandle_t LEDS_Mailbox; -extern QueueHandle_t MOTEURS_Mailbox; +extern QueueHandle_t MOTORS_Mailbox; extern QueueHandle_t APPLICATION_Mailbox; extern QueueHandle_t XBEE_Mailbox; @@ -43,10 +43,10 @@ extern QueueHandle_t XBEE_Mailbox; #define MSG_ID_BUTTON_PRESSED 0x30 -#define MSG_ID_MOTEURS_STOP 0x40 -#define MSG_ID_MOTEURS_MOVE 0x41 -#define MSG_ID_MOTEURS_TURN 0x42 -#define MSG_ID_MOTEURS_END_OF_MOUVMENT 0x43 +#define MSG_ID_MOTORS_STOP 0x40 +#define MSG_ID_MOTORS_MOVE 0x41 +#define MSG_ID_MOTORS_TURN 0x42 +#define MSG_ID_MOTORS_END_OF_MOUVMENT 0x43 #define MSG_ID_XBEE_CMD 0x50 #define MSG_ID_XBEE_ANS 0x51 diff --git a/software/dumber3/Application/moteurs.c b/software/dumber3/Application/moteurs.c deleted file mode 100644 index 937351c..0000000 --- a/software/dumber3/Application/moteurs.c +++ /dev/null @@ -1,595 +0,0 @@ -/* - * moteurs.c - * - * Created on: Sep 12, 2022 - * Author: dimercur - */ - -#include "moteurs.h" -#include "timers.h" - -#include "stm32l0xx_ll_gpio.h" -#include "stm32l0xx_ll_tim.h" - -#include - -/* - * Global informations - * Main clock: 6 Mhz - * TIM2 PWM Input (CH1): Encodeur droit PHB : 0 -> 65535 - * TIM21 PWM Input (CH1): Encodeur Gauche PHA: 0 -> 65535 - * TIM3: PWM Output moteur (0->200) (~30 Khz) - */ - -extern TIM_HandleTypeDef htim2; -extern TIM_HandleTypeDef htim21; -extern TIM_HandleTypeDef htim3; - -#define MOTEURS_MAX_COMMANDE 200 -#define MOTEURS_MAX_ENCODEUR USHRT_MAX - -typedef struct { - int16_t commande; - int16_t consigne; - uint16_t encodeur; - uint16_t encodeurFront; - uint8_t moteurLent; -} MOTEURS_EtatMoteur; - -typedef struct { - uint8_t type; - int16_t commande; - int16_t consigne; - int32_t distance; - int32_t tours; -} MOTEURS_EtatDiff; - -MOTEURS_EtatMoteur MOTEURS_EtatMoteurGauche, MOTEURS_EtatMoteurDroit = { 0 }; -MOTEURS_EtatDiff MOTEURS_EtatDifferentiel = { 0 }; - -#define MOTEUR_Kp 300 - -/***** Tasks part *****/ - -/* Tache moteurs (gestion des messages) */ -StaticTask_t xTaskMoteurs; -StackType_t xStackMoteurs[STACK_SIZE]; -TaskHandle_t xHandleMoteurs = NULL; -void MOTEURS_TachePrincipale(void *params); - -/* Tache moteurs périodique (asservissement) */ -StaticTask_t xTaskMoteursAsservissement; -StackType_t xStackMoteursAsservissement[STACK_SIZE]; -TaskHandle_t xHandleMoteursAsservissement = NULL; -void MOTEURS_TacheAsservissement(void *params); - -/* Fonctions diverses */ -void MOTEURS_Set(int16_t cmdGauche, int16_t cmdDroit); -void MOTEURS_DesactiveAlim(void); -void MOTEURS_ActiveAlim(void); -int16_t MOTEURS_CorrectionEncodeur(MOTEURS_EtatMoteur etat); - -#ifdef TESTS -TIM_HandleTypeDef htim7; - -volatile uint32_t DEBUG_startTime = 0; -volatile uint32_t DEBUG_endTime = 0; -volatile uint32_t DEBUG_duration = 0; -volatile uint32_t DEBUG_worstCase = 0; - -void Init_Systick(void) { -// TIM_ClockConfigTypeDef sClockSourceConfig = { 0 }; -// -// __HAL_RCC_TIM7_CLK_ENABLE(); -// -// htim7.Instance = TIM2; -// htim7.Init.Prescaler = 0; -// htim7.Init.CounterMode = TIM_COUNTERMODE_UP; -// htim7.Init.Period = 65535; -// htim7.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; -// htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; -// if (HAL_TIM_Base_Init(&htim7) != HAL_OK) { -// Error_Handler(); -// } -// -// sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; -// if (HAL_TIM_ConfigClockSource(&htim7, &sClockSourceConfig) != HAL_OK) { -// Error_Handler(); -// } -// -// LL_TIM_EnableCounter(TIM7); -} - -void StartMeasure(void) { -// DEBUG_startTime = LL_TIM_GetCounter(TIM7); -} - -void EndMeasure(void) { -// DEBUG_endTime = LL_TIM_GetCounter(TIM7); -// -// if (DEBUG_startTime >= DEBUG_endTime) -// DEBUG_duration = 65533 - DEBUG_startTime + DEBUG_endTime; -// else -// DEBUG_duration = DEBUG_endTime - DEBUG_startTime; -// -// if (DEBUG_duration > DEBUG_worstCase) -// DEBUG_worstCase = DEBUG_duration; -} -#endif /* TESTS */ -/** - * @brief Fonction d'initialisation des moteurs - * - */ -void MOTEURS_Init(void) { - /* Désactive les alimentations des moteurs */ - MOTEURS_DesactiveAlim(); - - /* Create the task without using any dynamic memory allocation. */ - xHandleMoteurs = xTaskCreateStatic(MOTEURS_TachePrincipale, /* Function that implements the task. */ - "MOTEURS Principale", /* Text name for the task. */ - STACK_SIZE, /* Number of indexes in the xStack array. */ - NULL, /* Parameter passed into the task. */ - PriorityMoteursHandler,/* Priority at which the task is created. */ - xStackMoteurs, /* Array to use as the task's stack. */ - &xTaskMoteurs); /* Variable to hold the task's data structure. */ - vTaskResume(xHandleMoteurs); - - /* Create the task without using any dynamic memory allocation. */ - xHandleMoteursAsservissement = xTaskCreateStatic( - MOTEURS_TacheAsservissement, /* Function that implements the task. */ - "MOTEURS Asservissement", /* Text name for the task. */ - STACK_SIZE, /* Number of indexes in the xStack array. */ - NULL, /* Parameter passed into the task. */ - PriorityMoteursAsservissement,/* Priority at which the task is created. */ - xStackMoteursAsservissement, /* Array to use as the task's stack. */ - &xTaskMoteursAsservissement); /* Variable to hold the task's data structure. */ - vTaskSuspend(xHandleMoteursAsservissement); // On ne lance la tache d'asservissement que lorsque'une commande moteur arrive - - MOTEURS_DesactiveAlim(); - -#ifdef TESTS - Init_Systick(); -#endif /* TESTS */ -} - -void MOTEURS_Avance(int32_t distance) { - static int32_t dist; - - dist = distance*15; - - if (dist) { - MOTEURS_ActiveAlim(); - MESSAGE_SendMailbox(MOTEURS_Mailbox, MSG_ID_MOTEURS_MOVE, - APPLICATION_Mailbox, (void*) &dist); - } else - MOTEURS_Stop(); -} - -void MOTEURS_Tourne(int32_t tours) { - static int32_t turns; - - turns = tours; - - if (turns) { - MOTEURS_ActiveAlim(); - MESSAGE_SendMailbox(MOTEURS_Mailbox, MSG_ID_MOTEURS_TURN, - APPLICATION_Mailbox, (void*) &turns); - } else - MOTEURS_Stop(); -} - -void MOTEURS_Stop(void) { - MOTEURS_DesactiveAlim(); - MESSAGE_SendMailbox(MOTEURS_Mailbox, MSG_ID_MOTEURS_STOP, - APPLICATION_Mailbox, (void*) NULL); -} - -/* - * @brief Tache de supervision des moteurs - * Gestion de la boite aux lettres moteurs, et supervision generale - * @params params non utilisé - */ -void MOTEURS_TachePrincipale(void *params) { - MESSAGE_Typedef msg; - int32_t distance, tours; - - while (1) { - msg = MESSAGE_ReadMailbox(MOTEURS_Mailbox); - - switch (msg.id) { - case MSG_ID_MOTEURS_MOVE: - distance = *((int32_t*) msg.data); - MOTEURS_EtatDifferentiel.distance = distance; - MOTEURS_EtatDifferentiel.tours = 0; - - if (distance > 0) { - MOTEURS_EtatMoteurGauche.consigne = 50; - MOTEURS_EtatMoteurDroit.consigne = 50; - } else { - MOTEURS_EtatMoteurGauche.consigne = -50; - MOTEURS_EtatMoteurDroit.consigne = -50; - } - - vTaskResume(xHandleMoteursAsservissement); - break; - - case MSG_ID_MOTEURS_TURN: - tours = *((int32_t*) msg.data); - MOTEURS_EtatDifferentiel.distance = 0; - MOTEURS_EtatDifferentiel.tours = tours; - - if (tours > 0) { - MOTEURS_EtatMoteurGauche.consigne = -50; - MOTEURS_EtatMoteurDroit.consigne = 50; - } else { - MOTEURS_EtatMoteurGauche.consigne = 50; - MOTEURS_EtatMoteurDroit.consigne = -50; - } - - vTaskResume(xHandleMoteursAsservissement); - break; - - case MSG_ID_MOTEURS_STOP: - MOTEURS_EtatDifferentiel.distance = 0; - MOTEURS_EtatDifferentiel.tours = 0; - - MOTEURS_EtatMoteurGauche.consigne = 0; - MOTEURS_EtatMoteurDroit.consigne = 0; - if ((MOTEURS_CorrectionEncodeur(MOTEURS_EtatMoteurGauche) == 0) - && (MOTEURS_CorrectionEncodeur(MOTEURS_EtatMoteurDroit) == 0)) { - // Les moteurs sont déjà arrêtés - vTaskSuspend(xHandleMoteursAsservissement); - - MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_MOTEURS_END_OF_MOUVMENT, - MOTEURS_Mailbox, (void*) NULL); - } else - // Les moteurs tournent encore - vTaskResume(xHandleMoteursAsservissement); - break; - default: - break; - } - } -} - -/* - * @brief Tache d'asservissement, périodique (10ms) - * - * @params params non utilisé - */ -void MOTEURS_TacheAsservissement(void *params) { - TickType_t xLastWakeTime; - int16_t erreurG, erreurD = 0; - int16_t encodeurGauche, encodeurDroit; - int32_t locCmdG, locCmdD; - - // Initialise the xLastWakeTime variable with the current time. - xLastWakeTime = xTaskGetTickCount(); - - for (;;) { - // Wait for the next cycle. - vTaskDelayUntil(&xLastWakeTime, - pdMS_TO_TICKS(MOTEURS_PERIODE_ASSERVISSEMENT)); - -#ifdef TESTS - //StartMeasure(); -#endif /* TESTS */ - - encodeurGauche = MOTEURS_CorrectionEncodeur(MOTEURS_EtatMoteurGauche); - encodeurDroit = MOTEURS_CorrectionEncodeur(MOTEURS_EtatMoteurDroit); - - /* - * encodeur est entre -32768 et +32767, selon le sens de rotation du moteur - * consigne est entre -32768 et + 32767 selon le sens de rotation du moteur - * erreur est entre -32768 et 32767 selon la difference à apporter à la commande - */ - - erreurG = MOTEURS_EtatMoteurGauche.consigne - encodeurGauche; - erreurD = MOTEURS_EtatMoteurDroit.consigne - encodeurDroit; - - if (((MOTEURS_EtatMoteurDroit.consigne == 0) - && (MOTEURS_EtatMoteurGauche.consigne == 0)) - && ((erreurD == 0) && (erreurG == 0))) { - - MOTEURS_DesactiveAlim(); - MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_MOTEURS_END_OF_MOUVMENT, - MOTEURS_Mailbox, (void*) NULL); - vTaskSuspend(xHandleMoteursAsservissement); - } - - if (MOTEURS_EtatMoteurGauche.consigne == 0) - MOTEURS_EtatMoteurGauche.commande = 0; - else { - if (erreurG != 0) { - //locCmdG = (int32_t)MOTEURS_EtatMoteurGauche.commande + ((int32_t)MOTEUR_Kp*(int32_t)erreurG)/100; - locCmdG = ((int32_t) MOTEUR_Kp * (int32_t) erreurG) / 100; - - if (MOTEURS_EtatMoteurGauche.consigne >= 0) { - if (locCmdG < 0) - MOTEURS_EtatMoteurGauche.commande = 0; - else if (locCmdG > SHRT_MAX) - MOTEURS_EtatMoteurGauche.commande = SHRT_MAX; - else - MOTEURS_EtatMoteurGauche.commande = (int16_t) locCmdG; - } else { - if (locCmdG > 0) - MOTEURS_EtatMoteurGauche.commande = 0; - else if (locCmdG < SHRT_MIN) - MOTEURS_EtatMoteurGauche.commande = SHRT_MIN; - else - MOTEURS_EtatMoteurGauche.commande = (int16_t) locCmdG; - } - } - } - - if (MOTEURS_EtatMoteurDroit.consigne == 0) - MOTEURS_EtatMoteurDroit.commande = 0; - else { - if (erreurD != 0) { - //locCmdD = (int32_t)MOTEURS_EtatMoteurDroit.commande + ((int32_t)MOTEUR_Kp*(int32_t)erreurD)/100; - locCmdD = ((int32_t) MOTEUR_Kp * (int32_t) erreurD) / 100; - - if (MOTEURS_EtatMoteurDroit.consigne >= 0) { - if (locCmdD < 0) - MOTEURS_EtatMoteurDroit.commande = 0; - else if (locCmdD > SHRT_MAX) - MOTEURS_EtatMoteurDroit.commande = SHRT_MAX; - else - MOTEURS_EtatMoteurDroit.commande = (int16_t) locCmdD; - } else { - if (locCmdD > 0) - MOTEURS_EtatMoteurDroit.commande = 0; - else if (locCmdD < SHRT_MIN) - MOTEURS_EtatMoteurDroit.commande = SHRT_MIN; - else - MOTEURS_EtatMoteurDroit.commande = (int16_t) locCmdD; - } - } - } - - /* Finalement, on applique les commandes aux moteurs */ - MOTEURS_Set(MOTEURS_EtatMoteurGauche.commande, - MOTEURS_EtatMoteurDroit.commande); - -#ifdef TESTS - //EndMeasure(); -#endif /* TESTS */ - } -} - -typedef struct { - uint16_t encodeur; - uint16_t correction; -} MOTEURS_CorrectionPoint; - -#define MOTEURS_MAX_CORRECTION_POINTS 16 - -const MOTEURS_CorrectionPoint MOTEURS_CorrectionPoints[MOTEURS_MAX_CORRECTION_POINTS] = -{ { MOTEURS_MAX_ENCODEUR - 1, 1 }, { 42000, 100 }, { 22000, 2500 }, { - 18000, 5000 }, { 16500, 7500 }, { 15500, 10000 }, - { 14500, 12500 }, { 13000, 15000 }, { 12500, 17500 }, { 12200, - 20000 }, { 11500, 22500 }, { 11100, 25000 }, { 11000, - 27500 }, { 10900, 29000 }, { 10850, 30500 }, { 10800, - SHRT_MAX } // 32767 -}; - -/* - * @brief Fonction de conversion des valeurs brutes de l'encodeur en valeur linearisées - * - * @param encodeur valeur brute de l'encodeur - * @return valeur linéarisée (entre -32768 et 32767) - */ -int16_t MOTEURS_CorrectionEncodeur(MOTEURS_EtatMoteur etat) { - int16_t correction = 0; - uint8_t index = 0; - uint32_t A, B, C; - uint16_t encodeur = etat.encodeur; - - if (encodeur == MOTEURS_MAX_ENCODEUR) - correction = 0; - else { // recherche par dichotomie de l'intervale - while (index < MOTEURS_MAX_CORRECTION_POINTS) { - if ((MOTEURS_CorrectionPoints[index].encodeur >= encodeur) - && (MOTEURS_CorrectionPoints[index + 1].encodeur < encodeur)) { - // valeur trouvée, on sort - break; - } else - index++; - } - - if (index >= MOTEURS_MAX_CORRECTION_POINTS) - correction = SHRT_MAX; - else { - A = encodeur - MOTEURS_CorrectionPoints[index + 1].encodeur; - B = MOTEURS_CorrectionPoints[index + 1].correction - - MOTEURS_CorrectionPoints[index].correction; - C = MOTEURS_CorrectionPoints[index].encodeur - - MOTEURS_CorrectionPoints[index + 1].encodeur; - - correction = - (int16_t) (MOTEURS_CorrectionPoints[index + 1].correction - - (uint16_t) ((A * B) / C)); - } - } - - /* - * Selon le sens de rotation du moteur (commande > 0 ou < 0), on corrige le signe du capteur - */ - if (etat.consigne < 0) - correction = -correction; - - return correction; -} - -/** - * - */ -void MOTEURS_DesactiveAlim(void) { - LL_TIM_DisableCounter(TIM3); - LL_TIM_DisableCounter(TIM2); - LL_TIM_DisableCounter(TIM21); - - LL_TIM_CC_DisableChannel(TIM3, - LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2 | LL_TIM_CHANNEL_CH3 - | LL_TIM_CHANNEL_CH4); - - LL_TIM_CC_DisableChannel(TIM2, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); - LL_TIM_CC_DisableChannel(TIM21, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); - - LL_TIM_DisableIT_CC1(TIM2); - LL_TIM_DisableIT_CC1(TIM21); - LL_TIM_DisableIT_UPDATE(TIM2); - LL_TIM_DisableIT_UPDATE(TIM21); - - LL_GPIO_SetOutputPin(GPIOB, SHUTDOWN_ENCODERS_Pin); - LL_GPIO_ResetOutputPin(GPIOB, SHUTDOWN_5V_Pin); -} - -/** - * - */ -void MOTEURS_ActiveAlim(void) { - LL_TIM_EnableCounter(TIM3); - LL_TIM_EnableCounter(TIM2); - LL_TIM_EnableCounter(TIM21); - - LL_TIM_CC_EnableChannel(TIM3, - LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2 | LL_TIM_CHANNEL_CH3 - | LL_TIM_CHANNEL_CH4); - - LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); - LL_TIM_CC_EnableChannel(TIM21, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); - - LL_TIM_EnableIT_CC1(TIM2); - LL_TIM_EnableIT_CC1(TIM21); - LL_TIM_EnableIT_UPDATE(TIM2); - LL_TIM_EnableIT_UPDATE(TIM21); - - LL_GPIO_ResetOutputPin(GPIOB, SHUTDOWN_ENCODERS_Pin); - LL_GPIO_SetOutputPin(GPIOB, SHUTDOWN_5V_Pin); -} - -/** - * @brief Active les encodeurs et le régulateur des moteur si nécessaire et - * règle la commande du moteur (entre -MOTEURS_MAX_COMMANDE et +MOTEURS_MAX_COMMANDE) - * On applique une "regle de 3" - * pour SHRT_MAX -> MOTEURS_MAX_COMMANDE - * pour 0 -> 0 - * pour une commande C dans l'interval [0 .. 32767], la commande est - * commande = (C * MOTEURS_MAX_COMMANDE)/32767 - */ -void MOTEURS_Set(int16_t cmdGauche, int16_t cmdDroit) { - int32_t locValGauche, locValDroit; - - locValGauche = (int32_t) (((int32_t) cmdGauche * (int32_t) SHRT_MAX) - / ((int32_t) MOTEURS_MAX_COMMANDE)); - locValDroit = (int32_t) (((int32_t) cmdDroit * (int32_t) SHRT_MAX) - / ((int32_t) MOTEURS_MAX_COMMANDE)); - - if (LL_GPIO_IsOutputPinSet(GPIOB, SHUTDOWN_5V_Pin) == GPIO_PIN_RESET) - MOTEURS_ActiveAlim(); - - // Moteur droit - if (cmdDroit >= 0) { - LL_TIM_OC_SetCompareCH2(TIM3, (uint32_t) locValDroit); - LL_TIM_OC_SetCompareCH1(TIM3, (uint32_t) 0); - } else { - LL_TIM_OC_SetCompareCH2(TIM3, (uint32_t) 0); - LL_TIM_OC_SetCompareCH1(TIM3, (uint32_t) locValDroit); - } - - // Moteur gauche - if (cmdGauche >= 0) { - LL_TIM_OC_SetCompareCH4(TIM3, (uint32_t) locValGauche); - LL_TIM_OC_SetCompareCH3(TIM3, (uint32_t) 0); - } else { - LL_TIM_OC_SetCompareCH4(TIM3, (uint32_t) 0); - LL_TIM_OC_SetCompareCH3(TIM3, (uint32_t) locValGauche); - } -} - -/* - * @brief Recupere les mesures brutes des encodeurs et les enregistre dans la structure moteur correspondante - * - * @param htim pointeur sur la reference du timer qui generé l'interruption - */ -void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) { - if (htim->Instance == TIM21) { /* moteur gauche */ - if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) { - if (MOTEURS_EtatMoteurGauche.moteurLent != 0) { - MOTEURS_EtatMoteurGauche.encodeur = MOTEURS_MAX_ENCODEUR; - MOTEURS_EtatMoteurGauche.encodeurFront = MOTEURS_MAX_ENCODEUR; - } else { - MOTEURS_EtatMoteurGauche.encodeur = - (uint16_t) LL_TIM_IC_GetCaptureCH1(TIM21); - MOTEURS_EtatMoteurGauche.encodeurFront = - (uint16_t) LL_TIM_IC_GetCaptureCH2(TIM21); - } - - if (LL_TIM_IsActiveFlag_UPDATE(TIM21)) - LL_TIM_ClearFlag_UPDATE(TIM21); - - MOTEURS_EtatMoteurGauche.moteurLent = 0; - - if (MOTEURS_EtatDifferentiel.distance) { - if (MOTEURS_EtatDifferentiel.distance>0) MOTEURS_EtatDifferentiel.distance--; - else MOTEURS_EtatDifferentiel.distance++; - - if (MOTEURS_EtatDifferentiel.distance==0) { - MOTEURS_EtatMoteurGauche.consigne=0; - MOTEURS_EtatMoteurDroit.consigne=0; - } - } - - if (MOTEURS_EtatDifferentiel.tours) { - if (MOTEURS_EtatDifferentiel.tours>0) MOTEURS_EtatDifferentiel.tours--; - else MOTEURS_EtatDifferentiel.tours++; - - if (MOTEURS_EtatDifferentiel.tours==0) { - MOTEURS_EtatMoteurGauche.consigne=0; - MOTEURS_EtatMoteurDroit.consigne=0; - } - } - - } - } else { /* moteur droit */ - if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) { - if (MOTEURS_EtatMoteurDroit.moteurLent != 0) { - MOTEURS_EtatMoteurDroit.encodeur = MOTEURS_MAX_ENCODEUR; - MOTEURS_EtatMoteurDroit.encodeurFront = MOTEURS_MAX_ENCODEUR; - } else { - MOTEURS_EtatMoteurDroit.encodeur = - (uint16_t) LL_TIM_IC_GetCaptureCH1(TIM2); - MOTEURS_EtatMoteurDroit.encodeurFront = - (uint16_t) LL_TIM_IC_GetCaptureCH2(TIM2); - } - - if (LL_TIM_IsActiveFlag_UPDATE(TIM2)) - LL_TIM_ClearFlag_UPDATE(TIM2); - - MOTEURS_EtatMoteurDroit.moteurLent = 0; - } - } -} - -/* - * @brief Gestionnaire d'interruption "overflow" - * Lorsque deux interruptions "overflow" sont arrivées sans que l'interruption capture n'arrive, - * cela signifie que le moteur est à l'arret. - * On met la valeur de l'encodeur à MOTEURS_MAX_ENCODEUR - * - * @param htim pointeur sur la reference du timer qui generé l'interruption - */ -void MOTEURS_TimerEncodeurUpdate(TIM_HandleTypeDef *htim) { - if (htim->Instance == TIM21) { /* moteur gauche */ - if ((MOTEURS_EtatMoteurGauche.moteurLent++) >= 1) { - MOTEURS_EtatMoteurGauche.encodeur = MOTEURS_MAX_ENCODEUR; - MOTEURS_EtatMoteurGauche.moteurLent = 1; - } - } else { /* moteur droit */ - if ((MOTEURS_EtatMoteurDroit.moteurLent++) >= 1) { - MOTEURS_EtatMoteurDroit.encodeur = MOTEURS_MAX_ENCODEUR; - MOTEURS_EtatMoteurDroit.moteurLent = 1; - } - } -} diff --git a/software/dumber3/Application/moteurs.h b/software/dumber3/Application/moteurs.h deleted file mode 100644 index f14120d..0000000 --- a/software/dumber3/Application/moteurs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * moteurs.h - * - * Created on: Sep 12, 2022 - * Author: dimercur - */ - -#ifndef INC_MOTEURS_H_ -#define INC_MOTEURS_H_ - -#include "application.h" - -void MOTEURS_Init(void); -//void MOTEURS_Set(uint8_t mot, int16_t val); -//void MOTEURS_Test (void); -void MOTEURS_Avance(int32_t distance); -void MOTEURS_Tourne(int32_t tours); -void MOTEURS_Stop(void); - -void MOTEURS_TimerEncodeurUpdate (TIM_HandleTypeDef *htim); - -#endif /* INC_MOTEURS_H_ */ diff --git a/software/dumber3/Application/motors.c b/software/dumber3/Application/motors.c new file mode 100644 index 0000000..a10e907 --- /dev/null +++ b/software/dumber3/Application/motors.c @@ -0,0 +1,675 @@ +/** + ****************************************************************************** + * @file motors.c + * @brief motors driver body + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 + * + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ + +#include "motors.h" +#include "timers.h" + +#include "stm32l0xx_ll_gpio.h" +#include "stm32l0xx_ll_tim.h" + +#include + +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup MOTORS + * Motors driver is in charge of controlling motors and applying a regulation to ensure a linear trajectory + * + * Global informations about peripherals + * - Main clock: 6 Mhz + * - TIM2 PWM Input (CH1): right encoder PHB : 0 -> 65535 + * - TIM21 PWM Input (CH1): left encoder PHA: 0 -> 65535 + * - TIM3: PWM Output motor (0->200) (~30 Khz) + * @{ + */ + +/** @addtogroup MOTORS_Private Private + * @{ + */ + +extern TIM_HandleTypeDef htim2; +extern TIM_HandleTypeDef htim21; +extern TIM_HandleTypeDef htim3; + +#define MOTORS_MAX_COMMAND 200 +#define MOTORS_MAX_ENCODER USHRT_MAX + +/** Structure for storing motore (left or right) regulation state + * Used during regulation task for controlling motor */ +typedef struct { + int16_t output; /**< */ + int16_t set_point; /**< Xbee RF quality (not used)*/ + uint16_t encoder; /**< Xbee RF quality (not used)*/ + uint16_t encoderEdge; /**< Xbee RF quality (not used)*/ + uint8_t slowMotor; /**< Xbee RF quality (not used)*/ +} MOTORS_MotorState; + +/** Structure storing counters used for watchdog and system inactivity. + * Used notably to check if watchdog reset was missed or power down system because of inactivity */ +typedef struct { + uint8_t type; /**< Xbee RF quality (not used)*/ + int16_t output; /**< Xbee RF quality (not used)*/ + int16_t set_point; /**< Xbee RF quality (not used)*/ + int32_t distance; /**< Xbee RF quality (not used)*/ + int32_t turns; /**< Xbee RF quality (not used)*/ +} MOTORS_DifferentialState; + +MOTORS_MotorState MOTORS_LeftMotorState, MOTORS_RightMotorState = { 0 }; +MOTORS_DifferentialState MOTORS_DiffState = { 0 }; + +#define MOTOR_Kp 300 + +/***** Tasks part *****/ + +/* Tache moteurs (gestion des messages) */ +StaticTask_t xTaskMotors; +StackType_t xStackMotors[STACK_SIZE]; +TaskHandle_t xHandleMotors = NULL; +void MOTORS_HandlerTask(void *params); + +/* Tache moteurs périodique (asservissement) */ +StaticTask_t xTaskMotorsControl; +StackType_t xStackMotorsControl[STACK_SIZE]; +TaskHandle_t xHandleMotorsControl = NULL; +void MOTORS_ControlTask(void *params); + +/* Fonctions diverses */ +void MOTORS_Set(int16_t leftMotor, int16_t rightMotor); +void MOTORS_PowerOff(void); +void MOTORS_PowerOn(void); +int16_t MOTORS_EncoderCorrection(MOTORS_MotorState state); + +#ifdef TESTS +TIM_HandleTypeDef htim7; + +volatile uint32_t DEBUG_startTime = 0; +volatile uint32_t DEBUG_endTime = 0; +volatile uint32_t DEBUG_duration = 0; +volatile uint32_t DEBUG_worstCase = 0; + +void Init_Systick(void) { +// TIM_ClockConfigTypeDef sClockSourceConfig = { 0 }; +// +// __HAL_RCC_TIM7_CLK_ENABLE(); +// +// htim7.Instance = TIM2; +// htim7.Init.Prescaler = 0; +// htim7.Init.CounterMode = TIM_COUNTERMODE_UP; +// htim7.Init.Period = 65535; +// htim7.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; +// htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; +// if (HAL_TIM_Base_Init(&htim7) != HAL_OK) { +// Error_Handler(); +// } +// +// sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; +// if (HAL_TIM_ConfigClockSource(&htim7, &sClockSourceConfig) != HAL_OK) { +// Error_Handler(); +// } +// +// LL_TIM_EnableCounter(TIM7); +} + +void StartMeasure(void) { +// DEBUG_startTime = LL_TIM_GetCounter(TIM7); +} + +void EndMeasure(void) { +// DEBUG_endTime = LL_TIM_GetCounter(TIM7); +// +// if (DEBUG_startTime >= DEBUG_endTime) +// DEBUG_duration = 65533 - DEBUG_startTime + DEBUG_endTime; +// else +// DEBUG_duration = DEBUG_endTime - DEBUG_startTime; +// +// if (DEBUG_duration > DEBUG_worstCase) +// DEBUG_worstCase = DEBUG_duration; +} +#endif /* TESTS */ + +/** + * @brief Function for initializing motors driver + * + * @param None + * @retval None + */ +void MOTORS_Init(void) { + /* Désactive les alimentations des moteurs */ + MOTORS_PowerOff(); + + /* Create the task without using any dynamic memory allocation. */ + xHandleMotors = xTaskCreateStatic(MOTORS_HandlerTask, /* Function that implements the task. */ + "MOTORS Handler", /* Text name for the task. */ + STACK_SIZE, /* Number of indexes in the xStack array. */ + NULL, /* Parameter passed into the task. */ + PriorityMotorsHandler,/* Priority at which the task is created. */ + xStackMotors, /* Array to use as the task's stack. */ + &xTaskMotors); /* Variable to hold the task's data structure. */ + vTaskResume(xHandleMotors); + + /* Create the task without using any dynamic memory allocation. */ + xHandleMotorsControl = xTaskCreateStatic( + MOTORS_ControlTask, /* Function that implements the task. */ + "MOTORS Control", /* Text name for the task. */ + STACK_SIZE, /* Number of indexes in the xStack array. */ + NULL, /* Parameter passed into the task. */ + PriorityMotorsAsservissement,/* Priority at which the task is created. */ + xStackMotorsControl, /* Array to use as the task's stack. */ + &xTaskMotorsControl); /* Variable to hold the task's data structure. */ + vTaskSuspend(xHandleMotorsControl); // On ne lance la tache d'asservissement que lorsque'une commande moteur arrive + + MOTORS_PowerOff(); + +#ifdef TESTS + Init_Systick(); +#endif /* TESTS */ +} + +/** + * @brief Function for initializing motors driver + * + * @param None + * @retval None + */ +void MOTORS_Move(int32_t distance) { + static int32_t dist; + + dist = distance*15; + + if (dist) { + MOTORS_PowerOn(); + MESSAGE_SendMailbox(MOTORS_Mailbox, MSG_ID_MOTORS_MOVE, + APPLICATION_Mailbox, (void*) &dist); + } else + MOTORS_Stop(); +} + +/** + * @brief Function for initializing motors driver + * + * @param None + * @retval None + */ +void MOTORS_Turn(int32_t tours) { + static int32_t turns; + + turns = tours; + + if (turns) { + MOTORS_PowerOn(); + MESSAGE_SendMailbox(MOTORS_Mailbox, MSG_ID_MOTORS_TURN, + APPLICATION_Mailbox, (void*) &turns); + } else + MOTORS_Stop(); +} + +/** + * @brief Function for initializing motors driver + * + * @param None + * @retval None + */ +void MOTORS_Stop(void) { + MOTORS_PowerOff(); + MESSAGE_SendMailbox(MOTORS_Mailbox, MSG_ID_MOTORS_STOP, + APPLICATION_Mailbox, (void*) NULL); +} + +/* + * @brief Tache de supervision des moteurs + * Gestion de la boite aux lettres moteurs, et supervision generale + * @param params non utilisé + */ +void MOTORS_HandlerTask(void *params) { + MESSAGE_Typedef msg; + int32_t distance, tours; + + while (1) { + msg = MESSAGE_ReadMailbox(MOTORS_Mailbox); + + switch (msg.id) { + case MSG_ID_MOTORS_MOVE: + distance = *((int32_t*) msg.data); + MOTORS_DiffState.distance = distance; + MOTORS_DiffState.turns = 0; + + if (distance > 0) { + MOTORS_LeftMotorState.set_point = 50; + MOTORS_RightMotorState.set_point = 50; + } else { + MOTORS_LeftMotorState.set_point = -50; + MOTORS_RightMotorState.set_point = -50; + } + + vTaskResume(xHandleMotorsControl); + break; + + case MSG_ID_MOTORS_TURN: + tours = *((int32_t*) msg.data); + MOTORS_DiffState.distance = 0; + MOTORS_DiffState.turns = tours; + + if (tours > 0) { + MOTORS_LeftMotorState.set_point = -50; + MOTORS_RightMotorState.set_point = 50; + } else { + MOTORS_LeftMotorState.set_point = 50; + MOTORS_RightMotorState.set_point = -50; + } + + vTaskResume(xHandleMotorsControl); + break; + + case MSG_ID_MOTORS_STOP: + MOTORS_DiffState.distance = 0; + MOTORS_DiffState.turns = 0; + + MOTORS_LeftMotorState.set_point = 0; + MOTORS_RightMotorState.set_point = 0; + if ((MOTORS_EncoderCorrection(MOTORS_LeftMotorState) == 0) + && (MOTORS_EncoderCorrection(MOTORS_RightMotorState) == 0)) { + // Les moteurs sont déjà arrêtés + vTaskSuspend(xHandleMotorsControl); + + MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_MOTORS_END_OF_MOUVMENT, + MOTORS_Mailbox, (void*) NULL); + } else + // Les moteurs tournent encore + vTaskResume(xHandleMotorsControl); + break; + default: + break; + } + } +} + +/* + * @brief Tache d'asservissement, périodique (10ms) + * + * @param params non utilisé + */ +void MOTORS_ControlTask(void *params) { + TickType_t xLastWakeTime; + int16_t leftError, rightError = 0; + int16_t leftEncoder, rightEncoder; + int32_t locCmdG, locCmdD; + + // Initialise the xLastWakeTime variable with the current time. + xLastWakeTime = xTaskGetTickCount(); + + for (;;) { + // Wait for the next cycle. + vTaskDelayUntil(&xLastWakeTime, + pdMS_TO_TICKS(MOTORS_REGULATION_DELAY)); + +#ifdef TESTS + //StartMeasure(); +#endif /* TESTS */ + + leftEncoder = MOTORS_EncoderCorrection(MOTORS_LeftMotorState); + rightEncoder = MOTORS_EncoderCorrection(MOTORS_RightMotorState); + + /* + * encodeur est entre -32768 et +32767, selon le sens de rotation du moteur + * consigne est entre -32768 et + 32767 selon le sens de rotation du moteur + * erreur est entre -32768 et 32767 selon la difference à apporter à la commande + */ + + leftError = MOTORS_LeftMotorState.set_point - leftEncoder; + rightError = MOTORS_RightMotorState.set_point - rightEncoder; + + if (((MOTORS_RightMotorState.set_point == 0) + && (MOTORS_LeftMotorState.set_point == 0)) + && ((rightError == 0) && (leftError == 0))) { + + MOTORS_PowerOff(); + MESSAGE_SendMailbox(APPLICATION_Mailbox, MSG_ID_MOTORS_END_OF_MOUVMENT, + MOTORS_Mailbox, (void*) NULL); + vTaskSuspend(xHandleMotorsControl); + } + + if (MOTORS_LeftMotorState.set_point == 0) + MOTORS_LeftMotorState.output = 0; + else { + if (leftError != 0) { + //locCmdG = (int32_t)MOTEURS_EtatMoteurGauche.commande + ((int32_t)MOTEUR_Kp*(int32_t)erreurG)/100; + locCmdG = ((int32_t) MOTOR_Kp * (int32_t) leftError) / 100; + + if (MOTORS_LeftMotorState.set_point >= 0) { + if (locCmdG < 0) + MOTORS_LeftMotorState.output = 0; + else if (locCmdG > SHRT_MAX) + MOTORS_LeftMotorState.output = SHRT_MAX; + else + MOTORS_LeftMotorState.output = (int16_t) locCmdG; + } else { + if (locCmdG > 0) + MOTORS_LeftMotorState.output = 0; + else if (locCmdG < SHRT_MIN) + MOTORS_LeftMotorState.output = SHRT_MIN; + else + MOTORS_LeftMotorState.output = (int16_t) locCmdG; + } + } + } + + if (MOTORS_RightMotorState.set_point == 0) + MOTORS_RightMotorState.output = 0; + else { + if (rightError != 0) { + //locCmdD = (int32_t)MOTEURS_EtatMoteurDroit.commande + ((int32_t)MOTEUR_Kp*(int32_t)erreurD)/100; + locCmdD = ((int32_t) MOTOR_Kp * (int32_t) rightError) / 100; + + if (MOTORS_RightMotorState.set_point >= 0) { + if (locCmdD < 0) + MOTORS_RightMotorState.output = 0; + else if (locCmdD > SHRT_MAX) + MOTORS_RightMotorState.output = SHRT_MAX; + else + MOTORS_RightMotorState.output = (int16_t) locCmdD; + } else { + if (locCmdD > 0) + MOTORS_RightMotorState.output = 0; + else if (locCmdD < SHRT_MIN) + MOTORS_RightMotorState.output = SHRT_MIN; + else + MOTORS_RightMotorState.output = (int16_t) locCmdD; + } + } + } + + /* Finalement, on applique les commandes aux moteurs */ + MOTORS_Set(MOTORS_LeftMotorState.output, + MOTORS_RightMotorState.output); + +#ifdef TESTS + //EndMeasure(); +#endif /* TESTS */ + } +} + +typedef struct { + uint16_t encoder; + uint16_t correction; +} MOTORS_CorrectionPoint; + +#define MOTORS_MAX_CORRECTION_POINTS 16 + +const MOTORS_CorrectionPoint MOTORS_CorrectionPoints[MOTORS_MAX_CORRECTION_POINTS] = +{ { MOTORS_MAX_ENCODER - 1, 1 }, { 42000, 100 }, { 22000, 2500 }, { + 18000, 5000 }, { 16500, 7500 }, { 15500, 10000 }, + { 14500, 12500 }, { 13000, 15000 }, { 12500, 17500 }, { 12200, + 20000 }, { 11500, 22500 }, { 11100, 25000 }, { 11000, + 27500 }, { 10900, 29000 }, { 10850, 30500 }, { 10800, + SHRT_MAX } // 32767 +}; + +/* + * @brief Fonction de conversion des valeurs brutes de l'encodeur en valeur linearisées + * + * @param encodeur valeur brute de l'encodeur + * @return valeur linéarisée (entre -32768 et 32767) + */ +int16_t MOTORS_EncoderCorrection(MOTORS_MotorState state) { + int16_t correction = 0; + uint8_t index = 0; + uint32_t A, B, C; + uint16_t encoder = state.encoder; + + if (encoder == MOTORS_MAX_ENCODER) + correction = 0; + else { // recherche par dichotomie de l'intervale + while (index < MOTORS_MAX_CORRECTION_POINTS) { + if ((MOTORS_CorrectionPoints[index].encoder >= encoder) + && (MOTORS_CorrectionPoints[index + 1].encoder < encoder)) { + // valeur trouvée, on sort + break; + } else + index++; + } + + if (index >= MOTORS_MAX_CORRECTION_POINTS) + correction = SHRT_MAX; + else { + A = encoder - MOTORS_CorrectionPoints[index + 1].encoder; + B = MOTORS_CorrectionPoints[index + 1].correction + - MOTORS_CorrectionPoints[index].correction; + C = MOTORS_CorrectionPoints[index].encoder + - MOTORS_CorrectionPoints[index + 1].encoder; + + correction = + (int16_t) (MOTORS_CorrectionPoints[index + 1].correction + - (uint16_t) ((A * B) / C)); + } + } + + /* + * Selon le sens de rotation du moteur (commande > 0 ou < 0), on corrige le signe du capteur + */ + if (state.set_point < 0) + correction = -correction; + + return correction; +} + +/** + * @brief Function for initializing motors driver + * + * @param None + * @retval None + */ +void MOTORS_PowerOff(void) { + LL_TIM_DisableCounter(TIM3); + LL_TIM_DisableCounter(TIM2); + LL_TIM_DisableCounter(TIM21); + + LL_TIM_CC_DisableChannel(TIM3, + LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2 | LL_TIM_CHANNEL_CH3 + | LL_TIM_CHANNEL_CH4); + + LL_TIM_CC_DisableChannel(TIM2, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); + LL_TIM_CC_DisableChannel(TIM21, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); + + LL_TIM_DisableIT_CC1(TIM2); + LL_TIM_DisableIT_CC1(TIM21); + LL_TIM_DisableIT_UPDATE(TIM2); + LL_TIM_DisableIT_UPDATE(TIM21); + + LL_GPIO_SetOutputPin(GPIOB, SHUTDOWN_ENCODERS_Pin); + LL_GPIO_ResetOutputPin(GPIOB, SHUTDOWN_5V_Pin); +} + +/** + * @brief Function for initializing motors driver + * + * @param None + * @retval None + */ +void MOTORS_PowerOn(void) { + LL_TIM_EnableCounter(TIM3); + LL_TIM_EnableCounter(TIM2); + LL_TIM_EnableCounter(TIM21); + + LL_TIM_CC_EnableChannel(TIM3, + LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2 | LL_TIM_CHANNEL_CH3 + | LL_TIM_CHANNEL_CH4); + + LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); + LL_TIM_CC_EnableChannel(TIM21, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); + + LL_TIM_EnableIT_CC1(TIM2); + LL_TIM_EnableIT_CC1(TIM21); + LL_TIM_EnableIT_UPDATE(TIM2); + LL_TIM_EnableIT_UPDATE(TIM21); + + LL_GPIO_ResetOutputPin(GPIOB, SHUTDOWN_ENCODERS_Pin); + LL_GPIO_SetOutputPin(GPIOB, SHUTDOWN_5V_Pin); +} + +/** + * @brief Active les encodeurs et le régulateur des moteur si nécessaire et + * règle la commande du moteur (entre -MOTEURS_MAX_COMMANDE et +MOTEURS_MAX_COMMANDE) + * On applique une "regle de 3" + * pour SHRT_MAX -> MOTEURS_MAX_COMMANDE + * pour 0 -> 0 + * pour une commande C dans l'interval [0 .. 32767], la commande est + * commande = (C * MOTEURS_MAX_COMMANDE)/32767 + * + * @param[in] cmdGauche blablabla + * @param[in] cmdDroit blablabla + */ +void MOTORS_Set(int16_t leftMotor, int16_t rightMotor) { + int32_t leftValue, rightValue; + + leftValue = (int32_t) (((int32_t) leftMotor * (int32_t) SHRT_MAX) + / ((int32_t) MOTORS_MAX_COMMAND)); + rightValue = (int32_t) (((int32_t) rightMotor * (int32_t) SHRT_MAX) + / ((int32_t) MOTORS_MAX_COMMAND)); + + if (LL_GPIO_IsOutputPinSet(GPIOB, SHUTDOWN_5V_Pin) == GPIO_PIN_RESET) + MOTORS_PowerOn(); + + // Moteur droit + if (rightMotor >= 0) { + LL_TIM_OC_SetCompareCH2(TIM3, (uint32_t) rightValue); + LL_TIM_OC_SetCompareCH1(TIM3, (uint32_t) 0); + } else { + LL_TIM_OC_SetCompareCH2(TIM3, (uint32_t) 0); + LL_TIM_OC_SetCompareCH1(TIM3, (uint32_t) rightValue); + } + + // Moteur gauche + if (leftMotor >= 0) { + LL_TIM_OC_SetCompareCH4(TIM3, (uint32_t) leftValue); + LL_TIM_OC_SetCompareCH3(TIM3, (uint32_t) 0); + } else { + LL_TIM_OC_SetCompareCH4(TIM3, (uint32_t) 0); + LL_TIM_OC_SetCompareCH3(TIM3, (uint32_t) leftValue); + } +} + +/* + * @brief Recupere les mesures brutes des encodeurs et les enregistre dans la structure moteur correspondante + * + * @param[in] htim pointeur sur la reference du timer qui generé l'interruption + */ +void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) { + if (htim->Instance == TIM21) { /* moteur gauche */ + if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) { + if (MOTORS_LeftMotorState.slowMotor != 0) { + MOTORS_LeftMotorState.encoder = MOTORS_MAX_ENCODER; + MOTORS_LeftMotorState.encoderEdge = MOTORS_MAX_ENCODER; + } else { + MOTORS_LeftMotorState.encoder = + (uint16_t) LL_TIM_IC_GetCaptureCH1(TIM21); + MOTORS_LeftMotorState.encoderEdge = + (uint16_t) LL_TIM_IC_GetCaptureCH2(TIM21); + } + + if (LL_TIM_IsActiveFlag_UPDATE(TIM21)) + LL_TIM_ClearFlag_UPDATE(TIM21); + + MOTORS_LeftMotorState.slowMotor = 0; + + if (MOTORS_DiffState.distance) { + if (MOTORS_DiffState.distance>0) MOTORS_DiffState.distance--; + else MOTORS_DiffState.distance++; + + if (MOTORS_DiffState.distance==0) { + MOTORS_LeftMotorState.set_point=0; + MOTORS_RightMotorState.set_point=0; + } + } + + if (MOTORS_DiffState.turns) { + if (MOTORS_DiffState.turns>0) MOTORS_DiffState.turns--; + else MOTORS_DiffState.turns++; + + if (MOTORS_DiffState.turns==0) { + MOTORS_LeftMotorState.set_point=0; + MOTORS_RightMotorState.set_point=0; + } + } + + } + } else { /* moteur droit */ + if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) { + if (MOTORS_RightMotorState.slowMotor != 0) { + MOTORS_RightMotorState.encoder = MOTORS_MAX_ENCODER; + MOTORS_RightMotorState.encoderEdge = MOTORS_MAX_ENCODER; + } else { + MOTORS_RightMotorState.encoder = + (uint16_t) LL_TIM_IC_GetCaptureCH1(TIM2); + MOTORS_RightMotorState.encoderEdge = + (uint16_t) LL_TIM_IC_GetCaptureCH2(TIM2); + } + + if (LL_TIM_IsActiveFlag_UPDATE(TIM2)) + LL_TIM_ClearFlag_UPDATE(TIM2); + + MOTORS_RightMotorState.slowMotor = 0; + } + } +} + +/* + * @brief Gestionnaire d'interruption "overflow" + * Lorsque deux interruptions "overflow" sont arrivées sans que l'interruption capture n'arrive, + * cela signifie que le moteur est à l'arret. + * On met la valeur de l'encodeur à MOTEURS_MAX_ENCODEUR + * + * @param[in] htim pointeur sur la reference du timer qui generé l'interruption + */ +void MOTORS_TimerEncodeurUpdate(TIM_HandleTypeDef *htim) { + if (htim->Instance == TIM21) { /* moteur gauche */ + if ((MOTORS_LeftMotorState.slowMotor++) >= 1) { + MOTORS_LeftMotorState.encoder = MOTORS_MAX_ENCODER; + MOTORS_LeftMotorState.slowMotor = 1; + } + } else { /* moteur droit */ + if ((MOTORS_RightMotorState.slowMotor++) >= 1) { + MOTORS_RightMotorState.encoder = MOTORS_MAX_ENCODER; + MOTORS_RightMotorState.slowMotor = 1; + } + } +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ diff --git a/software/dumber3/Application/motors.h b/software/dumber3/Application/motors.h new file mode 100644 index 0000000..62012f4 --- /dev/null +++ b/software/dumber3/Application/motors.h @@ -0,0 +1,67 @@ +/** + ****************************************************************************** + * @file motors.c + * @brief motors driver header + * @author S. DI MERCURIO (dimercur@insa-toulouse.fr) + * @date December 2023 + * + ****************************************************************************** + * @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved. + * @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only). + * + * @copyright This file is part of "Dumber" project + * + * @copyright This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * @copyright This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * @copyright You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + ****************************************************************************** + */ + +#ifndef INC_MOTORS_H_ +#define INC_MOTORS_H_ + +#include "application.h" + +/** @addtogroup Application_Software + * @{ + */ + +/** @addtogroup MOTORS + * @{ + */ + +/** @addtogroup MOTORS_Public Public + * @{ + */ + +void MOTORS_Init(void); +void MOTORS_Move(int32_t distance); +void MOTORS_Turn(int32_t tours); +void MOTORS_Stop(void); + +void MOTORS_TimerEncodeurUpdate (TIM_HandleTypeDef *htim); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#endif /* INC_MOTORS_H_ */ diff --git a/software/dumber3/Application/panic.c b/software/dumber3/Application/panic.c index 99c12fc..6d9eaf8 100644 --- a/software/dumber3/Application/panic.c +++ b/software/dumber3/Application/panic.c @@ -12,32 +12,32 @@ #include "leds.h" void PANIC_StopTasksAndWait(void); -void MOTEURS_DesactiveAlim(void); +void MOTORS_PowerOff(void); extern TaskHandle_t xHandleLedsHandler; extern TaskHandle_t xHandleLedsAction; -extern TaskHandle_t xHandleBatterie; +extern TaskHandle_t xHandleBattery; extern TimerHandle_t xHandleTimerButton; extern TaskHandle_t xHandleApplicationMain; extern TimerHandle_t xHandleTimerTimeout; -extern TaskHandle_t xHandleMoteurs; -extern TaskHandle_t xHandleMoteursAsservissement; +extern TaskHandle_t xHandleMotors; +extern TaskHandle_t xHandleMotorsControl; extern TaskHandle_t xHandleXbeeTXHandler; extern TaskHandle_t xHandleXbeeRX; void PANIC_Raise(PANIC_Typedef panicId) { switch (panicId) { case panic_adc_err: - LEDS_Set(leds_erreur_1); + LEDS_Set(leds_error_1); break; case panic_charger_err: - LEDS_Set(leds_erreur_2); + LEDS_Set(leds_error_2); break; case panic_malloc: - LEDS_Set(leds_erreur_3); + LEDS_Set(leds_error_3); break; default: - LEDS_Set(leds_erreur_5); + LEDS_Set(leds_error_5); break; } @@ -66,21 +66,21 @@ void PANIC_StopTasksAndWait(void){ if (currentTask != xHandleXbeeTXHandler) vTaskSuspend(xHandleXbeeTXHandler); - if (currentTask != xHandleMoteurs) - vTaskSuspend(xHandleMoteurs); + if (currentTask != xHandleMotors) + vTaskSuspend(xHandleMotors); - if (currentTask != xHandleMoteursAsservissement) - vTaskSuspend(xHandleMoteursAsservissement); + if (currentTask != xHandleMotorsControl) + vTaskSuspend(xHandleMotorsControl); - if (currentTask != xHandleBatterie) - vTaskSuspend(xHandleBatterie); + if (currentTask != xHandleBattery) + vTaskSuspend(xHandleBattery); if (currentTask != xHandleApplicationMain) vTaskSuspend(xHandleApplicationMain); /* Stop des alim moteurs */ - MOTEURS_DesactiveAlim(); + MOTORS_PowerOff(); /* disable XBEE */ HAL_GPIO_WritePin(XBEE_RESET_GPIO_Port, XBEE_RESET_Pin, GPIO_PIN_RESET); diff --git a/software/dumber3/Core/Src/main.c b/software/dumber3/Core/Src/main.c index 921743c..7ae6d29 100644 --- a/software/dumber3/Core/Src/main.c +++ b/software/dumber3/Core/Src/main.c @@ -681,7 +681,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) } /* USER CODE BEGIN Callback 1 */ else if ((htim->Instance == TIM2) || (htim->Instance == TIM21)) - MOTEURS_TimerEncodeurUpdate (htim); + MOTORS_TimerEncodeurUpdate (htim); /* USER CODE END Callback 1 */ } diff --git a/software/dumber3/Doxyfile b/software/dumber3/Doxyfile new file mode 100644 index 0000000..d915477 --- /dev/null +++ b/software/dumber3/Doxyfile @@ -0,0 +1,2744 @@ +# Doxyfile 1.9.4 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables: +# doxygen -x_noenv [configFile] + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Dumber 3" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Firmware for dumber robots used at INSA-GEI" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = "/home/dimercur/Documents/Travail/Depots-Git/dumber/doc/Doc robot/doxygen" + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# numer of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +#TYPEDEF_HIDES_STRUCT = NO +TYPEDEF_HIDES_STRUCT = YES + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = YES + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3 + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.l \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3/Drivers \ + /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3/Tests \ + /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3/TestsPlans \ + /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3/Debug \ + /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3/Release \ + /home/dimercur/Documents/Travail/Depots-Git/dumber/software/dumber3/workspace \ + Middlewares + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# ANamespace::AClass, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /