API Reference¶
qwiic_pir¶
Python module for the Qwiic PIR. This python package is a port of the exisiting [SparkFun Qwiic PIR Arduino Library](https://github.com/sparkfun/SparkFun_Qwiic_PIR_Arduino_Library) This package can be used in conjunction with the overall [SparkFun Qwiic Python Package](https://github.com/sparkfun/Qwiic_Py) New to qwiic? Take a look at the entire [SparkFun Qwiic Ecosystem](https://www.sparkfun.com/qwiic).
-
class
qwiic_pir.
QwiicPIR
(address=None, i2c_driver=None)[source]¶ - Parameters
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.
- Returns
The GPIO device object.
- Return type
Object
-
available
()[source]¶ Return the event_available bit of the EVENT_STATUS register
- Returns
event_available bit
- Rtye
bool
-
begin
()[source]¶ Initialize the operation of the Qwiic PIR Run is_connected() and check the ID in the ID register
- Returns
Returns true if the intialization was successful, otherwise False.
- Return type
bool
-
clear_event_bits
()[source]¶ Clear the object_remove, object_detect, and event_available bits of the EVENT_STATUS register
- Returns
Nothing
- Return type
Void
-
disable_interrupt
()[source]¶ Clear the interrupt_enable bit of the INTERRUPT_CONFIG register
- Returns
Nothing
- Return type
Void
-
enable_interrupt
()[source]¶ Set interrupt_enable bit of the INTERRUPT_CONFIG register to a 1
- Returns
Nothing
- Return type
Void
-
get_I2C_address
()[source]¶ Returns the current I2C address of the Qwiic PIR
- Returns
current I2C address
- Return type
int
-
get_debounce_time
()[source]¶ Returns the value in the EVENT_DEBOUNCE_TIME register
- Returns
debounce time in milliseconds
- Return type
int
-
get_firmware_version
()[source]¶ Read the register and get the major and minor firmware version number.
- Returns
16 bytes version number
- Return type
int
-
is_connected
()[source]¶ Determine if a Qwiic PIR device is connected to the system.
- Returns
True if the device is connected, otherwise False.
- Return type
bool
-
is_detected_queue_empty
()[source]¶ Returns the is_empty bit of the DETECTED_QUEUE_STATUS register
- Returns
detected_is_empty
- Return type
bool
-
is_detected_queue_full
()[source]¶ Returns the is_full bit of the DETECTED_QUEUE_STATUS register
- Returns
detected_is_full
- Return type
bool
-
is_removed_queue_empty
()[source]¶ Returns the is_empty bit of the REMOVED_QUEUE_STATUS register
- Returns
removed_is_empty
- Return type
bool
-
is_removed_queue_full
()[source]¶ Returns the is_full bit of the REMOVED_QUEUE_STATUS register
- Returns
removed_is_full
- Return type
bool
-
object_detected
()[source]¶ Returns the value of the object_detect status bit of the EVENT_STATUS register
- Returns
object_detect bit
- Return type
bool
-
object_removed
()[source]¶ Returns the value of the object_remove status bit of the EVENT_STATUS register
- Returns
object_remove bit
- Return type
bool
-
pop_detected_queue
()[source]¶ Returns contents of DETECTED_QUEUE_BACK register and writes a 1 to pop_request bit of DETECTED_QUEUE_STATUS register.
- Returns
DETECTED_QUEUE_BACK
- Return type
int
-
pop_removed_queue
()[source]¶ Returns contents of REMOVED_QUEUE_BACK register and writes a 1 to pop_request bit of REMOVED_QUEUE_STATUS register.
- Returns
REMOVED_QUEUE_BACK
- Return type
int
-
raw_reading
()[source]¶ Returns the value of the raw_reading status bit of the EVENT_STATUS register
- Returns
raw_object_detected bit
- Return type
bool
-
reset_interrupt_config
()[source]¶ Enable detect interrupt and clear the event_available bit of EVENT_STATUS register
- Returns
Nothing
- Return type
Void
-
set_I2C_address
(new_address)[source]¶ Change the I2C address of the Qwiic PIR
- Parameters
new_address – the new I2C address to set the Qwiic PIR to
- Returns
True if the change was successful, false otherwise.
- Return type
bool
-
set_debounce_time
(time)[source]¶ Write two bytes into the EVENT_DEBOUNCE_TIME register
- Parameters
time – the time in milliseconds to set debounce time to The max deounce time is 0xFFFF milliseconds, but the function checks if the entered parameter is valid
- Returns
Nothing
- Return type
void
-
time_since_first_detect
()[source]¶ Returns the four bytes of DETECTED_QUEUE_BACK. Time in milliseconds
- Returns
DETECTED_QUEUE_BACK
- Return type
int
-
time_since_first_remove
()[source]¶ Returns the four bytes of REMOVED_QUEUE_BACK. Time in milliseconds
- Returns
REMOVED_QUEUE_BACK
- Return type
int