Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ICLib

A collection of integrated circuit libraries in pure Python.

Features

  • High-level integrated circuit usage.

  • Low-level integrated circuit usage.

Installation

pip install iclib

Usage

Below shows a sample usage of ADC78H89.

from iclib.adc78h89 import ADC78H89
from periphery import SPI

spi = SPI('/dev/spidev0.0', 3, 1e6)
adc78h89 = ADC78H89(spi)
voltages = adc78h89.sample_all()

print(voltages[ADC78H89.InputChannel.AIN1])
print(voltages[ADC78H89.InputChannel.GROUND])

Below shows a sample usage of MCP4161.

from iclib.mcp4161 import MCP4161
from periphery import SPI

spi = SPI('/dev/spidev0.0', 3, 1e6)
mcp4161 = MCP4161(spi)

mcp4161.set_wiper_step(123, True)  # eeprom
mcp4161.set_wiper_step(123)

Below shows a sample usage of SN74HCS137.

from time import sleep
from unittest.mock import MagicMock

from periphery import GPIO
from iclib.sn78hcs137 import SN74HCS137

latch_enable_gpio = GPIO('/dev/gpiochip0', 0, 'out', inverted=True)
strobe_input_gpio = GPIO('/dev/gpiochip0', 1, 'out', inverted=True)
address_select_0_gpio = GPIO('/dev/gpiochip0', 2, 'out', inverted=False)
address_select_1_gpio = GPIO('/dev/gpiochip0', 3, 'out', inverted=False)
address_select_2_gpio = GPIO('/dev/gpiochip0', 4, 'out', inverted=False)
sn78hcs137 = SN74HCS137(
    latch_enable_gpio,
    MagicMock(),
    strobe_input_gpio,
    address_select_0_gpio,
    address_select_1_gpio,
    address_select_2_gpio,
)

sn78hcs137.select(SN74HCS137.Address.Y3)
sleep(1)
sn78hcs137.deselect()

Below shows a sample usage of NHD-C12864A1Z-FSW-FBW-HTT.

from time import sleep

from periphery import GPIO, SPI
from iclib.nhd_c12864a1z_fsw_fbw_htt import NHDC12864A1ZFSWFBWHTT

spi = SPI('/dev/spidev0.0', 3, 10e6)
a0 = GPIO('/dev/gpiochip0', 8, 'out')
not_reset = GPIO('/dev/gpiochip0', 9, 'out')
display = NHDC12864A1ZFSWFBWHTT(spi, a0, not_reset)

display.clear_screen()

display.draw_rect(0, 0, 127, 63)

display.set_font('dejavusans.ttf')
display.set_size(8, 14)
display.draw_word('Welcome to Blue Sky solar racing! 12345678910', 2, 2)
display.set_size(16, 16)
display.draw_word('@#$%*^', 1, int(driver.HEIGHT * 0.7))
display.display()

sleep(5)

display.clear_screen()

 # Fill screen
 for row in range(display.HEIGHT)
     for col in range(display.WIDTH)
         display.write_pixel(col, row)

 display.display()

 # Create checkerboard pattern
 for row in range(display.HEIGHT)
     for col in range(display.WIDTH)
         if (row + col) % 2 == 1:  # Checker pattern
             display.clear_pixel(col, row)

Testing and Validation

ICLib has extensive test coverage, passes mypy static type checking with strict parameter, and has been validated through extensive use in real-life scenarios.

Contributing

Contributions are welcome! Please read our Contributing Guide for more information.

License

ICLib is distributed under the MIT license.

Metadata

Release files for iclib 0.0.0.dev22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iclib 0.0.0.dev22
File Size Uploaded Provenance Actions
iclib-0.0.0.dev22.tar.gz 43.5 kB Without provenance Details for iclib-0.0.0.dev22.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iclib 0.0.0.dev22
File Interpreter ABI Platform Actions
iclib-0.0.0.dev22-py3-none-any.whl Python 3 none any Details for iclib-0.0.0.dev22-py3-none-any.whl

Total release size: 95.7 kB

Release files / iclib-0.0.0.dev22.tar.gz

Download URL iclib-0.0.0.dev22.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
47f630d26e748f7fcbd45ff08c1e26aad868f189570b43efe834bb99aeb0ae46
BLAKE2b-256 checksum
How to use checksums
e187c882221c8033ffaf87e518b71e8127d6ba08f3406c23feea4cce4f9c08e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / iclib-0.0.0.dev22-py3-none-any.whl

Download URL iclib-0.0.0.dev22-py3-none-any.whl
Size 52.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecc65158ae29783e1657f20600f79fdeec8bc5d8f0318386af2e16a22193f650
BLAKE2b-256 checksum
How to use checksums
81fabefa968eb01e29aabafb99a4ba3b82252fcdc7acec03bdb752dfdcf90015
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Security for iclib 0.0.0.dev22

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page