mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 00:36:00 +00:00
Updated gitignore and added spatz utilities
This commit is contained in:
parent
9eddbaa30f
commit
fe3e5d38e4
3
.gitignore
vendored
3
.gitignore
vendored
@ -10,6 +10,9 @@
|
||||
Debug/
|
||||
Release/
|
||||
|
||||
!include/sta/debug/
|
||||
!src/debug/
|
||||
|
||||
# Doxygen
|
||||
docs/html
|
||||
docs/latex
|
||||
|
@ -201,6 +201,14 @@ namespace sta
|
||||
* @param length Buffer length
|
||||
*/
|
||||
void read(double * buffer, size_t length);
|
||||
public:
|
||||
virtual void request(uint8_t * txBuffer, size_t txLength, uint8_t * rxBuffer, size_t rxLength) = 0;
|
||||
|
||||
void request(uint8_t * txBuffer, size_t txLength, float * rxBuffer, size_t rxLength);
|
||||
|
||||
void request(uint8_t * txBuffer, size_t txLength, double * rxBuffer, size_t rxLenght);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
#ifndef STA_DEBUGGING_PROFILING_HPP
|
||||
#define STA_DEBUGGING_PROFILING_HPP
|
||||
#ifndef STA_CORE_PROFILE_HPP
|
||||
#define STA_CORE_PROFILE_HPP
|
||||
|
||||
#include <sta/debug/debug.hpp>
|
||||
|
||||
@ -44,4 +44,4 @@ namespace sta
|
||||
|
||||
#endif // // STA_PROFILING_ENABLED
|
||||
|
||||
#endif // STA_DEBUGGING_PROFILING_HPP
|
||||
#endif // STA_CORE_PROFILE_HPP
|
||||
|
56
include/sta/debug/spatz.hpp
Normal file
56
include/sta/debug/spatz.hpp
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef STA_CORE_SPATZ_HPP
|
||||
#define STA_CORE_SPATZ_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_SPATZ_ENABLED
|
||||
|
||||
#include <sta/debug/debug.hpp>
|
||||
#ifndef STA_DEBUGGING_ENABLED
|
||||
# error "Cannot use SPATZ without debugging being enabled."
|
||||
#endif // STA_DEBUGGING_ENABLED
|
||||
|
||||
#include <sta/mutex.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace spatz
|
||||
{
|
||||
/**
|
||||
* @brief Initialize SPATZ for in-the-loop testing.
|
||||
*
|
||||
* @param mutex A mutex used to make SPATZ thread-safe.
|
||||
*/
|
||||
void init(Mutex * mutex);
|
||||
|
||||
/**
|
||||
* @brief Request bytes for a specific sensor id via the printable.
|
||||
*
|
||||
* @param id The id of the sensor to request data for.
|
||||
* @param buffer The byte buffer to write the data to.
|
||||
* @param length The number of the bytes to request.
|
||||
*/
|
||||
void request(uint8_t id, uint8_t * buffer, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Request floats for a specific sensor id via the printable.
|
||||
*
|
||||
* @param id The id of the sensor to request data for.
|
||||
* @param buffer The float buffer to write the data to.
|
||||
* @param length The number of floats to request.
|
||||
*/
|
||||
void request(uint8_t id, float * buffer, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Request doubles for a specific sensor id via the printable.
|
||||
*
|
||||
* @param id The id of the sensor to request data for.
|
||||
* @param buffer The double buffer to write the data to.
|
||||
* @param length The number of doubles to request.
|
||||
*/
|
||||
void request(uint8_t id, double * buffer, size_t length);
|
||||
} // namespace spatz
|
||||
} // namespace sta
|
||||
|
||||
#endif // STA_SPATZ_ENABLED
|
||||
|
||||
#endif // STA_CORE_SPATZ_HPP
|
42
src/debug/spatz.cpp
Normal file
42
src/debug/spatz.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <sta/debug/spatz.hpp>
|
||||
|
||||
#ifdef STA_SPATZ_ENABLED
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace spatz
|
||||
{
|
||||
sta::Mutex * mutex_;
|
||||
|
||||
void init(sta::Mutex * mutex)
|
||||
{
|
||||
mutex_ = mutex;
|
||||
}
|
||||
|
||||
void request(uint8_t id, uint8_t * buffer, size_t length)
|
||||
{
|
||||
sta::lock_guard lock(*mutex_);
|
||||
|
||||
Debug->println(id);
|
||||
Debug->read(buffer, length);
|
||||
}
|
||||
|
||||
void request(uint8_t id, float * buffer, size_t length)
|
||||
{
|
||||
sta::lock_guard lock(*mutex_);
|
||||
|
||||
Debug->println(id);
|
||||
Debug->read(buffer, length);
|
||||
}
|
||||
|
||||
void request(uint8_t id, double * buffer, size_t length)
|
||||
{
|
||||
sta::lock_guard lock(*mutex_);
|
||||
|
||||
Debug->println(id);
|
||||
Debug->read(buffer, length);
|
||||
}
|
||||
} // namespace spatz
|
||||
} // namespace sta
|
||||
|
||||
#endif // STA_SPATZ_ENABLED
|
Loading…
x
Reference in New Issue
Block a user