SX1276: indent with tabs

This commit is contained in:
Pascal Langer 2020-06-15 23:34:56 +02:00
parent 908634474b
commit 2aa96dd129
3 changed files with 47 additions and 39 deletions

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_REVISION 1 #define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 19 #define VERSION_PATCH_LEVEL 20
//****************** //******************
// Protocols // Protocols

View File

@ -1,6 +1,8 @@
#ifdef SX1276_INSTALLED #ifdef SX1276_INSTALLED
#include "iface_sx1276.h" #include "iface_sx1276.h"
bool SX1276_Mode_LoRa=false;
void SX1276_WriteReg(uint8_t address, uint8_t data) void SX1276_WriteReg(uint8_t address, uint8_t data)
{ {
SPI_CSN_off; SPI_CSN_off;
@ -44,12 +46,12 @@ uint8_t SX1276_Reset()
bool SX1276_DetectChip() //to be called after reset, verfies the chip has been detected bool SX1276_DetectChip() //to be called after reset, verfies the chip has been detected
{ {
#define MaxAttempts 5 #define SX1276_Detect_MaxAttempts 5
uint8_t i = 0; uint8_t i = 0;
bool chipFound = false; bool chipFound = false;
while ((i < MaxAttempts) && !chipFound) while ((i < SX1276_Detect_MaxAttempts) && !chipFound)
{ {
uint8_t ChipVersion = SX1276_ReadReg(0x42); uint8_t ChipVersion = SX1276_ReadReg(SX1276_42_VERSION);
if (ChipVersion == 0x12) if (ChipVersion == 0x12)
{ {
debugln("SX1276 reg version=%d", ChipVersion); debugln("SX1276 reg version=%d", ChipVersion);
@ -59,7 +61,7 @@ bool SX1276_DetectChip() //to be called after reset, verfies the chip has been d
{ {
debug("SX1276 not found! attempts: %d", i); debug("SX1276 not found! attempts: %d", i);
debug(" of "); debug(" of ");
debugln("%d SX1276 reg version=%d", MaxAttempts, ChipVersion); debugln("%d SX1276 reg version=%d", SX1276_Detect_MaxAttempts, ChipVersion);
i++; i++;
} }
} }
@ -100,6 +102,8 @@ void SX1276_SetMode(bool lora, bool low_freq_mode, uint8_t mode)
{ {
uint8_t data = 0x00; uint8_t data = 0x00;
SX1276_Mode_LoRa=lora;
if(lora) if(lora)
{ {
data = data | (1 << 7); data = data | (1 << 7);
@ -139,13 +143,11 @@ void SX1276_ConfigModem1(uint8_t bandwidth, uint8_t coding_rate, bool implicit_h
if (bandwidth == SX1276_MODEM_CONFIG1_BW_500KHZ) //datasheet errata reconmendation http://caxapa.ru/thumbs/972894/SX1276_77_8_ErrataNote_1.1_STD.pdf if (bandwidth == SX1276_MODEM_CONFIG1_BW_500KHZ) //datasheet errata reconmendation http://caxapa.ru/thumbs/972894/SX1276_77_8_ErrataNote_1.1_STD.pdf
{ {
SX1276_WriteReg(0x36, 0x02); SX1276_WriteReg(SX1276_36_LORA_REGHIGHBWOPTIMIZE1, 0x02);
SX1276_WriteReg(0x3a, 0x64); SX1276_WriteReg(SX1276_3A_LORA_REGHIGHBWOPTIMIZE2, 0x64);
} }
else else
{ SX1276_WriteReg(SX1276_36_LORA_REGHIGHBWOPTIMIZE1, 0x03);
SX1276_WriteReg(0x36, 0x03);
}
} }
void SX1276_ConfigModem2(uint8_t spreading_factor, bool tx_continuous_mode, bool rx_payload_crc_on) void SX1276_ConfigModem2(uint8_t spreading_factor, bool tx_continuous_mode, bool rx_payload_crc_on)

View File

@ -40,6 +40,12 @@ enum
SX1276_4D_PADAC = 0x4D SX1276_4D_PADAC = 0x4D
}; };
enum
{
SX1276_36_LORA_REGHIGHBWOPTIMIZE1 = 0x36,
SX1276_3A_LORA_REGHIGHBWOPTIMIZE2 = 0x3A
};
enum enum
{ {
SX1276_OPMODE_SLEEP = 0, SX1276_OPMODE_SLEEP = 0,