mirror of
https://github.com/HwzLoveDz/AXP202-PMIC.git
synced 2026-11-18 06:49:21 +00:00
no
This commit is contained in:
parent
1ab85f2778
commit
8a4e4bc146
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Win32",
|
|
||||||
"includePath": [
|
|
||||||
"${workspaceFolder}/**",
|
|
||||||
"C:\\Users\\69180\\Desktop\\PMU_AXP20x\\components/**",
|
|
||||||
"C:\\Espressif/**"
|
|
||||||
],
|
|
||||||
"defines": [
|
|
||||||
"_DEBUG",
|
|
||||||
"UNICODE",
|
|
||||||
"_UNICODE"
|
|
||||||
],
|
|
||||||
"configurationProvider": "ms-vscode.makefile-tools"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 4
|
|
||||||
}
|
|
||||||
35
software/ESP-IDF/PMU_AXP20x/.vscode/launch.json
vendored
35
software/ESP-IDF/PMU_AXP20x/.vscode/launch.json
vendored
@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
// 使用 IntelliSense 了解相关属性。
|
|
||||||
// 悬停以查看现有属性的描述。
|
|
||||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "(gdb) 启动",
|
|
||||||
"type": "cppdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceFolder}/build/PMU_AXP202x.elf",
|
|
||||||
"args": [],
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"environment": [],
|
|
||||||
"externalConsole": false,
|
|
||||||
"MIMode": "gdb",
|
|
||||||
"miDebuggerPath": "C:/Espressif/tools/riscv32-esp-elf-gdb/11.2_20220823/riscv32-esp-elf-gdb/bin/riscv32-esp-elf-gdb.exe",
|
|
||||||
"setupCommands": [
|
|
||||||
{
|
|
||||||
"description": "为 gdb 启用整齐打印",
|
|
||||||
"text": "-enable-pretty-printing",
|
|
||||||
"ignoreFailures": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "将反汇编风格设置为 Intel",
|
|
||||||
"text": "-gdb-set disassembly-flavor intel",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"idf.adapterTargetName": "esp32s3",
|
|
||||||
"idf.openOcdConfigs": [
|
|
||||||
"board/esp32s3-builtin.cfg"
|
|
||||||
],
|
|
||||||
"idf.flashType": "JTAG",
|
|
||||||
"idf.portWin": "COM17",
|
|
||||||
"idf.flashBaudRate": "2000000",
|
|
||||||
"cmake.configureOnOpen": true
|
|
||||||
}
|
|
||||||
@ -75,7 +75,7 @@ static void axp_irq_init()
|
|||||||
gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
|
gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void axp_config_init()
|
static void axp_init()
|
||||||
{
|
{
|
||||||
if (axp.begin(twi_read, twi_write, AXP202_SLAVE_ADDRESS))
|
if (axp.begin(twi_read, twi_write, AXP202_SLAVE_ADDRESS))
|
||||||
{
|
{
|
||||||
@ -83,7 +83,10 @@ static void axp_config_init()
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "Success init axp20x !!!");
|
ESP_LOGI(TAG, "Success init axp20x !!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void axp_config()
|
||||||
|
{
|
||||||
// 两个警告等级(类似于手机20%一提醒,10%一提醒)和一个关机电压(类似于手机3%关机,实际显示0%)
|
// 两个警告等级(类似于手机20%一提醒,10%一提醒)和一个关机电压(类似于手机3%关机,实际显示0%)
|
||||||
axp.setVWarningLevel1(3450);
|
axp.setVWarningLevel1(3450);
|
||||||
axp.setVWarningLevel2(3400);
|
axp.setVWarningLevel2(3400);
|
||||||
@ -188,16 +191,76 @@ static void axp_config_init()
|
|||||||
axp.gpioWrite(AXP_GPIO_0, 1);
|
axp.gpioWrite(AXP_GPIO_0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void axp_info()
|
||||||
|
{
|
||||||
|
if (axp.isDCDC2Enable())
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "DC2: %u mV", axp.getDCDC2Voltage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "DC2: DISABLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axp.isDCDC3Enable())
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "DC3: %u mV", axp.getDCDC3Voltage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "DC3: DISABLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axp.isLDO2Enable())
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "LDO2: %u mV", axp.getLDO2Voltage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "LDO2: DISABLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axp.isLDO3Enable())
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "LDO3: %u mV", axp.getLDO3Voltage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "LDO3: DISABLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axp.isLDO4Enable())
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "LDO4: %u mV", axp.getLDO4Voltage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "LDO4: DISABLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axp.isExtenEnable())
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "Exten: ENABLE");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "Exten: DISABLE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void app_main(void)
|
extern "C" void app_main(void)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(i2c_master_init());
|
ESP_ERROR_CHECK(i2c_master_init());
|
||||||
|
|
||||||
|
axp_init();
|
||||||
|
|
||||||
|
axp_info();
|
||||||
|
|
||||||
axp_irq_init();
|
axp_irq_init();
|
||||||
|
|
||||||
axp_config_init();
|
axp_config();
|
||||||
|
|
||||||
//! Enable all irq channel
|
// //! Enable all irq channel
|
||||||
axp.enableIRQ(AXP202_ALL_IRQ, true);
|
axp.enableIRQ(AXP202_ALL_IRQ, true);
|
||||||
|
|
||||||
axp.clearIRQ();
|
axp.clearIRQ();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user