PCF85063/PCF85063ATL low-power RTC driver for MicroPython — MicroPython 异步驱动
实验性异步版本:尚未完成实物验收。
同步来源:同步版本。维护者说明同步版本已验证;本次未逐包复测同步来源,适用硬件和固件范围以原有记录为准。
异步版本:本包 Python 源码及示例已通过 MicroPython 1.23 / 1.29 编译检查;软件回归只覆盖选定路径,不代表本包全部 API、实际器件及并发行为已验证。
目录
- 简介
- 主要功能
- 硬件要求
- 软件环境
- 文件结构
- 文件说明
- 快速开始
- 异步设计与使用
- API Async Matrix
- Source Demo to Async Demo Mapping
- 超时、取消、并发与残余阻塞
- Hardware Acceptance
- 注意事项
- 版本记录
- 联系方式
- 许可协议
简介
pcf85063_async_driver 是当前仓库中独立发布的 MicroPython 异步包。设备/功能名称和 API 均来自包内运行时文件;它不是对同步 API 的无依据重命名。源包:misc/pcf85063_driver。
主要功能
- 可解析的公开类:
PCF85063,PCF85063Async,SyncAdapterMixin。 - 可解析的公开调用入口:36 个(详见 API 矩阵)。
- 异步等级:
cooperative_nonblocking;依据:等待阶段使用协程让出;底层总线调用仍同步。
硬件要求
| 项目 | 从代码取得的事实 |
|---|---|
| 通信/IO | I2C, Pin( |
| 示例 GPIO | 示例未声明固定 GPIO 编号 |
| 供电、地址与电平 | 仅按模块实物标签、数据手册及代码常量配置;。 |
软件环境
| 项目 | 值 |
|---|---|
| 运行时 | MicroPython + uasyncio |
| 包版本 | 0.1.0 |
| 作者 | FreakStudio |
| 依赖 | 无声明的第三方依赖 |
文件结构
├── code/main.py
├── code/pcf85063.py
├── code/pcf85063_async.py
├── examples/main_sync.py
├── LICENSE
└── package.json
文件说明
code/:实际发布的运行时 Python 模块;以package.json.urls为安装映射依据。code/main.py(若存在):异步演示入口,不是默认发布运行时映射。examples/(若存在):同步保真基线或额外示例,不应当作安装后的运行时模块。package.json、LICENSE:发布元数据和许可证的唯一事实来源。
快速开始
- 按
package.json.urls将运行时文件复制到设备;不要把examples/当作运行时依赖。 - 按上文硬件/运行环境配置总线、GPIO、网络或凭证。
- 使用包内真实
code/main.py的 import 与构造方式运行。以下是当前文件逐字读取的异步入口;部署时请保留try/finally并调用对象实际提供的deinit()或aclose()。
try:
import uasyncio as asyncio
except ImportError:
import asyncio
async def main():
# Python env : MicroPython v1.23.0
# -*- coding: utf-8 -*-
# @Time : 2026/07/23
# @Author : FreakStudio
# @File : main.py
# @Description : 测试 PCF85063 RTC 驱动类的代码
# @License : Apache-2.0
# ======================================== 导入相关模块 =========================================
from machine import I2C, Pin
from pcf85063 import PCF85063, ALARM_DISABLE
# ======================================== 全局变量 ============================================
# 请根据实际硬件修改以下引脚配置
SCL_PIN = 22
SDA_PIN = 21
I2C_FREQ = 400000
# PCF85063 默认 I2C 地址
PCF85063_ADDR = 0x51
# 打印间隔(毫秒)
PRINT_INTERVAL = 2000
last_print_time = time.ticks_ms()
# ======================================== 功能函数 ============================================
def print_datetime(label, dt):
"""
打印格式化的日期时间
Args:
label (str): 标签文字
dt (tuple): 7 元组 (year, month, day, weekday, hour, minute, second)
"""
year, month, day, weekday, hour, minute, second = dt
weekdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
wday_str = weekdays[weekday] if 0 <= weekday <= 6 else "?"
print("%s: %04d-%02d-%02d %s %02d:%02d:%02d" % (label, year, month, day, wday_str, hour, minute, second))
def set_test_alarm(rtc):
"""
配置测试闹钟
默认注释调用,可在 REPL 中手动触发以测试闹钟功能。
配置为每分钟第 0 秒触发一次。
需要闹钟中断引脚连接到 MCU 才能感知触发。
"""
# 闹钟配置:仅匹配秒=0,其余字段禁用(每分钟触发一次)
rtc.set_alarm(second=0, minute=ALARM_DISABLE, hour=ALARM_DISABLE, day=ALARM_DISABLE, weekday=ALARM_DISABLE)
rtc.enable_alarm_interrupt(True)
print("Alarm configured: trigger on second=0 of every minute")
# ======================================== 初始化配置 ===========================================
# 上电等待,确保硬件稳定
await asyncio.sleep(3)
print("FreakStudio: PCF85063 RTC driver test")
print("I2C freq: %d Hz" % I2C_FREQ)
# 初始化 I2C 总线
i2c = I2C(0, scl=Pin(SCL_PIN), sda=Pin(SDA_PIN), freq=I2C_FREQ)
print("I2C initialized on SCL=%d, SDA=%d" % (SCL_PIN, SDA_PIN))
# 扫描 I2C 总线
devices = i2c.scan()
if not devices:
raise RuntimeError("No I2C device found")
print("I2C devices found: %s" % str([hex(d) for d in devices]))
# 验证 PCF85063 是否在预期地址上
if PCF85063_ADDR not in devices:
raise RuntimeError("Device not found at expected address 0x%02X" % PCF85063_ADDR)
print("Device found at address 0x%02X" % PCF85063_ADDR)
# 初始化 RTC 驱动
# year_base 参数说明:
# - 默认 1970,与 Unix 时间戳基准一致
# - 若实际年份范围为 2000-2099,可设 year_base=2000,
# 使寄存器仅存储低 2 位年份值,延长寄存器有效范围至 2100 年之后
rtc = PCF85063(i2c, address=PCF85063_ADDR, year_base=1970, debug=False)
print("PCF85063 RTC driver initialized (year_base=1970)")
# 软件复位 RTC
rtc.reset()
print("RTC soft reset completed")
# ======================================== 主程序 ===========================================
try:
# 读取当前 RTC 时间
dt = rtc.read_datetime()
print_datetime("Current datetime", dt)
# 设置测试时间
# 2026年7月23日 星期四 12:00:00(weekday: 0=Sun, 1=Mon, ..., 4=Thu)
test_dt = (2026, 7, 23, 4, 12, 0, 0)
rtc.set_datetime(test_dt)
print_datetime("Set datetime ", test_dt)
# 读回验证写入是否成功
dt = rtc.read_datetime()
print_datetime("Readback ", dt)
# 使用 datetime() 接口重复验证(兼容 machine.RTC 风格)
dt_via = rtc.datetime()
print_datetime("Via datetime() ", dt_via)
# 使用 datetime() 接口设置时间
test_dt2 = (2026, 7, 24, 5, 8, 30, 0)
rtc.datetime(test_dt2)
dt_via2 = rtc.datetime()
print_datetime("Set via dt() ", dt_via2)
# 配置闹钟(默认注释,需连接闹钟中断引脚时在 REPL 中手动调用)
# set_test_alarm(rtc)
print("")
print("Entering main loop: reading datetime every %d ms" % PRINT_INTERVAL)
print("Press Ctrl+C to stop")
while True:
current_time = time.ticks_ms()
if time.ticks_diff(current_time, last_print_time) >= PRINT_INTERVAL:
# 读取当前时间并打印
dt = rtc.read_datetime()
print_datetime("RTC", dt)
last_print_time = current_time
await asyncio.sleep_ms(100)
except KeyboardInterrupt:
print("Program interrupted by user")
except OSError as e:
print("Hardware communication error: %s" % str(e))
except Exception as e:
print("Unknown error: %s" % str(e))
finally:
print("Cleaning up resources...")
rtc.deinit()
del rtc
print("Program exited")
if __name__ == '__main__':
asyncio.run(main())
异步设计与使用
源状态:sync_source。本包归属当前异步仓库;原始实现的作者和许可证以源包元数据及 LICENSE 为准。协程入口应以 asyncio.run(main()) 启动。若类提供 start()/stop()、deinit() 或 aclose(),必须按其实际签名管理后台任务和资源,且在 finally 中清理。
API Async Matrix
| API | Level | Async strategy | Residual blocking | Timeout/cancellation |
|---|---|---|---|---|
PCF85063.datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063.deinit |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063.enable_alarm_interrupt |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063.read_datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063.reset |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063.set_alarm |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063.set_datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.datetime_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.deinit_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.enable_alarm_interrupt_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.read_datetime_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.reset_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.set_alarm_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
PCF85063Async.set_datetime_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
SyncAdapterMixin.aclose |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
aclose |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
bcd_to_dec |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
const |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
datetime_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
dec_to_bcd |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
deinit |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
deinit_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
enable_alarm_interrupt |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
enable_alarm_interrupt_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
main |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
print_datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_datetime_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
reset |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
reset_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_alarm |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_alarm_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_datetime |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_datetime_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_test_alarm |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
Source Demo to Async Demo Mapping
| Source sync step | Source API/protocol action | Async implementation | Preserved output/error meaning | Residual blocking |
|---|---|---|---|---|
| 源包示例 | code/main.py |
code/main.py 或本文快速开始 |
保留实际构造与调用;异常语义以运行时代码为准 | 存在 |
超时、取消、并发与残余阻塞
任何 await 不会自动使底层 I2C/SPI/UART/Pin 操作变为非阻塞。取消时应停止后台任务并在 finally 释放资源;没有实现超时参数的 API 不应被假定具有超时。协议命令、帧界限、ACK、静默间隔及错误含义只以当前实现和源示例可证明的内容为准。
Hardware Acceptance
| Level | Evidence | Not covered |
|---|---|---|
| Link | 未实测:仅完成静态代码与文档取证。 | 总线/网络连接、设备身份响应。 |
| Basic function | 未实测。 | 一次真实业务 API 成功及结果正确性。 |
| Complete business flow | 未实测。 | 端到端设备、对端、供电、时序和异常恢复。 |
注意事项
| 类别 | 说明 |
|---|---|
| 并发 | 同一硬件实例应由调用方串行化;UART 额外遵守其并发契约。 |
| 阻塞 | 不把短同步总线访问或严格时序脉冲描述为真正可中断。 |
| 验收 | 文档生成不等于硬件验证;接入真实设备后分别记录三层验收证据。 |
版本记录
| 版本号 | 日期 | 作者 | 修改说明 |
|---|---|---|---|
0.1.0 |
2026-09-17 | FreakStudio | 基于当前异步代码、来源包和许可证重新取证 README。 |
联系方式
请通过本仓库的 issue 或维护者渠道联系;包内元数据作者为:FreakStudio。
许可协议
许可证声明:Apache-2.0。以下为本包 LICENSE 的逐字内容:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 Waveshare
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.