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_MINOR 3
#define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 19
#define VERSION_PATCH_LEVEL 20
//******************
// Protocols

View File

@ -1,6 +1,8 @@
#ifdef SX1276_INSTALLED
#include "iface_sx1276.h"
bool SX1276_Mode_LoRa=false;
void SX1276_WriteReg(uint8_t address, uint8_t data)
{
SPI_CSN_off;
@ -44,35 +46,35 @@ uint8_t SX1276_Reset()
bool SX1276_DetectChip() //to be called after reset, verfies the chip has been detected
{
#define MaxAttempts 5
uint8_t i = 0;
bool chipFound = false;
while ((i < MaxAttempts) && !chipFound)
{
uint8_t ChipVersion = SX1276_ReadReg(0x42);
if (ChipVersion == 0x12)
{
debugln("SX1276 reg version=%d", ChipVersion);
chipFound = true;
}
else
{
debug("SX1276 not found! attempts: %d", i);
debug(" of ");
debugln("%d SX1276 reg version=%d", MaxAttempts, ChipVersion);
i++;
}
}
if (!chipFound)
{
debugln("SX1276 not detected!!!");
return false;
}
else
{
debugln("Found SX1276 Device!");
return true;
}
#define SX1276_Detect_MaxAttempts 5
uint8_t i = 0;
bool chipFound = false;
while ((i < SX1276_Detect_MaxAttempts) && !chipFound)
{
uint8_t ChipVersion = SX1276_ReadReg(SX1276_42_VERSION);
if (ChipVersion == 0x12)
{
debugln("SX1276 reg version=%d", ChipVersion);
chipFound = true;
}
else
{
debug("SX1276 not found! attempts: %d", i);
debug(" of ");
debugln("%d SX1276 reg version=%d", SX1276_Detect_MaxAttempts, ChipVersion);
i++;
}
}
if (!chipFound)
{
debugln("SX1276 not detected!!!");
return false;
}
else
{
debugln("Found SX1276 Device!");
return true;
}
}
void SX1276_SetTxRxMode(uint8_t mode)
@ -100,6 +102,8 @@ void SX1276_SetMode(bool lora, bool low_freq_mode, uint8_t mode)
{
uint8_t data = 0x00;
SX1276_Mode_LoRa=lora;
if(lora)
{
data = data | (1 << 7);
@ -137,15 +141,13 @@ void SX1276_ConfigModem1(uint8_t bandwidth, uint8_t coding_rate, bool implicit_h
SX1276_WriteReg(SX1276_1D_MODEMCONFIG1, data);
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(0x3a, 0x64);
}
else
{
SX1276_WriteReg(0x36, 0x03);
}
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(SX1276_36_LORA_REGHIGHBWOPTIMIZE1, 0x02);
SX1276_WriteReg(SX1276_3A_LORA_REGHIGHBWOPTIMIZE2, 0x64);
}
else
SX1276_WriteReg(SX1276_36_LORA_REGHIGHBWOPTIMIZE1, 0x03);
}
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
};
enum
{
SX1276_36_LORA_REGHIGHBWOPTIMIZE1 = 0x36,
SX1276_3A_LORA_REGHIGHBWOPTIMIZE2 = 0x3A
};
enum
{
SX1276_OPMODE_SLEEP = 0,