Skip to content

Modules

harp.devices.soundcard #

AdcConfiguration #

Bases: IntEnum

Specifies the operation mode of the analog inputs.

Attributes:

Name Type Description
NOT_USED int

No description currently available

ADC_ADC int

No description currently available

AMPLITUDE_BOTH_ADC int

No description currently available

AMPLITUDE_LEFT_ADC int

No description currently available

AMPLITUDE_RIGHT_ADC int

No description currently available

AMPLITUDE_LEFT_AMPLITUDE_RIGHT int

No description currently available

AMPLITUDE_BOTH_FREQUENCY int

No description currently available

AnalogDataPayload dataclass #

AnalogDataPayload(Adc0: int, Adc1: int, AttenuationLeft: int, AttenuationRight: int, Frequency: int)

Parameters:

Name Type Description Default
Adc0 int
required
Adc1 int
required
AttenuationLeft int
required
AttenuationRight int
required
Frequency int
required

ControllerCommand #

Bases: IntEnum

Specifies commands to send to the PIC32 micro-controller

Attributes:

Name Type Description
DISABLE_BOOTLOADER int

No description currently available

ENABLE_BOOTLOADER int

No description currently available

DELETE_ALL_SOUNDS int

No description currently available

Device #

The Device class provides the interface for interacting with Harp devices. This implementation of the Harp device was based on the official documentation available on the harp-tech website.

Attributes:

Name Type Description
WHO_AM_I int

The device ID number. A list of devices can be found here

DEFAULT_DEVICE_NAME str

The device name, i.e. "Behavior". This name is derived by cross-referencing the WHO_AM_I identifier with the corresponding device name in the device_names dictionary

HW_VERSION_H int

The major hardware version

HW_VERSION_L int

The minor hardware version

ASSEMBLY_VERSION int

The version of the assembled components

HARP_VERSION_H int

The major Harp core version

HARP_VERSION_L int

The minor Harp core version

FIRMWARE_VERSION_H int

The major firmware version

FIRMWARE_VERSION_L int

The minor firmware version

DEVICE_NAME str

The device name stored in the Harp device

SERIAL_NUMBER (int, optional)

The serial number of the device

__enter__() #

Support for using Device with 'with' statement.

Returns:

Type Description
Device

The Device instance

__exit__(exc_type, exc_val, exc_tb) #

Cleanup resources when exiting the 'with' block.

Parameters:

Name Type Description Default
exc_type Exception type or None

Type of the exception that caused the context to be exited

required
exc_val Exception or None

Exception instance that caused the context to be exited

required
exc_tb traceback or None

Traceback if an exception occurred

required

__init__(serial_port, dump_file_path=None, read_timeout_s=1, timeout_strategy=TimeoutStrategy.RAISE) #

Parameters:

Name Type Description Default
serial_port str

The serial port used to establish the connection with the Harp device. It must be denoted as /dev/ttyUSBx in Linux and COMx in Windows, where x is the number of the serial port

required
dump_file_path Optional[str]

The binary file to which all Harp messages will be written

None
read_timeout_s float

TODO

1

alive_en(enable) #

Sets the ALIVE_EN bit of the device.

Parameters:

Name Type Description Default
enable bool

If True, enables the ALIVE_EN bit. If False, disables it

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

connect() #

Connects to the Harp device.

disconnect() #

Disconnects from the Harp device.

dump_registers() #

Asserts the DUMP bit to dump the values of all core and app registers as Harp Read Reply Messages. More information on the DUMP bit can be found here.

Returns:

Type Description
list

The list containing the reply Harp messages for all the device's registers

event_count() #

Gets the number of events in the event queue.

Returns:

Type Description
int

The number of events in the event queue

get_events() #

Gets all events from the event queue.

Returns:

Type Description
list

The list containing every Harp event message that were on the queue

info() #

Prints the device information.

load() #

Loads the data stored in the device's common registers.

mute_reply(enable) #

Sets the MUTE_REPLY bit of the device.

Parameters:

Name Type Description Default
enable bool

If True, the Replies to all the Commands are muted. If False, un-mutes them

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

op_led_en(enable) #

Sets the operation LED of the device.

Parameters:

Name Type Description Default
enable bool

If True, enables the operation LED. If False, disables it

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

read_float(address) #

Reads the value of a register of type Float.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_operation_ctrl() #

Reads the OPERATION_CTRL register of the device.

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

read_s16(address) #

Reads the value of a register of type S16.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_s32(address) #

Reads the value of a register of type S32.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_s64(address) #

Reads the value of a register of type S64.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_s8(address) #

Reads the value of a register of type S8.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u16(address) #

Reads the value of a register of type U16.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u32(address) #

Reads the value of a register of type U32.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u64(address) #

Reads the value of a register of type U64.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u8(address) #

Reads the value of a register of type U8.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

reset_device(reset_mode=ResetMode.RST_DEF) #

Resets the device and reboots with all the registers with the default values. Beware that the EEPROM will be erased. More information on the reset device register can be found here.

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

send(message, *, expect_reply=True, timeout_strategy=None) #

Sends a Harp message and (optionally) waits for a reply.

Parameters:

Name Type Description Default
message HarpMessage

The HarpMessage to be sent to the device

required
expect_reply bool

If False, do not wait for a reply (fire-and-forget)

True
timeout_strategy TimeoutStrategy | None

Override the device-level timeout strategy for this call

None

Returns:

Type Description
ReplyHarpMessage | None

Reply (or None when allowed by the timeout strategy or expect_reply=False)

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

set_clock_config(clock_config) #

Sets the clock configuration of the device.

Parameters:

Name Type Description Default
clock_config ClockConfig

The clock configuration value

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

set_mode(mode) #

Sets the operation mode of the device.

Parameters:

Name Type Description Default
mode DeviceMode

The new device mode value

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

set_timestamp_offset(timestamp_offset) #

When the value of this register is above 0 (zero), the device's timestamp will be offset by this amount. The register is sensitive to 500 microsecond increments. This register is non-volatile.

Parameters:

Name Type Description Default
timestamp_offset int

The timestamp offset value

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

visual_en(enable) #

Sets the status led of the device.

Parameters:

Name Type Description Default
enable bool

If True, enables the status led. If False, disables it

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

write_float(address, value) #

