Line data Source code
1 : #include "LR2021.h" 2 : 3 : #include "../LR11x0/LR_common.h" 4 : 5 : #include <string.h> 6 : #include <math.h> 7 : 8 : #if !RADIOLIB_EXCLUDE_LR2021 9 : 10 0 : int16_t LR2021::setBpskModulationParams(uint32_t bitRate, uint8_t pulseShape, bool diff, uint8_t diffInit) { 11 : uint8_t buff[] = { 12 0 : (uint8_t)((bitRate >> 24) & 0xFF), (uint8_t)((bitRate >> 16) & 0xFF), 13 0 : (uint8_t)((bitRate >> 8) & 0xFF), (uint8_t)(bitRate & 0xFF), 14 0 : (uint8_t)((pulseShape << 4) | ((uint8_t)diff << 2) | (diffInit & 0x03)), 15 0 : }; 16 0 : return(this->SPIcommand(RADIOLIB_LR2021_CMD_SET_BPSK_MODULATION_PARAMS, true, buff, sizeof(buff))); 17 : } 18 : 19 0 : int16_t LR2021::setBpskPacketParams(uint8_t payloadLen, uint8_t mode, bool sigFoxControlMsg, uint8_t sigFoxRank) { 20 : uint8_t buff[] = { 21 : payloadLen, 22 0 : (uint8_t)((mode << 4) | ((uint8_t)sigFoxControlMsg << 2) | (sigFoxRank & 0x03)), 23 0 : }; 24 0 : return(this->SPIcommand(RADIOLIB_LR2021_CMD_SET_BPSK_PACKET_PARAMS, true, buff, sizeof(buff))); 25 : } 26 : 27 0 : int16_t LR2021::lrFhssSetSyncword(uint32_t syncWord) { 28 0 : return(this->setU32(RADIOLIB_LR2021_CMD_LR_FHSS_SET_SYNCWORD, syncWord)); 29 : } 30 : 31 1 : int16_t LR2021::setTxTestMode(uint8_t mode) { 32 1 : return(this->SPIcommand(RADIOLIB_LR2021_CMD_SET_TX_TEST_MODE, true, &mode, sizeof(mode))); 33 : } 34 : 35 : #endif