53 lines
2.0 KiB
C
53 lines
2.0 KiB
C
/*
|
|
* MTG RFID Companion - Hardware pin assignments
|
|
*
|
|
* Do NOT change these unless explicitly instructed. SPI2_HOST (VSPI) is
|
|
* shared by the ST7789 display and the MFRC522 RFID reader.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "sdkconfig.h"
|
|
#include "hal/gpio_types.h"
|
|
#include "driver/spi_master.h"
|
|
|
|
/* SPI2_HOST (VSPI): dedicated to the ST7789 display.
|
|
* On 7-pin ST7789 modules the display labels these SDA (MOSI) and
|
|
* SCL (SCK). MISO is unused (the display never reads the bus; the RFID
|
|
* reader lives on its own SPI3 bus). */
|
|
#define HW_SPI_HOST (SPI2_HOST)
|
|
#define HW_SPI_SCK_GPIO (GPIO_NUM_18) /* display SCL */
|
|
#define HW_SPI_MOSI_GPIO (GPIO_NUM_23) /* display SDA */
|
|
#define HW_SPI_MISO_GPIO (GPIO_NUM_NC) /* unused */
|
|
|
|
/* MFRC522 RFID reader - OWN SPI3_HOST (HSPI) bus, separate from the display.
|
|
* Using a independent controller avoids any bus interference between the
|
|
* panel and the reader. */
|
|
#define HW_RFID_SPI_HOST (SPI3_HOST)
|
|
#define HW_RFID_SCK_GPIO (GPIO_NUM_16)
|
|
#define HW_RFID_MOSI_GPIO (GPIO_NUM_17)
|
|
#define HW_RFID_MISO_GPIO (GPIO_NUM_13)
|
|
#define HW_RC522_CS_GPIO (GPIO_NUM_26)
|
|
#define HW_RC522_RST_GPIO (GPIO_NUM_22)
|
|
|
|
/* ST7789 display - 7-pin breakout: CS / DC / RST / SDA / SCL / GND / VCC.
|
|
* SDA and SCL share the SPI bus above (SCL=HW_SPI_SCK, SDA=HW_SPI_MOSI).
|
|
*
|
|
* IMPORTANT: CS and DC are on NON-STRAPPING pins (GPIO21, GPIO19) so the
|
|
* panel never interferes with the ESP32 boot/flash. Keeping these on
|
|
* GPIO15/GPIO2 (strapping pins) blocks flashing while the display is
|
|
* connected, because the panel holds the strap lines at reset. */
|
|
#define HW_LCD_CS_GPIO (GPIO_NUM_21)
|
|
#define HW_LCD_DC_GPIO (GPIO_NUM_19)
|
|
#define HW_LCD_RST_GPIO (GPIO_NUM_4)
|
|
|
|
/* EC11 rotary encoder */
|
|
#define HW_ENC_CLK_GPIO (GPIO_NUM_32)
|
|
#define HW_ENC_DT_GPIO (GPIO_NUM_33)
|
|
#define HW_ENC_SW_GPIO (GPIO_NUM_25)
|
|
|
|
/* WS2812B Neopixel */
|
|
#define HW_NEOPIXEL_GPIO (GPIO_NUM_27)
|
|
|
|
/* Piezo buzzer */
|
|
#define HW_BUZZER_GPIO (GPIO_NUM_14) |