Skip to main content

Library to control 8crt Automation Card

Project description

Welcome to SM8crt’s documentation!

Install

sudo pip install SM8crt

or

sudo pip3 install SM8crt

Update

sudo pip install SM8crt -U

or

sudo pip3 install SM8crt -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 SM8crt
>>> sm = SM8crt.SM8crt()
>>> sm.set_led(2, 1) # Set LED 2 to ON
>>>

Documentation

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

Bases: object

Python class to control the 8crt Card for Raspberry Pi.

  • Parameters:
    • stack (int) – Stack level/device number.
    • i2c (int) – i2c bus number

cal_crt(channel, value)

Calibrate current readings. Calibration must be done in 2 points. The further the points are apart, the more accurate the calibration will be.

  • Parameters:
    • channel (int) – Channel number
    • value (int) – Current(A) value

calib_status()

Get current calibration status of device.

  • Returns: (int) Calib status

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_crt(channel)

Read the instantenous current(A) of one input channel.

  • Parameters: channel (int) – Channel number [1..8]
  • Returns: (float) Current value in amperes(A)

get_crt_range(channel)

Get the full scale range for a current sensor.

  • Parameters: channel (int) – Channel number [1..8]
  • Returns: (int) Full scale range in amperes(A)

get_crt_rms(channel)

Read the RMS current(A) of one input channel.

  • Parameters: channel (int) – Channel number [1..8]
  • Returns: (float) RMS current value in amperes(A)

get_crt_sensor_type(channel)

Get the type of current sensor.

Type 0 = 2.5V +/- 0.625V Type 1 = 2.5V +/- 1V

  • Parameters: channel (int) – Channel number [1..8]
  • Returns: (int) 0 or 1 indicating sensor type

get_led(led)

Get led state.

  • Parameters: led (int) – Led number
  • Returns: 0(OFF) or 1(ON)

get_rtc()

Get rtc time.

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

get_version()

Get firmware version.

Returns: (int) Firmware version number

set_all_leds(val)

Set all leds states as bitmask.

  • Parameters: val (int) – Led bitmask

set_crt_range(channel, value)

Set the full scale range for a current sensor.

  • Parameters:
    • channel (int) – Channel number [1..8]
    • value (int) – Full scale range in amperes(A) [1..300]

set_crt_sensor_type(channel, sensor_type)

Set the type of current sensor.

Type 0 = 2.5V +/- 0.625V Type 1 = 2.5V +/- 1V

  • Parameters:
    • channel (int) – Channel number [1..8]
    • sensor_type (int) – 0 or 1 indicating sensor type

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) Watchdog 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) – Watchdog period in seconds

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

SM8crt-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SM8crt-0.1.0-py2.py3-none-any.whl (10.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file SM8crt-0.1.0.tar.gz.

File metadata

  • Download URL: SM8crt-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for SM8crt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e65d22fa2b07d5539dc3d736909c228f7b687534ade09f4b335629d642f37cf1
MD5 44354da2843d5d34e26fcd56ce978943
BLAKE2b-256 6a9f8e468286ce9148be76d32ea0145d8ebb41259a2848f9a3a2c5f7c47a8d5b

See more details on using hashes here.

File details

Details for the file SM8crt-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: SM8crt-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for SM8crt-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fb19f1afa78a0ec2b5ef817c3699cc93bee75cfa75a28e84c7369ca58cf34174
MD5 2f499c01a3cff46811342fdc3689c47f
BLAKE2b-256 8b93374936b6e1b48550670163ba5e0da6009059573b4f7f17507e114e6dd1dc

See more details on using hashes here.

Supported by

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