Skip to main content

A collection of integrated circuit libraries in pure Python

Project description

ADC78H89 is a 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.configure()
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iclib-0.0.0.dev4.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

iclib-0.0.0.dev4-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file iclib-0.0.0.dev4.tar.gz.

File metadata

  • Download URL: iclib-0.0.0.dev4.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for iclib-0.0.0.dev4.tar.gz
Algorithm Hash digest
SHA256 4ab629f47a19977d949f0c2c25a8a5c29912387bdca8a335d292f1197893a2a2
MD5 c6a7c9f9b1b4ac24c5b463a15f8ed13d
BLAKE2b-256 a2656db6728e2ef95fa4b0d0c71e38aed027f4b9bf346a6ee2e7e0fc5542319c

See more details on using hashes here.

File details

Details for the file iclib-0.0.0.dev4-py3-none-any.whl.

File metadata

  • Download URL: iclib-0.0.0.dev4-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for iclib-0.0.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 8c3f05f0d2e684fb2ffd9ead492668617d3815d5f0f129a08cf8e5469eb8c52c
MD5 a672e8bd0ce285a62f38961091e33615
BLAKE2b-256 0b8422afa38c23e00f0e93574e8b5fa2020b8eda9f5d8085a0cf8eb439676f41

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page