2023-03-26 16:42:00 +02:00
|
|
|
#ifndef MISSION_PAYLOAD_SCEXHELPERS_H_
|
|
|
|
#define MISSION_PAYLOAD_SCEXHELPERS_H_
|
2022-02-04 17:48:05 +01:00
|
|
|
|
2022-04-29 15:46:16 +02:00
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
|
|
|
#include <fsfw/events/Event.h>
|
|
|
|
|
2022-02-04 17:48:05 +01:00
|
|
|
#include <cstdint>
|
2022-04-29 15:46:16 +02:00
|
|
|
#include <vector>
|
2022-02-04 17:48:05 +01:00
|
|
|
|
2022-10-04 23:04:50 +02:00
|
|
|
#include "eive/eventSubsystemIds.h"
|
|
|
|
#include "eive/objects.h"
|
|
|
|
|
2022-02-04 17:48:05 +01:00
|
|
|
// Definitions for the Solar Cell Experiment
|
|
|
|
namespace scex {
|
|
|
|
|
2022-04-29 15:46:16 +02:00
|
|
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SCEX_HANDLER;
|
|
|
|
|
|
|
|
static constexpr Event MISSING_PACKET = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
|
2022-08-31 16:07:38 +02:00
|
|
|
static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 1, severity::LOW);
|
|
|
|
//! FRAM, One Cell or All cells command finished. P1: Command ID
|
2022-08-31 16:12:32 +02:00
|
|
|
static constexpr Event MULTI_PACKET_COMMAND_DONE =
|
|
|
|
event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO);
|
2022-04-29 15:46:16 +02:00
|
|
|
|
|
|
|
enum Cmds : DeviceCommandId_t {
|
|
|
|
PING = 0b00111,
|
|
|
|
ALL_CELLS_CMD = 0b00101,
|
|
|
|
ONE_CELL = 0b00110,
|
|
|
|
FRAM = 0b00001,
|
|
|
|
EXP_STATUS_CMD = 0b00010,
|
|
|
|
TEMP_CMD = 0b00011,
|
|
|
|
ION_CMD = 0b00100,
|
|
|
|
ERROR_REPLY = 0b01000,
|
|
|
|
INVALID = 255
|
|
|
|
};
|
|
|
|
|
|
|
|
static const std::vector<DeviceCommandId_t> VALID_CMDS = {
|
|
|
|
PING, ALL_CELLS_CMD, ONE_CELL, FRAM, EXP_STATUS_CMD, TEMP_CMD, ION_CMD};
|
|
|
|
|
|
|
|
static constexpr uint8_t HEADER_LEN = 5;
|
|
|
|
static constexpr uint8_t CRC_LEN = 2;
|
2022-04-09 01:00:42 +02:00
|
|
|
|
|
|
|
static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0;
|
|
|
|
static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1;
|
|
|
|
|
2022-06-21 16:44:14 +02:00
|
|
|
uint8_t createCmdByte(Cmds cmd, bool tempCheck = false);
|
2022-05-29 17:52:13 +02:00
|
|
|
|
2022-06-21 16:44:14 +02:00
|
|
|
ReturnValue_t prepareScexCmd(Cmds cmd, std::pair<uint8_t*, size_t> cmdBufPair, size_t& cmdLen,
|
|
|
|
std::pair<const uint8_t*, size_t> usrDataPair, bool tempCheck = false);
|
2022-02-04 17:48:05 +01:00
|
|
|
|
2022-04-09 14:43:06 +02:00
|
|
|
} // namespace scex
|
2022-02-04 17:48:05 +01:00
|
|
|
|
2023-03-26 16:42:00 +02:00
|
|
|
#endif /* MISSION_PAYLOAD_SCEXHELPERS_H_ */
|