Skip to content
Snippets Groups Projects
Commit cfde8393 authored by Nicolò Caruso's avatar Nicolò Caruso Committed by Emilio Corigliano
Browse files

[GS] Fixed CMakefile from rebase, Radio now using DipReader, format BoardStat>

CMakefile: Board from nokia-entry changed in main therefore after boardcore c>
Radio: Now using the dip switch and not an hardcoded #ifdef
BoardStatus: Format fix
parent da83badd
Branches
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
#include <Groundstation/Automated/Buses.h>
#include <Groundstation/Automated/Hub.h>
#include <Groundstation/Common/Ports/Serial.h>
#include <Groundstation/DipReader.h>
#include <interfaces-impl/hwmapping.h>
#include <radio/SX1278/SX1278Frontends.h>
......@@ -53,14 +54,16 @@ namespace Antennas
bool RadioMain::start()
{
#ifdef SKYWARD_GS_MAIN_USE_BACKUP_RF
std::unique_ptr<SX1278::ISX1278Frontend> frontend =
std::make_unique<EbyteFrontend>(radio::txen::getPin(),
radio::rxen::getPin());
#else
std::unique_ptr<SX1278::ISX1278Frontend> frontend =
std::make_unique<Skyward433Frontend>();
#endif
DipReader dipSwitch;
DipStatus dipStatus = dipSwitch.readDip();
std::unique_ptr<SX1278::ISX1278Frontend> frontend;
if (dipStatus.hasBackup)
frontend = std::make_unique<EbyteFrontend>(radio1::txen::getPin(),
radio1::rxen::getPin());
else
frontend = std::make_unique<Skyward433Frontend>();
std::unique_ptr<Boardcore::SX1278Fsk> sx1278 =
std::make_unique<Boardcore::SX1278Fsk>(
......
......@@ -26,6 +26,7 @@
#include <Groundstation/Base/Buses.h>
#include <Groundstation/Base/Hub.h>
#include <Groundstation/Common/Ports/Serial.h>
#include <Groundstation/DipReader.h>
#include <radio/SX1278/SX1278Frontends.h>
using namespace Groundstation;
......@@ -65,14 +66,16 @@ void __attribute__((used)) MIOSIX_RADIO2_DIO3_IRQ()
bool RadioMain::start()
{
#ifdef SKYWARD_GS_MAIN_USE_BACKUP_RF
std::unique_ptr<SX1278::ISX1278Frontend> frontend =
std::make_unique<EbyteFrontend>(radio1::txen::getPin(),
DipReader dipSwitch;
DipStatus dipStatus = dipSwitch.readDip();
std::unique_ptr<SX1278::ISX1278Frontend> frontend;
if (dipStatus.hasBackup)
frontend = std::make_unique<EbyteFrontend>(radio1::txen::getPin(),
radio1::rxen::getPin());
#else
std::unique_ptr<SX1278::ISX1278Frontend> frontend =
std::make_unique<Skyward433Frontend>();
#endif
else
frontend = std::make_unique<Skyward433Frontend>();
std::unique_ptr<Boardcore::SX1278Fsk> sx1278 =
std::make_unique<Boardcore::SX1278Fsk>(
......
......@@ -48,11 +48,11 @@ public:
DipStatus dipReading;
// Write to the shift register (CS == Not LD)
miosix::dipSwitch::cs::low();
miosix::dipSwitch::sh::low();
miosix::dipSwitch::clk::high();
miosix::delayUs(100);
miosix::dipSwitch::clk::low();
miosix::dipSwitch::cs::high();
miosix::dipSwitch::sh::high();
miosix::delayUs(5);
// Read first register GS(0)/ARP(1)
......@@ -64,17 +64,17 @@ public:
dipReading.ip3 = readBit();
dipReading.ip4 = readBit();
dipReading.ip5 = readBit();
dipReading.ip6 = readBit();
dipReading.ip7 = readBit();
return dipReading;
}
private:
bool readBit()
static bool readBit()
{
bool bit;
miosix::dipSwitch::clk::high();
miosix::delayUs(5);
bit = miosix::dipSwitch::qh;
bit = miosix::dipSwitch::qh::value();
miosix::delayUs(5);
miosix::dipSwitch::clk::low();
miosix::delayUs(5);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment