Moved the defines and board specific data into the header

This commit is contained in:
jakeg00dwin 2024-09-26 16:45:08 -07:00
parent cfa740209f
commit 07c2ee4b6d
2 changed files with 32 additions and 23 deletions

View File

@ -1,4 +1,35 @@
#ifndef BOARD_CONFIG_H #ifndef BOARD_CONFIG_H
#define 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 #endif //BOARD_CONFIG_H

View File

@ -13,36 +13,14 @@
#include "inc/board_config.h" #include "inc/board_config.h"
//GLOBAL VARS/OBJS
// MAGNETOMETER (LIS2MDL) CONFIGURATION // MAGNETOMETER (LIS2MDL) CONFIGURATION
Adafruit_LIS2MDL lis2mdl = Adafruit_LIS2MDL(12345); // Create magnetometer object 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 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 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 SoftwareSerial gpsSerial(GPS_RX_PIN, GPS_TX_PIN); // Software serial for GPS
TinyGPSPlus gps; // TinyGPS++ object to process GPS data 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. RH_RF95 rf95(RFM95_CS, RMF95_INT); // Radio instance.