hardware button support

This commit is contained in:
Adolfo Reyna
2026-01-29 15:23:03 -05:00
parent 1684eb0198
commit 8d0bca691a
7 changed files with 204 additions and 40 deletions

View File

@@ -28,8 +28,10 @@
#
******************************************************************************/
#include "DEV_Config.h"
#include "board_config.h" // Use our board configuration
#define SPI_PORT spi1
// Use SPI port from board config
#define SPI_PORT DISPLAY_SPI_PORT
/**
* GPIO
@@ -90,14 +92,16 @@ void DEV_Delay_ms(UDOUBLE xms)
void DEV_GPIO_Init(void)
{
// Use pin definitions from board_config.h
EPD_RST_PIN = DISPLAY_RST_PIN;
EPD_DC_PIN = DISPLAY_DC_PIN;
EPD_BUSY_PIN = DISPLAY_BUSY_PIN;
EPD_CS_PIN = DISPLAY_CS_PIN;
EPD_CLK_PIN = DISPLAY_SCK_PIN;
EPD_MOSI_PIN = DISPLAY_MOSI_PIN;
EPD_RST_PIN = 12;
EPD_DC_PIN = 8;
EPD_BUSY_PIN = 13;
EPD_CS_PIN = 9;
EPD_CLK_PIN = 10;
EPD_MOSI_PIN = 11;
printf("E-Paper pins: RST=%d, DC=%d, CS=%d, BUSY=%d, CLK=%d, MOSI=%d\r\n",
EPD_RST_PIN, EPD_DC_PIN, EPD_CS_PIN, EPD_BUSY_PIN, EPD_CLK_PIN, EPD_MOSI_PIN);
DEV_GPIO_Mode(EPD_RST_PIN, 1);
DEV_GPIO_Mode(EPD_DC_PIN, 1);
@@ -118,9 +122,12 @@ UBYTE DEV_Module_Init(void)
// GPIO Config
DEV_GPIO_Init();
// Initialize SPI at 4MHz
spi_init(SPI_PORT, 4000 * 1000);
gpio_set_function(EPD_CLK_PIN, GPIO_OUT);
gpio_set_function(EPD_MOSI_PIN, GPIO_OUT);
// Configure SPI pins to use hardware SPI function
gpio_set_function(EPD_CLK_PIN, GPIO_FUNC_SPI);
gpio_set_function(EPD_MOSI_PIN, GPIO_FUNC_SPI);
printf("DEV_Module_Init OK \r\n");
return 0;