Skip to main content

Welcome to SM24b8vin’s documentation!

Install

sudo pip install SM24b8vin

or

sudo pip3 install SM24b8vin

Update

sudo pip install SM24b8vin -U

or

sudo pip3 install SM24b8vin -U

Initiate class

$ python
Python 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import SM24b8vin
>>> sm24b = SM24b8vin.SM24b8vin()
>>> sm24b.get_u_in(1)
>>>

Documentation

__init__.py This module provides the SM24b8vin class which implements the functionality (for analog input, LED control, RTC, watchdog, and calibration) of the 24b8vin card.

class SM24b8vin.SM24b8vin(stack=0, i2c=1)

Bases: object

Python class to control the 24b8vin card (Eight 24-bit analog inputs).

This class provides methods to read the eight analog input channels, set/read the gain codes, control 8 LEDs, access the RTC, use the watchdog, and perform calibration operations.

  • Parameters:
    • stack (int) – The device stack index (added to SLAVE_OWN_ADDRESS_BASE).
    • i2c (int) – I2C bus number.

get_all_leds()

Get the status of all LEDs as a bitmask.

  • Returns: Bitmask of LED states.
  • Return type: int

get_gain(channel)

Get gain setting for an analog input channel.

  • Parameters: channel (int) – Channel number [1..{gain}].
  • Returns: Gain code.
  • Return type: int

get_led(led)

Get the state of a single LED.

  • Parameters: led (int) – LED number [1..{led}].
  • Returns: 1 (ON) or 0 (OFF).
  • Return type: int

get_rtc()

Get the real–time clock (RTC) time.

  • Returns: (year, month, day, hour, minute, second)
  • Return type: tuple

get_u_in(channel)

Get analog input voltage for a given channel (in volts).

  • Parameters: channel (int) – Channel number [1..{u_in}].
  • Returns: Voltage value in volts.
  • Return type: float

get_version()

Get the firmware version.

  • Returns: Version string in the form “major.minor”.
  • Return type: str

set_all_leds(bitmask)

Set all LEDs at once using a bitmask.

  • Parameters: bitmask (int) – Bitmask value (0 to 2^(LED_CH_NO)-1).

set_gain(channel, gain)

Set the gain for an analog input channel.

  • Parameters:
    • channel (int) – Channel number [1..{gain}].
    • gain (int) – Gain code (0–7).

set_led(led, state)

Set the state of a single LED.

  • Parameters:
    • led (int) – LED number [1..{led}].
    • state (int) – 0 (OFF) or 1 (ON).

set_rtc(year, month, day, hour, minute, second)

Set the RTC time.

  • Parameters:
    • year (int) – Full year (e.g. 2025)
    • month (int) – Date/time components.
    • day (int) – Date/time components.
    • hour (int) – Date/time components.
    • minute (int) – Date/time components.
    • second (int) – Date/time components.

wdt_clear_reset_count()

Clear the watchdog reset count.

wdt_get_init_period()

Get the initial watchdog period (in seconds).

wdt_get_off_period()

Get the watchdog power–off period (in seconds).

wdt_get_period()

Get the watchdog period (in seconds).

wdt_get_reset_count()

Get the watchdog reset count.

wdt_reload()

Reload (reset) the watchdog timer.

wdt_set_init_period(period)

Set the initial watchdog period.

  • Parameters: period (int) – Period in seconds.

wdt_set_off_period(period)

Set the watchdog power–off period.

  • Parameters: period (int) – Off period in seconds.

wdt_set_period(period)

Set the watchdog period.

  • Parameters: period (int) – Period in seconds.

Metadata

Release files for sm24b8vin 1.0.1

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

Source distribution (sdist)

Source distribution for sm24b8vin 1.0.1
File Size Uploaded
sm24b8vin-1.0.1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sm24b8vin 1.0.1
File Interpreter ABI Platform
sm24b8vin-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 14.6 kB

Release files / sm24b8vin-1.0.1.tar.gz

Download URL sm24b8vin-1.0.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
302afee3e8422c043d9c6c616969edc7fc785290022733842f02cea4c0ed2f5f
BLAKE2b-256 checksum
How to use checksums
c0924b9b4c81713694c3c3512027ab03bcbfa9d7d239787004cd9f5d51d96e10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release files / sm24b8vin-1.0.1-py2.py3-none-any.whl

Download URL sm24b8vin-1.0.1-py2.py3-none-any.whl
Size 7.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0d8201ad78595bd56ac49f4f1d0701c739f127734fb5adeabf8277d9564be844
BLAKE2b-256 checksum
How to use checksums
493d268b78eb7645cc6420b0c1d6a2b8e81dc8d3e8dc74dfd62ba077a56a62d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

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