Skip to content

Commit a501b4d

Browse files
Luis Miguel Collado LleraLuis Miguel Collado Llera
Luis Miguel Collado Llera
authored and
Luis Miguel Collado Llera
committed
kode dot board with pins defined
1 parent 3f0ad32 commit a501b4d

File tree

3 files changed

+104
-141
lines changed

3 files changed

+104
-141
lines changed
+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// custom_ota_override.cpp
2-
// Esta función sobrescribe la definición débil en el core de Arduino-ESP32.
2+
// This function overrides the weak definition of `verifyRollbackLater()` in the kode dot board.
3+
34
extern "C" {
5+
// Declare the weak function symbol to override it
46
bool verifyRollbackLater() __attribute__((weak));
57
}
68

9+
// Custom implementation of verifyRollbackLater()
10+
// Returning `true` prevents the OTA image from being automatically marked as valid.
11+
// This ensures that the system will roll back to the previous image unless it is explicitly validated later.
712
bool verifyRollbackLater() {
8-
// Retorna true para evitar que se marque la imagen OTA como válida automáticamente.
913
return true;
1014
}

variants/kodedot/pins_arduino.h

+98-87
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,107 @@
1+
/*
2+
────────────────────────────────────────────────────────────────────────
3+
KodeDot – ESP32-S3R8 Variant
4+
Pin definition file for the Arduino-ESP32 core
5+
────────────────────────────────────────────────────────────────────────
6+
* External 2 × 10 connector → simple aliases PIN1 … PIN20
7+
* On-board QSPI LCD 410×502 @40 MHz (SPI3_HOST)
8+
* micro-SD on SPI2_HOST
9+
* Dual-I²C: external (GPIO37/36) + internal-sensors (GPIO48/47)
10+
* USB VID/PID 0x303A:0x1001
11+
*/
12+
113
#ifndef Pins_Arduino_h
214
#define Pins_Arduino_h
315

416
#include <stdint.h>
517
#include <stdbool.h>
618

