From 3f3e7c9ecfb875efbc2674dc99129545470bc364 Mon Sep 17 00:00:00 2001 From: Carlos Augusto Porto Freitas Date: Wed, 13 Mar 2024 15:50:20 -0300 Subject: [PATCH] firmware: drivers: sl_ttc2: Updating driver mutex #343 --- firmware/drivers/sl_ttc2/sl_ttc2.h | 24 +++++++++ firmware/drivers/sl_ttc2/sl_ttc2_mutex.c | 4 +- firmware/drivers/sl_ttc2/sl_ttc2_mutex.h | 64 ------------------------ 3 files changed, 26 insertions(+), 66 deletions(-) delete mode 100644 firmware/drivers/sl_ttc2/sl_ttc2_mutex.h diff --git a/firmware/drivers/sl_ttc2/sl_ttc2.h b/firmware/drivers/sl_ttc2/sl_ttc2.h index 956f52fe..91c7926c 100644 --- a/firmware/drivers/sl_ttc2/sl_ttc2.h +++ b/firmware/drivers/sl_ttc2/sl_ttc2.h @@ -48,6 +48,9 @@ #define SL_TTC2_DEVICE_ID_RADIO_0 0xCC2AU /**< TTC 2.0 device ID (radio 1). */ #define SL_TTC2_DEVICE_ID_RADIO_1 0xCC2BU /**< TTC 2.0 device ID (radio 2). */ +/* TTC 2.0 Mutex wait time */ +#define SL_TTC2_MUTEX_WAIT_TIME_MS 5000U /**< TTC 2.0 mutex wait time. */ + /* TTC 2.0 Preamble byte */ #define SL_TTC2_PKT_PREAMBLE 0x7EU /**< Preamble byte value. */ @@ -587,6 +590,27 @@ int sl_ttc2_spi_transfer(sl_ttc2_config_t config, uint8_t *wdata, uint8_t *rdata */ void sl_ttc2_delay_ms(uint32_t ms); +/** + * \brief Creates the sl_ttc2 create. + * + * \return The status/error code. + */ +int sl_ttc2_mutex_create(void); + +/** + * \brief Takes the sl_ttc2 mutex. + * + * \return The status/error code. + */ +int sl_ttc2_mutex_take(void); + +/** + * \brief Gives the sl_ttc2 mutex. + * + * \return The status/error code. + */ +int sl_ttc2_mutex_give(void); + #endif /* SL_TTC2_H_ */ /** \} End of sl_ttc2 group */ diff --git a/firmware/drivers/sl_ttc2/sl_ttc2_mutex.c b/firmware/drivers/sl_ttc2/sl_ttc2_mutex.c index 2f31a30f..9ca16cdf 100644 --- a/firmware/drivers/sl_ttc2/sl_ttc2_mutex.c +++ b/firmware/drivers/sl_ttc2/sl_ttc2_mutex.c @@ -29,7 +29,7 @@ * * \date 2024/02/26 * - * \addtogroup sl_ttc2_mutex + * \addtogroup sl_ttc2 * \{ */ @@ -37,7 +37,7 @@ #include #include -#include "sl_ttc2_mutex.h" +#include "sl_ttc2.h" static xSemaphoreHandle sl_ttc2_mutex = NULL; diff --git a/firmware/drivers/sl_ttc2/sl_ttc2_mutex.h b/firmware/drivers/sl_ttc2/sl_ttc2_mutex.h deleted file mode 100644 index 683ef582..00000000 --- a/firmware/drivers/sl_ttc2/sl_ttc2_mutex.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * sl_ttc2_mutex.h - * - * Copyright The OBDH 2.0 Contributors - * - * This file is part of OBDH 2.0. - * - * OBDH 2.0 is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * OBDH 2.0 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with OBDH 2.0. If not, see . - * - */ - -/** - * \brief SpaceLab TTC 2.0 driver mutex definition. - * - * \author Carlos Augusto Porto Freitas - * - * \version 0.10.10 - * - * \date 2024/02/26 - * - * \defgroup sl_ttc2_mutex Mutex - * \ingroup sl_ttc2 - * \{ - */ -#ifndef DRIVERS_SL_TTC2_SL_TTC2_MUTEX_H_ -#define DRIVERS_SL_TTC2_SL_TTC2_MUTEX_H_ - -#define SL_TTC2_MUTEX_WAIT_TIME_MS 1200U - -/** - * \brief Creates the sl_ttc2 create. - * - * \return The status/error code. - */ -int sl_ttc2_mutex_create(void); - -/** - * \brief Takes the sl_ttc2 mutex. - * - * \return The status/error code. - */ -int sl_ttc2_mutex_take(void); - -/** - * \brief Gives the sl_ttc2 mutex. - * - * \return The status/error code. - */ -int sl_ttc2_mutex_give(void); - -#endif /* DRIVERS_SL_TTC2_SL_TTC2_MUTEX_H_ */ - -/** \} End of sl_ttc2_mutex group */