Calibration_Stand/backend/Libs/sx1278/README.md

51 lines
804 B
Markdown

# Getting Started
## Step 1: Download wiringPi
Downoad:
```
git clone https://github.com/WiringPi/WiringPi.git
```
Building:
```
cd wiringPi
./build
```
## Step 2: Init
```
SX1278_Init(PinNSS, PinRST, PinDIO0);
SX1278_load();
```
## Step 3: Usage
### Examples
Send data:
```
uint8_t txBuffer[SX1278_PAYLOAD] = YOUR_DATA;
SX1278_SetMode(SX1278_MODE_TRANSMITTER);
while (1)
{
SX1278_FIFO_SendData(&txBuffer);
delay(100);
}
```
Read data:
```
uint8_t rxBuffer[SX1278_PAYLOAD];
SX1278_SetMode(SX1278_MODE_RECEIVER);
while (1)
{
if(digitalRead(PinDIO0) == 1)
{
SX1278_FIFO_ReadData(&rxBuffer);
for(int i = 0; i < SX1278_PAYLOAD; i++)
{
printf("0x%X, ", rxBuffer[i]);
}
printf("\n");
}
delay(100);
}
```