Current Progress -- Save to switch computer

This commit is contained in:
Paul Nehlich
2023-10-26 07:10:20 +02:00
parent fa4cfd517f
commit 5641f1afad
5 changed files with 62 additions and 2 deletions

View File

@ -8,6 +8,8 @@
#include <mission/controller/BlinkController.h>
#include <mission/devices/LightHandler.h>
#include <bsp_z7/objects/communication/GpioCommIF.h>
#include <bsp_z7/objects/communication/GpioCookie.h>
#include "fsfw/events/EventManager.h"
#include "fsfw/health/HealthTable.h"
@ -66,6 +68,7 @@ void ObjectFactory::produce(void *args) {
new PrintController(123);
new BlinkController(124);
new LightHandler(125, new ComIF(), *CookieIF);
static GpioIF gpioIF = new GpioIF(220);
new LightHandler(124, gpioIF);
}

View File

@ -1,4 +1,6 @@
target_sources(
${TARGET_NAME} PRIVATE
ServoCommInterface.cpp
SerialTCPCookie.cpp)
SerialTCPCookie.cpp
GpioCommIF.cpp
GpioCookie.cpp)

View File

@ -0,0 +1,28 @@
#pragma once
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include "GpioCookie.h"
class GpioCommIF : public DeviceCommunicationIF, public SystemObject {
public:
GpioCommIF(object_id_t setObjectId);
virtual ~GpioCommIF() {}
ReturnValue_t initializeInterface(CookieIF *cookie) override;
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) override;
ReturnValue_t getSendSuccess(CookieIF *cookie) override;
ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override;
private:
ReturnValue_t initializeInterface(GpioCookie *cookie);
ReturnValue_t sendMessage(GpioCookie *cookie, const uint8_t *sendData, size_t sendLen);
ReturnValue_t readReceivedMessage(GpioCookie *cookie, uint8_t **buffer, size_t *size);
};

View File

@ -0,0 +1,7 @@
#include "GpioCookie.h"
GpioCookie::GpioCookie(uint32_t pinAddress, uint32_t bitOffsetMask)
: pinAddress(pinAddress), bitOffsetMask(bitOffsetMask) {
}
GpioCookie::~GpioCookie() {}

View File

@ -0,0 +1,20 @@
#pragma once
#include <fsfw/devicehandlers/CookieIF.h>
#include <stddef.h>
class GpioCookie : public CookieIF {
/**
* @brief A Cookie containing the Pin and bit offset mask
*
* @param bitOffsetMask Since we can only address each word (32-bit), but a GPIO is represented by a single bit for efficiency-reasons, we need a mask to AND-out all bits we do not want to write to. All bits should zero except the one of the GPIO- If there are multiple GPIOs to set at the same time, this should also be possible, as long as there is no validation fo rthe bitmask
*
*/
public:
GpioCookie(uint32_t pinAddress, uint32_t bitOffsetMask);
virtual ~GpioCookie();
const uint32_t pin;
const uint32_t bitOffsetMask;
int socket;
};