forked from ROMEO/obsw
Current Progress -- Save to switch computer
This commit is contained in:
@ -8,6 +8,8 @@
|
|||||||
#include <mission/controller/BlinkController.h>
|
#include <mission/controller/BlinkController.h>
|
||||||
|
|
||||||
#include <mission/devices/LightHandler.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/events/EventManager.h"
|
||||||
#include "fsfw/health/HealthTable.h"
|
#include "fsfw/health/HealthTable.h"
|
||||||
@ -66,6 +68,7 @@ void ObjectFactory::produce(void *args) {
|
|||||||
new PrintController(123);
|
new PrintController(123);
|
||||||
new BlinkController(124);
|
new BlinkController(124);
|
||||||
|
|
||||||
new LightHandler(125, new ComIF(), *CookieIF);
|
static GpioIF gpioIF = new GpioIF(220);
|
||||||
|
new LightHandler(124, gpioIF);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${TARGET_NAME} PRIVATE
|
${TARGET_NAME} PRIVATE
|
||||||
ServoCommInterface.cpp
|
ServoCommInterface.cpp
|
||||||
SerialTCPCookie.cpp)
|
SerialTCPCookie.cpp
|
||||||
|
GpioCommIF.cpp
|
||||||
|
GpioCookie.cpp)
|
28
bsp_z7/objects/communication/GpioCommIF.h
Normal file
28
bsp_z7/objects/communication/GpioCommIF.h
Normal 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);
|
||||||
|
};
|
7
bsp_z7/objects/communication/GpioCookie.cpp
Normal file
7
bsp_z7/objects/communication/GpioCookie.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "GpioCookie.h"
|
||||||
|
|
||||||
|
GpioCookie::GpioCookie(uint32_t pinAddress, uint32_t bitOffsetMask)
|
||||||
|
: pinAddress(pinAddress), bitOffsetMask(bitOffsetMask) {
|
||||||
|
}
|
||||||
|
|
||||||
|
GpioCookie::~GpioCookie() {}
|
20
bsp_z7/objects/communication/GpioCookie.h
Normal file
20
bsp_z7/objects/communication/GpioCookie.h
Normal 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;
|
||||||
|
};
|
Reference in New Issue
Block a user