Writes the value of a register of type Float.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value float | list[float]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_operation_ctrl(mode=None, mute_rpl=None, visual_en=None, op_led_en=None, alive_en=None) #

Writes the OPERATION_CTRL register of the device.

Parameters:

Name Type Description Default
mode OperationMode

The new operation mode value

None
mute_rpl bool

If True, the Replies to all the Commands are muted

None
visual_en bool

If True, enables the status led

None
op_led_en bool

If True, enables the operation LED

None
alive_en bool

If True, enables the ALIVE_EN bit

None

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

write_s16(address, value) #

Writes the value of a register of type S16.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_s32(address, value) #

Writes the value of a register of type S32.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_s64(address, value) #

Writes the value of a register of type S64.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_s8(address, value) #

Writes the value of a register of type S8.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u16(address, value) #

Writes the value of a register of type U16.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u32(address, value) #

Writes the value of a register of type U32.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u64(address, value) #

Writes the value of a register of type U64.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u8(address, value) #

Writes the value of a register of type U8.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

DigitalInputConfiguration #

Bases: IntEnum

Specifies the operation mode of the digital input.

Attributes:

Name Type Description
DIGITAL int

Used as a pure digital input.

START_AND_STOP_SOUND int

Starts sound when rising edge and stop when falling edge.

START_SOUND int

Starts sound when rising edge.

STOP int

Stops sound or frequency when rising edge.

START_AND_STOP_FREQUENCY int

Starts frequency when rising edge and stop when falling edge.

START_FREQUENCY int

Starts frequency when rising edge.

DigitalInputs #

Bases: IntFlag

Specifies the state of the digital input lines.

Attributes:

Name Type Description
DI0 int

No description currently available

DigitalOutputConfiguration #

Bases: IntEnum

Specifies the operation mode of the digital output.

Attributes:

Name Type Description
DIGITAL int

Used as a pure digital output.

PULSE int

The digital output will be high during a period specified by register DOxPulse.

HIGH_WHEN_SOUND int

High when the sound is being played.

PULSE_1MS_WHEN_START int

High when sound starts during 1 ms.

PULSE_10MS_WHEN_START int

High when sound starts during 10 ms.

PULSE_100MS_WHEN_START int

High when sound starts during 100 ms.

PULSE_1MS_WHEN_STOP int

High when sound stops during 1 ms.

PULSE_10MS_WHEN_STOP int

High when sound stops during 10 ms.

PULSE_100MS_WHEN_STOP int

High when sound starts during 100 ms.

DigitalOutputs #

Bases: IntFlag

Specifies the state of the digital output lines.

Attributes:

Name Type Description
DO0 int

No description currently available

DO1 int

No description currently available

DO2 int

No description currently available

HarpMessage #

The HarpMessage class implements the Harp message as described in the protocol.

Attributes:

Name Type Description
frame bytearray

The bytearray containing the whole Harp message

message_type MessageType

The message type

length int

The length parameter of the Harp message

address int

The address of the register to which the Harp message refers to

port int

Indicates the origin or destination of the Harp message in case the device is a hub of Harp devices. The value 255 points to the device itself (default value).

payload_type PayloadType

The payload type

checksum int

The sum of all bytes contained in the Harp message

address property #

The address of the register to which the Harp message refers to.

Returns:

Type Description
int

The address of the register to which the Harp message refers to

checksum property #

The sum of all bytes contained in the Harp message.

Returns:

Type Description
int

The sum of all bytes contained in the Harp message

frame property #

The bytearray containing the whole Harp message.

Returns:

Type Description
bytearray

The bytearray containing the whole Harp message

length property #

The length parameter of the Harp message.

Returns:

Type Description
int

The length parameter of the Harp message

message_type property #

The message type.

Returns:

Type Description
MessageType

The message type

payload property #

The payload sent in the write Harp message.

Returns:

Type Description
Union[int, list[int]]

The payload sent in the write Harp message

payload_type property #

The payload type.

Returns:

Type Description
PayloadType

The payload type

port property writable #

Indicates the origin or destination of the Harp message in case the device is a hub of Harp devices. The value 255 points to the device itself (default value).

Returns:

Type Description
int

The port value

__repr__() #

Prints debug representation of the reply message.

Returns:

Type Description
str

The debug representation of the reply message

__str__() #

Prints friendly representation of a Harp message.

Returns:

Type Description
str

The representation of the Harp message

calculate_checksum() #

Calculates the checksum of the Harp message.

Returns:

Type Description
int

The value of the checksum

create(message_type, address, payload_type, value=None) staticmethod #

Creates a Harp message.

Parameters:

Name Type Description Default
message_type MessageType

The message type. It can only be of type READ or WRITE

required
address int

The address of the register that the message will interact with

required
payload_type PayloadType

The payload type

required
value Optional[int | list[int] | float | list[float]]

The payload of the message. If message_type == MessageType.WRITE, the value cannot be None

None

parse(frame) staticmethod #

Parses a bytearray to a (reply) Harp message.

Parameters:

Name Type Description Default
frame bytearray

The bytearray will be parsed into a (reply) Harp message

required

Returns:

Type Description
ReplyHarpMessage

The Harp message object parsed from the original bytearray

HarpReadException #

Bases: HarpException

Exception raised when there is an error reading from a register in the Harp device.

HarpWriteException #

Bases: HarpException

Exception raised when there is an error writing to a register in the Harp device.

MessageType #

Bases: IntEnum

An enumeration of the allowed message types of a Harp message. More information on the MessageType byte of a Harp message can be found here.

Attributes:

Name Type Description
READ int

The value that corresponds to a Read Harp message (1)

WRITE int

The value that corresponds to a Write Harp message (2)

EVENT int

The value that corresponds to an Event Harp message (3). Messages of this type are only meant to be send by the device

READ_ERROR int

The value that corresponds to a Read Error Harp message (9). Messages of this type are only meant to be send by the device

WRITE_ERROR int

The value that corresponds to a Write Error Harp message (10). Messages of this type are only meant to be send by the device

PayloadType #

Bases: IntEnum

An enumeration of the allowed payload types of a Harp message. More information on the PayloadType byte of a Harp message can be found here.

Attributes:

Name Type Description
U8 int

The value that corresponds to a message of type U8

S8 int

The value that corresponds to a message of type S8

U16 int

The value that corresponds to a message of type U16

