firmware/src/mesh/STM32WLE5JCInterface.cpp
Ben Meadors a491ceefcd
Wio-e5 wip (#2265)
* Wio-e5 / STM32WL wip

* Stubbing some FS stuff out

* Wio-e5 / STM32WL wip

* Stubbing some FS stuff out

* Wio-e5 / STM32WL wip

* Stubbing some FS stuff out

* Wio-e5 / STM32WL wip

* Stubbing some FS stuff out

* LittleFS compiles. Can't check with actual device.

* make cppcheck happy again

* Guard against accelerometer thread

* Missed a spot

* Upload via ST-LINK

* Derive MAC address from UID

* upload port

* Trunk it

* Guard it

* Maybe fix the cache error on startup.

* Latest RadioLib ref to fix SubGHZ

* revert nasty Sub-GHz Hack

* Boots and radio inits with RadioLib 6.0, LittleFS doesn't seem to work

---------

Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: GUVWAF <thijs@havinga.eu>
2023-06-01 07:14:55 -05:00

46 lines
1.1 KiB
C++

#include "STM32WLE5JCInterface.h"
#include "configuration.h"
#include "error.h"
#ifndef STM32WLx_MAX_POWER
#define STM32WLx_MAX_POWER 22
#endif
#ifdef ARCH_STM32WL
STM32WLE5JCInterface::STM32WLE5JCInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy)
: SX126xInterface(hal, cs, irq, rst, busy)
{
}
bool STM32WLE5JCInterface::init()
{
RadioLibInterface::init();
lora.setRfSwitchTable(rfswitch_pins, rfswitch_table);
if (power == 0)
power = STM32WLx_MAX_POWER;
if (power > STM32WLx_MAX_POWER) // This chip has lower power limits than some
power = STM32WLx_MAX_POWER;
limitPower();
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);
LOG_INFO("STM32WLx init result %d\n", res);
LOG_INFO("Frequency set to %f\n", getFreq());
LOG_INFO("Bandwidth set to %f\n", bw);
LOG_INFO("Power output set to %d\n", power);
if (res == RADIOLIB_ERR_NONE)
startReceive(); // start receiving
return res == RADIOLIB_ERR_NONE;
}
#endif // ARCH_STM32WL