From 8cce9c35f37be9202480add526022126fcf02f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gassmann?= Date: Thu, 2 May 2024 21:16:41 +0200 Subject: [~] Moved the screen related code in a component --- components/screen/screen.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 components/screen/screen.h (limited to 'components/screen/screen.h') diff --git a/components/screen/screen.h b/components/screen/screen.h new file mode 100644 index 0000000..b8b951c --- /dev/null +++ b/components/screen/screen.h @@ -0,0 +1,55 @@ +#ifndef SC_H +#define SC_H + +#include +#include +#include "driver/gpio.h" +#include "driver/i2c_master.h" + +#define MCP_I2C_ADDR CONFIG_MCP_I2C_ADDR +#define SDA_PIN CONFIG_SDA_PIN +#define SCL_PIN CONFIG_SCL_PIN +#define N0_P0 CONFIG_N0_P0 +#define N0_P1 CONFIG_N0_P1 +#define N0_P2 CONFIG_N0_P2 +#define N0_P3 CONFIG_N0_P3 +#define N1_P0 CONFIG_N1_P0 +#define N1_P1 CONFIG_N1_P1 +#define N1_P2 CONFIG_N1_P2 +#define N1_P3 CONFIG_N1_P3 +#define N2_P0 CONFIG_N2_P0 +#define N2_P1 CONFIG_N2_P1 +#define N2_P2 CONFIG_N2_P2 +#define N2_P3 CONFIG_N2_P3 +#define N3_P0 CONFIG_N3_P0 +#define N3_P1 CONFIG_N3_P1 +#define N3_P2 CONFIG_N3_P2 +#define N3_P3 CONFIG_N3_P3 +#define MCP_GPIO_OUTPUT 0 +#define REG_IODIRA 0x00 +#define REG_IODIRB 0x01 +#define REG_GPIOA 0x12 +#define REG_GPIOB 0x13 +#define BV(x) (1 << (x)) + +struct Nixie +{ + uint8_t digit; + uint8_t reg; + uint8_t D; + uint8_t C; + uint8_t B; + uint8_t A; +}; + +struct Screen +{ + struct Nixie nixies[4]; + i2c_master_bus_handle_t i2c_bus; + i2c_master_dev_handle_t mcp; +}; + +void configure_screen(struct Screen* screen); +void test_screen(struct Screen* screen); +void display(struct Screen* screen, char digits[4]); +#endif \ No newline at end of file -- cgit v1.2.3