S16 int

The value that corresponds to a message of type S16

U32 int

The value that corresponds to a message of type U32

S32 int

The value that corresponds to a message of type S32

U64 int

The value that corresponds to a message of type U64

S64 int

The value that corresponds to a message of type S64

Float int

The value that corresponds to a message of type Float

Timestamp int

The value that corresponds to a message of type Timestamp. This is not a valid PayloadType, but it is used to indicate that the message has a timestamp.

TimestampedU8 int

The value that corresponds to a message of type TimestampedU8

TimestampedS8 int

The value that corresponds to a message of type TimestampedS8

TimestampedU16 int

The value that corresponds to a message of type TimestampedU16

TimestampedS16 int

The value that corresponds to a message of type TimestampedS16

TimestampedU32 int

The value that corresponds to a message of type TimestampedU32

TimestampedS32 int

The value that corresponds to a message of type TimestampedS32

TimestampedU64 int

The value that corresponds to a message of type TimestampedU64

TimestampedS64 int

The value that corresponds to a message of type TimestampedS64

TimestampedFloat int

The value that corresponds to a message of type TimestampedFloat

ReplyHarpMessage #

Bases: HarpMessage

A response message from a Harp device.

Attributes:

Name Type Description
payload Union[int, list[int]]

The message payload formatted as the appropriate type

timestamp float

The Harp timestamp at which the message was sent

is_error property #

Indicates if this HarpMessage is an error message or not.

Returns:

Type Description
bool

Returns True if this HarpMessage is an error message, False otherwise.

timestamp property #

The Harp timestamp at which the message was sent.

Returns:

Type Description
float

The Harp timestamp at which the message was sent

__init__(frame) #

Parameters:

Name Type Description Default
frame bytearray

The Harp message in bytearray format

required

payload_as_string() #

Returns the payload as a str.

Returns:

Type Description
str

The payload parsed as a str

SoundCard #

Bases: Device

SoundCard class for controlling the device.

read_analog_data() #

Reads the contents of the AnalogData register.

Returns:

Type Description
AnalogDataPayload

Value read from the AnalogData register.

read_attenuation_and_frequency_di0() #

Reads the contents of the AttenuationAndFrequencyDI0 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndFrequencyDI0 register.

read_attenuation_and_frequency_di1() #

Reads the contents of the AttenuationAndFrequencyDI1 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndFrequencyDI1 register.

read_attenuation_and_frequency_di2() #

Reads the contents of the AttenuationAndFrequencyDI2 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndFrequencyDI2 register.

read_attenuation_and_play_sound_or_freq() #

Reads the contents of the AttenuationAndPlaySoundOrFreq register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndPlaySoundOrFreq register.

read_attenuation_and_sound_index_di0() #

Reads the contents of the AttenuationAndSoundIndexDI0 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndSoundIndexDI0 register.

read_attenuation_and_sound_index_di1() #

Reads the contents of the AttenuationAndSoundIndexDI1 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndSoundIndexDI1 register.

read_attenuation_and_sound_index_di2() #

Reads the contents of the AttenuationAndSoundIndexDI2 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndSoundIndexDI2 register.

read_attenuation_both() #

Reads the contents of the AttenuationBoth register.

Returns:

Type Description
list[int]

Value read from the AttenuationBoth register.

read_attenuation_left() #

Reads the contents of the AttenuationLeft register.

Returns:

Type Description
int

Value read from the AttenuationLeft register.

read_attenuation_left_di0() #

Reads the contents of the AttenuationLeftDI0 register.

Returns:

Type Description
int

Value read from the AttenuationLeftDI0 register.

read_attenuation_left_di1() #

Reads the contents of the AttenuationLeftDI1 register.

Returns:

Type Description
int

Value read from the AttenuationLeftDI1 register.

read_attenuation_left_di2() #

Reads the contents of the AttenuationLeftDI2 register.

Returns:

Type Description
int

Value read from the AttenuationLeftDI2 register.

read_attenuation_right() #

Reads the contents of the AttenuationRight register.

Returns:

Type Description
int

Value read from the AttenuationRight register.

read_attenuation_right_di0() #

Reads the contents of the AttenuationRightDI0 register.

Returns:

Type Description
int

Value read from the AttenuationRightDI0 register.

read_attenuation_right_di1() #

Reads the contents of the AttenuationRightDI1 register.

Returns:

Type Description
int

Value read from the AttenuationRightDI1 register.

read_attenuation_right_di2() #

Reads the contents of the AttenuationRightDI2 register.

Returns:

Type Description
int

Value read from the AttenuationRightDI2 register.

read_commands() #

Reads the contents of the Commands register.

Returns:

Type Description
ControllerCommand

Value read from the Commands register.

read_configure_adc() #

Reads the contents of the ConfigureAdc register.

Returns:

Type Description
AdcConfiguration

Value read from the ConfigureAdc register.

read_configure_di0() #

Reads the contents of the ConfigureDI0 register.

Returns:

Type Description
DigitalInputConfiguration

Value read from the ConfigureDI0 register.

read_configure_di1() #

Reads the contents of the ConfigureDI1 register.

Returns:

Type Description
DigitalInputConfiguration

Value read from the ConfigureDI1 register.

read_configure_di2() #

Reads the contents of the ConfigureDI2 register.

Returns:

Type Description
DigitalInputConfiguration

Value read from the ConfigureDI2 register.

read_configure_do0() #

Reads the contents of the ConfigureDO0 register.

Returns:

Type Description
DigitalOutputConfiguration

Value read from the ConfigureDO0 register.

read_configure_do1() #

Reads the contents of the ConfigureDO1 register.

Returns:

Type Description
DigitalOutputConfiguration

Value read from the ConfigureDO1 register.

read_configure_do2() #

Reads the contents of the ConfigureDO2 register.

Returns:

Type Description
DigitalOutputConfiguration

Value read from the ConfigureDO2 register.

read_enable_events() #

Reads the contents of the EnableEvents register.

Returns:

Type Description
SoundCardEvents

Value read from the EnableEvents register.

read_frequency_di0() #

Reads the contents of the FrequencyDI0 register.

Returns:

Type Description
int

Value read from the FrequencyDI0 register.

read_frequency_di1() #

Reads the contents of the FrequencyDI1 register.

Returns:

