42 lines
986 B
C
42 lines
986 B
C
|
#ifndef SX1278_H
|
||
|
#define SX1278_H
|
||
|
|
||
|
#include <wiringPi.h>
|
||
|
#include <wiringPiSPI.h>
|
||
|
#include <stdint.h>
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include "sx1278Regs-Fsk.h"
|
||
|
|
||
|
#define SX1278_PAYLOAD 23
|
||
|
|
||
|
// Ожидаемая версия модуля
|
||
|
#define EXPECTED_VERSION 0x12
|
||
|
|
||
|
// Объявление структуры SX1278
|
||
|
typedef struct {
|
||
|
uint8_t PinNSS;
|
||
|
uint8_t PinReset;
|
||
|
uint8_t PinDIO0;
|
||
|
} SX1278_t;
|
||
|
|
||
|
// Режимы работы SX1278
|
||
|
typedef enum {
|
||
|
SX1278_MODE_SLEEP,
|
||
|
SX1278_MODE_STANDBY,
|
||
|
SX1278_MODE_RECEIVER,
|
||
|
SX1278_MODE_TRANSMITTER
|
||
|
} SX1278_Mode;
|
||
|
|
||
|
// Прототипы функций
|
||
|
int SX1278_Init(uint8_t PinNss, uint8_t PinReset, uint8_t PinDIO0);
|
||
|
void SX1278_FIFO_SendData(uint8_t *data);
|
||
|
void SX1278_FIFO_ReadData(uint8_t *data);
|
||
|
void SX1278_WriteRegister(uint8_t reg, uint8_t value);
|
||
|
uint8_t SX1278_ReadRegister(uint8_t reg);
|
||
|
void SX1278_reset(void);
|
||
|
void SX1278_SetMode(SX1278_Mode mode);
|
||
|
void SX1278_load(void);
|
||
|
|
||
|
#endif /* SX1278_H */
|