| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /**
- * @Author: DELL
- * @Date: 2025/5/22 上午9:18
- * Description:
- * Copyright: Copyright (©) 2025 永续绿建. All rights reserved.
- */
- #ifndef WIRE_CONTROLLER_EXTEND_IO_H
- #define WIRE_CONTROLLER_EXTEND_IO_H
- #pragma once
- #include "esp_err.h"
- #include "driver/gpio.h"
- typedef enum {
- GPIO_NUM_Q0 = 0, /*!< GPIO0, input and output */
- GPIO_NUM_Q1 = 1, /*!< GPIO1, input and output */
- GPIO_NUM_Q2 = 2, /*!< GPIO2, input and output */
- GPIO_NUM_Q3 = 3, /*!< GPIO3, input and output */
- GPIO_NUM_Q4 = 4, /*!< GPIO4, input and output */
- GPIO_NUM_Q5 = 5, /*!< GPIO5, input and output */
- GPIO_NUM_Q6 = 6, /*!< GPIO6, input and output */
- GPIO_NUM_Q7 = 7, /*!< GPIO7, input and output */
- /** @endcond */
- } extend_gpio_num_t;
- // 74HC595引脚定义 (根据实际电路修改)
- #define DATA_PIN 40 // DS (串行数据输入)
- #define CLOCK_PIN 42 // SHCP (移位寄存器时钟)
- #define LATCH_PIN 41 // STCP (存储寄存器时钟)
- #define HC595_SHCP_Low() gpio_set_level(CLOCK_PIN, 0)
- #define HC595_SHCP_High() gpio_set_level( CLOCK_PIN, 1 )
- #define HC595_STCP_Low() gpio_set_level( LATCH_PIN, 0 )
- #define HC595_STCP_High() gpio_set_level( LATCH_PIN, 1 )
- #define HC595_Data_Low() gpio_set_level( DATA_PIN, 0 )
- #define HC595_Data_High() gpio_set_level( DATA_PIN, 1 )
- void extend_io_init();
- void hc595_init();
- esp_err_t hc595_gpio_write(extend_gpio_num_t gpio_num, uint32_t level) ;
- #endif //WIRE_CONTROLLER_EXTEND_IO_H
|