Type Description
int

Value read from the FrequencyDI1 register.

read_frequency_di2() #

Reads the contents of the FrequencyDI2 register.

Returns:

Type Description
int

Value read from the FrequencyDI2 register.

read_input_state() #

Reads the contents of the InputState register.

Returns:

Type Description
DigitalInputs

Value read from the InputState register.

read_output_clear() #

Reads the contents of the OutputClear register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputClear register.

read_output_set() #

Reads the contents of the OutputSet register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputSet register.

read_output_state() #

Reads the contents of the OutputState register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputState register.

read_output_toggle() #

Reads the contents of the OutputToggle register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputToggle register.

read_play_sound_or_frequency() #

Reads the contents of the PlaySoundOrFrequency register.

Returns:

Type Description
int

Value read from the PlaySoundOrFrequency register.

read_pulse_do0() #

Reads the contents of the PulseDO0 register.

Returns:

Type Description
int

Value read from the PulseDO0 register.

read_pulse_do1() #

Reads the contents of the PulseDO1 register.

Returns:

Type Description
int

Value read from the PulseDO1 register.

read_pulse_do2() #

Reads the contents of the PulseDO2 register.

Returns:

Type Description
int

Value read from the PulseDO2 register.

read_sound_index_di0() #

Reads the contents of the SoundIndexDI0 register.

Returns:

Type Description
int

Value read from the SoundIndexDI0 register.

read_sound_index_di1() #

Reads the contents of the SoundIndexDI1 register.

Returns:

Type Description
int

Value read from the SoundIndexDI1 register.

read_sound_index_di2() #

Reads the contents of the SoundIndexDI2 register.

Returns:

Type Description
int

Value read from the SoundIndexDI2 register.

read_stop() #

Reads the contents of the Stop register.

Returns:

Type Description
int

Value read from the Stop register.

write_attenuation_and_frequency_di0(value) #

Writes a value to the AttenuationAndFrequencyDI0 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndFrequencyDI0 register.

required

write_attenuation_and_frequency_di1(value) #

Writes a value to the AttenuationAndFrequencyDI1 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndFrequencyDI1 register.

required

write_attenuation_and_frequency_di2(value) #

Writes a value to the AttenuationAndFrequencyDI2 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndFrequencyDI2 register.

required

write_attenuation_and_play_sound_or_freq(value) #

Writes a value to the AttenuationAndPlaySoundOrFreq register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndPlaySoundOrFreq register.

required

write_attenuation_and_sound_index_di0(value) #

Writes a value to the AttenuationAndSoundIndexDI0 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndSoundIndexDI0 register.

required

write_attenuation_and_sound_index_di1(value) #

Writes a value to the AttenuationAndSoundIndexDI1 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndSoundIndexDI1 register.

required

write_attenuation_and_sound_index_di2(value) #

Writes a value to the AttenuationAndSoundIndexDI2 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndSoundIndexDI2 register.

required

write_attenuation_both(value) #

Writes a value to the AttenuationBoth register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationBoth register.

required

write_attenuation_left(value) #

Writes a value to the AttenuationLeft register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeft register.

required

write_attenuation_left_di0(value) #

Writes a value to the AttenuationLeftDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeftDI0 register.

required

write_attenuation_left_di1(value) #

Writes a value to the AttenuationLeftDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeftDI1 register.

required

write_attenuation_left_di2(value) #

Writes a value to the AttenuationLeftDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeftDI2 register.

required

write_attenuation_right(value) #

Writes a value to the AttenuationRight register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRight register.

required

write_attenuation_right_di0(value) #

Writes a value to the AttenuationRightDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRightDI0 register.

required

write_attenuation_right_di1(value) #

Writes a value to the AttenuationRightDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRightDI1 register.

required

write_attenuation_right_di2(value) #

Writes a value to the AttenuationRightDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRightDI2 register.

required

write_commands(value) #

Writes a value to the Commands register.

Parameters:

Name Type Description Default
value ControllerCommand

Value to write to the Commands register.

required

write_configure_adc(value) #

Writes a value to the ConfigureAdc register.

Parameters:

Name Type Description Default
value AdcConfiguration

Value to write to the ConfigureAdc register.

required

write_configure_di0(value) #

Writes a value to the ConfigureDI0 register.

Parameters:

Name Type Description Default
value DigitalInputConfiguration

Value to write to the ConfigureDI0 register.

required

write_configure_di1(value) #

Writes a value to the ConfigureDI1 register.

Parameters:

Name Type Description Default
value DigitalInputConfiguration

Value to write to the ConfigureDI1 register.

required

write_configure_di2(value) #

Writes a value to the ConfigureDI2 register.

Parameters:

Name Type Description Default
value DigitalInputConfiguration

Value to write to the ConfigureDI2 register.

required

write_configure_do0(value) #

Writes a value to the ConfigureDO0 register.

Parameters:

Name Type Description Default
value DigitalOutputConfiguration

Value to write to the ConfigureDO0 register.

required

write_configure_do1(value) #

Writes a value to the ConfigureDO1 register.

Parameters:

Name Type Description Default
value DigitalOutputConfiguration

Value to write to the ConfigureDO1 register.

required

write_configure_do2(value) #

Writes a value to the ConfigureDO2 register.

Parameters:

Name Type Description Default
value DigitalOutputConfiguration

Value to write to the ConfigureDO2 register.

required

write_enable_events(value) #

Writes a value to the EnableEvents register.

Parameters:

Name Type Description Default
value SoundCardEvents

Value to write to the EnableEvents register.

required

write_frequency_di0(value) #

Writes a value to the FrequencyDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the FrequencyDI0 register.

required

write_frequency_di1(value) #

Writes a value to the FrequencyDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the FrequencyDI1 register.

required

write_frequency_di2(value) #

Writes a value to the FrequencyDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the FrequencyDI2 register.

required

write_output_clear(value) #

Writes a value to the OutputClear register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputClear register.

required

write_output_set(value) #

Writes a value to the OutputSet register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputSet register.

required

write_output_state(value) #

Writes a value to the OutputState register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputState register.

required

write_output_toggle(value) #

Writes a value to the OutputToggle register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputToggle register.

required

write_play_sound_or_frequency(value) #

Writes a value to the PlaySoundOrFrequency register.

Parameters:

