[CC1101] 3 New CC1101 Functions (#1038)
* getFrequency implementation * getFrequency Method * Get bitrate method * getBitRate * CalcRxBandwidth() method * CalcRxBandwidth(); * Fix Notes * Changes for pull * Changes for pull 2 * Update keywords.txt * Revert to hopefully bring in current * Fix () * Re add
This commit is contained in:
parent
0707a326a5
commit
1fb5100413
3 changed files with 27 additions and 0 deletions
|
@ -134,6 +134,7 @@ getSNR KEYWORD2
|
||||||
getDataRate KEYWORD2
|
getDataRate KEYWORD2
|
||||||
setBitRate KEYWORD2
|
setBitRate KEYWORD2
|
||||||
setRxBandwidth KEYWORD2
|
setRxBandwidth KEYWORD2
|
||||||
|
autoSetRxBandwidth KEYWORD2
|
||||||
setAFCBandwidth KEYWORD2
|
setAFCBandwidth KEYWORD2
|
||||||
setAFC KEYWORD2
|
setAFC KEYWORD2
|
||||||
setAFCAGCTrigger KEYWORD2
|
setAFCAGCTrigger KEYWORD2
|
||||||
|
|
|
@ -489,6 +489,24 @@ int16_t CC1101::setRxBandwidth(float rxBw) {
|
||||||
return(RADIOLIB_ERR_INVALID_RX_BANDWIDTH);
|
return(RADIOLIB_ERR_INVALID_RX_BANDWIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t CC1101::autoSetRxBandwidth() {
|
||||||
|
// Uncertainty ~ +/- 40ppm for a cheap CC1101
|
||||||
|
// Uncertainty * 2 for both transmitter and receiver
|
||||||
|
float uncertainty = ((this->frequency) * 40 * 2);
|
||||||
|
uncertainty = (uncertainty/1000); //Since bitrate is in kBit
|
||||||
|
float minbw = ((this->bitRate) + uncertainty);
|
||||||
|
|
||||||
|
int possibles[16] = {58, 68, 81, 102, 116, 135, 162, 203, 232, 270, 325, 406, 464, 541, 650, 812};
|
||||||
|
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if (possibles[i] > minbw) {
|
||||||
|
int16_t state = setRxBandwidth(possibles[i]);
|
||||||
|
return(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(RADIOLIB_ERR_UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
int16_t CC1101::setFrequencyDeviation(float freqDev) {
|
int16_t CC1101::setFrequencyDeviation(float freqDev) {
|
||||||
// set frequency deviation to lowest available setting (required for digimodes)
|
// set frequency deviation to lowest available setting (required for digimodes)
|
||||||
float newFreqDev = freqDev;
|
float newFreqDev = freqDev;
|
||||||
|
|
|
@ -745,6 +745,14 @@ class CC1101: public PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
int16_t setRxBandwidth(float rxBw);
|
int16_t setRxBandwidth(float rxBw);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief calculates and sets Rx bandwidth based on the freq, baud and freq uncertainty.
|
||||||
|
Reimplement of atlas0fd00m's (RfCat) CalculatePktChanBw function.
|
||||||
|
Modified for worse ppm with the CC1101, and adjusted for the supportted CC1101 bw.
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t autoSetRxBandwidth();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
|
\brief Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
|
||||||
\param freqDev Frequency deviation to be set in kHz.
|
\param freqDev Frequency deviation to be set in kHz.
|
||||||
|
|
Loading…
Add table
Reference in a new issue