![]() |
Qwiic_CAP1203_Py
2.0.0
Python for SFE Qwiic CAP1203
|
Public Member Functions | |
def | __init__ (self, address=None, i2c_driver=None) |
Constructor. More... | |
def | is_connected (self) |
Determines if this device is connected. More... | |
def | begin (self) |
Initializes this device with default parameters. More... | |
def | check_main_control (self) |
Control the primary power state of the device. More... | |
def | check_status (self) |
Checks inputs in the general status register to ensure program is set up correctly. More... | |
def | clear_interrupt (self) |
Clears the interrupt (INT) bit by writing a logic 0 to it. More... | |
def | set_interrupt_disabled (self) |
This disables all the interrupts, so the alert LED will not turn on when a sensor is touched. More... | |
def | set_interrupt_enabled (self) |
This turns on all the interrupts, so the alert LED turns on when any sensor is touched. More... | |
def | is_interrupt_enabled (self) |
Returns state of intterupt pin. More... | |
def | set_sensitivity (self, sensitivity) |
Sensitivity calibrated for SparkFun Capacitive Touch Slider. More... | |
def | get_sensitivity (self) |
Returns the sensitivity multiplier for current sensitivity settings (pg. More... | |
def | is_left_touched (self) |
Checks if touch input detected on left sensor (pad 1). More... | |
def | is_middle_touched (self) |
Checks if touch input detected on left sensor (pad 2). More... | |
def | is_right_touched (self) |
Checks if touch input detected on left sensor (pad 3). More... | |
def | is_touched (self) |
Checks if touch input detected on any sensor. More... | |
def | is_right_swipe_pulled (self) |
Checks if a right swipe occured on the board. More... | |
def | is_left_swipe_pulled (self) |
Checks if a left swipe occured on the board. More... | |
def | set_power_button_pad (self, pad) |
Sets a specific pad to act as a power button. More... | |
def | get_power_button_pad (self) |
Returns which capacitive touch pad is currently set to act as a power button. More... | |
def | set_power_button_time (self, input_time) |
Configure the length of time that the designated power button must indicate a touch before an interrupt is generated and the power status indicator is set. More... | |
def | get_power_button_time (self) |
Returns the length of the time designated time power button must indicate a touch before an interrupt is generated. More... | |
def | set_power_button_enabled (self) |
Enables power button in active state. More... | |
def | set_power_button_disabled (self) |
Disables power button in active state. More... | |
def | is_power_button_enabled (self) |
Returns state of power button. More... | |
def | is_power_button_touched (self) |
Once the power button has been held for designated time, an interrupt is generated and PWR bit is set in the General Status Register. More... | |
def | millis (self) |
Get the current time in milliseconds. More... | |
Public Attributes | |
address | |
Properties | |
connected = property(is_connected) | |
def qwiic_cap1203.QwiicCAP1203.__init__ | ( | self, | |
address = None , |
|||
i2c_driver = None |
|||
) |
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_cap1203.QwiicCAP1203.begin | ( | self | ) |
Initializes this device with default parameters.
True
if successful, otherwise False
def qwiic_cap1203.QwiicCAP1203.check_main_control | ( | self | ) |
Control the primary power state of the device.
See data sheet on Main Control Register (pg. 22).
def qwiic_cap1203.QwiicCAP1203.check_status | ( | self | ) |
Checks inputs in the general status register to ensure program is set up correctly.
See data sheet on Status Registers (pg. 23).
def qwiic_cap1203.QwiicCAP1203.clear_interrupt | ( | self | ) |
Clears the interrupt (INT) bit by writing a logic 0 to it.
This bit must be cleared in order to detec a new capacitive touch input. See datasheet on Main Control Register (pg. 22).
def qwiic_cap1203.QwiicCAP1203.get_power_button_pad | ( | self | ) |
Returns which capacitive touch pad is currently set to act as a power button.
Add 1 to return value so value matches pad number. See data sheet on Power Button (pg. 44) REG VALUE PAD 0x00 1 0x01 2 0x02 3
def qwiic_cap1203.QwiicCAP1203.get_power_button_time | ( | self | ) |
Returns the length of the time designated time power button must indicate a touch before an interrupt is generated.
See data sheet on Power Button Time (pg. 44) REG VALUE TIME 0x00 280 MS 0x01 560 MS 0x02 1120 MS 0x03 2240 MS
def qwiic_cap1203.QwiicCAP1203.get_sensitivity | ( | self | ) |
Returns the sensitivity multiplier for current sensitivity settings (pg.
25).
def qwiic_cap1203.QwiicCAP1203.is_connected | ( | self | ) |
Determines if this device is connected.
True
if connected, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_interrupt_enabled | ( | self | ) |
Returns state of intterupt pin.
Returns true if all interrupts enabled (0x07), otherwise returns false. When the interrupts are enabled, the LED on the CAP1203 Touch Slider Board turns on when it detects a touch (pg. 33).
True
if enabled, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_left_swipe_pulled | ( | self | ) |
Checks if a left swipe occured on the board.
This method takes up all functionality due to implementation of while loop with millis().
True
if left swipe occured, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_left_touched | ( | self | ) |
Checks if touch input detected on left sensor (pad 1).
Need to clear interrupt pin after touch occurs. See datasheet on Sensor Interrupt Status Reg (pg.23).
True
if left sensor is touched, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_middle_touched | ( | self | ) |
Checks if touch input detected on left sensor (pad 2).
Need to clear interrupt pin after touch occurs. See datasheet on Sensor Interrupt Status Reg (pg.23).
True
if middle sensor is touched, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_power_button_enabled | ( | self | ) |
Returns state of power button.
Returns true if enabled (reg. value is 0x01), otherwise returns false. Power button must be ENABLED to use. See data sheet on Power Button Configuration Register (pg. 43-44).
True
if enabled, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_power_button_touched | ( | self | ) |
Once the power button has been held for designated time, an interrupt is generated and PWR bit is set in the General Status Register.
See data sheet on Power Button (pg. 16), Power Button Register (pg. 43), and Power Button Configuration Register (pg. 43).
True
if power button is touched, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_right_swipe_pulled | ( | self | ) |
Checks if a right swipe occured on the board.
This method takes up all functionality due to implementation of while loop with millis().
True
if right swipe occured, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_right_touched | ( | self | ) |
Checks if touch input detected on left sensor (pad 3).
Need to clear interrupt pin after touch occurs. See datasheet on Sensor Interrupt Status Reg (pg.23).
True
if right sensor is touched, otherwise False
def qwiic_cap1203.QwiicCAP1203.is_touched | ( | self | ) |
Checks if touch input detected on any sensor.
Need to clear interrupt pin after touch occurs. See datasheet on Sensor Interrupt Status (pg.23).
True
if any sensor is touched, otherwise False
def qwiic_cap1203.QwiicCAP1203.millis | ( | self | ) |
Get the current time in milliseconds.
def qwiic_cap1203.QwiicCAP1203.set_interrupt_disabled | ( | self | ) |
This disables all the interrupts, so the alert LED will not turn on when a sensor is touched.
Set on default in begin function See data sheet on Interrupt Enable Register (pg. 33).
def qwiic_cap1203.QwiicCAP1203.set_interrupt_enabled | ( | self | ) |
This turns on all the interrupts, so the alert LED turns on when any sensor is touched.
See data sheet on Interrupt Enable Register (pg. 33).
def qwiic_cap1203.QwiicCAP1203.set_power_button_disabled | ( | self | ) |
Disables power button in active state.
See data sheet on Power Button Configuration Register (pg. 43-44)
def qwiic_cap1203.QwiicCAP1203.set_power_button_enabled | ( | self | ) |
Enables power button in active state.
See data sheet on Power Button Configuration Register (pg. 43-44)
def qwiic_cap1203.QwiicCAP1203.set_power_button_pad | ( | self, | |
pad | |||
) |
Sets a specific pad to act as a power button.
Function takes in which pad to set as power button. See datasheet on Power Button (pg. 16).
int | pad: Pad to be set as power button |
True
if successful, otherwise False
def qwiic_cap1203.QwiicCAP1203.set_power_button_time | ( | self, | |
input_time | |||
) |
Configure the length of time that the designated power button must indicate a touch before an interrupt is generated and the power status indicator is set.
See data sheet on Power Button Configuration Register (pg. 43).
Possible inputs (represent time in ms): 280, 560, 1120, 2240
int | input_time: Power button input time |
True
if successful, otherwise False
def qwiic_cap1203.QwiicCAP1203.set_sensitivity | ( | self, | |
sensitivity | |||
) |
Sensitivity calibrated for SparkFun Capacitive Touch Slider.
You may want to change sensitivity settings if creating your own capacitive touch pads. See datasheet on Sensitivity Control Register (pg. 25).
int | sensitivity: Sensitivity multiplier |
qwiic_cap1203.QwiicCAP1203.address |
|
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 |