Name Type Description Default
value int

Value to write to the PlaySoundOrFrequency register.

required

write_pulse_do0(value) #

Writes a value to the PulseDO0 register.

Parameters:

Name Type Description Default
value int

Value to write to the PulseDO0 register.

required

write_pulse_do1(value) #

Writes a value to the PulseDO1 register.

Parameters:

Name Type Description Default
value int

Value to write to the PulseDO1 register.

required

write_pulse_do2(value) #

Writes a value to the PulseDO2 register.

Parameters:

Name Type Description Default
value int

Value to write to the PulseDO2 register.

required

write_sound_index_di0(value) #

Writes a value to the SoundIndexDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the SoundIndexDI0 register.

required

write_sound_index_di1(value) #

Writes a value to the SoundIndexDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the SoundIndexDI1 register.

required

write_sound_index_di2(value) #

Writes a value to the SoundIndexDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the SoundIndexDI2 register.

required

write_stop(value) #

Writes a value to the Stop register.

Parameters:

Name Type Description Default
value int

Value to write to the Stop register.

required

SoundCardEvents #

Bases: IntFlag

Specifies the active events in the SoundCard.

Attributes:

Name Type Description
PLAY_SOUND_OR_FREQUENCY int

No description currently available

STOP int

No description currently available

DIGITAL_INPUTS int

No description currently available

ADC_VALUES int

No description currently available

SoundCardRegisters #

Bases: IntEnum

Enum for all available registers in the SoundCard device.

Attributes:

Name Type Description
PLAY_SOUND_OR_FREQUENCY int

Starts the sound index (if less than 32) or frequency (if greater or equal than 32)

STOP int

Any value will stop the current sound

ATTENUATION_LEFT int

Configure left channel's attenuation (1 LSB is 0.1dB)

ATTENUATION_RIGHT int

Configure right channel's attenuation (1 LSB is 0.1dB)

ATTENUATION_BOTH int

Configures both attenuation on right and left channels [Att R][Att L]

ATTENUATION_AND_PLAY_SOUND_OR_FREQ int

Configures attenuation and plays sound index [Att R][Att L] [Index]

INPUT_STATE int

State of the digital inputs

CONFIGURE_DI0 int

Configuration of the digital input 0 (DI0)

CONFIGURE_DI1 int

Configuration of the digital input 1 (DI1)

CONFIGURE_DI2 int

Configuration of the digital input 2 (DI2)

SOUND_INDEX_DI0 int

Specifies the sound index to be played when triggering DI0

SOUND_INDEX_DI1 int

Specifies the sound index to be played when triggering DI1

SOUND_INDEX_DI2 int

Specifies the sound index to be played when triggering DI2

FREQUENCY_DI0 int

Specifies the sound frequency to be played when triggering DI0

FREQUENCY_DI1 int

Specifies the sound frequency to be played when triggering DI1

FREQUENCY_DI2 int

Specifies the sound frequency to be played when triggering DI2

ATTENUATION_LEFT_DI0 int

Left channel's attenuation (1 LSB is 0.5dB) when triggering DI0

ATTENUATION_LEFT_DI1 int

Left channel's attenuation (1 LSB is 0.5dB) when triggering DI1

ATTENUATION_LEFT_DI2 int

Left channel's attenuation (1 LSB is 0.5dB) when triggering DI2

ATTENUATION_RIGHT_DI0 int

Right channel's attenuation (1 LSB is 0.5dB) when triggering DI0

ATTENUATION_RIGHT_DI1 int

Right channel's attenuation (1 LSB is 0.5dB) when triggering DI1

ATTENUATION_RIGHT_DI2 int

Right channel's attenuation (1 LSB is 0.5dB) when triggering DI2

ATTENUATION_AND_SOUND_INDEX_DI0 int

Sound index and attenuation to be played when triggering DI0 [Att R][Att L] [Index]

ATTENUATION_AND_SOUND_INDEX_DI1 int

Sound index and attenuation to be played when triggering DI1 [Att R][Att L] [Index]

ATTENUATION_AND_SOUND_INDEX_DI2 int

Sound index and attenuation to be played when triggering DI2 [Att R][Att L] [Index]

ATTENUATION_AND_FREQUENCY_DI0 int

Sound index and attenuation to be played when triggering DI0 [Att BOTH][Frequency]

ATTENUATION_AND_FREQUENCY_DI1 int

Sound index and attenuation to be played when triggering DI1 [Att BOTH][Frequency]

ATTENUATION_AND_FREQUENCY_DI2 int

Sound index and attenuation to be played when triggering DI2 [Att BOTH][Frequency]

CONFIGURE_DO0 int

Configuration of the digital output 0 (DO0)

CONFIGURE_DO1 int

Configuration of the digital output 1 (DO1)

CONFIGURE_DO2 int

