Skip to content
Snippets Groups Projects
Commit 5c1083dd authored by Matteo Pignataro's avatar Matteo Pignataro
Browse files

[ParafoilTestDev] OBSW mockup ready

parent 7b232421
Branches
Tags
No related merge requests found
...@@ -53,12 +53,12 @@ namespace ParafoilTestDev ...@@ -53,12 +53,12 @@ namespace ParafoilTestDev
//IMU MPU9250 settings //IMU MPU9250 settings
static miosix::GpioPin IMU_CS(GPIOB_BASE, 2); static miosix::GpioPin IMU_CS(GPIOB_BASE, 2);
static MPU9250::MPU9250GyroFSR IMU_GYRO_SCALE = MPU9250::GYRO_FSR_250DPS; static MPU9250::MPU9250GyroFSR IMU_GYRO_SCALE = MPU9250::GYRO_FSR_250DPS;
static MPU9250::MPU9250AccelFSR IMU_ACCEL_SCALE = MPU9250::ACCEL_FSR_2G; static MPU9250::MPU9250AccelFSR IMU_ACCEL_SCALE = MPU9250::ACCEL_FSR_4G;
static constexpr unsigned short IMU_SAMPLE_RATE = 100; static constexpr unsigned short IMU_SAMPLE_RATE = 500;
static constexpr unsigned int IMU_SAMPLE_PERIOD = 1000 / IMU_SAMPLE_RATE; static constexpr unsigned int IMU_SAMPLE_PERIOD = 1000 / IMU_SAMPLE_RATE;
//Barometer BME280 settings //Barometer BME280 settings
static miosix::GpioPin PRESS_CS(GPIOC_BASE, 11); static miosix::GpioPin PRESS_CS(GPIOC_BASE, 11);
static BME280::StandbyTime PRESS_SAMPLE_RATE = BME280::STB_TIME_10; static BME280::StandbyTime PRESS_SAMPLE_RATE = BME280::STB_TIME_0_5;
static constexpr unsigned int PRESS_SAMPLE_PERIOD = 20; static constexpr unsigned int PRESS_SAMPLE_PERIOD = 20;
} }
\ No newline at end of file
...@@ -43,9 +43,13 @@ void __attribute__((used)) EXTI10_IRQHandlerImpl() ...@@ -43,9 +43,13 @@ void __attribute__((used)) EXTI10_IRQHandlerImpl()
{ {
using namespace ParafoilTestDev; using namespace ParafoilTestDev;
if (ParafoilTest::getInstance().radio->xbee != nullptr) /*if (ParafoilTest::getInstance().radio->xbee != nullptr)
{ {
ParafoilTest::getInstance().radio->xbee->handleATTNInterrupt(); ParafoilTest::getInstance().radio->xbee->handleATTNInterrupt();
}*/
if(ParafoilTest::getInstance().radio -> module != nullptr)
{
ParafoilTest::getInstance().radio -> module -> handleDioIRQ();
} }
} }
...@@ -69,13 +73,14 @@ namespace ParafoilTestDev ...@@ -69,13 +73,14 @@ namespace ParafoilTestDev
config.clockDivider = SPI::ClockDivider::DIV_16; config.clockDivider = SPI::ClockDivider::DIV_16;
//Instantiate the xbee object //Instantiate the xbee object
xbee = new Xbee::Xbee(xbee_bus, config, /*xbee = new Xbee::Xbee(xbee_bus, config,
XBEE_CS, XBEE_CS,
XBEE_ATTN, XBEE_ATTN,
XBEE_RESET); XBEE_RESET);*/
module = new SX1278(xbee_bus, XBEE_CS);
//Create the mavlink driver //Create the mavlink driver
mav_driver = new MavDriver(xbee, mav_driver = new MavDriver(module,
bind(&Radio::handleMavlinkMessage, this, _1, _2), bind(&Radio::handleMavlinkMessage, this, _1, _2),
SLEEP_AFTER_SEND, MAV_OUT_BUFFER_MAX_AGE); SLEEP_AFTER_SEND, MAV_OUT_BUFFER_MAX_AGE);
init(); init();
...@@ -258,11 +263,11 @@ namespace ParafoilTestDev ...@@ -258,11 +263,11 @@ namespace ParafoilTestDev
//scheduler -> addTask(LRfunction, LR_UPDATE_PERIOD, RADIO_ID); //scheduler -> addTask(LRfunction, LR_UPDATE_PERIOD, RADIO_ID);
//Set the frame receive callback //Set the frame receive callback
xbee -> setOnFrameReceivedListener( //module -> setOnFrameReceivedListener(
bind(&Radio::onXbeeFrameReceived, this, _1)); //bind(&Radio::onXbeeFrameReceived, this, _1));
//Set the data rate //Set the data rate
Xbee::setDataRate(*xbee, XBEE_80KBPS_DATA_RATE, XBEE_TIMEOUT); //Xbee::setDataRate(*xbee, XBEE_80KBPS_DATA_RATE, XBEE_TIMEOUT);
//Enable external interrupt on F10 pin //Enable external interrupt on F10 pin
enableExternalInterrupt(GPIOF_BASE, 10, InterruptTrigger::FALLING_EDGE); enableExternalInterrupt(GPIOF_BASE, 10, InterruptTrigger::FALLING_EDGE);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <TelemetriesTelecommands/Mavlink.h> #include <TelemetriesTelecommands/Mavlink.h>
#include <radio/Xbee/Xbee.h> #include <radio/Xbee/Xbee.h>
#include <drivers/SX1278/SX1278.h>
#include <scheduler/TaskScheduler.h> #include <scheduler/TaskScheduler.h>
#include <common/events/Events.h> #include <common/events/Events.h>
...@@ -42,7 +43,8 @@ namespace ParafoilTestDev ...@@ -42,7 +43,8 @@ namespace ParafoilTestDev
/** /**
* @brief The xbee module driver * @brief The xbee module driver
*/ */
Xbee::Xbee* xbee; //Xbee::Xbee* xbee;
SX1278* module;
/** /**
* @brief Construct a new Radio object * @brief Construct a new Radio object
......
...@@ -109,8 +109,11 @@ void Sensors::BME280init() ...@@ -109,8 +109,11 @@ void Sensors::BME280init()
slave.config.clockDivider = SPI::ClockDivider::DIV_16; slave.config.clockDivider = SPI::ClockDivider::DIV_16;
auto config = BME280::BME280_CONFIG_ALL_ENABLED;
config.bits.oversamplingPressure = BME280::OVERSAMPLING_4;
// Instantiate the object // Instantiate the object
press_bme280 = new BME280(slave, BME280::BME280_CONFIG_ALL_ENABLED); press_bme280 = new BME280(slave, config);
// Set the standby time // Set the standby time
press_bme280->setStandbyTime(PRESS_SAMPLE_RATE); press_bme280->setStandbyTime(PRESS_SAMPLE_RATE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment