Did neopixel, network, nvm
This commit is contained in:
parent
e31e9eeaa1
commit
d750096bef
@ -31,7 +31,7 @@
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
//| :mod:`neopixel_write` --- Low-level neopixel implementation
|
||||
//| """:mod:`neopixel_write` --- Low-level neopixel implementation
|
||||
//| ===========================================================
|
||||
//|
|
||||
//| .. module:: neopixel_write
|
||||
@ -53,15 +53,14 @@
|
||||
//| pin = digitalio.DigitalInOut(board.NEOPIXEL)
|
||||
//| pin.direction = digitalio.Direction.OUTPUT
|
||||
//| pixel_off = bytearray([0, 0, 0])
|
||||
//| neopixel_write.neopixel_write(pin, pixel_off)
|
||||
//| neopixel_write.neopixel_write(pin, pixel_off)"""
|
||||
//|
|
||||
//| .. function:: neopixel_write(digitalinout, buf)
|
||||
//|
|
||||
//| Write buf out on the given DigitalInOut.
|
||||
//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: bytearray) -> Any:
|
||||
//| """Write buf out on the given DigitalInOut.
|
||||
//|
|
||||
//| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with
|
||||
//| :param bytearray buf: The bytes to clock out. No assumption is made about color order
|
||||
//|
|
||||
//| :param bytearray buf: The bytes to clock out. No assumption is made about color order"""
|
||||
//| ...
|
||||
STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) {
|
||||
if (!MP_OBJ_IS_TYPE(digitalinout_obj, &digitalio_digitalinout_type)) {
|
||||
mp_raise_TypeError_varg(translate("Expected a %q"), digitalio_digitalinout_type.name);
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#if CIRCUITPY_NETWORK
|
||||
|
||||
//| :mod:`network` --- Network Interface Management
|
||||
//| """:mod:`network` --- Network Interface Management
|
||||
//| ===============================================
|
||||
//|
|
||||
//| .. module:: network
|
||||
@ -47,11 +47,11 @@
|
||||
//|
|
||||
//| This module provides a registry of configured NICs.
|
||||
//| It is used by the 'socket' module to look up a suitable
|
||||
//| NIC when a socket is created.
|
||||
//| NIC when a socket is created."""
|
||||
//|
|
||||
//| .. function:: route()
|
||||
//|
|
||||
//| Returns a list of all configured NICs.
|
||||
//| def route() -> Any:
|
||||
//| """Returns a list of all configured NICs."""
|
||||
//| ...
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t network_route(void) {
|
||||
|
@ -31,29 +31,33 @@
|
||||
#include "shared-bindings/nvm/ByteArray.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
//| .. currentmodule:: nvm
|
||||
|
||||
|
||||
|
||||
//| class ByteArray:
|
||||
//| """.. currentmodule:: nvm
|
||||
//|
|
||||
//| :class:`ByteArray` -- Presents a stretch of non-volatile memory as a bytearray.
|
||||
//| ================================================================================
|
||||
//| :class:`ByteArray` -- Presents a stretch of non-volatile memory as a bytearray.
|
||||
//| ================================================================================
|
||||
//|
|
||||
//| Non-volatile memory is available as a byte array that persists over reloads
|
||||
//| and power cycles. Each assignment causes an erase and write cycle so its recommended to assign
|
||||
//| all values to change at once.
|
||||
//| Non-volatile memory is available as a byte array that persists over reloads
|
||||
//| and power cycles. Each assignment causes an erase and write cycle so its recommended to assign
|
||||
//| all values to change at once.
|
||||
//|
|
||||
//| Usage::
|
||||
//| Usage::
|
||||
//|
|
||||
//| import microcontroller
|
||||
//| microcontroller.nvm[0:3] = b"\xcc\x10\x00"
|
||||
//| import microcontroller
|
||||
//| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\""""
|
||||
//|
|
||||
|
||||
//| .. class:: ByteArray()
|
||||
//|
|
||||
//| Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.
|
||||
//| def __init__(self, ):
|
||||
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`."""
|
||||
//| ...
|
||||
//|
|
||||
|
||||
//| .. method:: __len__()
|
||||
//|
|
||||
//| Return the length. This is used by (`len`)
|
||||
//| def __len__(self, ) -> Any:
|
||||
//| """Return the length. This is used by (`len`)"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t nvm_bytearray_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
||||
nvm_bytearray_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "shared-bindings/nvm/__init__.h"
|
||||
#include "shared-bindings/nvm/ByteArray.h"
|
||||
|
||||
//| :mod:`nvm` --- Non-volatile memory
|
||||
//| """:mod:`nvm` --- Non-volatile memory
|
||||
//| ===========================================================
|
||||
//|
|
||||
//| .. module:: nvm
|
||||
@ -47,7 +47,8 @@
|
||||
//| .. toctree::
|
||||
//| :maxdepth: 3
|
||||
//|
|
||||
//| ByteArray
|
||||
//| ByteArray"""
|
||||
//|
|
||||
STATIC const mp_rom_map_elem_t nvm_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_nvm) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ByteArray), MP_ROM_PTR(&nvm_bytearray_type) },
|
||||
|
Loading…
x
Reference in New Issue
Block a user