Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed unnecessary initializations when setting Tx or Rx mode. #20

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 12 additions & 34 deletions ELECHOUSE_CC1101_RCS_DRV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,8 @@ void ELECHOUSE_CC1101::RegConfigSettings(byte f)
****************************************************************/
void ELECHOUSE_CC1101::SetTx(void)
{
SpiStrobe(CC1101_SRES);
SpiStart(); //spi initialization
GDO_Set(); //GDO set
digitalWrite(SS_PIN, HIGH);
digitalWrite(SCK_PIN, HIGH);
digitalWrite(MOSI_PIN, LOW);
Reset(); //CC1101 reset
RegConfigSettings(conf); //CC1101 register config
SpiStrobe(CC1101_STX); //start send
SpiStrobe(CC1101_SIDLE);
SpiStrobe(CC1101_STX); //start send
}
/****************************************************************
*FUNCTION NAME:SetRx
Expand All @@ -483,15 +476,7 @@ void ELECHOUSE_CC1101::SetTx(void)
****************************************************************/
void ELECHOUSE_CC1101::SetRx(void)
{
SpiStrobe(CC1101_SRES);
SpiStart(); //spi initialization
GDO_Set(); //GDO set
digitalWrite(SS_PIN, HIGH);
digitalWrite(SCK_PIN, HIGH);
digitalWrite(MOSI_PIN, LOW);
Reset(); //CC1101 reset
RegConfigSettings(conf); //CC1101 register config
SpiStrobe(CC1101_SRX); //start receive
SpiStrobe(CC1101_SRX); //start receive
}
/****************************************************************
*FUNCTION NAME:SetTx
Expand All @@ -501,15 +486,11 @@ void ELECHOUSE_CC1101::SetRx(void)
****************************************************************/
void ELECHOUSE_CC1101::SetTx(float mhz)
{
SpiStrobe(CC1101_SRES);
setMHZ(mhz);
SpiStart(); //spi initialization
GDO_Set(); //GDO set
digitalWrite(SS_PIN, HIGH);
digitalWrite(SCK_PIN, HIGH);
digitalWrite(MOSI_PIN, LOW);
Reset(); //CC1101 reset
RegConfigSettings(conf); //CC1101 register config
SpiWriteReg(CC1101_FREQ2, F2);
SpiWriteReg(CC1101_FREQ1, F1);
SpiWriteReg(CC1101_FREQ0, F0);
SpiStrobe(CC1101_SIDLE);
SpiStrobe(CC1101_STX); //start send
}
/****************************************************************
Expand All @@ -520,15 +501,12 @@ void ELECHOUSE_CC1101::SetTx(float mhz)
****************************************************************/
void ELECHOUSE_CC1101::SetRx(float mhz)
{
SpiStrobe(CC1101_SRES);
setMHZ(mhz);
SpiStart(); //spi initialization
GDO_Set(); //GDO set
digitalWrite(SS_PIN, HIGH);
digitalWrite(SCK_PIN, HIGH);
digitalWrite(MOSI_PIN, LOW);
Reset(); //CC1101 reset
RegConfigSettings(conf); //CC1101 register config
SpiWriteReg(CC1101_FREQ2, F2);
SpiWriteReg(CC1101_FREQ1, F1);
SpiWriteReg(CC1101_FREQ0, F0);
SpiStrobe(CC1101_SIDLE);
digitalWrite(SCK_PIN, LOW);
SpiStrobe(CC1101_SRX); //start receive
}
/****************************************************************
Expand Down