From 07c2ee4b6dc20af65f14a3f1e624bb209244e76c Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Thu, 26 Sep 2024 16:45:08 -0700 Subject: [PATCH] Moved the defines and board specific data into the header --- inc/board_config.h | 31 +++++++++++++++++++++++++++++++ src/main.cpp | 24 +----------------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/inc/board_config.h b/inc/board_config.h index 795dc03..b9d3968 100644 --- a/inc/board_config.h +++ b/inc/board_config.h @@ -1,4 +1,35 @@ #ifndef BOARD_CONFIG_H #define BOARD_CONFIG_H +//Un-comment a line below for the target board/uC. +#define FEATHER_RFM95 +//#define FEATHER_RFM96 + +//Only applied if defined + #ifdef FEATHER_RFM9X + // DISPLAY CONFIGURATION (ST7789) + #define TFT_CS 5 // Chip select pin for the display + #define TFT_RST 9 // Reset pin for the display + #define TFT_DC 6 // Data/Command pin for the display + + // LED RING CONFIGURATION (WS2812) + #define NUM_LEDS 24 // Number of LEDs in the ring + #define DATA_PIN 12 // Pin for LED data + + // GPS CONFIGURATION (BN-220) + #define GPS_TX_PIN 10 // GPS TX pin connected to Arduino RX + #define GPS_RX_PIN 11 // GPS RX pin connected to Arduino TX + + // Radio defines + #define RFM95_CS 8 + #define RFM95_INT 7 + #define RFM95_RST 4 + #define RF95_FREQ 915.0 + #define RF95_MAX_DB 23 + #define RF95_MIN_DB 5 + #define RF95_TIMEOUT 250 + #define RF95_BUF_SZ 32 + #endif //FEATHER_RFM9X + + #endif //BOARD_CONFIG_H diff --git a/src/main.cpp b/src/main.cpp index 3d6d3c7..79a159a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,36 +13,14 @@ #include "inc/board_config.h" +//GLOBAL VARS/OBJS // MAGNETOMETER (LIS2MDL) CONFIGURATION Adafruit_LIS2MDL lis2mdl = Adafruit_LIS2MDL(12345); // Create magnetometer object - -// DISPLAY CONFIGURATION (ST7789) -#define TFT_CS 5 // Chip select pin for the display -#define TFT_RST 9 // Reset pin for the display -#define TFT_DC 6 // Data/Command pin for the display Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // Initialize display - -// LED RING CONFIGURATION (WS2812) -#define NUM_LEDS 24 // Number of LEDs in the ring -#define DATA_PIN 12 // Pin for LED data CRGB leds[NUM_LEDS]; // Array to hold LED colors - -// GPS CONFIGURATION (BN-220) -#define GPS_TX_PIN 10 // GPS TX pin connected to Arduino RX -#define GPS_RX_PIN 11 // GPS RX pin connected to Arduino TX SoftwareSerial gpsSerial(GPS_RX_PIN, GPS_TX_PIN); // Software serial for GPS TinyGPSPlus gps; // TinyGPS++ object to process GPS data - -// Radio defines -#define RFM95_CS 8 -#define RFM95_INT 7 -#define RFM95_RST 4 -#define RF95_FREQ 915.0 -#define RF95_MAX_DB 23 -#define RF95_MIN_DB 5 -#define RF95_TIMEOUT 250 -#define RF95_BUF_SZ 32 RH_RF95 rf95(RFM95_CS, RMF95_INT); // Radio instance.