![]() |
Qwiic_Button_Py
2.0.3-3-gae48379
Python for SFE Qwiic Button
|
Public Member Functions | |
| def | __init__ (self, address=None, i2c_driver=None) |
| def | is_connected (self) |
| Determine if a Qwiic Button device is connected to the system. More... | |
| def | begin (self) |
| Initialize the operation of the Qwiic Button Run is_connected() and check the ID in the ID register. More... | |
| def | get_firmware_version (self) |
| Read the register and get the major and minor firmware version number. More... | |
| def | set_I2C_address (self, new_address) |
| Change the I2C address of the Qwiic Button. More... | |
| def | get_I2C_address (self) |
| Returns the current I2C address of the Qwiic Button. More... | |
| def | is_button_pressed (self) |
| Returns the value of the is_pressed status bit of the BUTTON_STATUS register. More... | |
| def | has_button_been_clicked (self) |
| Returns the value of the has_been_clicked status bit of the BUTTON_STATUS register. More... | |
| def | get_debounce_time (self) |
| Returns the value in the BUTTON_DEBOUNCE_TIME register. More... | |
| def | set_debounce_time (self, time) |
| Write two bytes into the BUTTON_DEBOUNCE_TIME register. More... | |
| def | enable_pressed_interrupt (self) |
| Set pressed_enable bit of the INTERRUPT_CONFIG register to a 1. More... | |
| def | disable_pressed_interrupt (self) |
| Clear the pressed_enable bit of the INTERRUPT_CONFIG register. More... | |
| def | enable_clicked_interrupt (self) |
| Set the clicked_enable bit of the INTERRUPT_CONFIG register. More... | |
| def | disable_clicked_interrupt (self) |
| Clear the clicked_enable bit of the INTERRUPT_CONFIG register. More... | |
| def | available (self) |
| Return the event_available bit of the BUTTON_STATUS register. More... | |
| def | clear_event_bits (self) |
| Clear the is_pressed, has_been_clicked, and event_available bits of the BUTTON_STATUS register. More... | |
| def | reset_interrupt_config (self) |
| Enable pressed and clicked interrupts and clear the event_available bit of BUTTON_STATUS register. More... | |
| def | is_pressed_queue_full (self) |
| Returns the is_full bit of the PRESSED_QUEUE_STATUS register. More... | |
| def | is_pressed_queue_empty (self) |
| Returns the is_empty bit of the PRESSED_QUEUE_STATUS register. More... | |
| def | time_since_last_press (self) |
| Returns the four bytes of PRESSED_QUEUE_FRONT. More... | |
| def | time_since_first_press (self) |
| Returns the four bytes of PRESSED_QUEUE_BACK. More... | |
| def | pop_pressed_queue (self) |
| Returns contents of PRESSED_QUEUE_BACK register and writes a 1 to popRequest bit of PRESSED_QUEUE_STATUS register. More... | |
| def | is_clicked_queue_full (self) |
| Reads the is_full bit of the CLICKED_QUEUE_STATUS register. More... | |
| def | is_clicked_queue_empty (self) |
| Reads the is_empty bit of the CLICKED_QUEUE_STATUS register. More... | |
| def | time_since_last_click (self) |
| Returns the four bytes of CLICKED_QUEUE_FRONT register. More... | |
| def | time_since_first_click (self) |
| Returns the four bytes of CLICKED_QUEUE_BACK register. More... | |
| def | pop_clicked_queue (self) |
| Returns contents of CLICKED_QUEUE_BACK register and writes a 1 to popRequest bit of CLICKED_QUEUE_STATUS register. More... | |
| def | LED_config (self, brightness, cycle_time, off_time, granularity=1) |
| Write brightness, cycle_time, off_time, and granularity parameters to their respective registers: LED_BRIGHTNESS, LED_PULSE_CYCLE_TIME, LED_PULSE_OFF_TIME, LED_PULSE_GRANULARITY. More... | |
| def | LED_off (self) |
| Write zero's to all the LED registers: LED_BRIGHTNESS, LED_PULSE_CYCLE_TIME, LED_PULSE_OFF_TIME, and LED_PULSE_GRANULARITY defaults to zero. More... | |
| def | LED_on (self, brightness) |
| Set LED on without pulse. More... | |
Static Public Attributes | |
| device_name = _DEFAULT_NAME | |
| available_addresses = _AVAILABLE_I2C_ADDRESS | |
| int | DEV_ID = 0x5D |
| int | ID = 0x00 |
| int | FIRMWARE_MINOR = 0x01 |
| int | FIRMWARE_MAJOR = 0x02 |
| int | BUTTON_STATUS = 0x03 |
| int | INTERRUPT_CONFIG = 0x04 |
| int | BUTTON_DEBOUNCE_TIME = 0x05 |
| int | PRESSED_QUEUE_STATUS = 0x07 |
| int | PRESSED_QUEUE_FRONT = 0x08 |
| int | PRESSED_QUEUE_BACK = 0x0C |
| int | CLICKED_QUEUE_STATUS = 0x10 |
| int | CLICKED_QUEUE_FRONT = 0x11 |
| int | CLICKED_QUEUE_BACK = 0x15 |
| int | LED_BRIGHTNESS = 0x19 |
| int | LED_PULSE_GRANULARITY = 0x1A |
| int | LED_PULSE_CYCLE_TIME = 0x1B |
| int | LED_PULSE_OFF_TIME = 0x1D |
| int | I2C_ADDRESS = 0x1F |
| int | event_available = 0 |
| int | has_been_clicked = 0 |
| int | is_pressed = 0 |
| int | clicked_enable = 0 |
| int | pressed_enable = 0 |
| int | pressed_pop_request = 0 |
| int | pressed_is_empty = 0 |
| int | pressed_is_full = 0 |
| int | clicked_pop_request = 0 |
| int | clicked_is_empty = 0 |
| int | clicked_is_full = 0 |
| address | The I2C address to use for the device. If not provided, the default address is used. |
| i2c_driver | An existing i2c driver object. If not provided a driver object is created. |
| def qwiic_button.QwiicButton.__init__ | ( | self, | |
address = None, |
|||
i2c_driver = None |
|||
| ) |
| def qwiic_button.QwiicButton.available | ( | self | ) |
Return the event_available bit of the BUTTON_STATUS register.
| def qwiic_button.QwiicButton.begin | ( | self | ) |
Initialize the operation of the Qwiic Button Run is_connected() and check the ID in the ID register.
| def qwiic_button.QwiicButton.clear_event_bits | ( | self | ) |
Clear the is_pressed, has_been_clicked, and event_available bits of the BUTTON_STATUS register.
| def qwiic_button.QwiicButton.disable_clicked_interrupt | ( | self | ) |
Clear the clicked_enable bit of the INTERRUPT_CONFIG register.
| def qwiic_button.QwiicButton.disable_pressed_interrupt | ( | self | ) |
Clear the pressed_enable bit of the INTERRUPT_CONFIG register.
| def qwiic_button.QwiicButton.enable_clicked_interrupt | ( | self | ) |
Set the clicked_enable bit of the INTERRUPT_CONFIG register.
| def qwiic_button.QwiicButton.enable_pressed_interrupt | ( | self | ) |
Set pressed_enable bit of the INTERRUPT_CONFIG register to a 1.
| def qwiic_button.QwiicButton.get_debounce_time | ( | self | ) |
Returns the value in the BUTTON_DEBOUNCE_TIME register.
| def qwiic_button.QwiicButton.get_firmware_version | ( | self | ) |
Read the register and get the major and minor firmware version number.
| def qwiic_button.QwiicButton.get_I2C_address | ( | self | ) |
Returns the current I2C address of the Qwiic Button.
| def qwiic_button.QwiicButton.has_button_been_clicked | ( | self | ) |
Returns the value of the has_been_clicked status bit of the BUTTON_STATUS register.
| def qwiic_button.QwiicButton.is_button_pressed | ( | self | ) |
Returns the value of the is_pressed status bit of the BUTTON_STATUS register.
| def qwiic_button.QwiicButton.is_clicked_queue_empty | ( | self | ) |
Reads the is_empty bit of the CLICKED_QUEUE_STATUS register.
| def qwiic_button.QwiicButton.is_clicked_queue_full | ( | self | ) |
Reads the is_full bit of the CLICKED_QUEUE_STATUS register.
| def qwiic_button.QwiicButton.is_connected | ( | self | ) |
Determine if a Qwiic Button device is connected to the system.
| def qwiic_button.QwiicButton.is_pressed_queue_empty | ( | self | ) |
Returns the is_empty bit of the PRESSED_QUEUE_STATUS register.
| def qwiic_button.QwiicButton.is_pressed_queue_full | ( | self | ) |
Returns the is_full bit of the PRESSED_QUEUE_STATUS register.
| def qwiic_button.QwiicButton.LED_config | ( | self, | |
| brightness, | |||
| cycle_time, | |||
| off_time, | |||
granularity = 1 |
|||
| ) |
Write brightness, cycle_time, off_time, and granularity parameters to their respective registers: LED_BRIGHTNESS, LED_PULSE_CYCLE_TIME, LED_PULSE_OFF_TIME, LED_PULSE_GRANULARITY.
| brightness | between 0 (led off) and 255 (max brightness) |
| cycle_time | total pulse cycle in in milliseconds Range 0 to 0xFFFF |
| off_time | off time between pulses in milliseconds Range 0 to 0xFFFF |
| granularity | the amount of steps it takes to get to led brightness If not provided, granularity defaults to 1 |
| def qwiic_button.QwiicButton.LED_off | ( | self | ) |
Write zero's to all the LED registers: LED_BRIGHTNESS, LED_PULSE_CYCLE_TIME, LED_PULSE_OFF_TIME, and LED_PULSE_GRANULARITY defaults to zero.
| def qwiic_button.QwiicButton.LED_on | ( | self, | |
| brightness | |||
| ) |
Set LED on without pulse.
| brightness | between 0 (led off) and 255 (max brightness) |
| def qwiic_button.QwiicButton.pop_clicked_queue | ( | self | ) |
Returns contents of CLICKED_QUEUE_BACK register and writes a 1 to popRequest bit of CLICKED_QUEUE_STATUS register.
| def qwiic_button.QwiicButton.pop_pressed_queue | ( | self | ) |
Returns contents of PRESSED_QUEUE_BACK register and writes a 1 to popRequest bit of PRESSED_QUEUE_STATUS register.
| def qwiic_button.QwiicButton.reset_interrupt_config | ( | self | ) |
Enable pressed and clicked interrupts and clear the event_available bit of BUTTON_STATUS register.
| def qwiic_button.QwiicButton.set_debounce_time | ( | self, | |
| time | |||
| ) |
Write two bytes into the BUTTON_DEBOUNCE_TIME register.
| time | the time in milliseconds to set debounce time to The max debounce time is 0xFFFF milliseconds, but the function checks if the entered parameter is valid |
| def qwiic_button.QwiicButton.set_I2C_address | ( | self, | |
| new_address | |||
| ) |
Change the I2C address of the Qwiic Button.
| new_address | the new I2C address to set the Qwiic Button to The function itself checks if the entered parameter is a valid I2C address |
| def qwiic_button.QwiicButton.time_since_first_click | ( | self | ) |
Returns the four bytes of CLICKED_QUEUE_BACK register.
Time in milliseconds
| def qwiic_button.QwiicButton.time_since_first_press | ( | self | ) |
Returns the four bytes of PRESSED_QUEUE_BACK.
Time in milliseconds
| def qwiic_button.QwiicButton.time_since_last_click | ( | self | ) |
Returns the four bytes of CLICKED_QUEUE_FRONT register.
Time in milliseconds
| def qwiic_button.QwiicButton.time_since_last_press | ( | self | ) |
Returns the four bytes of PRESSED_QUEUE_FRONT.
Time in milliseconds.
| qwiic_button.QwiicButton.address |
|
static |
|
static |
|
static |
|
static |
| qwiic_button.QwiicButton.clicked_enable |
|
static |
| qwiic_button.QwiicButton.clicked_is_empty |
|
static |
| qwiic_button.QwiicButton.clicked_is_full |
|
static |
| qwiic_button.QwiicButton.clicked_pop_request |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| qwiic_button.QwiicButton.event_available |
|
static |
|
static |
|
static |
| qwiic_button.QwiicButton.has_been_clicked |
|
static |
|
static |
|
static |
|
static |
| qwiic_button.QwiicButton.is_pressed |
|
static |
|
static |
|
static |
|
static |
|
static |
| qwiic_button.QwiicButton.pressed_enable |
|
static |
| qwiic_button.QwiicButton.pressed_is_empty |
|
static |
| qwiic_button.QwiicButton.pressed_is_full |
|
static |
| qwiic_button.QwiicButton.pressed_pop_request |
|
static |
|
static |
|
static |