Skip to content

Commit

Permalink
Added getModemConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
hallard committed Jan 19, 2017
1 parent ba8acfa commit 8a536bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions RH_RF95.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,19 @@ bool RH_RF95::setModemConfig(ModemConfigChoice index)
return true;
}

// Return the Modem configs
bool RH_RF95::getModemConfig(ModemConfigChoice index, ModemConfig* config)
{
if (index > (signed int)(sizeof(MODEM_CONFIG_TABLE) / sizeof(ModemConfig)))
return false;

memcpy_P(config, &MODEM_CONFIG_TABLE[index], sizeof(RH_RF95::ModemConfig));

return true;
}



void RH_RF95::setPreambleLength(uint16_t bytes)
{
spiWrite(RH_RF95_REG_20_PREAMBLE_MSB, bytes >> 8);
Expand Down
7 changes: 7 additions & 0 deletions RH_RF95.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,13 @@ class RH_RF95 : public RHSPIDriver
/// \return true if index is a valid choice.
bool setModemConfig(ModemConfigChoice index);

/// Get the values of one of the predefined modem configurations.
///
/// \param[in] index The configuration choice.
/// \param[in] config A ModemConfig structure that will contains values of the modem configuration values.
/// \return true if index is a valid choice and config has been filled with values
bool getModemConfig(ModemConfigChoice index, ModemConfig* config);

/// Tests whether a new message is available
/// from the Driver.
/// On most drivers, this will also put the Driver into RHModeRx mode until
Expand Down

0 comments on commit 8a536bc

Please sign in to comment.