tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/veml6070/registers.go (about)

     1  package veml6070
     2  
     3  // I2C addresses and other constants
     4  
     5  const (
     6  	ADDR_L = 0x38 // 7bit address of the VEML6070 (write, read)
     7  	ADDR_H = 0x39 // 7bit address of the VEML6070 (read)
     8  )
     9  
    10  // Some possible values for resistance value (in ohm) of VEML6070 calibration resistor
    11  const (
    12  	RSET_240K = 240000
    13  	RSET_270K = 270000
    14  	RSET_300K = 300000
    15  	RSET_600K = 600000
    16  )
    17  
    18  // Possible values for integration time of VEML6070
    19  // (internally represents the config register bit mask)
    20  const (
    21  	IT_HALF = 0x00
    22  	IT_1    = 0x04
    23  	IT_2    = 0x08
    24  	IT_4    = 0x0C
    25  )
    26  
    27  // Possible values for UVI (UV index) risk level estimations - the VEML6070 can
    28  // only estimate UVI risk levels since it can only sense UVA rays but the vendor
    29  // tried to come up with some coarse thresholds, from application notes
    30  const (
    31  	UVI_RISK_LOW = iota
    32  	UVI_RISK_MODERATE
    33  	UVI_RISK_HIGH
    34  	UVI_RISK_VERY_HIGH
    35  	UVI_RISK_EXTREME
    36  )
    37  
    38  // Scale factor in milliseconds / ohm to determine refresh time
    39  // (aka sampling time) without IT_FACTOR for any given RSET, from datasheet.
    40  // Note: 100.0 milliseconds are applicable for RSET=240 kOhm and IT_FACTOR=1
    41  const RSET_TO_REFRESHTIME_SCALE = 100.0 / RSET_240K
    42  
    43  // The refresh time in milliseconds for which NORMALIZED_UVA_SENSITIVITY
    44  // is applicable to a step count
    45  const NORMALIZED_REFRESHTIME = 100.0
    46  
    47  // The UVA sensitivity in mW/(m*m)/step which is applicable to a step count
    48  // normalized to the NORMALIZED_REFRESHTIME, from datasheet for RSET=240 kOhm
    49  // and IT_FACTOR=1
    50  const NORMALIZED_UVA_SENSITIVITY = 50.0
    51  
    52  // Config register
    53  
    54  // Possible values for shutdown
    55  const (
    56  	CONFIG_SD_DISABLE = 0x00
    57  	CONFIG_SD_ENABLE  = 0x01
    58  )
    59  
    60  // Enable / disable
    61  const (
    62  	CONFIG_DEFAULTS = 0x02
    63  	CONFIG_ENABLE   = CONFIG_SD_DISABLE | CONFIG_DEFAULTS
    64  	CONFIG_DISABLE  = CONFIG_SD_ENABLE | CONFIG_DEFAULTS
    65  )