diff options
| author | caternuson <caternuson@gmail.com> | 2020-09-28 13:15:43 -0700 |
|---|---|---|
| committer | caternuson <caternuson@gmail.com> | 2020-09-28 13:15:43 -0700 |
| commit | 8e4f08a109980e76df43cd95f8bca96422ae89ce (patch) | |
| tree | 99bec53f28b02cf2268ea534d310301924584ef9 /docs | |
| parent | 4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff) | |
add MP const info to Design Guide
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/design_guide.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/design_guide.rst b/docs/design_guide.rst index 6f87ecf79..9ce8dc963 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -448,6 +448,19 @@ struct.pack Use `struct.pack_into` instead of `struct.pack`. +Use of MicroPython `const()` +-------------------------------------------------------------------------------- +The MicroPython `const()` feature, as discussed in `this forum post +<https://forum.micropython.org/viewtopic.php?t=450>`_, and in `this issue thread +<https://github.com/micropython/micropython/issues/573>`_, provides some +optimizations that can be useful on smaller, memory constrained devices. However, +when using `const()`, keep in mind these general guide lines: + +- Always use via an import, ex: `from micropython import const` +- Limit use to global (module level) variables only. +- If user will not need access to variable, prefix name with a leading + underscore, ex: `_SOME_CONST`. + Sensor properties and units -------------------------------------------------------------------------------- |
