i2c-microsd-expansion-circuitpython 1.0.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. i2c_microsd_expansion_circuitpython-1.0.13/CHANGELOG.md +201 -0
  2. i2c_microsd_expansion_circuitpython-1.0.13/LICENSE +21 -0
  3. i2c_microsd_expansion_circuitpython-1.0.13/MANIFEST.in +18 -0
  4. i2c_microsd_expansion_circuitpython-1.0.13/PKG-INFO +564 -0
  5. i2c_microsd_expansion_circuitpython-1.0.13/README.md +536 -0
  6. i2c_microsd_expansion_circuitpython-1.0.13/docs/api.md +114 -0
  7. i2c_microsd_expansion_circuitpython-1.0.13/docs/api.rst +12 -0
  8. i2c_microsd_expansion_circuitpython-1.0.13/docs/conf.py +93 -0
  9. i2c_microsd_expansion_circuitpython-1.0.13/docs/examples.rst +188 -0
  10. i2c_microsd_expansion_circuitpython-1.0.13/docs/index.rst +147 -0
  11. i2c_microsd_expansion_circuitpython-1.0.13/docs/requirements.txt +7 -0
  12. i2c_microsd_expansion_circuitpython-1.0.13/docs/wiring.md +81 -0
  13. i2c_microsd_expansion_circuitpython-1.0.13/examples/README.md +58 -0
  14. i2c_microsd_expansion_circuitpython-1.0.13/examples/abrupt_recovery.py +179 -0
  15. i2c_microsd_expansion_circuitpython-1.0.13/examples/append_and_list.py +94 -0
  16. i2c_microsd_expansion_circuitpython-1.0.13/examples/basic_readwrite.py +135 -0
  17. i2c_microsd_expansion_circuitpython-1.0.13/examples/bitbang_script.py +113 -0
  18. i2c_microsd_expansion_circuitpython-1.0.13/examples/config_save_load.py +161 -0
  19. i2c_microsd_expansion_circuitpython-1.0.13/examples/diagnostics.py +52 -0
  20. i2c_microsd_expansion_circuitpython-1.0.13/examples/dual_module_mirror.py +139 -0
  21. i2c_microsd_expansion_circuitpython-1.0.13/examples/exhaustive.py +383 -0
  22. i2c_microsd_expansion_circuitpython-1.0.13/examples/neopixel_blit.py +114 -0
  23. i2c_microsd_expansion_circuitpython-1.0.13/examples/nonblocking_write.py +120 -0
  24. i2c_microsd_expansion_circuitpython-1.0.13/examples/one_shot_files.py +105 -0
  25. i2c_microsd_expansion_circuitpython-1.0.13/examples/pwm_fade.py +87 -0
  26. i2c_microsd_expansion_circuitpython-1.0.13/examples/quickstart.py +90 -0
  27. i2c_microsd_expansion_circuitpython-1.0.13/examples/sensor_ring_logger.py +141 -0
  28. i2c_microsd_expansion_circuitpython-1.0.13/examples/set_clock.py +67 -0
  29. i2c_microsd_expansion_circuitpython-1.0.13/examples/simpletest.py +80 -0
  30. i2c_microsd_expansion_circuitpython-1.0.13/examples/sweep.py +166 -0
  31. i2c_microsd_expansion_circuitpython-1.0.13/examples/threshold_bitbang_alert.py +130 -0
  32. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_expansion_circuitpython.egg-info/PKG-INFO +564 -0
  33. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_expansion_circuitpython.egg-info/SOURCES.txt +44 -0
  34. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_expansion_circuitpython.egg-info/dependency_links.txt +1 -0
  35. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_expansion_circuitpython.egg-info/requires.txt +4 -0
  36. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_expansion_circuitpython.egg-info/top_level.txt +1 -0
  37. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_module/__init__.py +63 -0
  38. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_module/config.py +49 -0
  39. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_module/module.py +1794 -0
  40. i2c_microsd_expansion_circuitpython-1.0.13/i2c_microsd_module/protocol.py +114 -0
  41. i2c_microsd_expansion_circuitpython-1.0.13/optional_requirements.txt +8 -0
  42. i2c_microsd_expansion_circuitpython-1.0.13/pyproject.toml +48 -0
  43. i2c_microsd_expansion_circuitpython-1.0.13/requirements.txt +8 -0
  44. i2c_microsd_expansion_circuitpython-1.0.13/setup.cfg +4 -0
  45. i2c_microsd_expansion_circuitpython-1.0.13/tests/mock_module.py +446 -0
  46. i2c_microsd_expansion_circuitpython-1.0.13/tests/test_local.py +720 -0
