Library to control Sixteen Analog/Digital Inputs 8-Layer Stackable HAT for Raspberry Pi
Project description
Welcome to lib16univin’s documentation!
Install
sudo pip install SM16univin
or
sudo pip3 install SM16univin
Update
sudo pip install SM16univin -U
or
sudo pip3 install SM16univin -U
Initiate class
$ python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lib16univin
>>> card = lib16univin.SM16univin()
>>> card.get_version()
>>>
Documentation
class lib16univin.SM16univin(stack=0, i2c=1)
Bases: object
Python class to control the 16 Universal Analog Inputs Card for Raspberry Pi.
- Parameters:
- stack (int) – Stack level/device number.
- i2c (int) – i2c bus number
get_all_dig_in()
Get all digital (dry contact) input status as a bitmask.
- Returns: (int) Optocoupled bitmask
get_all_leds()
Get all leds state as bitmask.
- Returns: (int) Leds state bitmask
get_button()
Get button status.
- Returns: (bool) status : True(ON)/False(OFF)
get_button_latch()
Get button latch status.
- Returns: (bool) status : True(ON)/False(OFF)
get_dig_in(channel)
Get digital (dry contact) input status.
- Parameters: channel (int) – Channel number
- Returns: (bool) Channel status
get_dig_in_cnt_en(channel)
Get digital (dry contact) input counting edges status.
- Parameters: channel (int) – Channel number
- Returns: (int) Counting edge status : 0(disable)/1(enable)
get_dig_in_counter(channel)
Get digital (dry contact) inputs edges counter for one channel.
- Parameters: channel (int) – Channel number
- Returns: (int) dry contact transitions counter
get_led(led)
Get led state.
- Parameters: led (int) – Led number
- Returns: (int) Led state
get_r10k_in(channel)
Get 10k thermistor input channel value in ohms.
- Parameters: channel (int) – Channel number
- Returns: (int) Input value in ohms
get_r1k_in(channel)
Get 1k thermistor input channel value in ohms.
- Parameters: channel (int) – Channel number
- Returns: (int) Input value in ohms
get_rtc()
Get rtc time.
- Returns: (tuple) date(year, month, day, hour, minute, second)
get_u_in(channel)
Get 0-10V input channel value in volts.
- Parameters: channel (int) – Channel number
- Returns: (float) Input value in volts
get_version()
Get firmware version.
Returns: (int) Firmware version number
reset_dig_in_counter(channel)
Reset optocoupled inputs edges counter.
- Parameters: channel (int) – Channel number
set_all_leds(val)
Set all leds states as bitmask.
- Parameters: val (int) – Leds bitmask
set_dig_in_cnt_en(channel, value)
Set digital (dry contact) input channel counting edges status.
- Parameters:
- channel (int) – Channel number
- value (int) – Counting edge status 0(disable)/1(enable)
set_led(led, val)
Set led state.
- Parameters:
- led (int) – Led number
- val – 0(OFF) or 1(ON)
set_rtc(year, month, day, hour, minute, second)
Set rtc time.
- Parameters:
- year (int) – current year
- month (int) – current month
- day (int) – current day
- hour (int) – current hour
- minute (int) – current minute
- second (int) – current second
wdt_clear_reset_count()
Clear watchdog counter.
wdt_get_init_period()
Get watchdog initial period.
- Returns: (int) Initial watchdog period in seconds
wdt_get_off_period()
Get watchdog off period in seconds.
- Returns: (int) Watchfog off period in seconds.
wdt_get_period()
Get watchdog period in seconds.
- Returns: (int) Watchdog period in seconds
wdt_get_reset_count()
Get watchdog reset count.
- Returns: (int) Watchdog reset count
wdt_reload()
Reload watchdog.
wdt_set_init_period(period)
Set watchdog initial period.
- Parameters: period (int) – Initial period in second
wdt_set_off_period(period)
Set off period in seconds
- Parameters: period (int) – Off period in seconds
wdt_set_period(period)
Set watchdog period.
- Parameters: period (int) – Channel number
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sm16univin-1.0.4.tar.gz.
File metadata
- Download URL: sm16univin-1.0.4.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22288560bf864193334a926ddcdbb590ed38b041740ae9c7cda34d563c761d13
|
|
| MD5 |
72de0e56309cae2fcc690d5eae02c337
|
|
| BLAKE2b-256 |
6facfd988914e727360b5aef4244d6fd35793d4c8b426e82d2eeb4f5a1f0bf1d
|
File details
Details for the file sm16univin-1.0.4-py2.py3-none-any.whl.
File metadata
- Download URL: sm16univin-1.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
108048aa888e629a435c6b0b411d0ae6fae4baf716fd355d3863abc6b767cdcf
|
|
| MD5 |
c2185fa53d65cbd23bc2380e5cfefa02
|
|
| BLAKE2b-256 |
97286384f5157cb930932d0e9742588be2fccd38b00c8ee07cbb59e1f7530635
|