added SPI code

This commit is contained in:
2021-07-13 10:23:17 +02:00
parent 9b2fec1940
commit f1674aec4e
10 changed files with 205 additions and 42 deletions

View File

@ -6,18 +6,23 @@
#ifndef FSFWCONFIG_OBSWCONFIG_H_
#define FSFWCONFIG_OBSWCONFIG_H_
// Specify whether lwIP components are added. TMTC commanding is not possible without them
#define STM_USE_PERIPHERAL_TX_BUFFER_MPU_PROTECTION 1
//! Specify whether lwIP components are added. These are necessary for TMTC commanding
#define OBSW_ADD_LWIP_COMPONENTS 1
// Specify whether TMTC commanding via Ethernet is possible
//! Specify whether TMTC commanding via Ethernet is possible
#define OBSW_ETHERNET_TMTC_COMMANDING 1
// Only applies if TMTC commanding is enabled.
// Specify whether LEDs are used to display Ethernet connection status.
//! Only applies if TMTC commanding is enabled.
//! Specify whether LEDs are used to display Ethernet connection status.
#define OBSW_ETHERNET_USE_LED1_LED2 0
#define OBSW_ATTEMPT_DHCP_CONN 1
#define OBSW_PERIPHERAL_PST 0
#define OBSW_PERFORM_SPI_TEST 0
#define OBSW_PERFORM_L3GD20H_TEST 0
#if OBSW_ATTEMPT_DHCP_CONN == 0
#define MAX_DHCP_TRIES 0
#else
@ -29,7 +34,7 @@
#include "events/subsystemIdRanges.h"
#include "objects/systemObjectList.h"
#include "commonConfig.h"
#include <commonConfig.h>
namespace config {
#endif

View File

@ -0,0 +1,14 @@
#ifndef BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_
#define BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_
#include <cstdint>
namespace devaddress {
enum devaddress: uint32_t {
L3GD20H = 1
};
}
#endif /* BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_ */

View File

@ -8,6 +8,10 @@ enum mission_objects {
/* 0x62 ('b') Board and mission specific objects */
UDP_BRIDGE = 0x62000300,
UDP_POLLING_TASK = 0x62000400,
SPI_COM_IF = 0x63001000,
SPI_DEVICE_TEST = 0x74001000,
/* Generic name for FSFW static ID setter */
DOWNLINK_DESTINATION = UDP_BRIDGE
};

View File

@ -2,4 +2,32 @@
* Add polling sequence initialization which are not common to every BSP here.
*/
#include "pollingSequenceFactory.h"
#include "OBSWConfig.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
#if OBSW_PERFORM_L3GD20H_TEST == 1
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length, DeviceHandlerIF::GET_READ);
#endif
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!" << std::endl;
#else
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -2,11 +2,12 @@
#define POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_
#include "OBSWConfig.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
class FixedTimeslotTaskIF;
namespace pst {
ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence);
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF* thisSequence);
}