Skip to content

Commit

Permalink
Merge pull request pr3y#153 from bmorcelli/main
Browse files Browse the repository at this point in the history
Fix initialization to work with CC1101
  • Loading branch information
pr3y authored Aug 8, 2024
2 parents feee5d3 + 9593905 commit a640c04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void setup_gpio() {
#if defined(BACKLIGHT)
pinMode(BACKLIGHT, OUTPUT);
#endif
initCC1101once(); // Sets GPIO in the CC1101 lib
}


Expand Down Expand Up @@ -284,7 +285,7 @@ void setup() {
// start a task to handle serial commands while the webui is running
startSerialCommandsHandlerTask();
#endif

delay(200);
previousMillis = millis();
}
Expand All @@ -305,7 +306,7 @@ void loop() {
tft.fillRect(0,0,WIDTH,HEIGHT,BGCOLOR);
setupSdCard();
getConfigs();
if(RfModule==1) initCC1101once();


while(1){
if (returnToMenu) {
Expand Down
5 changes: 5 additions & 0 deletions src/modules/rf/rf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,17 @@ void initCC1101once() {
#else
ELECHOUSE_cc1101.setGDO0(CC1101_GDO0_PIN); // use Gdo0 for both Tx and Rx
#endif
/*
Don't need to start comunications now
if (ELECHOUSE_cc1101.getCC1101()){ // Check the CC1101 Spi connection.
Serial.println("cc1101 Connection OK");
} else {
Serial.println("cc1101 Connection Error");
return;
}
ELECHOUSE_cc1101.Init();
*/

#else
Serial.println("Error: USE_CC1101_VIA_SPI not defined for this board");
//TODO: interface using PCA9554
Expand All @@ -383,6 +387,7 @@ bool initRfModule(String mode, float frequency) {

if(RfModule == 1) { // CC1101 in use
#ifdef USE_CC1101_VIA_SPI
ELECHOUSE_cc1101.Init();
if (ELECHOUSE_cc1101.getCC1101()){ // Check the CC1101 Spi connection.
Serial.println("cc1101 Connection OK");
} else {
Expand Down

0 comments on commit a640c04

Please sign in to comment.