![]() |
Qwiic_OPT4048_Py
v0.9.1_test-4-gdcd7056
Python for SFE Qwiic OPT4048
|
Public Member Functions | |
def | __init__ (self, address=None, i2c_driver=None) |
Initialize the QwOpt4048 device class. More... | |
def | is_connected (self) |
Determine if a OPT4048 device is conntected to the system. More... | |
def | begin (self) |
Initializes this device with default parameters. More... | |
def | get_device_id (self) |
Retrieve the unique device ID of the OPT4048. More... | |
def | set_basic_setup (self) |
Configure basic setup for the OPT4048. More... | |
def | set_range (self, color_range) |
Set the range of the OPT4048. More... | |
def | get_range (self) |
Retrieve the current range setting of the OPT4048. More... | |
def | set_conversion_time (self, time) |
Set the time used to convert light to analog values. More... | |
def | get_conversion_time (self) |
Gets the time used to convert light to analog values. More... | |
def | set_qwake (self, enable=True) |
Sets the quick wake bit for the OPT4048. More... | |
def | get_qwake (self) |
Retrieve the quick wake bit for the OPT4048. More... | |
def | set_operation_mode (self, mode) |
Set the operation mode of the OPT4048: Power-down, Forced auto-range, one-shot, or continuous. More... | |
def | get_operation_mode (self) |
Retrieve the current operation mode of the OPT4048. More... | |
def | set_int_latch (self, enable=True) |
Set the interrupt latch of the OPT4048. More... | |
def | get_int_latch (self) |
Retrieve the interrupt latch of the OPT4048. More... | |
def | set_int_active_high (self, enable=True) |
Set the interrupt polarity of the OPT4048. More... | |
def | get_int_active_high (self) |
Retrieve the interrupt polarity of the OPT4048. More... | |
def | set_int_input (self, enable=True) |
Set the interrupt input of the OPT4048. More... | |
def | get_int_input_enable (self) |
Retrieve the interrupt input of the OPT4048. More... | |
def | set_int_mechanism (self, mechanism) |
Set the interrupt mechanism of the OPT4048: SMBus Alert, INT Pin data ready for next channel, or INT Pin data ready for all channels. More... | |
def | get_int_mechanism (self) |
Retrieve the interrupt mechanism of the OPT4048: SMBus Alert, INT Pin data ready for next channel, or INT Pin data ready for all channels. More... | |
def | get_all_flags (self) |
Retrieve all flags of the OPT4048. More... | |
def | get_overload_flag (self) |
Retrieve the flag that indicates the ADC is overloaded. More... | |
def | get_conv_ready_flag (self) |
Retrieve the flag that indicates a conversion is ready to be read. More... | |
def | get_too_bright_flag (self) |
Retrieve the flag that indicates lux has is above the current range. More... | |
def | get_too_dim_flag (self) |
Retrieve the flag that indicates lux has is below the current range. More... | |
def | set_fault_count (self, count) |
Set the number of faults needed to trigger an interupt. More... | |
def | get_fault_count (self) |
Retrieve the number of faults that have been triggered. More... | |
def | set_threshold_low (self, thresh) |
Set the low interrupt threshold value of the OPT4048. More... | |
def | get_threshold_low (self) |
Retrieve the low interrupt threshold value of the OPT4048. More... | |
def | set_threshold_high (self, thresh) |
Set the high interrupt threshold value of the OPT4048. More... | |
def | get_threshold_high (self) |
Retrieve the high interrupt threshold value of the OPT4048. More... | |
def | set_i2c_burst (self, enable=True) |
Set the I2C burst setting of the OPT4048: auto-increment or single register I2C reads. More... | |
def | get_i2c_burst (self) |
Retrieve the I2C burst setting of the OPT4048: auto-increment or single register I2C reads. More... | |
def | get_adc_ch0 (self) |
Retrieve the ADC value of channel 0 of the OPT4048. More... | |
def | get_adc_code (self, bytes) |
Calculate the ADC code from the 2 words read from an ADC register. More... | |
def | get_adc_counter (self, bytes) |
Calculate the ADC counter from the 2 words read from an ADC register. More... | |
def | get_adc_crc (self, bytes) |
Calculate the ADC CRC from the 2 words read from an ADC register. More... | |
def | get_adc_ch1 (self) |
Retrieve the ADC value of channel 1 of the OPT4048. More... | |
def | get_adc_ch2 (self) |
Retrieve the ADC value of channel 2 of the OPT4048. More... | |
def | get_adc_ch3 (self) |
Retrieve the ADC value of channel 3 of the OPT4048. More... | |
def | get_all_adc (self) |
Retrieve the ADC values of all channels of the OPT4048. More... | |
def | get_all_channel_data (self, color) |
Retrieve the ADC values of all channels of the OPT4048. More... | |
def | get_lux (self) |
Retrieve the Lux value of the OPT4048. More... | |
def | get_CIEx (self) |
Retrieve the CIEx value of the OPT4048. More... | |
def | get_CIEy (self) |
Retrieve the CIEy value of the OPT4048. More... | |
def | get_CCT (self) |
Retrieve the CCT value of the OPT4048. More... | |
Public Attributes | |
address | |
FLAGS_MASK_OVERLOAD | |
FLAGS_MASK_CONV_READY | |
FLAGS_MASK_FLAG_HIGH | |
FLAGS_MASK_FLAG_LOW | |
Properties | |
connected = property(is_connected) | |
def qwiic_opt4048.QwOpt4048.__init__ | ( | self, | |
address = None , |
|||
i2c_driver = None |
|||
) |
def qwiic_opt4048.QwOpt4048.begin | ( | self | ) |
Initializes this device with default parameters.
True
if successful, otherwise False
def qwiic_opt4048.QwOpt4048.get_adc_ch0 | ( | self | ) |
Retrieve the ADC value of channel 0 of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_adc_ch1 | ( | self | ) |
Retrieve the ADC value of channel 1 of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_adc_ch2 | ( | self | ) |
Retrieve the ADC value of channel 2 of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_adc_ch3 | ( | self | ) |
Retrieve the ADC value of channel 3 of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_adc_code | ( | self, | |
bytes | |||
) |
Calculate the ADC code from the 2 words read from an ADC register.
list | of int bytes: The resulting list of doing a 4 byte block read from an ADC register. |
def qwiic_opt4048.QwOpt4048.get_adc_counter | ( | self, | |
bytes | |||
) |
Calculate the ADC counter from the 2 words read from an ADC register.
list | of int bytes: The resulting list of doing a 4 byte block read from an ADC register. |
def qwiic_opt4048.QwOpt4048.get_adc_crc | ( | self, | |
bytes | |||
) |
Calculate the ADC CRC from the 2 words read from an ADC register.
list | of int bytes: The resulting list of doing a 4 byte block read from an ADC register. |
def qwiic_opt4048.QwOpt4048.get_all_adc | ( | self | ) |
Retrieve the ADC values of all channels of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_all_channel_data | ( | self, | |
color | |||
) |
Retrieve the ADC values of all channels of the OPT4048.
sfe_color_t | color: Color data object to store the ADC values. |
def qwiic_opt4048.QwOpt4048.get_all_flags | ( | self | ) |
Retrieve all flags of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_CCT | ( | self | ) |
Retrieve the CCT value of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_CIEx | ( | self | ) |
Retrieve the CIEx value of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_CIEy | ( | self | ) |
Retrieve the CIEy value of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_conv_ready_flag | ( | self | ) |
Retrieve the flag that indicates a conversion is ready to be read.
def qwiic_opt4048.QwOpt4048.get_conversion_time | ( | self | ) |
Gets the time used to convert light to analog values.
Longer times result in more accurate readings.
def qwiic_opt4048.QwOpt4048.get_device_id | ( | self | ) |
Retrieve the unique device ID of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_fault_count | ( | self | ) |
Retrieve the number of faults that have been triggered.
def qwiic_opt4048.QwOpt4048.get_i2c_burst | ( | self | ) |
Retrieve the I2C burst setting of the OPT4048: auto-increment or single register I2C reads.
On by default.
def qwiic_opt4048.QwOpt4048.get_int_active_high | ( | self | ) |
Retrieve the interrupt polarity of the OPT4048.
When enabled, the interrupt pin is active high.
def qwiic_opt4048.QwOpt4048.get_int_input_enable | ( | self | ) |
Retrieve the interrupt input of the OPT4048.
When enabled, the interrupt pin is used as an input.
def qwiic_opt4048.QwOpt4048.get_int_latch | ( | self | ) |
Retrieve the interrupt latch of the OPT4048.
When enabled, the interrupt pin will remain active until the interrupt register is read.
def qwiic_opt4048.QwOpt4048.get_int_mechanism | ( | self | ) |
Retrieve the interrupt mechanism of the OPT4048: SMBus Alert, INT Pin data ready for next channel, or INT Pin data ready for all channels.
def qwiic_opt4048.QwOpt4048.get_lux | ( | self | ) |
Retrieve the Lux value of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_operation_mode | ( | self | ) |
Retrieve the current operation mode of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_overload_flag | ( | self | ) |
Retrieve the flag that indicates the ADC is overloaded.
def qwiic_opt4048.QwOpt4048.get_qwake | ( | self | ) |
Retrieve the quick wake bit for the OPT4048.
When enabled, not all systems are put into deep sleep when the device is set to this mode, resulting in faster wake times.
def qwiic_opt4048.QwOpt4048.get_range | ( | self | ) |
Retrieve the current range setting of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_threshold_high | ( | self | ) |
Retrieve the high interrupt threshold value of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_threshold_low | ( | self | ) |
Retrieve the low interrupt threshold value of the OPT4048.
def qwiic_opt4048.QwOpt4048.get_too_bright_flag | ( | self | ) |
Retrieve the flag that indicates lux has is above the current range.
This is considered a fault and is stored int the fault register.
def qwiic_opt4048.QwOpt4048.get_too_dim_flag | ( | self | ) |
Retrieve the flag that indicates lux has is below the current range.
This is considered a fault and is stored int the fault register.
def qwiic_opt4048.QwOpt4048.is_connected | ( | self | ) |
Determine if a OPT4048 device is conntected to the system.
def qwiic_opt4048.QwOpt4048.set_basic_setup | ( | self | ) |
Configure basic setup for the OPT4048.
This function sets the range, conversion time, and operation mode to default values. It's meant to just get the device up and running with minimal thought from the user.
def qwiic_opt4048.QwOpt4048.set_conversion_time | ( | self, | |
time | |||
) |
Set the time used to convert light to analog values.
Longer times result in more accurate readings.
int | time: The desired conversion time to set. |
def qwiic_opt4048.QwOpt4048.set_fault_count | ( | self, | |
count | |||
) |
Set the number of faults needed to trigger an interupt.
int | count: Number of faults needed to trigger an interupt. |
def qwiic_opt4048.QwOpt4048.set_i2c_burst | ( | self, | |
enable = True |
|||
) |
Set the I2C burst setting of the OPT4048: auto-increment or single register I2C reads.
bool | enable: Enable or disable I2C burst setting. |
def qwiic_opt4048.QwOpt4048.set_int_active_high | ( | self, | |
enable = True |
|||
) |
Set the interrupt polarity of the OPT4048.
When enabled, the interrupt pin is active high.
bool | enable: Enable or disable interrupt polarity. |
def qwiic_opt4048.QwOpt4048.set_int_input | ( | self, | |
enable = True |
|||
) |
Set the interrupt input of the OPT4048.
When enabled, the interrupt pin is used as an input.
bool | enable: Enable or disable interrupt input. |
def qwiic_opt4048.QwOpt4048.set_int_latch | ( | self, | |
enable = True |
|||
) |
Set the interrupt latch of the OPT4048.
When enabled, the interrupt pin will remain active until the interrupt register is read.
bool | enable: Enable or disable interrupt latch. |
def qwiic_opt4048.QwOpt4048.set_int_mechanism | ( | self, | |
mechanism | |||
) |
Set the interrupt mechanism of the OPT4048: SMBus Alert, INT Pin data ready for next channel, or INT Pin data ready for all channels.
bool | enable: Enable or disable interrupt mechanism. |
def qwiic_opt4048.QwOpt4048.set_operation_mode | ( | self, | |
mode | |||
) |
Set the operation mode of the OPT4048: Power-down, Forced auto-range, one-shot, or continuous.
int | mode: The desired operation mode to set. |
def qwiic_opt4048.QwOpt4048.set_qwake | ( | self, | |
enable = True |
|||
) |
Sets the quick wake bit for the OPT4048.
When enabled, not all systems are put into deep sleep when the device is set to this mode, resulting in faster wake times.
bool | enable: Enable or disable quick wake. |
def qwiic_opt4048.QwOpt4048.set_range | ( | self, | |
color_range | |||
) |
Set the range of the OPT4048.
int | (Must be one of the valid range settings in the RANGE_... enums above) color_range: The desired range to set. |
def qwiic_opt4048.QwOpt4048.set_threshold_high | ( | self, | |
thresh | |||
) |
Set the high interrupt threshold value of the OPT4048.
int | thresh: High interrupt threshold value. |
def qwiic_opt4048.QwOpt4048.set_threshold_low | ( | self, | |
thresh | |||
) |
Set the low interrupt threshold value of the OPT4048.
int | thresh: Low interrupt threshold value. |
qwiic_opt4048.QwOpt4048.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 |
qwiic_opt4048.QwOpt4048.FLAGS_MASK_CONV_READY |
|
static |
qwiic_opt4048.QwOpt4048.FLAGS_MASK_FLAG_HIGH |
|
static |
qwiic_opt4048.QwOpt4048.FLAGS_MASK_FLAG_LOW |
|
static |
qwiic_opt4048.QwOpt4048.FLAGS_MASK_OVERLOAD |
|
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 |