From e47659cabd0e1c039ca4994797e049415d1b5dc7 Mon Sep 17 00:00:00 2001 From: Arnold Feng Date: Fri, 11 Jul 2025 17:16:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E6=96=B0=E5=A2=9EESP8266=E7=9A=84README.?= =?UTF-8?q?md=E3=80=81README-zh.md=202.=E6=96=B0=E5=A2=9EHDC1080=E7=9A=84R?= =?UTF-8?q?EADME.md=E3=80=81README-zh.md=203.=E6=96=B0=E5=A2=9EHDC2080?= =?UTF-8?q?=E7=9A=84README.md=E3=80=81README-zh.md=204.=E6=96=B0=E5=A2=9EL?= =?UTF-8?q?76K=5FGNSS=E7=9A=84README.md=E3=80=81README-zh.md=205.=E6=96=B0?= =?UTF-8?q?=E5=A2=9ELCD=E7=9A=84README.md=E3=80=81README-zh.md=206.?= =?UTF-8?q?=E6=96=B0=E5=A2=9Ekeyscan=E7=9A=84README.md=E3=80=81README-zh.m?= =?UTF-8?q?d=207.=E6=96=B0=E5=A2=9EADXL346=E7=9A=84README.md=E3=80=81READM?= =?UTF-8?q?E-zh.md=208.=E6=96=B0=E5=A2=9EAW9523B=E7=9A=84README.md?= =?UTF-8?q?=E3=80=81README-zh.md=209.=E6=96=B0=E5=A2=9EBH1750=E7=9A=84READ?= =?UTF-8?q?ME.md=E3=80=81README-zh.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/ADXL346/README-zh.md | 167 ++++++++++++ libraries/ADXL346/README.md | 169 +++++++------ libraries/AW9523B/README-zh.md | 77 ++++++ libraries/AW9523B/README.md | 82 ++++++ libraries/BH1750(GY-302)/README-zh.md | 63 +++++ libraries/BH1750(GY-302)/README.md | 55 ++-- libraries/ESP8266/README.md | 0 libraries/HDC1080/README-zh.md | 49 ++++ libraries/HDC2080/README-zh.md | 49 ++++ libraries/HDC2080/README.md | 49 ---- libraries/L76K/README-zh.md | 133 ++++++++++ libraries/L76K/README.md | 136 ++++++++++ libraries/LCD/README-zh.md | 319 +++++++++++++++++++++++ libraries/LCD/README.md | 350 ++++++++++++++------------ libraries/keyscan/README-zh.md | 51 ++++ libraries/keyscan/README.md | 50 ++++ 16 files changed, 1482 insertions(+), 317 deletions(-) create mode 100644 libraries/ADXL346/README-zh.md create mode 100644 libraries/AW9523B/README-zh.md create mode 100644 libraries/AW9523B/README.md create mode 100644 libraries/BH1750(GY-302)/README-zh.md create mode 100644 libraries/ESP8266/README.md create mode 100644 libraries/HDC1080/README-zh.md create mode 100644 libraries/HDC2080/README-zh.md create mode 100644 libraries/L76K/README-zh.md create mode 100644 libraries/L76K/README.md create mode 100644 libraries/LCD/README-zh.md create mode 100644 libraries/keyscan/README-zh.md create mode 100644 libraries/keyscan/README.md diff --git a/libraries/ADXL346/README-zh.md b/libraries/ADXL346/README-zh.md new file mode 100644 index 0000000..1da35b1 --- /dev/null +++ b/libraries/ADXL346/README-zh.md @@ -0,0 +1,167 @@ +# adxl346 + +默认初始化2G量程。 + +**类引用:** + +```python +from adxl346 import Adxl346 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ------- | ----------------------------------- | +| i2c | 是 | i2c对象 | 如I2C(I2C.I2C1, I2C.STANDARD_MODE) | +| dev_addr | 否 | int | 默认0x53 | + +```python +i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE) +adxl = Adxl346(i2c_dev) +``` + +**接口函数:** + +l **set_range(range=0)** + +设置量程。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| range | 否 | int | range_2g:0;
range_4g :1;
range_8g :2;
range_16g:3 | + +返回值: + +​ 无。 + +l **int_enable(int_code,tap_thr,dur,tap_axis,laten,window,ff_thr,ff_time,act_thr,act_axis,inact_thr,inact_axis,inact_time)** + +​ 中断使能。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ---------- | ---- | ---- | ------------------------------------------------------------ | +| int_code | 是 | int | 中断类型
单击中断:0x40
双击中断:0x20
运动中断:0x10
静止中断:0x08
自由落体中断:0x04 | +| tap_thr | 否 | int | 单双击中断选配
敲击中断阈值,默认0x30,建议不要小于该值 | +| dur | 否 | int | 单双击中断选配
敲击期间,默认0x20,建议大于0x10 | +| tap_axis | 否 | int | 单双击中断选配
敲击轴,默认0x07,既xyz,
只x轴:0x04
只y轴:0x02
只z轴:0x01 | +| laten | 否 | int | 双击中断选配
延迟,双击需在单击检测后该段时间外触发,默认0x15 | +| window | 否 | int | 双击中断选配
窗口,双击需在该时间内完成,默认0xff | +| ff_thr | 否 | int | 自由落体中断选配
加速度阈值,触发需大于该加速度,默认0x06,建议3-9 | +| ff_time | 否 | int | 自由落体中断选配
加速度时间,触发需大于该时间,默认0x15,建议0x14-0x46 | +| act_thr | 否 | int | 运动中断选配
加速度阈值,触发需大于该加速度,默认0x03 | +| act_axis | 否 | int | 运动中断选配,运动轴,默认0xf0
只x轴:0xc0
只y轴:0xa0
只z轴:0x90 | +| inact_thr | 否 | int | 静止中断选配
加速度阈值,触发需大于该加速度,默认0x03 | +| inact_axis | 否 | int | 静止中断选配,运动轴,默认0x0f
只x轴:0x0c
只y轴:0x0a
只z轴:0x09 | +| inact_time | 否 | int | 静止中断选配
静止保持时间,触发需静止大于该时间,默认0x03 | + +返回值: + +​ 0 :成功 + +​ -1 : 失败 + +l **clear_int(int_code)** + +​ 清除某中断使能。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ---- | ------------------------------------------------------------ | +| int_code | 是 | int | 中断类型
单击中断:0x40
双击中断:0x20
运动中断:0x10
静止中断:0x08
自由落体中断:0x04 | + +返回值: + +​ 无 + +l **read_acceleration()** + +​ 读取三轴加速度。 + +参数: + +​ 无。 + +返回值: + +| 名称 | 类型 | 说明 | +| ------- | ----- | --------------------- | +| (x,y,z) | tuple | x, y, z轴加速度,单位G | + + + +l **process_single_tap ()** + +​ 循环读取中断源寄存器,单击中断检测。 + +​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保单击中断使能并配置正确。 + +参数: + +​ 无。 + +返回值: + +​ 1:检测到单击中断 + +l **process_double_tap()** + +​ 循环读取中断源寄存器,双击中断检测。 + +​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保双击中断使能并配置正确。 + +参数: + +​ 无。 + +返回值: + +​ 1:检测到双击中断 + +l **process_act ()** + +​ 循环读取中断源寄存器,运动中断检测。 + +​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保运动中断使能并配置正确。 + +参数: + +​ 无。 + +返回值: + +​ 1:检测到运动中断 + +l **process_inact()** + +​ 循环读取中断源寄存器,静止中断检测。 + +​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保静止中断使能并配置正确。 + +参数: + +​ 无。 + +返回值: + +​ 1:检测到静止中断 + +l **process_ff ()** + +​ 循环读取中断源寄存器,自由落体中断检测。 + +​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保自由落体中断使能并配置正确。 + +参数: + +​ 无。 + +返回值: + +​ 1:检测到自由落体中断 diff --git a/libraries/ADXL346/README.md b/libraries/ADXL346/README.md index 1da35b1..eae5b53 100644 --- a/libraries/ADXL346/README.md +++ b/libraries/ADXL346/README.md @@ -1,167 +1,178 @@ # adxl346 -默认初始化2G量程。 -**类引用:** +Default initialization for a 2G range. + +**Class Reference:** ```python from adxl346 import Adxl346 ``` - -**实例化参数:** +**Instantiation Parameters:** -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | -------- | ---- | ------- | ----------------------------------- | -| i2c | 是 | i2c对象 | 如I2C(I2C.I2C1, I2C.STANDARD_MODE) | -| dev_addr | 否 | int | 默认0x53 | +| I2C | Yes | I2C object | Such as I2C(I2C.I2C1, I2C.STANDARD_MODE) | +| Device address | No | int | Default: 0x53 | ```python i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE) adxl = Adxl346(i2c_dev) ``` -**接口函数:** + +**Interface Function:** l **set_range(range=0)** -设置量程。 -参数: +Set the range. -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| range | 否 | int | range_2g:0;
range_4g :1;
range_8g :2;
range_16g:3 | +Parameters: -返回值: +| Name | Required | Type | Description | +| ----- | ---- | ---- | ------------ | +| range | No | int | range_2g: 0;
range_4g : 1;
range_8g : 2;
range_16g: 3 | -​ 无。 +Return value: + +No. l **int_enable(int_code,tap_thr,dur,tap_axis,laten,window,ff_thr,ff_time,act_thr,act_axis,inact_thr,inact_axis,inact_time)** -​ 中断使能。 -参数: +Interrupt enable. + +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ---------- | ---- | ---- | ------------------------------------------------------------ | -| int_code | 是 | int | 中断类型
单击中断:0x40
双击中断:0x20
运动中断:0x10
静止中断:0x08
自由落体中断:0x04 | -| tap_thr | 否 | int | 单双击中断选配
敲击中断阈值,默认0x30,建议不要小于该值 | -| dur | 否 | int | 单双击中断选配
敲击期间,默认0x20,建议大于0x10 | -| tap_axis | 否 | int | 单双击中断选配
敲击轴,默认0x07,既xyz,
只x轴:0x04
只y轴:0x02
只z轴:0x01 | -| laten | 否 | int | 双击中断选配
延迟,双击需在单击检测后该段时间外触发,默认0x15 | -| window | 否 | int | 双击中断选配
窗口,双击需在该时间内完成,默认0xff | -| ff_thr | 否 | int | 自由落体中断选配
加速度阈值,触发需大于该加速度,默认0x06,建议3-9 | -| ff_time | 否 | int | 自由落体中断选配
加速度时间,触发需大于该时间,默认0x15,建议0x14-0x46 | -| act_thr | 否 | int | 运动中断选配
加速度阈值,触发需大于该加速度,默认0x03 | -| act_axis | 否 | int | 运动中断选配,运动轴,默认0xf0
只x轴:0xc0
只y轴:0xa0
只z轴:0x90 | -| inact_thr | 否 | int | 静止中断选配
加速度阈值,触发需大于该加速度,默认0x03 | -| inact_axis | 否 | int | 静止中断选配,运动轴,默认0x0f
只x轴:0x0c
只y轴:0x0a
只z轴:0x09 | -| inact_time | 否 | int | 静止中断选配
静止保持时间,触发需静止大于该时间,默认0x03 | +| Name | Required | Type | Description | +| ---------- | ---- | ---- | ------------------------------ | +| int_code | Yes | int | Interrupt type
Single-click interrupt: 0x40
Double-click interrupt: 0x20
Motion interrupt: 0x10
Stationary interrupt: 0x08
Free fall interrupt: 0x04 | +| tap_thr | No | int | Optional for single or double click interrupts
Click threshold, default 0x30, recommended not to be less than this value | +| dur | No | int | Optional for single or double click interrupts
Click duration, default 0x20, recommended to be greater than 0x10 | +| tap_axis | No | int | Optional for single or double click interrupts
Click axis, default 0x07, which is xyz
Only x-axis: 0x04
Only y-axis: 0x02
Only z-axis: 0x01 | +| laten | No | int | Optional for double click interrupts
Delay, double click needs to be triggered after the single click detection for this period, default 0x15 | +| window | No | int | Optional for double click interrupts
Window, double click needs to be completed within this time, default 0xff | +| ff_thr | No | int | Optional for free fall interrupt
Acceleration threshold, trigger needs to be greater than this acceleration, default 0x06, recommended 3-9 | +| ff_time | No | int | Optional for free fall interrupt
Acceleration time, trigger needs to be greater than this time, default 0x15, recommended 0x14-0x46 | +| act_thr | No | int | Optional for motion interrupt
Acceleration threshold, trigger needs to be greater than this acceleration, default 0x03 | +| act_axis | No | int | Optional for motion interrupt, motion axis, default 0xf0
Only x-axis: 0xc0
Only y-axis: 0xa0
Only z-axis: 0x90 | +| inact_thr | No | int | Optional for stationary interrupt
Acceleration threshold, trigger needs to be greater than this acceleration, default 0x03 | +| inact_axis | No | int | Optional for stationary interrupt, motion axis, default 0x0f
Only x-axis: 0x0c
Only y-axis: 0x0a
Only z-axis: 0x09 | +| inact_time | No | int | Optional for stationary interrupt
Stationary duration, trigger needs to be stationary for more than this time, default 0x03 | -返回值: +Return value: -​ 0 :成功 +0 : Success -​ -1 : 失败 +-1 : Failure l **clear_int(int_code)** -​ 清除某中断使能。 +Clear the enable of a certain interrupt. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| -------- | ---- | ---- | ------------------------------------------------------------ | -| int_code | 是 | int | 中断类型
单击中断:0x40
双击中断:0x20
运动中断:0x10
静止中断:0x08
自由落体中断:0x04 | +| Name | Required | Type | Description | +| -------- | ---- | ---- | --------------------- | +| int_code | Yes | int | Interrupt type
Single-click interrupt: 0x40
Double-click interrupt: 0x20
Movement interrupt: 0x10
Stationary interrupt: 0x08
Free fall interrupt: 0x04 | -返回值: +Return value: + +No -​ 无 l **read_acceleration()** -​ 读取三轴加速度。 -参数: +Read the three-axis acceleration. + +Parameters: -​ 无。 +No. -返回值: +Return value: -| 名称 | 类型 | 说明 | +| Name | Type | Description | | ------- | ----- | --------------------- | -| (x,y,z) | tuple | x, y, z轴加速度,单位G | +|(x, y, z) | tuple | Axial accelerations along the x, y, and z axes, in units of G | + + - l **process_single_tap ()** -​ 循环读取中断源寄存器,单击中断检测。 -​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保单击中断使能并配置正确。 +Loop through reading the interrupt source register and click on interrupt detection. + +Note: If no interruption is detected, it will result in an infinite loop. It is recommended to execute it in the main thread with caution. Before execution, make sure to enable the interruption and configure it correctly. -参数: +Parameters: -​ 无。 +No. -返回值: +Return value: -​ 1:检测到单击中断 +Detected a click interruption l **process_double_tap()** -​ 循环读取中断源寄存器,双击中断检测。 -​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保双击中断使能并配置正确。 +Loop through reading the interrupt source register, and double-click the interrupt detection. + +Note: If no interruption is detected, it will result in an infinite loop. It is recommended to execute it in the main thread with caution. Before execution, make sure to enable the interrupt function and configure it correctly by double-clicking. -参数: +Parameters: -​ 无。 +No. -返回值: +Return value: -​ 1:检测到双击中断 +Detected double-click interruption l **process_act ()** -​ 循环读取中断源寄存器,运动中断检测。 -​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保运动中断使能并配置正确。 +Loop through reading the interrupt source register and perform motion interrupt detection. -参数: +Note: If no interruption is detected, it will result in an infinite loop. It is recommended to execute it in the main thread with caution. Before execution, make sure that the motion interruption is enabled and configured correctly. -​ 无。 +Parameters: -返回值: +No. -​ 1:检测到运动中断 +Return value: + +Motion interruption has been detected. l **process_inact()** -​ 循环读取中断源寄存器,静止中断检测。 -​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保静止中断使能并配置正确。 +Loop through reading the interrupt source register and perform static interrupt detection. + +Note: If no interruption is detected, it will result in an infinite loop. It is recommended to execute it in the main thread with caution. Before execution, make sure that the interrupt enable is enabled and the configuration is correct. -参数: +Parameters: -​ 无。 +No. -返回值: +Return value: -​ 1:检测到静止中断 +Detected a static interruption l **process_ff ()** -​ 循环读取中断源寄存器,自由落体中断检测。 -​ 注:未检测到中断则死循环,谨慎在主线程执行,执行前请确保自由落体中断使能并配置正确。 +Loop through reading the interrupt source register and detect free-fall interrupts. + +Note: If no interruption is detected, it will result in an infinite loop. It is recommended to execute it in the main thread with caution. Before execution, make sure that the free fall interruption is enabled and configured correctly. -参数: +Parameters: -​ 无。 +No. -返回值: +Return value: -​ 1:检测到自由落体中断 +1: Detected a break in free fall \ No newline at end of file diff --git a/libraries/AW9523B/README-zh.md b/libraries/AW9523B/README-zh.md new file mode 100644 index 0000000..79e810a --- /dev/null +++ b/libraries/AW9523B/README-zh.md @@ -0,0 +1,77 @@ +AW9523 GPIO扩展器驱动模块 + +**类引用** +```python +from aw9523 import AW9523 +``` + +实例化参数 + +| 名称 | 必填 | 类型 | 说明 | +|----|----|----|----| +| i2c_bus | 是 | I2C对象 | I2C总线对象 | +| int_pin | 否 | int | 中断引脚号,默认1 | +| int_mode | 否 | int | 中断模式,默认0 | +| int_callback | 否 | function | 中断回调函数 | +| address | 否 | int | I2C设备地址,默认0x58(按键驱动地址)| + +端口对象 + +```python +porta = Port(0, aw) # 端口A +portb = Port(1, aw) # 端口B +``` + +主要方法 + +l reset() + +复位AW9523芯片。 + +​​参数:​​ + +无 +​​返回值:​​ + +无 + +l pin(pin, mode=None, value=None, interrupt_enable=None) + +配置单个引脚。 + +​​参数:​​ + +| 名称 | 类型 | 说明 | +|----|----|----| +| pin | int | 引脚号(0-15) | +| mode | int | 模式:0=输出,1=输入 | +| value | int | 输出值:0=低电平,1=高电平 | +| interrupt_enable | int | 中断使能:0=禁用,1=启用 | + +​​返回值:​​ + +设置值时:无 +读取值时:当前引脚电平(0或1) + +read(pin) + +读取单个引脚电平。 + +​​参数:​​ +| 名称 | 类型 | 说明 | +|----|----|----| +| pin | int | 引脚号(0-15)| + +​​返回值:​​ + +0:低电平 +1:高电平 + +全局属性 + +| 属性 | 类型 | 说明 | +|----|----|----| +| mode | int | 所有引脚模式(读写)| +| interrupt_enable | int | 所有引脚中断使能(读写)| +| interrupt_flag | int | 所有引脚中断标志(只读)| +| gpio | int | 所有GPIO值(读写)| \ No newline at end of file diff --git a/libraries/AW9523B/README.md b/libraries/AW9523B/README.md new file mode 100644 index 0000000..709b1bc --- /dev/null +++ b/libraries/AW9523B/README.md @@ -0,0 +1,82 @@ +AW9523 GPIO Expansion Driver Module + +"Class Reference" + +```python +from aw9523 import AW9523 +``` + + +Instantiation parameters + +| Name | Required | Type | Description | +|---- |----|----|----| +| i2c_bus | Yes | I2C object | I2C bus object | +| int_pin | No | int | Interrupt pin number, default 1 | +| int_mode | No | int | Interrupt mode, default 0 | +| int_callback | No | function | Interrupt callback function | +| address | No | int | I2C device address, default 0x58 (keypad driver address) | + +Port object + +```python +porta = Port(0, aw) # Port A +portb = Port(1, aw) # Port B +``` + + +**Main method:** + +l reset() + + +Reset the AW9523 chip. + +Parameters: + +No + +Return value: + +No + +l pin(pin, mode=None, value=None, interrupt_enable=None) + +Configure a single pin. + +Parameters: + +| Name | Type | Description | +|----|----|----| +| pin | int | Pin number (0-15) | +| mode | int | Mode: 0 = Output, 1 = Input | +| value | int | Output value: 0 = Low level, 1 = High level | +| interrupt_enable | int | Interrupt enable: 0 = Disable, 1 = Enable | + +Return value: + +When setting the value: None +When reading the value: Current pin level (0 or 1) + +l read(pin) + +Read the level of a single pin. + +Parameters: +| Name | Type | Description | +|----|----|----| +| pin | int | Pin number (0-15) | + +Return value: + +0: Low level +1: High level + +Global attribute + +| Attribute | Type | Description | +|----|----|----| +| mode | int | All pin modes (read/write) | +| interrupt_enable | int | All pin interrupt enable (read/write) | +| interrupt_flag | int | All pin interrupt flags (read-only) | +| gpio | int | All GPIO values (read/write) | \ No newline at end of file diff --git a/libraries/BH1750(GY-302)/README-zh.md b/libraries/BH1750(GY-302)/README-zh.md new file mode 100644 index 0000000..1230ba4 --- /dev/null +++ b/libraries/BH1750(GY-302)/README-zh.md @@ -0,0 +1,63 @@ +# BH1750(gy-302) + +**类引用:** + +```python +from BH1750 import Bh1750 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ------- | ---- | +| i2c | 是 | i2c对象 | | +| dev_addr | 否 | int | 0x23 | + +```python +i2c_obj=I2C(I2C.I2C1,I2C.STANDARD_MODE) +bh1750 = Bh1750(i2c_obj) +``` + +**接口函数:** + +l **on(), off(), reset()** + +​ 开启传感器,使传感器非活动状态,重置传感器。 + +参数: + +​ 无。 + +返回值: + +​ 无。 + +l **set_measure_mode(mode)** + +​ 设置测量模式,持续测量或单次测量,不同精度。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ---- | ---- | ---- | ------------------------------------------------------------ | +| mode | 否 | int | 默认0.5lx精度;
0x10:(1lx精度)
0x13:(0.5lx精度) | + +返回值: + +​ 无 + +l **read ()** + +读取照度值。 + +参数: + +​ 无。 + +返回值: + +| 名称 | 类型 | 说明 | +| ---- | ---- | -------- | +| lux | int | 光照度值 | diff --git a/libraries/BH1750(GY-302)/README.md b/libraries/BH1750(GY-302)/README.md index 1230ba4..67c1979 100644 --- a/libraries/BH1750(GY-302)/README.md +++ b/libraries/BH1750(GY-302)/README.md @@ -1,63 +1,68 @@ # BH1750(gy-302) -**类引用:** + +**Class Reference: ** ```python from BH1750 import Bh1750 ``` - -**实例化参数:** +**Instantiation Parameters:** -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | -------- | ---- | ------- | ---- | -| i2c | 是 | i2c对象 | | -| dev_addr | 否 | int | 0x23 | +| I2C | Yes | I2C object | | +| Device address | No | int | 0x23 | ```python i2c_obj=I2C(I2C.I2C1,I2C.STANDARD_MODE) bh1750 = Bh1750(i2c_obj) ``` -**接口函数:** + +**Interface Function: ** l **on(), off(), reset()** -​ 开启传感器,使传感器非活动状态,重置传感器。 -参数: +Activate the sensor, put it in an inactive state, and reset the sensor. + +Parameters: -​ 无。 +No. -返回值: +Return value: -​ 无。 +No. l **set_measure_mode(mode)** -​ 设置测量模式,持续测量或单次测量,不同精度。 -参数: +Set the measurement mode, for continuous measurement or single measurement, with different levels of accuracy. -| 名称 | 必填 | 类型 | 说明 | -| ---- | ---- | ---- | ------------------------------------------------------------ | -| mode | 否 | int | 默认0.5lx精度;
0x10:(1lx精度)
0x13:(0.5lx精度) | +Parameters: -返回值: +| Name | Required | Type | Description | +| ---- | ---- | ---- | ------------------------- | +| mode | No | int | Default: 0.5lx precision;
0x10: (1lx precision)
0x13: (0.5lx precision) | + +Return value: + +No -​ 无 l **read ()** -读取照度值。 -参数: +Read the illuminance value. + +Parameters: -​ 无。 +No. -返回值: +Return value: -| 名称 | 类型 | 说明 | +| Name | Type | Description | | ---- | ---- | -------- | -| lux | int | 光照度值 | +| lux | int | Illuminance value | \ No newline at end of file diff --git a/libraries/ESP8266/README.md b/libraries/ESP8266/README.md new file mode 100644 index 0000000..e69de29 diff --git a/libraries/HDC1080/README-zh.md b/libraries/HDC1080/README-zh.md new file mode 100644 index 0000000..c65bb25 --- /dev/null +++ b/libraries/HDC1080/README-zh.md @@ -0,0 +1,49 @@ +# HDC1080 + +**类引用:** + +```python +from hdc1080 import Hdc1080 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ---- | ----------------------- | +| i2c_obj | 是 | int | i2c对象 | +| dev_addr | 否 | int | i2c从设备地址,默认0x40 | + +```python +i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE) +hdc = Hdc1080(i2c_dev) +``` + +**接口函数:** + +l **read()** + +​ 读取寄存器值转化成湿度和温度 + +参数: + +​ 无。 + +返回值: + +| 名称 | 类型 | 说明 | +| ---------------------- | ----- | ---------- | +| (humidity,temperature) | tuple | 湿度,温度 | + +l **reset()** + +​ 重置hdc1080 + +参数: + +​ 无。 + +返回值: + +​ 无。 diff --git a/libraries/HDC2080/README-zh.md b/libraries/HDC2080/README-zh.md new file mode 100644 index 0000000..d23d5b1 --- /dev/null +++ b/libraries/HDC2080/README-zh.md @@ -0,0 +1,49 @@ +# HDC2080 + +**类引用:** + +```python +from hdc2080 import Hdc2080 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ---- | ----------------------- | +| i2c_obj | 是 | int | i2c对象 | +| dev_addr | 否 | int | i2c从设备地址,默认0x40 | + +```python +i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE) +hdc = Hdc2080(i2c_dev) +``` + +**接口函数:** + +l **read()** + +​ 读取寄存器值转化成湿度和温度 + +参数: + +​ 无。 + +返回值: + +| 名称 | 类型 | 说明 | +| ---------------------- | ----- | ---------- | +| (humidity,temperature) | tuple | 湿度,温度 | + +l **reset()** + +​ 重置hdc1080 + +参数: + +​ 无。 + +返回值: + +​ 无。 diff --git a/libraries/HDC2080/README.md b/libraries/HDC2080/README.md index d23d5b1..e69de29 100644 --- a/libraries/HDC2080/README.md +++ b/libraries/HDC2080/README.md @@ -1,49 +0,0 @@ -# HDC2080 - -**类引用:** - -```python -from hdc2080 import Hdc2080 -``` - - - -**实例化参数:** - -| 名称 | 必填 | 类型 | 说明 | -| -------- | ---- | ---- | ----------------------- | -| i2c_obj | 是 | int | i2c对象 | -| dev_addr | 否 | int | i2c从设备地址,默认0x40 | - -```python -i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE) -hdc = Hdc2080(i2c_dev) -``` - -**接口函数:** - -l **read()** - -​ 读取寄存器值转化成湿度和温度 - -参数: - -​ 无。 - -返回值: - -| 名称 | 类型 | 说明 | -| ---------------------- | ----- | ---------- | -| (humidity,temperature) | tuple | 湿度,温度 | - -l **reset()** - -​ 重置hdc1080 - -参数: - -​ 无。 - -返回值: - -​ 无。 diff --git a/libraries/L76K/README-zh.md b/libraries/L76K/README-zh.md new file mode 100644 index 0000000..eb1d045 --- /dev/null +++ b/libraries/L76K/README-zh.md @@ -0,0 +1,133 @@ +GNSS 定位模块驱动 + +**类引用:** + +```python +from gnss_driver import Gnss +``` + +**实例化参数:** +| 名称 | 必填 | 类型 | 说明 | +|----|----|----|----| +| uartn | 是 | int | UART端口号 | +| baudrate | 是 | int | 波特率 | +| databits | 是 | int | 数据位 | +| parity | 是 | int | 校验位 | +| stopbits | 是 | int | 停止位 | +| flowctl | 是 | int | 流控 | +```python + gnss = Gnss(1, 9600, 8, 0, 1, 0) +``` +**接口函数:** + +l read_gnss(retry=1, debug=0) + +读取GNSS原始数据。 + +​​参数:​​ + +| 名称 | 类型 | 默认值 | 说明 | +|----|----|----|----| +| retry | int | 1 | 重试次数 | +| debug | int | 0 | 调试模式 | + +​​返回值:​​ + +-1:失败&nbst(data_valid, data):成功 + +data_valid:数据有效位(0x01-0x07) + +data:原始GNSS数据 + +l isFix() + +检查是否定位成功。 + +​​返回值:​​ + +1:定位成功 +0:定位失败 + +l getUtcTime() + +获取定位的UTC时间。 + +​​返回值:​​ + +成功:UTC时间字符串 + +失败:-1 + +l getLocationMode() + +获取定位模式。 + +​​返回值:​​ + +-1:获取失败 + +0:定位不可用 + +1:GPS/SPS模式 + +2:DGPS/DSPS模式 + +6:估算模式 + +l getUsedSateCnt() + +获取定位使用的卫星数量。 + +​​返回值:​​ + +成功:卫星数量 + +失败:-1 + +l getLocation() + +获取经纬度信息。 + +​​返回值:​​ + +成功:(经度, 经度方向, 纬度, 纬度方向) + +失败:-1 + +l getViewedSateCnt() + +获取可见卫星数量。 + +​​返回值:​​ + +成功:卫星数量 + +失败:-1 + +l getGeodeticHeight() + +获取海拔高度。 + +​​返回值:​​ + +成功:海拔高度(米) + +失败:-1 + +l getCourse() + +获取卫星方位角。 + +​​返回值:​​ + +字典:{卫星编号: 方位角} + +l getSpeed() + +获取对地速度。 + +​​返回值:​​ + +成功:速度(KM/h) + +失败:-1 diff --git a/libraries/L76K/README.md b/libraries/L76K/README.md new file mode 100644 index 0000000..84a3934 --- /dev/null +++ b/libraries/L76K/README.md @@ -0,0 +1,136 @@ +GNSS 定位模块驱动 + +**Class reference:** + +```python +from gnss_driver import Gnss +``` + +**Instance parameters:** +| Name | Required | Type | Description | |----|----|----|----| +| uartn | is | int | UART port number | +| baudrate | is | int | Baud rate | +| databits | is | int | Data bits | +| parity | is | int | Parity bit | +| stopbits | is | int | Stop bits | +| flowctl | is | int | Flow control | + +```python + gnss = Gnss(1, 9600, 8, 0, 1, 0) +``` +**Interface function:** + +l read_gnss(retry=1, debug=0) + +Read the raw data of GNSS. + +Parameters: + +| Name | Type | Default Value | Description | +|----|----|----|----| +| retry | int | 1 | Number of retries | +| debug | int | 0 | Debug mode | + +Return value: + +-1: Failure + +(data_valid, data): Success + +data_valid: Data Valid Bit (0x01 - 0x07) + +data: Raw GNSS data + +l isFix() + +Check if the positioning was successful. + +Return value: + +1: Successful positioning + +0: Failed positioning + +l getUtcTime() + +Obtain the UTC time for positioning. + +Return value: + +Success: UTC time string + +Failure: -1 + +l getLocationMode() + +Obtain the positioning mode. + +Return value: + +-1: Failure in acquisition + +0: Positioning is unavailable + +GPS/SPS mode + +2: DGPS/DSPS Mode + +6: Estimation Mode + +l getUsedSateCnt() + +Obtain the number of satellites used for positioning. + +Return value: + +Success: Number of satellites + +Failure: -1 + +l getLocation() + +Obtain the latitude and longitude information. + +Return value: + +Success: (Longitude, Longitude direction, Latitude, Latitude direction) + +Failure: -1 + +l getViewedSateCnt() + +Obtain the number of visible satellites. + +Return value: + +Success: Number of satellites + +Failure: -1 + +l getGeodeticHeight() + +Obtain the altitude. + +Return value: + +Success: Altitude (in meters) + +Failure: -1 + +l getCourse() + +Obtain the satellite azimuth angle. + +Return value: + +Dictionary: {Satellite Number: Azimuth} + +l getSpeed() + +Obtain the ground speed. + +Return value: + +Success: Speed (KM/h) + +Failure: -1 \ No newline at end of file diff --git a/libraries/LCD/README-zh.md b/libraries/LCD/README-zh.md new file mode 100644 index 0000000..5111b82 --- /dev/null +++ b/libraries/LCD/README-zh.md @@ -0,0 +1,319 @@ +# LCD 应用指导文档 + +## 接口说明 + +### st7789 + +**类引用:** + +```python +from peripheral.lcd.st7789 import St7789 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ----- | ----------------------- | +| InitData | 否 | tuple | 传入 LCD 的配置命令 | +| width | 否 | int | LCD 屏幕的宽度,默认240 | +| height | 否 | int | LCD 屏幕的高度,默认240 | +| clk | 否 | int | LCD SPI 时钟,默认13000 | + +``` +lcd_test = St7789() +``` + +**接口函数:** + +l **DrawPoint(x, y, color)** + +​ 画点。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| x | 是 | int | x坐标 | +| y | 是 | int | y坐标 | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **Clear (color)** + +​ 清屏。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **Fill(x_s, y_s, x_e, y_e, color)** + +​ 填充以起始坐标和结束坐标为对角线的矩形。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| x_s | 是 | int | 起始x坐标 | +| y_s | 是 | int | 起始y坐标 | +| x_e | 是 | int | 结束x坐标 | +| y_e | 是 | int | 结束x坐标 | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **DrawLine(x0, y0, x1, y1, color)** + +​ 画线。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| x0 | 是 | int | 起始x坐标 | +| y0 | 是 | int | 起始y坐标 | +| x1 | 是 | int | 结束x坐标 | +| y1 | 是 | int | 结束x坐标 | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **DrawRectangle (x0, y0, x1, y1, color)** + +​ 画矩形。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| x0 | 是 | int | 起始x坐标 | +| y0 | 是 | int | 起始y坐标 | +| x1 | 是 | int | 结束x坐标 | +| y1 | 是 | int | 结束x坐标 | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **DrawCircle (x0, y0, r, color)** + +​ 画矩形。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| x0 | 是 | int | 起始x坐标 | +| y0 | 是 | int | 起始y坐标 | +| r | 是 | int | 半径 | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **DrawCircle (x0, y0, r, color)** + +​ 画矩形。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ----- | ---- | ---- | ------------------------------------------------------------ | +| x0 | 是 | int | 起始x坐标 | +| y0 | 是 | int | 起始y坐标 | +| r | 是 | int | 半径 | +| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| + +返回值: + +​ 无 + +l **ShowChar(x, y, xsize, ysize, ch_buf, fc, bc)** + +​ 单字符串显示。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ------ | ---- | ---- | ---------------------- | +| x | 是 | int | x坐标 | +| y | 是 | int | y坐标 | +| xsize | 是 | int | 字体宽度 | +| ysize | 是 | int | 字体高度 | +| ch_buf | 是 | int | 存放字符的元组或者列表 | +| fc | 是 | int | 字体颜色,RGB565 | +| bc | 是 | int | 背景颜色,RGB565 | + +返回值: + +​ 无 + +l **ShowAscii (x, y, xsize, ysize, ch_buf, fc, bc)** + +​ ASCII字符显示。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ------ | ---- | ---- | --------------------------- | +| x | 是 | int | x坐标 | +| y | 是 | int | y坐标 | +| xsize | 是 | int | 字体宽度 | +| ysize | 是 | int | 字体高度 | +| ch_buf | 是 | int | 存放ascii字符的元组或者列表 | +| fc | 是 | int | 字体颜色,RGB565 | +| bc | 是 | int | 背景颜色,RGB565 | + +返回值: + +​ 无 + +l **ShowAsciiStr(x, y, xsize, ysize, str_ascii, fc, bc)** + +​ ASCII字符串显示。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| --------- | ---- | ---- | ------------------- | +| x | 是 | int | x坐标 | +| y | 是 | int | y坐标 | +| xsize | 是 | int | 字体宽度 | +| ysize | 是 | int | 字体高度 | +| str_ascii | 是 | int | 待显示的ASCII字符串 | +| fc | 是 | int | 字体颜色,RGB565 | +| bc | 是 | int | 背景颜色,RGB565 | + +返回值: + +​ 无 + +l **ShowJpg(name, start_x, start_y)** + +​ 显示图片,若大于屏幕则缩小显示在屏幕中间。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ------- | ---- | ---- | --------- | +| name | 是 | str | 图片路径 | +| start_x | 是 | int | 起始x坐标 | +| start_y | 是 | int | 起始y坐标 | + +返回值: + +​ 无 + +l **lcd_show_image(image_data, x, y, width, heigth)** + +​ bytearray图片显示,如果图片宽高小于80x80,可直接该函数一次性写入并显示。 + +参数: + +| 名称 | 必填 | 类型 | 说明 | +| ---------- | ---- | --------- | --------- | +| image_data | 是 | bytearray | 图片路径 | +| x | 是 | int | 起始x坐标 | +| y | 是 | int | 起始y坐标 | +| width | 是 | int | 图片宽度 | +| height | 是 | int | 图片高度 | + +返回值: + +​ 无 + + + +### st7735 + +**类引用:** + +```python +from peripheral.lcd.st7735 import St7735 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ----- | ----------------------- | +| InitData | 否 | tuple | 传入 LCD 的配置命令 | +| width | 否 | int | LCD 屏幕的宽度,默认128 | +| height | 否 | int | LCD 屏幕的高度,默认160 | +| clk | 否 | int | LCD SPI 时钟,默认13000 | + +```python +lcd_test = St7735() +``` + +**接口函数:** + +同st7789 + + + +### ili9225 + +**类引用:** + +```python +from peripheral.lcd.ili9225 import Ili9225 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ----- | ----------------------- | +| InitData | 否 | tuple | 传入 LCD 的配置命令 | +| width | 否 | int | LCD 屏幕的宽度,默认176 | +| height | 否 | int | LCD 屏幕的高度,默认220 | +| clk | 否 | int | LCD SPI 时钟,默认13000 | + +**接口函数:** + +同st7789 + + + +### ili9341 + +**类引用:** + +```python +from peripheral.lcd.ili9341 import Ili9341 +``` + + + +**实例化参数:** + +| 名称 | 必填 | 类型 | 说明 | +| -------- | ---- | ----- | ----------------------- | +| InitData | 否 | tuple | 传入 LCD 的配置命令 | +| width | 否 | int | LCD 屏幕的宽度,默认320 | +| height | 否 | int | LCD 屏幕的高度,默认240 | +| clk | 否 | int | LCD SPI 时钟,默认13000 | + +**接口函数:** + +同st7789 diff --git a/libraries/LCD/README.md b/libraries/LCD/README.md index 42fdeaf..45c0aa2 100644 --- a/libraries/LCD/README.md +++ b/libraries/LCD/README.md @@ -1,10 +1,10 @@ -# LCD 应用指导文档 +# LCD Application Instruction Document -## 接口说明 +## Interface Description ### st7789 -**类引用:** +**Class reference:** ```python from peripheral.lcd.st7789 import St7789 @@ -12,46 +12,46 @@ from peripheral.lcd.st7789 import St7789 -**实例化参数:** +**Instance parameters:** -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | -------- | ---- | ----- | ----------------------- | -| InitData | 否 | tuple | 传入 LCD 的配置命令 | -| width | 否 | int | LCD 屏幕的宽度,默认240 | -| height | 否 | int | LCD 屏幕的高度,默认240 | -| clk | 否 | int | LCD SPI 时钟,默认13000 | +| InitData | No | tuple | Configuration commands to be sent to the LCD | +| width | No | int | Width of the LCD screen, default 240 | +| height | No | int | Height of the LCD screen, default 240 | +| clk | No | int | LCD SPI clock, default 13000 | ``` lcd_test = St7789() ``` -**接口函数:** +**Interface function:** l **DrawPoint(x, y, color)** -​ 画点。 +​ Plot the point function. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| x | 是 | int | x坐标 | -| y | 是 | int | y坐标 | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +| Name | Required | Type | Description | +| ----- | ---- | ---- | --------------------- | +| x | Yes | int | X coordinate | +| y | Yes | int | Y coordinate | +| color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | -返回值: +Return value: -​ 无 +No l **Clear (color)** -​ 清屏。 +Clear the screen. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +| Name | Required | Type | Description | +| ----- | ---- | ---- | ------------- | +| Color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | 返回值: @@ -59,261 +59,283 @@ l **Clear (color)** l **Fill(x_s, y_s, x_e, y_e, color)** -​ 填充以起始坐标和结束坐标为对角线的矩形。 +Fill a rectangle whose diagonal is defined by the starting and ending coordinates. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| x_s | 是 | int | 起始x坐标 | -| y_s | 是 | int | 起始y坐标 | -| x_e | 是 | int | 结束x坐标 | -| y_e | 是 | int | 结束x坐标 | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +| Name | Required | Type | Description | +| ----- | ---- | ---- | ----------------------------- | +| x_s | Yes | int | Starting x-coordinate | +| y_s | Yes | int | Starting y-coordinate | +| x_e | Yes | int | Ending x-coordinate | +| y_e | Yes | int | Ending y-coordinate | +| Color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | -返回值: -​ 无 +Return value: + +No l **DrawLine(x0, y0, x1, y1, color)** -​ 画线。 +​ Underline. -参数: +Underline. -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| x0 | 是 | int | 起始x坐标 | -| y0 | 是 | int | 起始y坐标 | -| x1 | 是 | int | 结束x坐标 | -| y1 | 是 | int | 结束x坐标 | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +Parameters: -返回值: +| Name | Required | Type | Description | +| ----- | ---- | ---- | ------------------------------ | +| x0 | Yes | int | Starting x-coordinate | +| y0 | Yes | int | Starting y-coordinate | +| x1 | Yes | int | Ending x-coordinate | +| y1 | Yes | int | Ending y-coordinate | +| Color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | -​ 无 + +Return value: + +No l **DrawRectangle (x0, y0, x1, y1, color)** -​ 画矩形。 +Draw a rectangle. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| x0 | 是 | int | 起始x坐标 | -| y0 | 是 | int | 起始y坐标 | -| x1 | 是 | int | 结束x坐标 | -| y1 | 是 | int | 结束x坐标 | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +| Name | Required | Type | Description | +| ----- | ---- | ---- | ------------------------ | +| x0 | Yes | int | Starting x-coordinate | +| y0 | Yes | int | Starting y-coordinate | +| x1 | Yes | int | Ending x-coordinate | +| y1 | Yes | int | Ending y-coordinate | +| Color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | -返回值: -​ 无 +Return value: + +No l **DrawCircle (x0, y0, r, color)** -​ 画矩形。 +Draw a rectangle. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| x0 | 是 | int | 起始x坐标 | -| y0 | 是 | int | 起始y坐标 | -| r | 是 | int | 半径 | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +| Name | Required | Type | Description | +| ----- | ---- | ---- | --------------------------- | +| x0 | Yes | int | Initial x-coordinate | +| y0 | Yes | int | Initial y-coordinate | +| r | Yes | int | Radius | +| Color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | -返回值: -​ 无 +Return value: + +No l **DrawCircle (x0, y0, r, color)** -​ 画矩形。 +Draw a rectangle. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | -| ----- | ---- | ---- | ------------------------------------------------------------ | -| x0 | 是 | int | 起始x坐标 | -| y0 | 是 | int | 起始y坐标 | -| r | 是 | int | 半径 | -| color | 是 | int | 颜色
红色:0xF800
绿色: 0x07E0
蓝色: 0x001F
白色: 0xFFFF
黑色: 0x0000
| +| Name | Required | Type | Description | | ----- | ---- | ---- | ------------------------------------------------------------ | +| x0 | Yes | int | Initial x-coordinate | +| y0 | Yes | int | Initial y-coordinate | +| r | Yes | int | Radius | +| Color | Yes | int | Color
Red: 0xF800
Green: 0x07E0
Blue: 0x001F
White: 0xFFFF
Black: 0x0000 | -返回值: -​ 无 +Return value: + +No l **ShowChar(x, y, xsize, ysize, ch_buf, fc, bc)** -​ 单字符串显示。 +Single string display. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | ------ | ---- | ---- | ---------------------- | -| x | 是 | int | x坐标 | -| y | 是 | int | y坐标 | -| xsize | 是 | int | 字体宽度 | -| ysize | 是 | int | 字体高度 | -| ch_buf | 是 | int | 存放字符的元组或者列表 | -| fc | 是 | int | 字体颜色,RGB565 | -| bc | 是 | int | 背景颜色,RGB565 | +| x | Yes | int | X coordinate | +| y | Yes | int | Y coordinate | +| xsize | Yes | int | Font width | +| ysize | Yes | int | Font height | +| ch_buf | Yes | int | Tuple or list storing characters | +| fc | Yes | int | Font color, RGB565 | +| bc | Yes | int | Background color, RGB565 | -返回值: +Return value: -​ 无 +No -l **ShowAscii (x, y, xsize, ysize, ch_buf, fc, bc)** -​ ASCII字符显示。 +l **ShowAscii (x, y, xsize, ysize, ch_buf, fc, bc)** -参数: -| 名称 | 必填 | 类型 | 说明 | +ASCII character display. + +Parameters: + +| Name | Required | Type | Description | | ------ | ---- | ---- | --------------------------- | -| x | 是 | int | x坐标 | -| y | 是 | int | y坐标 | -| xsize | 是 | int | 字体宽度 | -| ysize | 是 | int | 字体高度 | -| ch_buf | 是 | int | 存放ascii字符的元组或者列表 | -| fc | 是 | int | 字体颜色,RGB565 | -| bc | 是 | int | 背景颜色,RGB565 | +| x | Yes | int | X coordinate | +| y | Yes | int | Y coordinate | +| xsize | Yes | int | Font width | +| ysize | Yes | int | Font height | +| ch_buf | Yes | int | Tuple or list storing ASCII characters | +| fc | Yes | int | Font color, RGB565 | +| bc | Yes | int | Background color, RGB565 | -返回值: +Return value: -​ 无 +No l **ShowAsciiStr(x, y, xsize, ysize, str_ascii, fc, bc)** -​ ASCII字符串显示。 +ASCII string display. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | --------- | ---- | ---- | ------------------- | -| x | 是 | int | x坐标 | -| y | 是 | int | y坐标 | -| xsize | 是 | int | 字体宽度 | -| ysize | 是 | int | 字体高度 | -| str_ascii | 是 | int | 待显示的ASCII字符串 | -| fc | 是 | int | 字体颜色,RGB565 | -| bc | 是 | int | 背景颜色,RGB565 | +| x | Yes | int | X coordinate | +| y | Yes | int | Y coordinate | +| xsize | Yes | int | Font width | +| ysize | Yes | int | Font height | +| str_ascii | Yes | int | ASCII string to be displayed | +| fc | Yes | int | Font color, RGB565 | +| bc | Yes | int | Background color, RGB565 | -返回值: +Return value: -​ 无 +No l **ShowJpg(name, start_x, start_y)** -​ 显示图片,若大于屏幕则缩小显示在屏幕中间。 +Display the picture. If it is larger than the screen, it will be scaled down and displayed in the center of the screen. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | ------- | ---- | ---- | --------- | -| name | 是 | str | 图片路径 | -| start_x | 是 | int | 起始x坐标 | -| start_y | 是 | int | 起始y坐标 | +| name | Yes | str | Image path | +| start_x | Yes | int | Starting x-coordinate | +| start_y | Yes | int | Starting y-coordinate | -返回值: +Return value: -​ 无 +No l **lcd_show_image(image_data, x, y, width, heigth)** -​ bytearray图片显示,如果图片宽高小于80x80,可直接该函数一次性写入并显示。 +For bytearray images, if the width and height of the image are less than 80x80, you can directly call this function to write and display it at once. -参数: +Parameters: -| 名称 | 必填 | 类型 | 说明 | +| Name | Required | Type | Description | | ---------- | ---- | --------- | --------- | -| image_data | 是 | bytearray | 图片路径 | -| x | 是 | int | 起始x坐标 | -| y | 是 | int | 起始y坐标 | -| width | 是 | int | 图片宽度 | -| height | 是 | int | 图片高度 | +| image_data | Yes | bytearray | Image path | +| x | Yes | int | Starting x-coordinate | +| y | Yes | int | Starting y-coordinate | +| width | Yes | int | Image width | +| height | Yes | int | Image height | -返回值: +Return value: -​ 无 +No ### st7735 -**类引用:** + +**Class Reference:** ```python from peripheral.lcd.st7735 import St7735 ``` - -**实例化参数:** -| 名称 | 必填 | 类型 | 说明 | + + +**Instantiation Parameters:** + +| Name | Required | Type | Description | | -------- | ---- | ----- | ----------------------- | -| InitData | 否 | tuple | 传入 LCD 的配置命令 | -| width | 否 | int | LCD 屏幕的宽度,默认128 | -| height | 否 | int | LCD 屏幕的高度,默认160 | -| clk | 否 | int | LCD SPI 时钟,默认13000 | +| InitData | No | tuple | Configuration commands to be sent to the LCD | +| width | No | int | Width of the LCD screen, default 128 | +| height | No | int | Height of the LCD screen, default 160 | +| clk | No | int | LCD SPI clock, default 13000 | ```python lcd_test = St7735() ``` -**接口函数:** -同st7789 +**Interface Function:** + +Same as st7789 + + ### ili9225 -**类引用:** + +**Class Reference:** ```python from peripheral.lcd.ili9225 import Ili9225 ``` - -**实例化参数:** -| 名称 | 必填 | 类型 | 说明 | -| -------- | ---- | ----- | ----------------------- | -| InitData | 否 | tuple | 传入 LCD 的配置命令 | -| width | 否 | int | LCD 屏幕的宽度,默认176 | -| height | 否 | int | LCD 屏幕的高度,默认220 | -| clk | 否 | int | LCD SPI 时钟,默认13000 | -**接口函数:** -同st7789 +**Instantiation Parameters:** + +| Name | Required | Type | Description | | -------- | ---- | ----- | ----------------------- | +| InitData | No | tuple | Configuration commands to be sent to the LCD | +| width | No | int | Width of the LCD screen, default 176 | +| height | No | int | Height of the LCD screen, default 220 | +| clk | No | int | LCD SPI clock, default 13000 | + +**Interface Function:** + + +Same as st7789 + + ### ili9341 -**类引用:** + +**Class Reference:** ```python from peripheral.lcd.ili9341 import Ili9341 ``` - -**实例化参数:** -| 名称 | 必填 | 类型 | 说明 | -| -------- | ---- | ----- | ----------------------- | -| InitData | 否 | tuple | 传入 LCD 的配置命令 | -| width | 否 | int | LCD 屏幕的宽度,默认320 | -| height | 否 | int | LCD 屏幕的高度,默认240 | -| clk | 否 | int | LCD SPI 时钟,默认13000 | -**接口函数:** -同st7789 +**Instantiation Parameters:** + +| Name | Required | Type | Description | | -------- | ---- | ----- | ----------------------- | +| InitData | No | tuple | Configuration commands to be sent to the LCD | +| width | No | int | Width of the LCD screen, default 320 | +| height | No | int | Height of the LCD screen, default 240 | +| clk | No | int | LCD SPI clock, default 13000 | + +**Interface Function:** + + +Same as st7789 \ No newline at end of file diff --git a/libraries/keyscan/README-zh.md b/libraries/keyscan/README-zh.md new file mode 100644 index 0000000..99fa410 --- /dev/null +++ b/libraries/keyscan/README-zh.md @@ -0,0 +1,51 @@ +# Key 按键驱动模块 + +**类引用** +```python +from key_driver import Key +``` + +**实例化参数** + +| 名称 | 必填 | 类型 | 说明 | +| ---- | ---- | ---- | ---- | +| pin | 是 | int | GPIO引脚号 | +| work_mode | 是 | int |工作模式:Key.WorkMode.ONE_SHOT 或 Key.WorkMode.CONTINUOUS +| debounse_ms | 是 | int | 按键消抖时间(毫秒)| +| level_on_pressed | 是 | int | 按键按下时的电平(0或1)| +| cared_event | 是 | int | 关心的事件类型(Key.Event.PRESSED、Key.Event.RELEASED 或其组合)| +| event_cb | 是 | function | 事件回调函数 | +| long_press_event | 否 | list | 长按事件时间列表(秒)| + +**事件类型** + +| 名称 | 值 | 说明 | +|----|----|----| +| Key.Event.PRESSED | 0x01 | 按键按下事件 | +| Key.Event.RELEASED | 0x02 | 按键释放事件 | +| Key.Event.LONG_PRESSED | 0x04 | 长按事件 | + +**工作模式** + +| 名称 | 值 | 说明 | +|----|----|----| +| Key.WorkMode.ONE_SHOT | 0x01 | 单次触发模式| +| Key.WorkMode.CONTINUOUS | 0x02 | 连续触发模式 | + +方法 + +l disable() + +禁用按键中断检测 + +​​参数:​​ 无 +​​ +返回值:​​ 无 + +l enable() + +启用按键中断检测 + +​​参数:​​ 无 + +​​返回值:​​ 无 \ No newline at end of file diff --git a/libraries/keyscan/README.md b/libraries/keyscan/README.md new file mode 100644 index 0000000..06d3c74 --- /dev/null +++ b/libraries/keyscan/README.md @@ -0,0 +1,50 @@ +# Key Button Driver Module + +"Class Reference" ```python +from key_driver import Key +``` + + +"Instantiation Parameters" + +| Name | Required | Type | Description | | ---- | ---- | ---- | ---- | +| pin | Is | int | GPIO pin number | +| work_mode | Is | int | Working mode: Key.WorkMode.ONE_SHOT or Key.WorkMode.CONTINUOUS | +| debounce_ms | Is | int | Button debouncing time (milliseconds) | +| level_on_pressed | Is | int | Button level when pressed (0 or 1) | +| cared_event | Is | int | Careful event type (Key.Event.PRESSED, Key.Event.RELEASED or their combination) | +| event_cb | Is | function | Event callback function | +| long_press_event | No | list | List of long press event times (seconds) | + +**Event Type** + +| Name | Value | Description | |----|----|----| +| Key.Event.PRESSED | 0x01 | Key Pressed Event | +| Key.Event.RELEASED | 0x02 | Key Released Event | +| Key.Event.LONG_PRESSED | 0x04 | Long Press Event | + +**Work Mode** + +| Name | Value | Description | |----|----|----| +| Key.WorkMode.ONE_SHOT | 0x01 | One-shot trigger mode | +| Key.WorkMode.CONTINUOUS | 0x02 | Continuous trigger mode | + +Method + +l disable() + + +Disable key interrupt detection + +Parameter: None + +Return value: None + +l enable() + + +Enable key interrupt detection + +Parameter: None + +Return value: None \ No newline at end of file From a4811110f24d994cbeb9993ee0e5ef8ff1c9e91d Mon Sep 17 00:00:00 2001 From: Arnold Feng Date: Thu, 17 Jul 2025 11:33:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=80=E6=9C=89readme-?= =?UTF-8?q?zh.md=E4=B8=BAreadme=5Fzh.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/ADXL346/{README-zh.md => README_zh.md} | 0 libraries/AW9523B/{README-zh.md => README_zh.md} | 0 libraries/BH1750(GY-302)/{README-zh.md => README_zh.md} | 0 libraries/ESP8266/{README-zh.md => README_zh.md} | 0 libraries/HDC1080/{README-zh.md => README_zh.md} | 0 libraries/HDC2080/{README-zh.md => README_zh.md} | 0 libraries/L76K/{README-zh.md => README_zh.md} | 0 libraries/LCD/{README-zh.md => README_zh.md} | 0 libraries/keyscan/{README-zh.md => README_zh.md} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename libraries/ADXL346/{README-zh.md => README_zh.md} (100%) rename libraries/AW9523B/{README-zh.md => README_zh.md} (100%) rename libraries/BH1750(GY-302)/{README-zh.md => README_zh.md} (100%) rename libraries/ESP8266/{README-zh.md => README_zh.md} (100%) rename libraries/HDC1080/{README-zh.md => README_zh.md} (100%) rename libraries/HDC2080/{README-zh.md => README_zh.md} (100%) rename libraries/L76K/{README-zh.md => README_zh.md} (100%) rename libraries/LCD/{README-zh.md => README_zh.md} (100%) rename libraries/keyscan/{README-zh.md => README_zh.md} (100%) diff --git a/libraries/ADXL346/README-zh.md b/libraries/ADXL346/README_zh.md similarity index 100% rename from libraries/ADXL346/README-zh.md rename to libraries/ADXL346/README_zh.md diff --git a/libraries/AW9523B/README-zh.md b/libraries/AW9523B/README_zh.md similarity index 100% rename from libraries/AW9523B/README-zh.md rename to libraries/AW9523B/README_zh.md diff --git a/libraries/BH1750(GY-302)/README-zh.md b/libraries/BH1750(GY-302)/README_zh.md similarity index 100% rename from libraries/BH1750(GY-302)/README-zh.md rename to libraries/BH1750(GY-302)/README_zh.md diff --git a/libraries/ESP8266/README-zh.md b/libraries/ESP8266/README_zh.md similarity index 100% rename from libraries/ESP8266/README-zh.md rename to libraries/ESP8266/README_zh.md diff --git a/libraries/HDC1080/README-zh.md b/libraries/HDC1080/README_zh.md similarity index 100% rename from libraries/HDC1080/README-zh.md rename to libraries/HDC1080/README_zh.md diff --git a/libraries/HDC2080/README-zh.md b/libraries/HDC2080/README_zh.md similarity index 100% rename from libraries/HDC2080/README-zh.md rename to libraries/HDC2080/README_zh.md diff --git a/libraries/L76K/README-zh.md b/libraries/L76K/README_zh.md similarity index 100% rename from libraries/L76K/README-zh.md rename to libraries/L76K/README_zh.md diff --git a/libraries/LCD/README-zh.md b/libraries/LCD/README_zh.md similarity index 100% rename from libraries/LCD/README-zh.md rename to libraries/LCD/README_zh.md diff --git a/libraries/keyscan/README-zh.md b/libraries/keyscan/README_zh.md similarity index 100% rename from libraries/keyscan/README-zh.md rename to libraries/keyscan/README_zh.md