Micropython library to interact with registers and individual bits of devices connected to SPI.
Project description
Pico Register
Micropython library that provides a convenient and efficient way to interact with registers and individual bits of devices connected to the Serial Peripheral Interface (SPI).
Access and control the values of registers, perform read and write operations, and manipulate specific bits within a register.
The library abstracts the low-level details of SPI communication, allowing users to focus on working with registers and bits.
Key Features
- Simple and intuitive API
- Read and write operations on registers
- Bit-level manipulation and access within registers
Installation
pip install pico-register
## Usage
from register import Register, Bits
# Address of the register as specified in the device datasheet
WHO_AM_I = 0x0F
CTRL_REG = 0x10
PRESS_OUT_LSB = 0x28
PRESS_OUT_MSB = 0x29
# Create the registers objects
reg_device_id = Register(WHO_AM_I)
reg_pressure = Register(PRESS_OUT_LSB, 2)
# or the bits
data_ready = Bits(CTRL_REG, 0)
low_pass_filter = Bits(CTRL_REG, 3, 2)
# write values
low_pass_filter = 3
# Read the values
if data_ready:
print(reg_pressure)
Contributing
Contributions to this project are welcome. If you find any issues, have suggestions for improvements, or want to add new features, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License. Feel free to use, modify, and distribute the code in accordance with the terms of the license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pico_register-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02ea6a7ff0e45ff87cbca917169e01c9e5bec91804a07a62249abfac0aa96e66 |
|
MD5 | 04a0f922f0f1a0cfb043ea50f97f238c |
|
BLAKE2b-256 | 3d8f7f8e4b92f240a3d06cd9f14c54b41a2278b2ae1e45016f45a01d17e660cc |