| 272 | } |
| 273 | |
| 274 | long LoRaClass::packetFrequencyError() |
| 275 | { |
| 276 | int32_t freqError = 0; |
| 277 | freqError = static_cast<int32_t>(readRegister(REG_FREQ_ERROR_MSB) & B111); |
| 278 | freqError <<= 8L; |
| 279 | freqError += static_cast<int32_t>(readRegister(REG_FREQ_ERROR_MID)); |
| 280 | freqError <<= 8L; |
| 281 | freqError += static_cast<int32_t>(readRegister(REG_FREQ_ERROR_LSB)); |
| 282 | |
| 283 | if (readRegister(REG_FREQ_ERROR_MSB) & B1000) { // Sign bit is on |
| 284 | freqError -= 524288; // B1000'0000'0000'0000'0000 |
| 285 | } |
| 286 | |
| 287 | const float fXtal = 32E6; // FXOSC: crystal oscillator (XTAL) frequency (2.5. Chip Specification, p. 14) |
| 288 | const float fError = ((static_cast<float>(freqError) * (1L << 24)) / fXtal) * (getSignalBandwidth() / 500000.0f); // p. 37 |
| 289 | |
| 290 | return static_cast<long>(fError); |
| 291 | } |
| 292 | |
| 293 | int LoRaClass::rssi() |
| 294 | { |
nothing calls this directly
no outgoing calls
no test coverage detected