Files
2026-06-12 17:03:10 +08:00

45 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef HW_INIT_H
#define HW_INIT_H
#include <stdint.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ---------- 基本 GPIO ---------- */
esp_err_t hw_gpio_init(void);
/* ---------- 电源控制 ---------- */
esp_err_t hw_power_init(void); /* 开启外围电源 (POW_CTL) */
esp_err_t hw_battery_adc_init(void); /* 初始化电池电压 ADC */
uint32_t hw_battery_read_mv(void); /* 读取电池电压 (mV),内部自动开关MOS */
/* ---------- 按钮 ---------- */
esp_err_t hw_button_init(void);
uint8_t hw_button_read(void); /* 返回编码: 0=none, 1=left, 2=right, 3=mid */
/* ---------- LED ---------- */
esp_err_t hw_led_init(void);
void hw_led_set(bool on);
/* ---------- I2C ---------- */
esp_err_t hw_i2c_init(void);
/* ---------- SPI ---------- */
esp_err_t hw_spi_init(void);
/* ---------- TFT 背光 PWM ---------- */
esp_err_t hw_tft_backlight_init(void);
void hw_tft_backlight_set(uint8_t duty); /* 0100 */
/* ---------- 一键初始化所有外设 ---------- */
esp_err_t hw_all_init(void);
#ifdef __cplusplus
}
#endif
#endif /* HW_INIT_H */