First version of SX1280 class (SPI communication tested)
This commit is contained in:
@@ -10,8 +10,11 @@
|
||||
#include "SPI_Peripheral_STM32.hpp"
|
||||
#include "BinLeds.hpp"
|
||||
#include "SSL_Comms.hpp"
|
||||
#include "SX1280Lib/sx1280-hal.h"
|
||||
|
||||
extern SPI_HandleTypeDef hspi2;
|
||||
#include <cstdio>
|
||||
|
||||
extern SPI_HandleTypeDef hspi1;
|
||||
|
||||
GPIO_Pin_STM32 ledOrange(LD3_GPIO_Port, LD3_Pin);
|
||||
GPIO_Pin_STM32 ledGreen(LD4_GPIO_Port, LD4_Pin);
|
||||
@@ -19,12 +22,26 @@ GPIO_Pin_STM32 ledRed(LD5_GPIO_Port, LD5_Pin);
|
||||
GPIO_Pin_STM32 ledBlue(LD6_GPIO_Port, LD6_Pin);
|
||||
BinLeds discoveryLeds((GPIO_Pin*[]){&ledOrange, &ledGreen, &ledRed, &ledBlue}, 4);
|
||||
|
||||
SPI_Peripheral_STM32 spiRadio(&hspi2, 1000);
|
||||
SPI_Peripheral_STM32 spiRadio(&hspi1, 1000);
|
||||
GPIO_Pin_STM32 sx1280_a_nss(SX1280_A_NSS_GPIO_Port, SX1280_A_NSS_Pin);
|
||||
GPIO_Pin_STM32 sx1280_a_rxen(SX1280_A_RXEN_GPIO_Port, SX1280_A_RXEN_Pin);
|
||||
GPIO_Pin_STM32 sx1280_a_txen(SX1280_A_TXEN_GPIO_Port, SX1280_A_TXEN_Pin);
|
||||
GPIO_Pin_STM32 sx1280_a_rst(SX1280_A_RST_GPIO_Port, SX1280_A_RST_Pin);
|
||||
GPIO_Pin_STM32 sx1280_a_busy(SX1280_A_BUSY_GPIO_Port, SX1280_A_BUSY_Pin);
|
||||
GPIO_Pin_STM32 sx1280_a_irq(SX1280_A_IRQ_GPIO_Port, SX1280_A_IRQ_Pin);
|
||||
|
||||
SX1280Hal pRadio(&spiRadio, &sx1280_a_nss, &sx1280_a_busy, &sx1280_a_irq, &sx1280_a_rst, nullptr);
|
||||
|
||||
GPIO_Pin_STM32 blueButton(B1_GPIO_Port, B1_Pin);
|
||||
SSL_Comms radio0(&blueButton);
|
||||
|
||||
void start(){
|
||||
discoveryLeds.set(15);
|
||||
spiRadio.init();
|
||||
radio0.init();
|
||||
pRadio.Init();
|
||||
uint16_t firmwareVersion = pRadio.GetFirmwareVersion();
|
||||
printf("Radio firmware version: %u\n", firmwareVersion);
|
||||
int8_t rssiInst = pRadio.GetRssiInst();
|
||||
printf("Radio RSSI: %d\n", rssiInst);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user