mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/cmake-demo.git
synced 2025-06-10 02:25:59 +00:00
95 lines
2.0 KiB
C++
95 lines
2.0 KiB
C++
#ifndef INC_SHARED_HPP_
|
|
#define INC_SHARED_HPP_
|
|
|
|
#include <cmsis_os2.h>
|
|
#include <states.hpp>
|
|
|
|
namespace rres
|
|
{
|
|
struct LoggingData
|
|
{
|
|
uint32_t hash;
|
|
uint32_t timestamp;
|
|
|
|
uint8_t state;
|
|
uint8_t sense_fire;
|
|
uint16_t sense_adc[6];
|
|
uint8_t fired;
|
|
};
|
|
|
|
enum Event
|
|
{
|
|
TICK_10HZ = 1 << 0,
|
|
TOCK_10HZ = 1 << 1,
|
|
START_LOGGING = 1 << 2,
|
|
DUMP_FLASH = 1 << 3,
|
|
CLEAR_FLASH = 1 << 4,
|
|
FLASH_EVENT = DUMP_FLASH | CLEAR_FLASH
|
|
};
|
|
|
|
void init();
|
|
|
|
/**
|
|
* @brief Wait for any of the provided flags to be set.
|
|
*
|
|
* @note Example usage: waitForAny(GYRO | TICK_20HZ); to either wait for the 20Hz tick or new gyro data.
|
|
*
|
|
* @param event An integer with every bit representing a specific event.
|
|
* @param timeout An optional timeout for additional safety.
|
|
* @return uint32_t Returns the flags that were set.
|
|
*/
|
|
uint32_t waitForAny(uint32_t event, uint32_t timeout = osWaitForever);
|
|
|
|
/**
|
|
* @brief Wait for all of the provided flags to be set.
|
|
*
|
|
* @note Example usage: waitForAny(GYRO | TICK_20HZ); to wait for both the 20Hz tick as well as new gyro data.
|
|
*
|
|
* @param event An integer with every bit representing a specific event.
|
|
* @param timeout An optional timeout for additional safety.
|
|
* @return uint32_t Returns the flags that were set.
|
|
*/
|
|
uint32_t waitForAll(uint32_t event, uint32_t timeout = osWaitForever);
|
|
|
|
LoggingData getData();
|
|
|
|
/**
|
|
* @brief Set the sensed fire bits.
|
|
*
|
|
* @param sense_fire The sensed fire bits.
|
|
*/
|
|
void setSenseFire(uint8_t sense_fire);
|
|
|
|
/**
|
|
* @brief Set Capacitor Voltages.
|
|
*
|
|
* @param sense_adc The sensed ADC values.
|
|
*/
|
|
void setSenseADC(uint16_t sense_adc[6]);
|
|
|
|
/**
|
|
* @brief Set fired event.
|
|
*
|
|
* @param fired The fired event.
|
|
*/
|
|
void setFired(uint8_t fired);
|
|
|
|
/**
|
|
* @brief Start logging data to the flash memory.
|
|
*/
|
|
void startLogging();
|
|
|
|
/**
|
|
* @brief Dump the flash memory to the console.
|
|
*/
|
|
void dumpFlash();
|
|
|
|
/**
|
|
* @brief Clear the flash memory.
|
|
*/
|
|
void clearFlash();
|
|
|
|
} // namespace grsm
|
|
|
|
#endif /* INC_SHARED_HPP_ */
|