![]() |
qwiic_cy8cmbr3_py
v1.0.0-1-g033724a
Python for SFE qwiic cy8cmbr3 py
|
Public Member Functions | |
| def | __init__ (self, address=None, i2c_driver=None, enableDebug=False) |
| Constructor. More... | |
| def | is_connected (self) |
| Determines if this device is connected. More... | |
| def | begin (self) |
| Initializes this device with default parameters. More... | |
| def | get_family_id (self) |
| Reads and returns the Family ID register. More... | |
| def | get_device_id (self) |
| Reads and returns the Device ID register. More... | |
| def | enable (self, cs=0, enable=True) |
| Enables or disables the capacitive sensor 0 (CS0) More... | |
| def | set_auto_reset_enable (self, enable=True, timeout=kAutoResetTimeout5Seconds) |
| Enables or disables the auto-reset feature for buttons and sliders. More... | |
| def | set_spo0_config (self, config) |
| Sets the SPO0 configuration. More... | |
| def | set_sensitivity_cs0 (self, sensitivity) |
| Sets the sensitivity for the capacitive sensor 0 (CS0) More... | |
| def | set_refresh_interval (self, interval) |
| Sets the refresh interval for the capacitive sensor. More... | |
| def | set_gpo_config (self, controlByHost, pwmOutput, strongDrive, activeHigh) |
| Configures the GPO0 settings. More... | |
| def | led_on (self, enable=True) |
| Sets the GPO0 output state to turn on/off an LED. More... | |
| def | led_off (self) |
| Turns off the LED connected to GPO0. More... | |
| def | get_debug_sensor_id (self) |
| Reads and returns the Debug Sensor ID register. More... | |
| def | set_sensor_id (self, sensor_id=0) |
| Sets the Sensor ID register. More... | |
| def | get_capacitance_pf (self) |
| Reads and returns the capacitance value from CS0 in picofarads (pF) More... | |
| def | get_diff_count (self) |
| Reads and returns the difference count value from CS0. More... | |
| def | get_diff_pf (self) |
| Reads and returns the difference count value from CS0 in picofarads (pF) More... | |
| def | get_baseline_count (self) |
| Reads and returns the baseline count value from CS0. More... | |
| def | check_saturation (self, rawCount) |
| Checks if the raw count value indicates saturation. More... | |
| def | get_raw_count (self, autoCalibrate=False) |
| Reads and returns the raw count value from CS0. More... | |
| def | is_ctrl_command_complete (self) |
| Determines if the last control command has completed. More... | |
| def | send_ctrl_command (self, command, waitForCompletion=True) |
| Sends a control command to the device. More... | |
| def | save_config (self) |
| Saves the current configuration to non-volatile memory. More... | |
| def | set_i2c_address (self, new_address) |
| Sets a new I2C address for the device. More... | |
| def | reset (self, waitForCompletion=True) |
| Performs a software reset of the device. More... | |
| def | debug_print (self, str) |
| Prints debug information to the console if debugging is enabled. More... | |
Public Attributes | |
| enableDebug | |
| address | |
Properties | |
| connected = property(is_connected) | |
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.__init__ | ( | self, | |
address = None, |
|||
i2c_driver = None, |
|||
enableDebug = False |
|||
| ) |
Constructor.
| int,optional | address: The I2C address to use for the device If not provided, the default address is used |
| I2CDriver,optional | i2c_driver: An existing i2c driver object If not provided, a driver object is created |
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.begin | ( | self | ) |
Initializes this device with default parameters.
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.check_saturation | ( | self, | |
| rawCount | |||
| ) |
Checks if the raw count value indicates saturation.
| rawCount | The raw count value to check |
True if saturated, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.debug_print | ( | self, | |
| str | |||
| ) |
Prints debug information to the console if debugging is enabled.
| str | The string to print |
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.enable | ( | self, | |
cs = 0, |
|||
enable = True |
|||
| ) |
Enables or disables the capacitive sensor 0 (CS0)
| cs | The capacitive sensor number (only 0 and 1 are supported) |
| enable | If True, enables CS0 If False, disables CS0 |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_baseline_count | ( | self | ) |
Reads and returns the baseline count value from CS0.
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_capacitance_pf | ( | self | ) |
Reads and returns the capacitance value from CS0 in picofarads (pF)
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_debug_sensor_id | ( | self | ) |
Reads and returns the Debug Sensor ID register.
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_device_id | ( | self | ) |
Reads and returns the Device ID register.
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_diff_count | ( | self | ) |
Reads and returns the difference count value from CS0.
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_diff_pf | ( | self | ) |
Reads and returns the difference count value from CS0 in picofarads (pF)
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_family_id | ( | self | ) |
Reads and returns the Family ID register.
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.get_raw_count | ( | self, | |
autoCalibrate = False |
|||
| ) |
Reads and returns the raw count value from CS0.
| autoCalibrate | If True, performs auto-calibration if saturation is detected. |
Note: Do not touch the sensor while auto-calibration is occurring. It will range the sensor to a very high capacitance value which will not be recoverable by future auto-calibrations until the sensor is manually reset. ONLY ENABLE IF AWARE OF THE CONSEQUENCES OF A SOFTWARE RESET!
| def qwiic_cy8cmbr3.QwiicCY8CMBR3.is_connected | ( | self | ) |
Determines if this device is connected.
True if connected, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.is_ctrl_command_complete | ( | self | ) |
Determines if the last control command has completed.
True if the last command is complete, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.led_off | ( | self | ) |
Turns off the LED connected to GPO0.
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.led_on | ( | self, | |
enable = True |
|||
| ) |
Sets the GPO0 output state to turn on/off an LED.
| enable | If True, turns on the LED If False, turns off the LED |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.reset | ( | self, | |
waitForCompletion = True |
|||
| ) |
Performs a software reset of the device.
| waitForCompletion | If True, waits for the reset to complete |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.save_config | ( | self | ) |
Saves the current configuration to non-volatile memory.
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.send_ctrl_command | ( | self, | |
| command, | |||
waitForCompletion = True |
|||
| ) |
Sends a control command to the device.
| command | The control command to send |
| waitForCompletion | If True, waits for the command to complete |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_auto_reset_enable | ( | self, | |
enable = True, |
|||
timeout = kAutoResetTimeout5Seconds |
|||
| ) |
Enables or disables the auto-reset feature for buttons and sliders.
| enable | If True, enables auto-reset If False, disables auto-reset |
| timeout | The auto-reset timeout to set Use one of the kAutoResetTimeout* constants defined in this class |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_gpo_config | ( | self, | |
| controlByHost, | |||
| pwmOutput, | |||
| strongDrive, | |||
| activeHigh | |||
| ) |
Configures the GPO0 settings.
| controlByHost | If True, GPO0 is controlled by the host If False, GPO0 is controlled by the device |
| pwmOutput | If True, GPO0 outputs PWM signal If False, GPO0 outputs digital signal |
| strongDrive | If True, GPO0 uses strong drive mode If False, GPO0 uses weak drive mode |
| activeHigh | If True, GPO0 is active high If False, GPO0 is active low |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_i2c_address | ( | self, | |
| new_address | |||
| ) |
Sets a new I2C address for the device.
| new_address | The new I2C address to set |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_refresh_interval | ( | self, | |
| interval | |||
| ) |
Sets the refresh interval for the capacitive sensor.
| interval | The refresh interval value to set Use one of the kRefreshInterval* constants defined in this class |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_sensitivity_cs0 | ( | self, | |
| sensitivity | |||
| ) |
Sets the sensitivity for the capacitive sensor 0 (CS0)
| sensitivity | The sensitivity value to set Use one of the kCsSensitivity* constants defined in this class |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_sensor_id | ( | self, | |
sensor_id = 0 |
|||
| ) |
Sets the Sensor ID register.
| sensor_id | The Sensor ID value to set |
True if successful, otherwise False | def qwiic_cy8cmbr3.QwiicCY8CMBR3.set_spo0_config | ( | self, | |
| config | |||
| ) |
Sets the SPO0 configuration.
| enable | If True, enables SPO0 If False, disables SPO0 |
| mode | The SPO0 mode to set |
| threshold | The SPO0 threshold to set |
True if successful, otherwise False | qwiic_cy8cmbr3.QwiicCY8CMBR3.address |
|
static |
|
static |
|
static |
| qwiic_cy8cmbr3.QwiicCY8CMBR3.enableDebug |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |