pinelora WIP

This commit is contained in:
Kevin Hester
2021-04-22 14:28:56 +08:00
parent 6e27856daa
commit 8e3281a658
4 changed files with 34 additions and 21 deletions

View File

@@ -424,8 +424,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define USE_SIM_RADIO
// Pine64 uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if
// not found then probe for SX1262
#define USE_RF95
// not found then probe for SX1262. Currently the RF95 code is disabled because I think the RF95 module won't need to ship.
// #define USE_RF95
#define USE_SX1262
// Fake SPI device selections
@@ -436,12 +436,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LORA_DIO0 26 // a No connect on the SX1262 module
#define LORA_RESET RADIOLIB_NC
#define LORA_DIO1 33 // SX1262 IRQ - FIXME, attach to gpio4/IRQ with linux spidev
#define LORA_DIO2 32 // SX1262 BUSY - FIXME, misassigned in schematic?
#define LORA_DIO1 33 // SX1262 IRQ, called DIO0 on pinelora schematic, pin 7 on ch341f "ack" - FIXME, enable hwints in linux
#define LORA_DIO2 32 // SX1262 BUSY, actually connected to "DIO5" on pinelora schematic, pin 8 on ch341f "slct"
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
#ifdef USE_SX1262
#define SX1262_CS 20 // FIXME - we need to assign a pinetab CS GPIO binding (so host can manually control it wrt BUSY)
#define SX1262_CS 20 // CS0 on pinelora schematic, hooked to gpio D0 on ch341f
#define SX1262_DIO1 LORA_DIO1
#define SX1262_BUSY LORA_DIO2
#define SX1262_RESET LORA_RESET

View File

@@ -6,6 +6,7 @@
#include <Utility.h>
#include <assert.h>
#include <linux/gpio/LinuxGPIOPin.h>
// FIXME - move setBluetoothEnable into a HALPlatform class
@@ -44,10 +45,10 @@ void updateBatteryLevel(uint8_t level) NOT_IMPLEMENTED("updateBatteryLevel");
*
* Porduino helper class to do this i2c based polling:
*/
class PolledIrqPin : public GPIOPin
class PolledIrqPin : public LinuxGPIOPin
{
public:
PolledIrqPin() : GPIOPin(LORA_DIO0, "LORA_DIO0") {}
PolledIrqPin() : LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq") {}
/// Read the low level hardware for this pin
virtual PinStatus readPinHardware()
@@ -77,6 +78,14 @@ void portduinoSetup()
// FIXME: remove this hack once interrupts are confirmed to work on new pine64 board
gpioBind(new PolledIrqPin());
// BUSY hw is busted on current board - just use the simulated pin (which will read low)
// gpioBind(new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy"));
auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy");
fakeBusy->writePin(LOW);
gpioBind(fakeBusy);
gpioBind(new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs"));
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());
}