Unverified Commit 0b5a710c authored by Robin Mueller's avatar Robin Mueller
Browse files

update for vor_common

parent a121960e
......@@ -17,6 +17,26 @@ static constexpr size_t UART_OBC_REPLY_RING_BUFFER_SIZE = 1024;
// OBC can hold
static constexpr size_t UART_OBC_MAX_NUMBER_OF_REPLY_QUEUE_PACKETS = 20;
namespace config {
// TODO: Value might require correction / tweaks
static constexpr size_t VOR_USLP_USER_DATA_SIZE = 116;
static constexpr size_t VOR_USLP_FDFH_SIZE = 3;
static constexpr size_t VOR_USLP_FRAME_HEADER_FECF_SIZE = 7 + 2;
static constexpr size_t VOR_USLP_FRAME_SIZE = VOR_USLP_USER_DATA_SIZE + VOR_USLP_FDFH_SIZE +
VOR_USLP_FRAME_HEADER_FECF_SIZE;
}
namespace uslp {
// TODO: Fill in correct value
static constexpr uint8_t PAYLOAD_VCID = 0;// ?;
static constexpr uint8_t MAP_ID = 0b1010;
static constexpr uint16_t SCID = 0xAB1E;
}
//! Configure scrub rates for ROM and RAM. A scrub cycle will occur every
//! n-th scrub cycles with n being the configured value.
//! The scrub engine will process one address (4 bytes)
......
#include "globalObjects.h"
#include <vor_common/common/peripherals/Rs485Handler.h>
#include "common/peripherals/UartHandler.h"
#include "common/time/Clock.h"
#include "config/definitions.h"
#include "vorago/reb/reb_log.h"
......@@ -19,9 +21,16 @@ PayloadPeriodicTask glob::payloadTestTaskHandle("TEST_TASK", 1000);
#endif /* VOR_ADD_TEST_TASKS == 1 */
#if VOR_ADD_UART_OBC_COM_TASK == 1
ObcComHandler glob::obcComTask("OBC_RS485_TASK", UART_TASK_PERIOD,
UartPortType::PORTA_UARTA, nullptr, 115200,
true);
uslp::FixedFrameParameters OBC_COM_USLP_PARAMS(config::VOR_USLP_FRAME_SIZE,
true, 2);
ObcComHandler glob::OBC_COM_TASK(
"OBC_RS485_COM",
Rs485Config(/* UartPortType::PORTB_UARTB TODO: Fill in correct port */,
&ObcComHandler::configureRs485Pins, 115200,
&OBC_COM_USLP_PARAMS, UART_OBC_REPLY_RING_BUFFER_SIZE,
UslpParams(uslp::SCID, uslp::PAYLOAD_VCID, uslp::MAP_ID)));
UslpTaskWrapper glob::USLP_TASK_WRAPPER(glob::OBC_COM_TASK);
#endif /* VOR_ADD_UART_TASKS == 0 */
void glob::produceObjects() {
......@@ -55,13 +64,12 @@ int glob::initializeObjects() {
#endif /* VOR_ADD_TEST_TASKS == 1 */
#if VOR_ADD_UART_OBC_COM_TASK == 1
result = glob::obcComTask.initialize();
result = glob::OBC_COM_TASK.initialize();
if (result != 0) {
initErrCounter++;
taskName = glob::obcComTask.getName();
taskName = glob::OBC_COM_TASK.getName();
VOR_CError("Object Initialization of Task %s failed\r\n", taskName);
}
glob::obcComTask.setInitialized();
#else
#endif
......
......@@ -2,6 +2,7 @@
#define MISSION_CORE_GLOBALOBJECTS_H_
#include "VORConfig.h"
#include <vor_common/common/uslp/TaskWrapper.h>
#include "common/peripherals/UartHandler.h"
#include "common/test/LedTask.h"
......@@ -33,7 +34,8 @@ extern LedTask ledTaskHandle;
#endif /* VOR_ADD_TEST_TASKS == 1 */
#if VOR_ADD_UART_OBC_COM_TASK == 1
extern ObcComHandler obcComTask;
extern ObcComHandler OBC_COM_TASK;
extern UslpTaskWrapper USLP_TASK_WRAPPER;
#endif
/**
......
#include "ObcComHandler.h"
ObcComHandler::ObcComHandler(std::string name, uint32_t periodMs,
Rs485Config cfg)
: Rs485Handler(name, periodMs, cfg) {}
ObcComHandler::ObcComHandler(const char *name, Rs485Config cfg)
: Rs485Handler(name, cfg) {}
int ObcComHandler::handlePacketParsing() {
// TODO: Scan the USLP packets and and unpack commands here
return 0;
}
void ObcComHandler::configureRs485Pins() {
// TODO: Implement
}
......@@ -9,10 +9,15 @@ class ObcComHandler
UART_OBC_REPLY_BUFFER_SIZE,
UART_OBC_MAX_NUMBER_OF_REPLY_QUEUE_PACKETS> {
public:
ObcComHandler(std::string name, uint32_t periodMs, Rs485Config cfg);
ObcComHandler(const char *name, Rs485Config cfg);
int handlePacketParsing() override;
/**
* Hardware configuration for the UART pins
*/
static void configureRs485Pins();
private:
};
......
#include "PayloadTestTask.h"
PayloadPeriodicTask::PayloadPeriodicTask(std::string name, uint32_t period,
PayloadPeriodicTask::PayloadPeriodicTask(const char *name, uint32_t period,
void (*deadlineMissedFunction)(void))
: TestTask(name, period, deadlineMissedFunction) {}
......
......@@ -5,7 +5,7 @@
class PayloadPeriodicTask : public TestTask {
public:
PayloadPeriodicTask(std::string name, uint32_t period,
PayloadPeriodicTask(const char *name, uint32_t period,
void (*deadlineMissedFunction)(void) = nullptr);
virtual ~PayloadPeriodicTask();
......
Subproject commit 08102c9a513eaf8679201ada6aa50d1c190b02d4
Subproject commit 5d450c68b85ee22faa268d727ed87b60a17a9da3
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment