self.machine.hardware_platforms[‘p3_roc’]¶
-
class
mpf.platforms.p3_roc.
P3RocHardwarePlatform
(machine)¶ Bases:
mpf.platforms.p_roc_common.PROCBasePlatform
,mpf.core.platform.I2cPlatform
,mpf.core.platform.AccelerometerPlatform
Platform class for the P3-ROC hardware controller.
Parameters: machine – The MachineController instance. -
machine
¶ The MachineController instance.
Accessing the p3_roc platform via code
Hardware platforms are stored in the
self.machine.hardware_platforms
dictionary, so the p3_roc platform is available viaself.machine.hardware_platforms['p3_roc']
.Methods & Attributes
The p3_roc platform has the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.
-
configure_accelerometer
(config, callback)¶ Configure the accelerometer on the P3-ROC.
-
configure_driver
(config: mpf.core.platform.DriverConfig, number: str, platform_settings: dict)¶ Create a P3-ROC driver.
Typically drivers are coils or flashers, but for the P3-ROC this is also used for matrix-based lights.
Parameters: config – Dictionary of settings for the driver. Returns: A reference to the PROCDriver object which is the actual object you can use to pulse(), patter(), enable(), etc.
-
configure_switch
(number: str, config: mpf.core.platform.SwitchConfig, platform_config: dict)¶ Configure a P3-ROC switch.
Parameters: config – Dictionary of settings for the switch. In the case of the P3-ROC, it uses the following: Returns: A configured switch object.
-
get_hw_switch_states
()¶ Read in and set the initial switch state.
The P-ROC uses the following values for hw switch states: 1 - closed (debounced) 2 - open (debounced) 3 - closed (not debounced) 4 - open (not debounced)
-
get_info_string
()¶ Dump infos about boards.
-
i2c_read16
(address, register)¶ Read an 16-bit value from the I2C bus of the P3-Roc.
-
i2c_read8
(address, register)¶ Read an 8-bit value from the I2C bus of the P3-Roc.
-
i2c_read_block
(address, register, count)¶ Read block via I2C.
-
i2c_write8
(address, register, value)¶ Write an 8-bit value to the I2C bus of the P3-Roc.
-
classmethod
scale_accelerometer_to_g
(raw_value)¶ Convert internal representation to g.
-
tick
()¶ Check the P3-ROC for any events (switch state changes).
Also tickles the watchdog and flushes any queued commands to the P3-ROC.
-