Configuration of the digital output 2 (DO2

PULSE_DO0 int

Pulse for the digital output 0 (DO0)

PULSE_DO1 int

Pulse for the digital output 1 (DO1)

PULSE_DO2 int

Pulse for the digital output 2 (DO2)

OUTPUT_SET int

Set the specified digital output lines

OUTPUT_CLEAR int

Clear the specified digital output lines

OUTPUT_TOGGLE int

Toggle the specified digital output lines

OUTPUT_STATE int

Write the state of all digital output lines

CONFIGURE_ADC int

Configuration of Analog Inputs

ANALOG_DATA int

Contains sampled analog input data or dynamic sound parameters controlled by the ADC channels. Values are zero if not used.

COMMANDS int

Send commands to PIC32 micro-controller

ENABLE_EVENTS int

Specifies the active events in the SoundCard device

harpdevice #

AdcConfiguration #

Bases: IntEnum

Specifies the operation mode of the analog inputs.

Attributes:

Name Type Description
NOT_USED int

No description currently available

ADC_ADC int

No description currently available

AMPLITUDE_BOTH_ADC int

No description currently available

AMPLITUDE_LEFT_ADC int

No description currently available

AMPLITUDE_RIGHT_ADC int

No description currently available

AMPLITUDE_LEFT_AMPLITUDE_RIGHT int

No description currently available

AMPLITUDE_BOTH_FREQUENCY int

No description currently available

AnalogDataPayload dataclass #

AnalogDataPayload(Adc0: int, Adc1: int, AttenuationLeft: int, AttenuationRight: int, Frequency: int)

Parameters:

Name Type Description Default
Adc0 int
required
Adc1 int
required
AttenuationLeft int
required
AttenuationRight int
required
Frequency int
required

ControllerCommand #

Bases: IntEnum

Specifies commands to send to the PIC32 micro-controller

Attributes:

Name Type Description
DISABLE_BOOTLOADER int

No description currently available

ENABLE_BOOTLOADER int

No description currently available

DELETE_ALL_SOUNDS int

No description currently available

DigitalInputConfiguration #

Bases: IntEnum

Specifies the operation mode of the digital input.

Attributes:

Name Type Description
DIGITAL int

Used as a pure digital input.

START_AND_STOP_SOUND int

Starts sound when rising edge and stop when falling edge.

START_SOUND int

Starts sound when rising edge.

STOP int

Stops sound or frequency when rising edge.

START_AND_STOP_FREQUENCY int

Starts frequency when rising edge and stop when falling edge.

START_FREQUENCY int

Starts frequency when rising edge.

DigitalInputs #

Bases: IntFlag

Specifies the state of the digital input lines.

Attributes:

Name Type Description
DI0 int

No description currently available

DigitalOutputConfiguration #

Bases: IntEnum

Specifies the operation mode of the digital output.

Attributes:

Name Type Description
DIGITAL int

Used as a pure digital output.

PULSE int

The digital output will be high during a period specified by register DOxPulse.

HIGH_WHEN_SOUND int

High when the sound is being played.

PULSE_1MS_WHEN_START int

High when sound starts during 1 ms.

PULSE_10MS_WHEN_START int

High when sound starts during 10 ms.

PULSE_100MS_WHEN_START int

High when sound starts during 100 ms.

PULSE_1MS_WHEN_STOP int

High when sound stops during 1 ms.

PULSE_10MS_WHEN_STOP int

High when sound stops during 10 ms.

PULSE_100MS_WHEN_STOP int

High when sound starts during 100 ms.

DigitalOutputs #

Bases: IntFlag

Specifies the state of the digital output lines.

Attributes:

Name Type Description
DO0 int

No description currently available

DO1 int

No description currently available

DO2 int

No description currently available

SoundCard #

Bases: Device

SoundCard class for controlling the device.

read_analog_data() #

Reads the contents of the AnalogData register.

Returns:

Type Description
AnalogDataPayload

Value read from the AnalogData register.

read_attenuation_and_frequency_di0() #

Reads the contents of the AttenuationAndFrequencyDI0 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndFrequencyDI0 register.

read_attenuation_and_frequency_di1() #

Reads the contents of the AttenuationAndFrequencyDI1 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndFrequencyDI1 register.

read_attenuation_and_frequency_di2() #

Reads the contents of the AttenuationAndFrequencyDI2 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndFrequencyDI2 register.

read_attenuation_and_play_sound_or_freq() #

Reads the contents of the AttenuationAndPlaySoundOrFreq register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndPlaySoundOrFreq register.

read_attenuation_and_sound_index_di0() #

Reads the contents of the AttenuationAndSoundIndexDI0 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndSoundIndexDI0 register.

read_attenuation_and_sound_index_di1() #

Reads the contents of the AttenuationAndSoundIndexDI1 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndSoundIndexDI1 register.

read_attenuation_and_sound_index_di2() #

Reads the contents of the AttenuationAndSoundIndexDI2 register.

Returns:

Type Description
list[int]

Value read from the AttenuationAndSoundIndexDI2 register.

read_attenuation_both() #

Reads the contents of the AttenuationBoth register.

Returns:

Type Description
list[int]

Value read from the AttenuationBoth register.

read_attenuation_left() #

Reads the contents of the AttenuationLeft register.

Returns:

Type Description
int

Value read from the AttenuationLeft register.

read_attenuation_left_di0() #

Reads the contents of the AttenuationLeftDI0 register.

Returns:

Type Description
int

Value read from the AttenuationLeftDI0 register.

read_attenuation_left_di1() #

Reads the contents of the AttenuationLeftDI1 register.

Returns:

Type Description
int

Value read from the AttenuationLeftDI1 register.

read_attenuation_left_di2() #

Reads the contents of the AttenuationLeftDI2 register.

Returns:

Type Description
int

Value read from the AttenuationLeftDI2 register.

read_attenuation_right() #

Reads the contents of the AttenuationRight register.

Returns:

Type Description
int

Value read from the AttenuationRight register.

read_attenuation_right_di0() #

Reads the contents of the AttenuationRightDI0 register.

Returns:

Type Description
int

Value read from the AttenuationRightDI0 register.

read_attenuation_right_di1() #

Reads the contents of the AttenuationRightDI1 register.

Returns:

Type Description
int

Value read from the AttenuationRightDI1 register.

read_attenuation_right_di2() #

Reads the contents of the AttenuationRightDI2 register.

Returns:

Type Description
int

Value read from the AttenuationRightDI2 register.

read_commands() #

Reads the contents of the Commands register.

Returns:

Type Description
ControllerCommand

Value read from the Commands register.

read_configure_adc() #

Reads the contents of the ConfigureAdc register.

Returns:

Type Description
AdcConfiguration

Value read from the ConfigureAdc register.

read_configure_di0() #

Reads the contents of the ConfigureDI0 register.

Returns:

Type Description
DigitalInputConfiguration

Value read from the ConfigureDI0 register.

read_configure_di1() #

Reads the contents of the ConfigureDI1 register.

Returns:

Type Description
DigitalInputConfiguration

Value read from the ConfigureDI1 register.

read_configure_di2() #

Reads the contents of the ConfigureDI2 register.

Returns:

Type Description
DigitalInputConfiguration

Value read from the ConfigureDI2 register.

read_configure_do0() #

Reads the contents of the ConfigureDO0 register.

Returns:

Type Description
DigitalOutputConfiguration

Value read from the ConfigureDO0 register.

read_configure_do1() #

Reads the contents of the ConfigureDO1 register.

Returns:

Type Description
DigitalOutputConfiguration

Value read from the ConfigureDO1 register.

read_configure_do2() #

Reads the contents of the ConfigureDO2 register.

Returns:

Type Description
DigitalOutputConfiguration

Value read from the ConfigureDO2 register.

read_enable_events() #

Reads the contents of the EnableEvents register.

Returns:

Type Description
SoundCardEvents

Value read from the EnableEvents register.

read_frequency_di0() #

Reads the contents of the FrequencyDI0 register.

Returns:

Type Description
int

Value read from the FrequencyDI0 register.

read_frequency_di1() #

Reads the contents of the FrequencyDI1 register.

Returns:

Type Description
int

Value read from the FrequencyDI1 register.

read_frequency_di2() #

Reads the contents of the FrequencyDI2 register.

Returns:

Type Description
int

Value read from the FrequencyDI2 register.

read_input_state() #

Reads the contents of the InputState register.

Returns:

Type Description
DigitalInputs

Value read from the InputState register.

read_output_clear() #

Reads the contents of the OutputClear register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputClear register.

read_output_set() #

Reads the contents of the OutputSet register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputSet register.

read_output_state() #

Reads the contents of the OutputState register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputState register.

read_output_toggle() #

Reads the contents of the OutputToggle register.

Returns:

Type Description
DigitalOutputs

Value read from the OutputToggle register.

read_play_sound_or_frequency() #

Reads the contents of the PlaySoundOrFrequency register.

Returns:

Type Description
int

Value read from the PlaySoundOrFrequency register.

read_pulse_do0() #

Reads the contents of the PulseDO0 register.

Returns:

Type Description
int

Value read from the PulseDO0 register.

read_pulse_do1() #

Reads the contents of the PulseDO1 register.

Returns:

Type Description
int

Value read from the PulseDO1 register.

read_pulse_do2() #

Reads the contents of the PulseDO2 register.

Returns:

Type Description
int

Value read from the PulseDO2 register.

read_sound_index_di0() #

Reads the contents of the SoundIndexDI0 register.

Returns:

Type Description
int

Value read from the SoundIndexDI0 register.

read_sound_index_di1() #

Reads the contents of the SoundIndexDI1 register.

Returns:

Type Description
int

Value read from the SoundIndexDI1 register.

read_sound_index_di2() #

Reads the contents of the SoundIndexDI2 register.

Returns:

Type Description
int

Value read from the SoundIndexDI2 register.

read_stop() #

Reads the contents of the Stop register.

Returns:

Type Description
int

Value read from the Stop register.

write_attenuation_and_frequency_di0(value) #

Writes a value to the AttenuationAndFrequencyDI0 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndFrequencyDI0 register.

required
write_attenuation_and_frequency_di1(value) #

Writes a value to the AttenuationAndFrequencyDI1 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndFrequencyDI1 register.

required
write_attenuation_and_frequency_di2(value) #

Writes a value to the AttenuationAndFrequencyDI2 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndFrequencyDI2 register.

required
write_attenuation_and_play_sound_or_freq(value) #

Writes a value to the AttenuationAndPlaySoundOrFreq register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndPlaySoundOrFreq register.

required
write_attenuation_and_sound_index_di0(value) #

Writes a value to the AttenuationAndSoundIndexDI0 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndSoundIndexDI0 register.

required
write_attenuation_and_sound_index_di1(value) #

Writes a value to the AttenuationAndSoundIndexDI1 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndSoundIndexDI1 register.

required
write_attenuation_and_sound_index_di2(value) #

Writes a value to the AttenuationAndSoundIndexDI2 register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationAndSoundIndexDI2 register.

required
write_attenuation_both(value) #

Writes a value to the AttenuationBoth register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the AttenuationBoth register.

required
write_attenuation_left(value) #

Writes a value to the AttenuationLeft register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeft register.

required
write_attenuation_left_di0(value) #

Writes a value to the AttenuationLeftDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeftDI0 register.

required
write_attenuation_left_di1(value) #

Writes a value to the AttenuationLeftDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeftDI1 register.

required
write_attenuation_left_di2(value) #

Writes a value to the AttenuationLeftDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationLeftDI2 register.

required
write_attenuation_right(value) #

Writes a value to the AttenuationRight register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRight register.

required
write_attenuation_right_di0(value) #

Writes a value to the AttenuationRightDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRightDI0 register.

required
write_attenuation_right_di1(value) #

Writes a value to the AttenuationRightDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRightDI1 register.

required
write_attenuation_right_di2(value) #

Writes a value to the AttenuationRightDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the AttenuationRightDI2 register.

required
write_commands(value) #

Writes a value to the Commands register.

Parameters:

Name Type Description Default
value ControllerCommand

Value to write to the Commands register.

required
write_configure_adc(value) #

Writes a value to the ConfigureAdc register.

Parameters:

Name Type Description Default
value AdcConfiguration

Value to write to the ConfigureAdc register.

required
write_configure_di0(value) #

Writes a value to the ConfigureDI0 register.

Parameters:

Name Type Description Default
value DigitalInputConfiguration

Value to write to the ConfigureDI0 register.

required
write_configure_di1(value) #

Writes a value to the ConfigureDI1 register.

Parameters:

Name Type Description Default
value DigitalInputConfiguration

Value to write to the ConfigureDI1 register.

required
write_configure_di2(value) #

Writes a value to the ConfigureDI2 register.

Parameters:

Name Type Description Default
value DigitalInputConfiguration

Value to write to the ConfigureDI2 register.

required
write_configure_do0(value) #

Writes a value to the ConfigureDO0 register.

Parameters:

Name Type Description Default
value DigitalOutputConfiguration

Value to write to the ConfigureDO0 register.

required
write_configure_do1(value) #

Writes a value to the ConfigureDO1 register.

Parameters:

Name Type Description Default
value DigitalOutputConfiguration

Value to write to the ConfigureDO1 register.

required
write_configure_do2(value) #

Writes a value to the ConfigureDO2 register.

Parameters:

Name Type Description Default
value DigitalOutputConfiguration

Value to write to the ConfigureDO2 register.

required
write_enable_events(value) #

Writes a value to the EnableEvents register.

Parameters:

Name Type Description Default
value SoundCardEvents

Value to write to the EnableEvents register.

required
write_frequency_di0(value) #

Writes a value to the FrequencyDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the FrequencyDI0 register.

required
write_frequency_di1(value) #

Writes a value to the FrequencyDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the FrequencyDI1 register.

required
write_frequency_di2(value) #

Writes a value to the FrequencyDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the FrequencyDI2 register.

required
write_output_clear(value) #

Writes a value to the OutputClear register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputClear register.

required
write_output_set(value) #

Writes a value to the OutputSet register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputSet register.

required
write_output_state(value) #

Writes a value to the OutputState register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputState register.

required
write_output_toggle(value) #

Writes a value to the OutputToggle register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the OutputToggle register.

required
write_play_sound_or_frequency(value) #

Writes a value to the PlaySoundOrFrequency register.

Parameters:

Name Type Description Default
value int

Value to write to the PlaySoundOrFrequency register.

required
write_pulse_do0(value) #

Writes a value to the PulseDO0 register.

Parameters:

Name Type Description Default
value int

Value to write to the PulseDO0 register.

required
write_pulse_do1(value) #

Writes a value to the PulseDO1 register.

Parameters:

Name Type Description Default
value int

Value to write to the PulseDO1 register.

required
write_pulse_do2(value) #

Writes a value to the PulseDO2 register.

Parameters:

Name Type Description Default
value int

Value to write to the PulseDO2 register.

required
write_sound_index_di0(value) #

Writes a value to the SoundIndexDI0 register.

Parameters:

Name Type Description Default
value int

Value to write to the SoundIndexDI0 register.

required
write_sound_index_di1(value) #

Writes a value to the SoundIndexDI1 register.

Parameters:

Name Type Description Default
value int

Value to write to the SoundIndexDI1 register.

required
write_sound_index_di2(value) #

Writes a value to the SoundIndexDI2 register.

Parameters:

Name Type Description Default
value int

Value to write to the SoundIndexDI2 register.

required
write_stop(value) #

Writes a value to the Stop register.

Parameters:

Name Type Description Default
value int

Value to write to the Stop register.

required

SoundCardEvents #

Bases: IntFlag

Specifies the active events in the SoundCard.

Attributes:

Name Type Description
PLAY_SOUND_OR_FREQUENCY int

No description currently available

STOP int

No description currently available

DIGITAL_INPUTS int

No description currently available

ADC_VALUES int

No description currently available

SoundCardRegisters #

Bases: IntEnum

Enum for all available registers in the SoundCard device.

Attributes:

Name Type Description
PLAY_SOUND_OR_FREQUENCY int

Starts the sound index (if less than 32) or frequency (if greater or equal than 32)

STOP int

Any value will stop the current sound

ATTENUATION_LEFT int

Configure left channel's attenuation (1 LSB is 0.1dB)

ATTENUATION_RIGHT int

Configure right channel's attenuation (1 LSB is 0.1dB)

ATTENUATION_BOTH int

Configures both attenuation on right and left channels [Att R][Att L]

ATTENUATION_AND_PLAY_SOUND_OR_FREQ int

Configures attenuation and plays sound index [Att R][Att L] [Index]

INPUT_STATE int

State of the digital inputs

CONFIGURE_DI0 int

Configuration of the digital input 0 (DI0)

CONFIGURE_DI1 int

Configuration of the digital input 1 (DI1)

CONFIGURE_DI2 int

Configuration of the digital input 2 (DI2)

SOUND_INDEX_DI0 int

Specifies the sound index to be played when triggering DI0

SOUND_INDEX_DI1 int

Specifies the sound index to be played when triggering DI1

SOUND_INDEX_DI2 int

Specifies the sound index to be played when triggering DI2

FREQUENCY_DI0 int

Specifies the sound frequency to be played when triggering DI0

FREQUENCY_DI1 int

Specifies the sound frequency to be played when triggering DI1

FREQUENCY_DI2 int

Specifies the sound frequency to be played when triggering DI2

ATTENUATION_LEFT_DI0 int

Left channel's attenuation (1 LSB is 0.5dB) when triggering DI0

ATTENUATION_LEFT_DI1 int

Left channel's attenuation (1 LSB is 0.5dB) when triggering DI1

ATTENUATION_LEFT_DI2 int

Left channel's attenuation (1 LSB is 0.5dB) when triggering DI2

ATTENUATION_RIGHT_DI0 int

Right channel's attenuation (1 LSB is 0.5dB) when triggering DI0

ATTENUATION_RIGHT_DI1 int

Right channel's attenuation (1 LSB is 0.5dB) when triggering DI1

ATTENUATION_RIGHT_DI2 int

Right channel's attenuation (1 LSB is 0.5dB) when triggering DI2

ATTENUATION_AND_SOUND_INDEX_DI0 int

Sound index and attenuation to be played when triggering DI0 [Att R][Att L] [Index]

ATTENUATION_AND_SOUND_INDEX_DI1 int

Sound index and attenuation to be played when triggering DI1 [Att R][Att L] [Index]

ATTENUATION_AND_SOUND_INDEX_DI2 int

Sound index and attenuation to be played when triggering DI2 [Att R][Att L] [Index]

ATTENUATION_AND_FREQUENCY_DI0 int

Sound index and attenuation to be played when triggering DI0 [Att BOTH][Frequency]

ATTENUATION_AND_FREQUENCY_DI1 int

Sound index and attenuation to be played when triggering DI1 [Att BOTH][Frequency]

ATTENUATION_AND_FREQUENCY_DI2 int

Sound index and attenuation to be played when triggering DI2 [Att BOTH][Frequency]

CONFIGURE_DO0 int

Configuration of the digital output 0 (DO0)

CONFIGURE_DO1 int

Configuration of the digital output 1 (DO1)

CONFIGURE_DO2 int

Configuration of the digital output 2 (DO2

PULSE_DO0 int

Pulse for the digital output 0 (DO0)

PULSE_DO1 int

Pulse for the digital output 1 (DO1)

PULSE_DO2 int

Pulse for the digital output 2 (DO2)

OUTPUT_SET int

Set the specified digital output lines

OUTPUT_CLEAR int

Clear the specified digital output lines

OUTPUT_TOGGLE int

Toggle the specified digital output lines

OUTPUT_STATE int

Write the state of all digital output lines

CONFIGURE_ADC int

Configuration of Analog Inputs

ANALOG_DATA int

Contains sampled analog input data or dynamic sound parameters controlled by the ADC channels. Values are zero if not used.

COMMANDS int

Send commands to PIC32 micro-controller

ENABLE_EVENTS int

Specifies the active events in the SoundCard device