7-
#define USB_VID 0x303a
8-
#define USB_PID 0x1001
9-
10-
static const uint8_t TX = 43;
11-
static const uint8_t RX = 44;
12-
13-
static const uint8_t SDA = 45;
14-
static const uint8_t SCL = 46;
15-
16-
static const uint8_t SS = 34;
17-
static const uint8_t MOSI = 35;
18-
static const uint8_t MISO = 37;
19-
static const uint8_t SCK = 36;
20-
21-
static const uint8_t A0 = 1;
22-
static const uint8_t A1 = 2;
23-
static const uint8_t A2 = 3;
24-
25-
static const uint8_t T3 = 3;
26-
27-
// SDCARD Slot
28-
#define BOARD_HAS_SDMMC
29-
#define SDMMC_D2 33 // SDMMC Data2
30-
#define SDMMC_D3 34 // SDMMC Data3 / SPI CS
31-
#define SDMMC_CMD 35 // SDMMC CMD / SPI MOSI
32-
#define SDMMC_CLK 36 // SDMMC CLK / SPI SCK
33-
#define SDMMC_D0 37 // SDMMC Data0 / SPI MISO
34-
#define SDMMC_D1 38 // SDMMC Data1
35-
#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_DEFAULT
36-
37-
// 240x240 LCD
19+
/*──────────────── USB device descriptor ────────────────*/
20+
#define USB_VID 0x303A // Espressif Systems VID
21+
#define USB_PID 0x1001 // Product ID: KodeDot-S3
22+
23+
/*──────────────── UART0 (Arduino Serial) ────────────────*/
24+
static const uint8_t TX = 43; // U0TXD – PIN16 on the 2×10 header
25+
static const uint8_t RX = 44; // U0RXD – PIN18 on the 2×10 header
26+
27+
/*──────────────── I²C buses ─────────────────────────────*/
28+
/* External expansion bus → header pins 11/13 */
29+
static const uint8_t SCL = 37; // GPIO37 – PIN12
30+
static const uint8_t SDA = 36; // GPIO36 – PIN14
31+
32+
/* Internal sensor/touch bus (not on header) */
33+
#define INT_I2C_SCL 47 // GPIO47
34+
#define INT_I2C_SDA 48 // GPIO48
35+
36+
/*──────────────── SPI2 – micro-SD ───────────────────────*/
37+
static const uint8_t SS = 15; // SD_CS
38+
static const uint8_t MOSI = 16; // SD_MOSI
39+
static const uint8_t MISO = 18; // SD_MISO
40+
static const uint8_t SCK = 17; // SD_CLK
41+
#define BOARD_HAS_SD_SPI
42+
#define SD_CS SS
43+
44+
/*──────────────── QSPI LCD (SPI3_HOST) ─────────────────–
45+
* Controller: ST7789 / 4-line SPI (no D/C pin)
46+
* Resolution: 410×502 px, 16 bpp, RGB color-space
47+
* Clock: 40 MHz
48+
*/
3849
#define BOARD_HAS_SPI_LCD
39-
#define LCD_MODEL ST7789
40-
#define LCD_WIDTH 240
41-
#define LCD_HEIGHT 240 // *RAM height is actually 320!
42-
#define LCD_MISO -1 // LCD Does not use MISO.
43-
#define LCD_DC 4 // Used to switch data and command status.
44-
#define LCD_CS 5 // used to enable LCD, low level to enable.
45-
#define LCD_CLK 6 // LCD SPI Clock.
46-
#define LCD_MOSI 7 // LCD SPI MOSI.
47-
#define LCD_RST 8 // used to reset LCD, low level to reset.
48-
#define LCD_BL 9 // LCD backlight control.
49-
50-
// Buttons
51-
#define BUTTON_OK 0 // OK button, low level when pressed.
52-
#define BUTTON_UP 10 // UP button, low level when pressed.
53-
#define BUTTON_DOWN 11 // Down button, low level when pressed.
54-
#define BUTTON_MENU 14 // Menu button, low level when pressed.
55-
56-
// LEDs
57-
#define LED_GREEN 15 // the light is lit when set high level.
58-
#define LED_YELLOW 16 // the light is lit when set high level.
59-
60-
// Board Controls
61-
#define DEV_VBUS_EN 12 // High level to enable DEV_VBUS power supply.
62-
#define BOOST_EN 13 // High level to enable Battery Boost circuit.
63-
#define LIMIT_EN 17 // Enable USB_HOST current limiting IC, high level enable.
64-
#define USB_HOST_EN \
65-
18 // Used to switch the USB interface. When high level, the USB_HOST interface is enabled. When low level, the USB_DEV interface is enabled.
66-
67-
// Board Sensors
68-
#define OVER_CURRENT 21 // Current overrun signal, high level means overrun.
69-
#define HOST_VOLTS 1 // USB_DEV voltage monitoring, ADC1 channel 0. actual_v = value_v * 3.7
70-
#define BAT_VOLTS 2 // Battery voltage monitoring, ADC1 channel 1. actual_v = value_v * 2
71-
72-
// USB Port
73-
#define USB_DN 19 // USB D-
74-
#define USB_DP 20 // USB D+
75-
76-
// Bottom header
77-
#define MTCK 39
78-
#define MTDO 40
79-
#define MTDI 41
80-
#define MTMS 42
81-
// #define FREE_6 3 // Idle, can be customized.
82-
// #define FREE_4 26 // Idle, can be customized.
83-
// #define FREE_1 45 // Idle, can be customized.
84-
// #define FREE_2 46 // Idle, can be customized.
85-
// #define FREE_5 47 // Idle, can be customized.
86-
// #define FREE_3 48 // Idle, can be customized.
87-
88-
typedef enum {
89-
USB_HOST_POWER_OFF,
90-
USB_HOST_POWER_VBUS,
91-
USB_HOST_POWER_BAT
92-
} UsbHostPower_t;
93-
void usbHostPower(UsbHostPower_t mode);
94-
void usbHostEnable(bool enable);
50+
#define LCD_MODEL ST7789
51+
#define LCD_WIDTH 410
52+
#define LCD_HEIGHT 502
53+
54+
#define LCD_HOST SPI3_HOST
55+
#define LCD_SCK 35 // GPIO35 • QSPI_CLK
56+
#define LCD_MOSI 33 // GPIO33 • QSPI_IO0 (D0)
57+
#define LCD_IO1 34 // GPIO34 • QSPI_IO1 (D1)
58+
#define LCD_IO2 37 // GPIO37 • QSPI_IO2 (D2)
59+
#define LCD_IO3 36 // GPIO36 • QSPI_IO3 (D3)
60+
#define LCD_CS 10 // GPIO10
61+
#define LCD_RST 9 // GPIO09
62+
#define LCD_DC -1 // not used in 4-line SPI
63+
/* Optional: back-light enable shares the NeoPixel pin */
64+
#define LCD_BL 5 // GPIO05 (same as NEOPIXEL)
65+
66+
/*──────────────── Analogue / Touch pads ────────────────*/
67+
static const uint8_t A0 = 11; // PIN4 – GPIO11 / TOUCH11 / ADC2_CH0
68+
static const uint8_t A1 = 12; // PIN6 – GPIO12 / TOUCH12 / ADC2_CH1
69+
static const uint8_t A2 = 13; // PIN8 – GPIO13 / TOUCH13 / ADC2_CH2
70+
static const uint8_t A3 = 14; // PIN10 – GPIO14 / TOUCH14 / ADC2_CH3
71+
static const uint8_t T0 = A0, T1 = A1, T2 = A2, T3 = A3;
72+
73+
/*──────────────── On-board controls & indicator ─────────*/
74+
#define BUTTON_TOP 0 // GPIO00 – BOOT • active-LOW
75+
#define BUTTON_BOTTOM 6 // GPIO06 • active-LOW
76+
#define NEOPIXEL_PIN 5 // GPIO05 – WS2812
77+
#define LED_BUILTIN NEOPIXEL_PIN
78+
79+
/*──────────────── JTAG (also on connector) ──────────────*/
80+
#define MTCK 39 // PIN11 – GPIO39
81+
#define MTDO 40 // PIN13 – GPIO40
82+
#define MTDI 41 // PIN15 – GPIO41
83+
#define MTMS 42 // PIN17 – GPIO42
84+
85+
/*──────────────── 2×10 header: simple aliases ───────────
86+
NOTE: power pins (1 = 5 V, 2 = 3 V3, 19/20 = GND) are **not**
87+
exposed as GPIO numbers – they remain undefined here. */
88+
#define PIN3 1 // GPIO01 / TOUCH1 / ADC1_CH0
89+
#define PIN4 11 // GPIO11 / TOUCH11 / ADC2_CH0
90+
#define PIN5 2 // GPIO02 / TOUCH2 / ADC1_CH1
91+
#define PIN6 12 // GPIO12 / TOUCH12 / ADC2_CH1
92+
#define PIN7 3 // GPIO03 / TOUCH3 / ADC1_CH2
93+
#define PIN8 13 // GPIO13 / TOUCH13 / ADC2_CH2
94+
#define PIN9 4 // GPIO04 / TOUCH4 / ADC1_CH3
95+
#define PIN10 14 // GPIO14 / TOUCH14 / ADC2_CH3
96+
#define PIN11 39 // MTCK
97+
#define PIN12 37 // SCL (external I²C)
98+
#define PIN13 40 // MTDO
99+
#define PIN14 36 // SDA (external I²C)
100+
#define PIN15 41 // MTDI
101+
#define PIN16 43 // TX (U0TXD)
102+
#define PIN17 42 // MTMS
103+
#define PIN18 44 // RX (U0RXD)
104+
/* PIN1, PIN2, PIN19, PIN20 are power/ground and deliberately
105+
left undefined – they are **not** usable as GPIO. */
95106

96107
#endif /* Pins_Arduino_h */

variants/kodedot/variant.cpp

-52
This file was deleted.

0 commit comments

Comments
 (0)