Skip to content

Commit c4493b9

Browse files
committed
1. Manually revise the register comments
1 parent 98dad8a commit c4493b9

1 file changed

Lines changed: 53 additions & 35 deletions

File tree

src/M5PM1.h

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,24 @@ typedef enum {
123123
#define M5PM1_REG_PWR_CFG \
124124
0x06 // R/W [7-5] 保留 / Reserved
125125
// [4] LED_EN 默认电平状态: 0=低电平 1=高电平 / LED_EN default level: 0=low, 1=high
126-
// [3] BOOST_EN - BOOST/GROVE(5VINOUT)电源使能(视实际硬件而定) / BOOST_EN - BOOST/GROVE(5VINOUT) power
127-
// enable (hardware dependent) [2] LDO_EN - 3.3V LDO使能: 0=关闭 1=开启 / LDO_EN - 3.3V LDO enable:
128-
// 0=off, 1=on [1] DCDC_EN - 5V DCDC使能: 0=关闭 1=开启 / DCDC_EN - 5V DCDC enable: 0=off, 1=on [0]
129-
// CHG_EN - 充电使能: 0=关闭 1=开启 / CHG_EN - charging enable: 0=off, 1=on
126+
// [3] BOOST_EN - BOOST/GROVE(5VINOUT)电源使能(视实际硬件而定)
127+
// BOOST_EN - BOOST/GROVE(5VINOUT) power enable (hardware dependent)
128+
// [2] LDO_EN - 3.3V LDO使能: 0=关闭 1=开启
129+
// LDO_EN - 3.3V LDO enable: 0=off, 1=on, 0=off, 1=on
130+
// [1] DCDC_EN - 5V DCDC使能: 0=关闭 1=开启
131+
// DCDC_EN - 5V DCDC enable: 0=off, 1=on
132+
// [0] CHG_EN - 充电使能: 0=关闭 1=开启 / CHG_EN - charging enable: 0=off, 1=on
130133
// 注意:下载模式或复位事件时自动清零 / Note: Auto-clears on download mode or reset events
131134

132135
#define M5PM1_REG_HOLD_CFG \
133136
0x07 // R/W 电源保持配置 / Power hold configuration
134137
// [7] 保留 / Reserved
135-
// [6] BOOST/GROVE(5VINOUT)电源保持(视实际硬件而定) / BOOST/GROVE(5VINOUT) power hold (hardware
136-
// dependent) [5] LDO(3.3V)电源保持 / LDO(3.3V) power hold [4] GPIO4输出状态保持 / GPIO4 output state
137-
// hold [3] GPIO3输出状态保持 / GPIO3 output state hold [2] GPIO2输出状态保持 / GPIO2 output state hold
138+
// [6] BOOST/GROVE(5VINOUT)电源保持(视实际硬件而定)
139+
// BOOST/GROVE(5VINOUT) power hold (hardware dependent)
140+
// [5] LDO(3.3V)电源保持 / LDO(3.3V) power hold
141+
// [4] GPIO4输出状态保持 / GPIO4 output state hold
142+
// [3] GPIO3输出状态保持 / GPIO3 output state hold
143+
// [2] GPIO2输出状态保持 / GPIO2 output state hold
138144
// [1] GPIO1输出状态保持 / GPIO1 output state hold
139145
// [0] GPIO0输出状态保持 / GPIO0 output state hold
140146
// 注意:复位/下载模式/关机时自动清零为0x00 / Note: Auto-clears to 0x00 on reset/download/shutdown
@@ -164,8 +170,8 @@ typedef enum {
164170
0x0C // W 系统命令 / System command
165171
// [7:4] 密钥必须为0xA / [7:4] KEY must be 0xA
166172
// [3:2] 保留 / Reserved
167-
// [1:0] CMD - 00:无操作 01:关机 10:复位 11:下载模式 / CMD - 00:no-op 01:shutdown 10:reboot 11:download
168-
// mode
173+
// [1:0] CMD - 00:无操作 01:关机 10:复位 11:下载模式
174+
// CMD - 00:no-op 01:shutdown 10:reboot 11:download mode
169175

170176
// ---- GPIO寄存器 ----
171177
// ---- GPIO Registers ----
@@ -181,22 +187,27 @@ typedef enum {
181187
#define M5PM1_REG_GPIO_DRV \
182188
0x13 // R/W GPIO驱动模式 / GPIO drive mode
183189
// [7-6] 保留 / Reserved
184-
// [5] LED_EN_DRV - LED使能引脚驱动: 0=推挽 1=开漏 / LED_EN_DRV - LED enable pin drive: 0=push-pull,
185-
// 1=open-drain [4:0] GPIO驱动: 1=开漏 0=推挽 / [4:0] GPIO drive: 1=open-drain, 0=push-pull
190+
// [5] LED_EN_DRV - LED使能引脚驱动: 0=推挽 1=开漏
191+
// LED_EN_DRV - LED enable pin drive: 0=push-pull, 1=open-drain
192+
// [4:0] GPIO驱动: 1=开漏 0=推挽 / [4:0] GPIO drive: 1=open-drain, 0=push-pull
186193
#define M5PM1_REG_GPIO_PUPD0 \
187194
0x14 // R/W GPIO0-3上下拉配置 / Pull-up/down for GPIO0-3
188-
// 每GPIO占2bit: 00=无 01=上拉 10=下拉 11=保留 / Each GPIO uses 2 bits: 00=none, 01=pull-up,
189-
// 10=pull-down, 11=reserved [7:6] GPIO3, [5:4] GPIO2, [3:2] GPIO1, [1:0] GPIO0 / [7:6] GPIO3, [5:4]
190-
// GPIO2, [3:2] GPIO1, [1:0] GPIO0
195+
// 每GPIO占2bit: 00=无 01=上拉 10=下拉 11=保留
196+
// Each GPIO uses 2 bits: 00=none, 01=pull-up, 10=pull-down, 11=reserved
197+
// [7:6] GPIO3, [5:4] GPIO2, [3:2] GPIO1, [1:0] GPIO0 / [7:6] GPIO3
198+
// [5:4] GPIO2, [3:2] GPIO1, [1:0] GPIO0
191199
#define M5PM1_REG_GPIO_PUPD1 \
192200
0x15 // R/W GPIO4上下拉配置 / Pull-up/down for GPIO4
193201
// [1:0] GPIO4: 00=无 01=上拉 10=下拉 11=保留 / [1:0] GPIO4: 00=none, 01=pull-up, 10=pull-down,
194202
// 11=reserved
195203
#define M5PM1_REG_GPIO_FUNC0 \
196204
0x16 // R/W GPIO0-3功能选择 / GPIO0-3 function
197-
// 每GPIO占2bit: 00=GPIO 01=IRQ 10=WAKE 11=特殊功能 / Each GPIO uses 2 bits: 00=GPIO, 01=IRQ, 10=WAKE,
198-
// 11=special GPIO0: 11=LED_EN (NeoPixel使能) / GPIO0: 11=LED_EN (NeoPixel enable) GPIO1: 11=ADC1 /
199-
// GPIO1: 11=ADC1 GPIO2: 11=ADC2 / GPIO2: 11=ADC2 GPIO3: 11=PWM0 / GPIO3: 11=PWM0
205+
// 每GPIO占2bit: 00=GPIO 01=IRQ 10=WAKE 11=特殊功能
206+
// Each GPIO uses 2 bits: 00=GPIO, 01=IRQ, 10=WAKE, 11=special
207+
// GPIO0: 11=LED_EN (NeoPixel)
208+
// GPIO1: 11=ADC1
209+
// GPIO2: 11=ADC2
210+
// GPIO3: 11=PWM0
200211
#define M5PM1_REG_GPIO_FUNC1 \
201212
0x17 // R/W GPIO4功能选择 / GPIO4 function
202213
// [1:0] GPIO4: 00=GPIO 01=IRQ 10=WAKE 11=PWM1 / [1:0] GPIO4: 00=GPIO, 01=IRQ, 10=WAKE, 11=PWM1
@@ -222,8 +233,9 @@ typedef enum {
222233
#define M5PM1_REG_ADC_CTRL \
223234
0x2A // R/W ADC控制 / ADC control
224235
// [7-4] 保留 / Reserved
225-
// [3:1] 通道: 1=ADC1(GPIO1) 2=ADC2(GPIO2) 6=芯片内部温度 / [3:1] Channel: 1=ADC1(GPIO1), 2=ADC2(GPIO2),
226-
// 6=internal temperature [0] START - 写1启动转换 / START - write 1 to start conversion
236+
// [3:1] 通道: 1=ADC1(GPIO1) 2=ADC2(GPIO2) 6=芯片内部温度
237+
// [3:1] Channel: 1=ADC1(GPIO1), 2=ADC2(GPIO2), 6=internal temperature
238+
// [0] START - 写1启动转换 / START - write 1 to start conversion
227239

228240
// ---- PWM寄存器 ----
229241
// ---- PWM Registers ----
@@ -256,8 +268,8 @@ typedef enum {
256268
0x3C // R/W 定时器配置 / Timer configuration
257269
// [7-4] 保留 / Reserved
258270
// [3] ARM - 自动重装: 0=单次 1=自动重装 / ARM - auto reload: 0=one-shot, 1=auto
259-
// [2:0] ACTION - 超时动作: 000=停止 001=标志 010=复位 011=开机 100=关机 / ACTION: 000=stop, 001=flag,
260-
// 010=reboot, 011=power on, 100=shutdown
271+
// [2:0] ACTION - 超时动作: 000=停止 001=标志 010=复位 011=开机 100=关机
272+
// ACTION: 000=stop, 001=flag, 010=reboot, 011=power on, 100=shutdown
261273
#define M5PM1_REG_TIM_KEY 0x3D // W 写入0xA5重载定时器 / Write 0xA5 to reload timer
262274

263275
// ---- 中断寄存器 ----
@@ -292,22 +304,28 @@ typedef enum {
292304
// ---- 按钮寄存器 ----
293305
// ---- Button Registers ----
294306
#define M5PM1_REG_BTN_STATUS \
295-
0x48 // R 按钮状态 / Button status
296-
// [7] BTN_FLAG - 按钮曾被按下标志(读取后自动清除) / BTN_FLAG - button pressed flag (auto-clears on
297-
// read) [6-1] 保留 / Reserved [0] BTN_STATE - 当前按钮状态: 0=释放 1=按下 / BTN_STATE - current button
298-
// state: 0=release, 1=pressed
307+
0x48 // R 按钮状态 / Button status
308+
// [7] BTN_FLAG - 按钮曾被按下标志(读取后自动清除)
309+
// BTN_FLAG - button pressed flag (auto-clears on read)
310+
// [6-1] 保留 / Reserved
311+
// [0] BTN_STATE - 当前按钮状态: 0=释放 1=按下
312+
// BTN_STATE - current button state: 0=release, 1=pressed
299313
#define M5PM1_REG_BTN_CFG_1 0x49 // R/W 按钮配置 / Button configuration
300-
// [7] DL_LOCK - 下载模式锁定: 0=正常 1=锁定(禁止进入下载模式) / DL_LOCK - download mode lock: 0=normal,
301-
// 1=locked (disable download mode) [6:5] DBL_DLY - 双击间隔: 00=125ms 01=250ms 10=500ms 11=1s / DBL_DLY -
302-
// double-click gap: 00=125ms, 01=250ms, 10=500ms, 11=1s [4:3] LONG_DLY - 长按延时: 00=1s 01=2s 10=3s 11=4s /
303-
// LONG_DLY - long-press delay: 00=1s, 01=2s, 10=3s, 11=4s [2:1] CLK_DLY - 单击延时: 00=125ms 01=250ms 10=500ms
304-
// 11=1s / CLK_DLY - click delay: 00=125ms, 01=250ms, 10=500ms, 11=1s [0] SINGLE_RST_DIS - 单击复位禁用: 0=使能
305-
// 1=禁用 / SINGLE_RST_DIS - single-click reset disable: 0=enable, 1=disable
314+
// [7] DL_LOCK - 下载模式锁定: 0=正常 1=锁定(禁止进入下载模式)
315+
// DL_LOCK - download mode lock: 0=normal, 1=locked (disable download mode)
316+
// [6:5] DBL_DLY - 双击间隔: 00=125ms 01=250ms 10=500ms 11=1s
317+
// DBL_DLY - double-click gap: 00=125ms, 01=250ms, 10=500ms, 11=1s
318+
// [4:3] LONG_DLY - 长按延时: 00=1s 01=2s 10=3s 11=4s
319+
// LONG_DLY - long-press delay: 00=1s, 01=2s, 10=3s, 11=4s
320+
// [2:1] CLK_DLY - 单击延时: 00=125ms 01=250ms 10=500ms 11=1s
321+
// CLK_DLY - click delay: 00=125ms, 01=250ms, 10=500ms, 11=1s
322+
// [0] SINGLE_RST_DIS - 单击复位禁用: 0=使能 1=禁用
323+
// SINGLE_RST_DIS - single-click reset disable: 0=enable, 1=disable
306324
#define M5PM1_REG_BTN_CFG_2 \
307325
0x4A // R/W 按钮配置2 / Button configuration 2
308326
// [7-1] 保留 / Reserved
309-
// [0] DOUBLE_OFF_DIS - 双击关机禁用: 0=使能 1=禁用 / DOUBLE_OFF_DIS - double-click shutdown disable:
310-
// 0=enable, 1=disable
327+
// [0] DOUBLE_OFF_DIS - 双击关机禁用: 0=使能 1=禁用
328+
// DOUBLE_OFF_DIS - double-click shutdown disable: 0=enable, 1=disable
311329

312330
// ---- NeoPixel寄存器 ----
313331
// ---- NeoPixel Registers ----
@@ -335,8 +353,8 @@ typedef enum {
335353
#define M5PM1_REG_RTC_RAM_START 0xA0 // R/W RTC RAM起始 / RTC RAM start (32 bytes)
336354
#define M5PM1_REG_RTC_RAM_END \
337355
0xBF // R/W RTC RAM结束 / RTC RAM end
338-
// 睡眠期间数据保持,可用于存储小量重要数据 / Data retained during sleep, for storing small important
339-
// data
356+
// 睡眠期间数据保持,可用于存储小量重要数据
357+
// Data retained during sleep, for storing small important data
340358

341359
// ============================
342360
// 位定义

0 commit comments

Comments
 (0)