Async conversion of tca9554_driver — MicroPython 异步驱动
实验性异步版本:尚未完成实物验收。
同步来源:同步版本。维护者说明同步版本已验证;本次未逐包复测同步来源,适用硬件和固件范围以原有记录为准。
异步版本:本包 Python 源码及示例已通过 MicroPython 1.23 / 1.29 编译检查;软件回归只覆盖选定路径,不代表本包全部 API、实际器件及并发行为已验证。
目录
- 简介
- 主要功能
- 硬件要求
- 软件环境
- 文件结构
- 文件说明
- 快速开始
- 异步设计与使用
- API Async Matrix
- Source Demo to Async Demo Mapping
- 超时、取消、并发与残余阻塞
- Hardware Acceptance
- 注意事项
- 版本记录
- 联系方式
- 许可协议
简介
tca9554_async_driver 是当前仓库中独立发布的 MicroPython 异步包。设备/功能名称和 API 均来自包内运行时文件;它不是对同步 API 的无依据重命名。源包:input/tca9554_driver。
主要功能
- 可解析的公开类:
TCA9554,TCA9554Async。 - 可解析的公开调用入口:56 个(详见 API 矩阵)。
- 异步等级:
cooperative_nonblocking;依据:等待阶段使用协程让出;底层总线调用仍同步。
硬件要求
| 项目 | 从代码取得的事实 |
|---|---|
| 通信/IO | I2C, Pin( |
| 示例 GPIO | 示例未声明固定 GPIO 编号 |
| 供电、地址与电平 | 仅按模块实物标签、数据手册及代码常量配置;。 |
软件环境
| 项目 | 值 |
|---|---|
| 运行时 | MicroPython + uasyncio |
| 包版本 | 1.0.0 |
| 作者 | FreakStudio |
| 依赖 | 无声明的第三方依赖 |
文件结构
├── code/main.py
├── code/_gs_tca9554_tca9554.py
├── code/tca9554_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 : 测试 TCA9554 8位 I2C GPIO 扩展器驱动类
# @License : MIT
# ======================================== 导入相关模块 =========================================
from machine import I2C, Pin
from _gs_tca9554_tca9554 import TCA9554, TCA9554_INPUT, TCA9554_OUTPUT, TCA9554_HIGH, TCA9554_LOW
# ======================================== 全局变量 ============================================
# 请替换为你的实际引脚配置
SCL_PIN = 22
SDA_PIN = 21
I2C_FREQ = 400000
TCA9554_ADDR = 0x20
# TCA9554 无标准芯片 ID 寄存器,使用地址扫描验证
TCA9554_EXPECTED_ADDR = TCA9554_ADDR
# 打印间隔(ms)
PRINT_INTERVAL = 2000
# 上次打印时间戳
last_print_time = 0
# ======================================== 功能函数 ============================================
def demo_output_mode(io_expander):
"""
演示输出模式:配置引脚为输出,写入高低电平(低频,自动执行)
"""
print("")
print("=== Demo: Output Mode ===")
# 配置引脚0为输出模式
io_expander.pin_mode(0, TCA9554_OUTPUT)
print("Pin 0 configured as OUTPUT")
# 写入高电平
io_expander.write(0, TCA9554_HIGH)
# 读取输出寄存器验证写入值
out_val = io_expander.read_output8()
print("Output register after writing HIGH to pin 0: 0x%02X" % out_val)
# 延时等待,便于观察
await asyncio.sleep(0.5)
# 写入低电平
io_expander.write(0, TCA9554_LOW)
out_val = io_expander.read_output8()
print("Output register after writing LOW to pin 0: 0x%02X" % out_val)
def demo_input_mode(io_expander):
"""
演示输入模式:配置引脚为输入,读取引脚电平(低频,自动执行)
"""
print("")
print("=== Demo: Input Mode ===")
# 配置引脚0为输入模式
io_expander.pin_mode(0, TCA9554_INPUT)
print("Pin 0 configured as INPUT")
# 读取全部8个引脚的输入寄存器
in_val = io_expander.read_input8()
print("Input register: 0x%02X" % in_val)
# 读取单个引脚的电平
pin_val = io_expander.read(0)
print("Pin 0 level: %d" % pin_val)
def demo_polarity_mode(io_expander):
"""
演示极性反转功能(模式切换,默认注释调用,可REPL手动触发)
"""
print("")
print("=== Demo: Polarity Inversion ===")
# 反转引脚0的输入极性
io_expander.set_polarity(0, True)
print("Pin 0 polarity inverted")
# 读取输入验证极性反转效果
in_val = io_expander.read(0)
print("Pin 0 level after polarity inversion: %d" % in_val)
# 恢复正常极性
io_expander.set_polarity(0, False)
print("Pin 0 polarity restored to normal")
def demo_port_operations(io_expander):
"""
演示端口级批量操作(批量操作,封装为独立函数供REPL调用)
"""
print("")
print("=== Demo: Port-Level Operations ===")
# 配置所有8个引脚为输出(0x00 = 全部输出)
io_expander.pin_mode8(0x00)
print("All pins configured as OUTPUT (mask=0x00)")
# 批量写入端口数据(0x55 = 01010101)
io_expander.write_port(0x55)
out_val = io_expander.read_output8()
print("Output register after write_port(0x55): 0x%02X" % out_val)
# 配置所有8个引脚为输入(0xFF = 全部输入)
io_expander.pin_mode8(0xFF)
print("All pins configured as INPUT (mask=0xFF)")
# 读取全部输入状态
in_val = io_expander.read_input8()
print("Input register: 0x%02X" % in_val)
# ======================================== 初始化配置 ==========================================
# 上电延时,等待硬件稳定
await asyncio.sleep(3)
print("FreakStudio: Testing TCA9554 8-bit I2C GPIO Expander Driver")
print("")
# 初始化 I2C 总线
print("Initializing I2C bus...")
i2c = I2C(0, scl=Pin(SCL_PIN), sda=Pin(SDA_PIN), freq=I2C_FREQ)
print("I2C bus initialized: SCL=%d, SDA=%d, freq=%d" % (SCL_PIN, SDA_PIN, I2C_FREQ))
# I2C 设备扫描
print("Scanning I2C bus...")
devices = i2c.scan()
# 检查扫描结果是否为空
if not devices:
raise RuntimeError("No I2C device found on bus")
print("Found %d device(s): %s" % (len(devices), [hex(d) for d in devices]))
# 检查目标设备是否在扫描列表中
if TCA9554_EXPECTED_ADDR not in devices:
raise RuntimeError("Device not found at expected address 0x%02X" % TCA9554_EXPECTED_ADDR)
print("Device found at expected address: 0x%02X" % TCA9554_EXPECTED_ADDR)
# 实例化 TCA9554 驱动(I2C 实例外部注入)
print("Initializing TCA9554 driver...")
io_expander = TCA9554(i2c, address=TCA9554_ADDR)
# 验证设备连接(I2C 探测读取)
if io_expander.is_connected():
print("TCA9554 connected and responding")
else:
raise RuntimeError("TCA9554 not responding at address 0x%02X" % TCA9554_ADDR)
# ======================================== 主程序 ===========================================
try:
# 低频自动执行:基础演示
demo_output_mode(io_expander)
demo_input_mode(io_expander)
# 模式切换:注释自动调用,可REPL手动触发
# demo_polarity_mode(io_expander)
# 批量操作:封装为独立函数,可REPL调用
# demo_port_operations(io_expander)
print("")
print("Basic demo completed. Use REPL to call additional functions:")
print(" demo_polarity_mode(io_expander)")
print(" demo_port_operations(io_expander)")
print("")
# 主循环:周期性读取输入寄存器
last_print_time = time.ticks_ms()
while True:
await asyncio.sleep_ms(0)
current_time = time.ticks_ms()
# 按间隔打印输入状态
if time.ticks_diff(current_time, last_print_time) >= PRINT_INTERVAL:
# 读取全部8个引脚的输入状态
in_val = io_expander.read_input8()
print("Input register: 0x%02X" % in_val)
last_print_time = current_time
# 短延时避免 CPU 占用过高
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...")
# 释放资源,所有引脚恢复输入模式
io_expander.deinit()
del io_expander
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 |
|---|---|---|---|---|
TCA9554.deinit |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.is_connected |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.pin_mode |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.pin_mode8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.read |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.read_input8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.read_output8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.set_polarity |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.set_polarity8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.write |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554.write_port |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.aclose |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.call_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.const_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.deinit_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.is_connected_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.pin_mode8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.pin_mode_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.read_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.read_input8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.read_output8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.set_polarity8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.set_polarity_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.write_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
TCA9554Async.write_port_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
aclose |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
call_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
const |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
const_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
deinit |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
deinit_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
demo_input_mode |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
demo_output_mode |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
demo_polarity_mode |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
demo_port_operations |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
is_connected |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
is_connected_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
main |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
pin_mode |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
pin_mode8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
pin_mode8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
pin_mode_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_input8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_input8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_output8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
read_output8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_polarity |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_polarity8 |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_polarity8_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
set_polarity_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
write |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
write_async |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
write_port |
cooperative_nonblocking |
等待阶段使用协程让出;底层总线调用仍同步 | 底层总线/同步临界区可能阻塞事件循环 | 请使用实现中已有 timeout 参数;取消后执行清理。 |
write_port_async |
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 额外遵守其并发契约。 |
| 阻塞 | 不把短同步总线访问或严格时序脉冲描述为真正可中断。 |
| 验收 | 文档生成不等于硬件验证;接入真实设备后分别记录三层验收证据。 |
版本记录
| 版本号 | 日期 | 作者 | 修改说明 |
|---|---|---|---|
1.0.0 |
2026-09-17 | FreakStudio | 基于当前异步代码、来源包和许可证重新取证 README。 |
联系方式
请通过本仓库的 issue 或维护者渠道联系;包内元数据作者为:FreakStudio。
许可协议
许可证声明:MIT。以下为本包 LICENSE 的逐字内容:
MIT License
Copyright (c) 2023 L-ING
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.