tinyGS
tinyGS copied to clipboard
Incorrect SPI low-level access method for SX126x
Hey guys,
While updating my station, I noticed tinyGS requires RadioLib godmode to build. Digging further, I noticed the following:
https://github.com/G4lile0/tinyGS/blob/2128f1410cfd229b9b5478a122446e393b41a0a2/tinyGS/src/Radio/Radio.cpp#L172-L175
Couple of thoughts on that:
- Please don't use godmode in production code, it's supposed to be a development feature. I'm guessing this is some sort of low-level direct hardware access, but as a rule of thumb, if you find yourselves in a situation you need to use it, it might be better to raise an issue in RadioLib repository.
- You're actually using incorrect SPI method for SX126x. The SPI interface is completely different from SX127x, so you have to use
SX126x::writeRegister()
instead ofModule::SPIsetRegValue()
. Also most of SX126x SPI registers are undocmented, and things like modem configuration have to be done through a command-based interface.
Overall, using godmode to achieve this seems like a massive overkill, since it will make literally every single method in the library accessible from the user sketch. I think a macro to selectively enable couple low-level hardware methods would be better here.