diff --git a/include/display_config.h b/include/display_config.h new file mode 100644 index 0000000..7073e9d --- /dev/null +++ b/include/display_config.h @@ -0,0 +1,20 @@ +/* + * This file is part of the Capibara zero (https://github.com/CapibaraZero/fw or + * https://capibarazero.github.io/). Copyright (c) 2024 Andrea Canale. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Set your display resolution here +#define DISPLAY_WIDTH 240 +#define DISPLAY_HEIGHT 240 \ No newline at end of file diff --git a/include/pins.h b/include/pins.h index b81608d..6ee7a79 100644 --- a/include/pins.h +++ b/include/pins.h @@ -44,27 +44,27 @@ // Define buttons pins #define OK_BTN_PIN A3 -#define UP_BTN_PIN A1 -#define DOWN_BTN_PIN A6 -#define LEFT_BTN_PIN A2 -#define RIGHT_BTN_PIN A7 +#define UP_BTN_PIN A5 +#define DOWN_BTN_PIN A2 +#define LEFT_BTN_PIN A4 +#define RIGHT_BTN_PIN A1 // Display pins -#define TFT_CS D9 -#define TFT_DC D10 -#define TFT_RST D11 -#define TFT_MOSI D12 -#define TFT_SCLK D13 +#define TFT_CS D5 +#define TFT_DC D6 +#define TFT_RST D3 +#define TFT_MOSI D4 +#define TFT_SCLK D2 // SD card -#define SD_CARD_MISO D2 -#define SD_CARD_SCK D3 -#define SD_CARD_MOSI D4 -#define SD_CARD_CS D5 +#define SD_CARD_CS D10 +#define SD_CARD_MOSI D11 +#define SD_CARD_MISO D12 +#define SD_CARD_SCK D13 #define CC1101_GDO0 A0 #define CC1101_CSN D7 -#define PN532_SCL A4 -#define PN532_SDA A5 +#define PN532_SCL A6 +#define PN532_SDA A7 #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 1f92586..7d54048 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,28 +32,15 @@ #include "pins.h" #include "posixsd.hpp" #include "style.h" +#include "display_config.h" /* TODO: To lower this, we can may switch to heap for wifi_networks */ #define TASK_STACK_SIZE 16000 -#ifdef ARDUINO_NANO_ESP32 -SPIClass SPI2(HSPI); -#endif static void init_sd() { -#ifdef ARDUINO_NANO_ESP32 - SPI2.begin(SD_CARD_SCK, SD_CARD_MISO, SD_CARD_MOSI, SD_CARD_CS); - SPI2.setDataMode(SPI_MODE0); -#else SPI.begin(SD_CARD_SCK, SD_CARD_MISO, SD_CARD_MOSI, SD_CARD_CS); -#endif - -#ifdef ARDUINO_NANO_ESP32 - if (!init_sdcard_custom_spi(SD_CARD_CS, SPI2)) { -#else if (!init_sdcard(SD_CARD_CS)) { -#endif Serial.println("init_sdcard failed"); - // LOG_ERROR("Error during init SD card"); }; } @@ -76,7 +63,7 @@ void setup() { init_sd(); init_english_dict(); display = new Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); - screen = new GFXForms(240, 320, display); + screen = new GFXForms(DISPLAY_WIDTH, DISPLAY_HEIGHT, display); screen->set_rotation(1); screen->set_background_color(HOME_BACKGROUND_COLOR); @@ -94,6 +81,6 @@ void setup() { } void loop() { - Serial0.println("Loop"); // Avoid FreeRTOS watchdog trigger + Serial.println("Loop"); // Avoid FreeRTOS watchdog trigger delay(1000); }