Skip to content

Commit

Permalink
Merge pull request #25 from CapibaraZero/develop/0.2.1
Browse files Browse the repository at this point in the history
Update to 0.2.1
  • Loading branch information
andreock authored Jun 4, 2024
2 parents bbfae82 + b675d78 commit bd99f8e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
20 changes: 20 additions & 0 deletions include/display_config.h
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

// Set your display resolution here
#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 240
30 changes: 15 additions & 15 deletions include/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 3 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};
}

Expand All @@ -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);

Expand All @@ -94,6 +81,6 @@ void setup() {
}

void loop() {
Serial0.println("Loop"); // Avoid FreeRTOS watchdog trigger
Serial.println("Loop"); // Avoid FreeRTOS watchdog trigger
delay(1000);
}

0 comments on commit bd99f8e

Please sign in to comment.