@@ -0,0 +1,201 @@
1
+ # Changelog
2
+
3
+ All notable changes to the CircuitPython host library are documented here.
4
+
5
+ ## [1.0.13] - 2026-12-04
6
+
7
+ ### Release
8
+
9
+ - First PyPI release of the CircuitPython port, published as
10
+ `i2c-microsd-expansion-circuitpython`.
11
+
12
+ ### Packaging
13
+
14
+ - PyPI-ready metadata: author and maintainer `syntax1269`, project URLs for
15
+ source, documentation, changelog and the umbrella repo, `requires-python
16
+ >=3.9` (the SPDX license metadata needs setuptools 77, which requires 3.9),
17
+ and the production-stable classifier. `MANIFEST.in` ships the docs, examples
18
+ and tests in the source distribution and keeps repo-only files such as
19
+ `wiki/` and `.github/` out of it.
20
+
21
+ ### Added
22
+
23
+ - **One-shot file helpers**: `write_text()` / `write_file()` create or truncate,
24
+ write, commit and close in one call; `append_text()` / `append_file()` append
25
+ atomically (no `close()` needed). Streaming API is unchanged.
26
+ - **`pwm_write(pin, duty)`** — raw duty `0..255` for a pin already in
27
+ `MICROSDEXP_PIN_MODE_PWM_OUTPUT`. `write_pin()` now passes its value through
28
+ unchanged instead of coercing it to `0/1`. PA0 is rejected; PB3 is
29
+ threshold-only. New `examples/pwm_fade.py`.
30
+
31
+ - New wire commands in `protocol`: `MICROSDEXP_CMD_MODULE_CLOCK` (`0x1B`),
32
+ `MICROSDEXP_CMD_PIN_MODE_READ` (`0x1E`) and `MICROSDEXP_CMD_VOLUME_NAME`
33
+ (`0x1F`).
34
+ - Host getters `module_clock_hz()` (measured CPU clock in Hz),
35
+ `pin_mode(pin_id)` (0..4, or `0xFF` when the pin is absent), `pin_modes()`
36
+ (all six pins in one 0x1E read, `None` for absent) and `volume_name()`
37
+ (NUL-terminated label, `""` when unset). Each sets `INVALID` on a short
38
+ frame.
39
+ - Software RTC support on CMD `0x0E`, now named `MICROSDEXP_CMD_CLOCK` (the
40
+ old `MICROSDEXP_CMD_CLOCK_SET` remains an alias): reads return the same six
41
+ bytes `[year-2000, month, day, hour, minute, second]` written — a software
42
+ RTC used for FAT file timestamps (boot default `2026-11-01 00:00:00`; it
43
+ keeps advancing once set).
44
+ - `set_clock(year, month, day, hour, minute, second)` converts the year to
45
+ `year-2000`, range-checks all fields locally (`INVALID`, no bus traffic) and
46
+ returns `True` on ACK. `read_clock()` returns the 6-field tuple or `None`
47
+ with `INVALID` on a short frame. `set_clock_time()` is kept as a deprecated
48
+ alias. Added `examples/set_clock.py`.
49
+
50
+ ### Changed
51
+
52
+ - **`version()` now returns the whole 3-line firmware banner** from CMD_VERSION
53
+ (`v<version>` / `I2C microSD Expansion` / `Copyright (C) 2026 …`), keeping the
54
+ internal newlines and dropping NUL padding. An empty or incomplete banner
55
+ sets `INVALID`. `firmware_banner()` is unchanged.
56
+ - `firmware_clock_hz()` is now a deprecated alias of `module_clock_hz()` — the
57
+ banner no longer carries the clock on its first line.
58
+ - `diagnostics()` now prints the banner on separate rows with no extra prefix
59
+ and adds `Volume Name`, `Module Clock` and one `PIN <name>` row per expansion
60
+ pin, in a fixed field order. `last_error` is still preserved. It also adds
61
+ `Current Date/Time: YYYY-MM-DD HH:MM:SS` (`n/a` on failure) immediately after
62
+ the `Module detected:` row; no other row or ordering changed.
63
+ - Mock, local tests, `exhaustive.py` and all docs updated for the new banner
64
+ and commands, including 0x0E read/write and the new diagnostics row.
65
+
66
+ ## [1.0.12] - 2026-12-04
67
+ ### Fixed
68
+
69
+ - **CircuitPython 9.x build**: `CardInfo.__repr__` concatenated two adjacent
70
+ f-strings, a form MicroPython's `mpy-cross` rejects, so the Community Bundle
71
+ could not build the `.mpy` bundle. The repr now concatenates with `+`. No API
72
+ or behaviour change.
73
+
74
+ ## [1.0.11] - 2026-11-23
75
+ ### Added
76
+
77
+ - **Capability discovery**: `MICROSDEXP_CMD_CAPABILITIES (0x45)`, a
78
+ `Capabilities` value object exported from the package, `capabilities()` and
79
+ `supports(bit)`, with CRC-16/CCITT-FALSE validation over frame bytes 0..29.
80
+ A NACK from older firmware reports `MicroSDExpError.UNSUPPORTED` (10) and is
81
+ non-fatal in `begin()`.
82
+
83
+ ## [1.0.9] - 2026-11-20
84
+ ### Added (expansion pins)
85
+
86
+ - Pin IDs `MICROSDEXP_PIN_PA0` (0), `PA1` (1), `PA4` (4) and reserved `PF7` (7)
87
+ join PA5/PB2/PB3; `set_pin_mode` / `write_pin` dispatch to commands
88
+ `0x32`–`0x38`. New `adc_pin(pin)` reads PA5 or PA4 (`adc_pa5()` wraps it).
89
+
90
+ ### Added
91
+
92
+ - **`card_present()`** — check whether a card is inserted before file I/O,
93
+ with a dedicated `NO_CARD` error. The module itself NACKs card commands
94
+ while no card is inserted.
95
+ - **`quickstart.py`** — the first example: write a short file and read it back.
96
+ - Four new examples: `sensor_ring_logger.py` (500 Hz sampling into a 512-byte
97
+ ring, drained with `write_now()` / `committed_bytes()`),
98
+ `config_save_load.py` (checked queries plus a staged settings update),
99
+ `dual_module_mirror.py` (two modules on one bus with `sticky_error`
100
+ failover) and `threshold_bitbang_alert.py` (CSV logging plus a module-side
101
+ strobe script).
102
+
103
+ ### Fixed
104
+
105
+ - **`poll_op()` no longer leaves a phantom open file.** A failed async OPEN
106
+ now clears `_file_open` / `_read_started` instead of applying the success
107
+ side effects (including the spurious stream-priming READ).
108
+ - **Abandoned async ops no longer wedge an instance.** `begin()` and `reboot()`
109
+ reset `_async_pending` and the optimistic file state; synchronous file calls
110
+ made while an op is pending return `INVALID` instead of interleaving.
111
+ - **Mutating housekeeping now respects the single open handle.** `mkdir()`,
112
+ `rmdir()` and `remove()` return `INVALID` while a file is open (or an async
113
+ op is pending). Read-only queries are unchanged.
114
+ - **Zero-length `write()` / `read()` are clean no-ops** (`last_ok` stays true
115
+ instead of reporting `NO_FILE`). Added boundary round-trip tests at
116
+ 1/63/64/65/255/256 bytes with 64 B and 16 B chunks.
117
+
118
+ ## [1.0.8] - 2026-11-19
119
+ ### Added
120
+
121
+ - **Checked query variants**: `exists_checked`, `file_size_checked` and
122
+ `is_directory_checked` return `(ok, value)` so "not found" is distinct from
123
+ a failed I²C transaction. Added `last_ok` shorthand. Original methods
124
+ unchanged.
125
+
126
+ ## [1.0.7] - 2026-11-19
127
+ ### Added
128
+
129
+ - **Non-blocking submit/poll API**: `begin_open_write`, `begin_open_read`,
130
+ `begin_close`, `begin_format`, `begin_query`, `poll_op`, `write_now`,
131
+ `read_now`, `committed_bytes`, plus the `AsyncOp` token and `ASYNC_*` result
132
+ constants. No sleeps; one STATUS read per poll; only one pending operation.
133
+ No feature flag needed; the blocking API is unchanged.
134
+ - Example `nonblocking_write.py` and updated README/RTD documentation.
135
+
136
+ ## [1.0.6] - 2026-11-19
137
+ ### Changed
138
+
139
+ - Documented blocking behavior and worst-case timeouts for every high-level
140
+ method in README and RTD docs. The Python ports remain synchronous; use a
141
+ background thread/task if your application cannot block.
142
+
143
+ ## [1.0.5] - 2026-11-19
144
+ ### Added
145
+
146
+ - **`diagnostics()`** returns a one-page health report (module, firmware and
147
+ protocol version, card/filesystem, capacity and free space, I²C address and
148
+ configured clock, communication verdict) for customer troubleshooting. Safe
149
+ before `begin()` (`n/a` for unreadable fields) and leaves `last_error`
150
+ unchanged. Uses the module's real `free_clusters` value.
151
+ - `examples/diagnostics.py` and an API entry for the new method.
152
+
153
+ ## [1.0.4] - 2026-11-19
154
+ ### Added
155
+
156
+ - **Sticky error API.** `sticky_error` reports the first failure since
157
+ `clear_error()`; `last_error` keeps its per-call semantics. Internal calls can
158
+ no longer hide a real fault from a caller that checks the sticky value.
159
+ - **Banner validation.** `version()` now sets `INVALID` when the answered
160
+ banner is empty or incomplete.
161
+
162
+ ## [1.0.3] - 2026-11-18
163
+ ### Fixed
164
+
165
+ - **Consistent sensor error sentinel.** `temperature_k()` and `adc_pa5()` now
166
+ both return `0xFFFF` on any failure (bus error or short read), matching the
167
+ Arduino port. `adc_pa5()` previously returned `0` on bus failures, which is a
168
+ valid ADC reading.
169
+
170
+ ## [1.0.2] - 2026-11-18
171
+ ### Fixed
172
+
173
+ - **`bitbang_buffer()` workspace bounds.** The old guard rejected only
174
+ `offset + count > 0xFFFF`, so writes between 256 and 65535 were sent to the
175
+ module and silently dropped or NACKed instead of failing at the host. It now
176
+ rejects any range outside the 256-byte workspace
177
+ (`protocol.BITBANG_WORKSPACE_SIZE`), including negative offsets, with
178
+ `MicroSDExpError.INVALID`.
179
+
180
+ ## [1.0.1] - 2026-11-18
181
+ ### Fixed
182
+
183
+ - **`version()` against the multi-line banner.** CMD `0x0F` answers with a
184
+ 112-byte, three-line banner. `version()` now returns the full banner and
185
+ sets `INVALID` on an incomplete answer. Added `firmware_banner()` and
186
+ `firmware_clock_hz()`.
187
+ - **`format()` timing.** Now waits on a dedicated 300 s budget instead of the
188
+ 15 s operation timeout.
189
+
190
+ ### Changed
191
+
192
+ - Standardized identifiers across the three host ports (`MICROSDEXP_*`,
193
+ `MicroSDExpError`, `MicroSDExpFile`, `microSDexp`).
194
+
195
+ ## [1.0.0] - 2026-11-16
196
+ ### Added
197
+
198
+ - Expansion-pin and bit-bang API (`set_pin_mode`, `write_pin`, `save_pin_mode`,
199
+ `show_neopixels`, `bitbang_*`).
200
+ - Streaming file API with context-manager files and explicit commit semantics.
201
+ - 256-byte read chunk support via `set_read_chunk_bytes()`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 I2C microSD Expansion contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ include README.md
2
+ include CHANGELOG.md
3
+ include LICENSE
4
+ include requirements.txt
5
+ include optional_requirements.txt
6
+ include pyproject.toml
7
+ recursive-include docs *.py *.rst *.md *.txt
8
+ recursive-include examples *.py *.md
9
+ recursive-include tests *.py
10
+
11
+ # Repository-only files: not part of the published package.
12
+ prune wiki
13
+ prune .github
14
+ exclude .gitattributes
15
+ exclude .gitignore
16
+ exclude .readthedocs.yaml
17
+ exclude CODE_OF_CONDUCT.md
18
+ global-exclude __pycache__ *.py[cod]