opsoro.hardware¶
This module defines the interface for communicating with the shield.
opsoro.hardware.analog¶
opsoro.hardware.capacitive¶
-
class
opsoro.hardware.capacitive.
Capacitive
[source]¶ Bases:
object
-
get_baseline_data
()[source]¶ Get list of electrode baseline data. Result is 10 bits, but the 2 least significant bits are set to 0.
Returns: electrode baseline data (10 bits). Return type: list
-
get_filtered_data
()[source]¶ Get list of electrode filtered data (10 bits per electrode).
Returns: electrode filtered data (10 bits per electrode). Return type: list
-
get_touched
()[source]¶ Returns the values of the touch registers, each bit corresponds to one electrode.
Returns: values of the touch registers, Return type: list
-
init
(electrodes, gpios=0, autoconfig=True)[source]¶ Initialize the MPR121 capacitive touch sensor.
Parameters: - electrodes (int) – amount of electrodes
- gpios (int) – amount of gpios
- autoconfig (bool) –
-
read_gpio
()[source]¶ Returns the status of all GPIO channels, each bit corresponds to one gpio channel.
Returns: status of all GPIO channels. Return type: list
-
set_gpio_pinmode
(gpio, pinmode)[source]¶ Sets a GPIO channel’s pin mode.
Parameters: - gpio (int) – gpio channel
- pinmode (int) – pinmode to set
-
opsoro.hardware.dummy_spidev¶
opsoro.hardware.i2c¶
-
class
opsoro.hardware.i2c.
I2C
[source]¶ Bases:
object
-
detect
(addr)[source]¶ Returns True if an I2C device is found at a particular address.
Parameters: addr (int) – address of the I2C device. Returns: I2C device detected Return type: bool
-
read16
(addr, reg)[source]¶ Read 2 bytes from an I2C device.
Parameters: - addr (int) – address of the I2C device.
- reg (int) – register address in the I2C device
Returns: 2 Bytes
Return type: var
-
read8
(addr, reg)[source]¶ Read a Byte from an I2C device.
Parameters: - addr (int) – address of the I2C device.
- reg (int) – register address in the I2C device
Returns: what is the function returning?
Return type: var
-
opsoro.hardware.neopixel¶
-
class
opsoro.hardware.neopixel.
Neopixel
[source]¶ Bases:
object
-
disable
()[source]¶ Turns off the NeoPixel MOSFET, disabling the NeoPixels. Data is lost when pixels are disabled.
-
enable
()[source]¶ Turns on the NeoPixel MOSFET, enabling the NeoPixels. Data is lost when pixels are disabled, so call show() again afterwards.
-
init
(num_leds)[source]¶ Initialize the NeoPixel library.
Parameters: num_leds (int) – number of neopixel leds.
-
set_all
(r, g, b)[source]¶ Set the color of the entire strip.
Parameters: - r (int) – red color value (0-255)
- g (int) – green color value (0-255)
- b (int) – blue color value (0-255)
-
set_all_hsv
(h, s, v)[source]¶ Set the HSV color of the entire strip.
Parameters: - h (int) – hue color value (0-255)
- s (int) – saturation color value (0-255)
- v (int) – value color value (0-255)
-
set_brightness
(brightness)[source]¶ Set the NeoPixel’s global brightness, 0-255.
Parameters: brightness (int) – brightness to set (0-255)
-
set_pixel
(pixel, r, g, b)[source]¶ Set the color of a single pixel.
Parameters: - pixel (int) – pixel index
- r (int) – red color value (0-255)
- g (int) – green color value (0-255)
- b (int) – blue color value (0-255)
-
set_pixel_hsv
(pixel, h, s, v)[source]¶ Set the HSV color of a single pixel.
Parameters: - pixel (int) – pixel index
- h (int) – hue color value (0-255)
- s (int) – saturation color value (0-255)
- v (int) – value color value (0-255)
-
set_range
(start, end, r, g, b)[source]¶ Set the color of a range of pixels.
Parameters: - start (int) – start index of led range
- end (int) – end index of led range
- r (int) – red color value (0-255)
- g (int) – green color value (0-255)
- b (int) – blue color value (0-255)
-
opsoro.hardware.servo¶
-
class
opsoro.hardware.servo.
Servo
[source]¶ Bases:
object
-
set
(channel, pos)[source]¶ Set the position of one servo. Pos in us, 500 to 2500
Parameters: - channel (int) – channel of the servo
- pos (int) – position of the servo (500 to 2500)
-
opsoro.hardware.spi¶
This module defines the interface for communicating with SPI.
-
class
opsoro.hardware.spi.
_SPI
[source]¶ Bases:
object
-
command
(cmd, params=None, returned=0, delay=0)[source]¶ - Send a command over the SPI bus to the ATmega328. Optionally reads the result buffer and returns those Bytes.
Parameters: - cmd (string) – spi command
- params (strin) – parameters for the command
- returned (int) – size of result reading
- delay (int) – delay between sending the command and reading the result
Returns: result buffer (Bytes)
Return type: list
-
opsoro.hardware.usb_serial¶
-
opsoro.hardware.
usb_serial
¶ alias of
opsoro.hardware.usb_serial