diff --git a/cmake/boardcore-host.cmake b/cmake/boardcore-host.cmake index 9f9c50716048941b81aa38d02d4530edf53171dc..a0a685e46cd1549783fdb6626be877a60b50389b 100644 --- a/cmake/boardcore-host.cmake +++ b/cmake/boardcore-host.cmake @@ -29,9 +29,6 @@ set(BOARDCORE_HOST_SRC # Actuators ${SBS_BASE}/src/shared/actuators/Servo/Servo.cpp - # Drivers - ${SBS_BASE}/src/shared/drivers/timer/TimestampTimer.cpp - # Events ${SBS_BASE}/src/shared/events/EventBroker.cpp diff --git a/cmake/boardcore.cmake b/cmake/boardcore.cmake index f36cdf935d7d3e30940a379d0647fe32d43206df..a95d56bd1dfa7ab560f5d28dcd60cdad9a249053 100644 --- a/cmake/boardcore.cmake +++ b/cmake/boardcore.cmake @@ -58,7 +58,6 @@ set(BOARDCORE_SRC ${BOARDCORE_PATH}/src/shared/drivers/interrupt/external_interrupts.cpp ${BOARDCORE_PATH}/src/shared/drivers/timer/PWM.cpp ${BOARDCORE_PATH}/src/shared/drivers/timer/CountedPWM.cpp - ${BOARDCORE_PATH}/src/shared/drivers/timer/TimestampTimer.cpp ${BOARDCORE_PATH}/src/shared/drivers/runcam/Runcam.cpp ${BOARDCORE_PATH}/src/shared/drivers/spi/SPITransaction.cpp ${BOARDCORE_PATH}/src/shared/drivers/usart/USART.cpp diff --git a/src/shared/drivers/timer/TimestampTimer.cpp b/src/shared/drivers/timer/TimestampTimer.cpp deleted file mode 100644 index 2eadc2650a4f2ee471bd73bb56f640baad3ca058..0000000000000000000000000000000000000000 --- a/src/shared/drivers/timer/TimestampTimer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2020-2021 Skyward Experimental Rocketry - * Authors: Luca Conterio, Davide Mor, Alberto Nidasio, Niccolò Betto - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "TimestampTimer.h" - -#include <miosix.h> -#include <utils/TimeUtils.h> - -namespace Boardcore -{ -namespace TimestampTimer -{ -uint64_t getTimestamp() -{ - return static_cast<uint64_t>(nsToUs(miosix::getTime())); -} -} // namespace TimestampTimer -} // namespace Boardcore diff --git a/src/shared/drivers/timer/TimestampTimer.h b/src/shared/drivers/timer/TimestampTimer.h index 13fa2ed1fa833d87982bf363e1a570c3359f6ac0..e40142369b8c05082838ec2615f0faebe09d420f 100644 --- a/src/shared/drivers/timer/TimestampTimer.h +++ b/src/shared/drivers/timer/TimestampTimer.h @@ -22,6 +22,9 @@ #pragma once +#include <miosix.h> +#include <utils/TimeUtils.h> + #include <cstdint> namespace Boardcore @@ -44,12 +47,17 @@ namespace Boardcore */ namespace TimestampTimer { + /** * @brief Returns the current timer value in microseconds. * @deprecated Use miosix::getTime() instead and update the code to nanoseconds. * * @return Current timestamp in microseconds. */ -uint64_t getTimestamp(); +inline uint64_t getTimestamp() +{ + return static_cast<uint64_t>(nsToUs(miosix::getTime())); +} + }; // namespace TimestampTimer } // namespace Boardcore