Created
March 21, 2024 18:22
-
-
Save tscholze/0d20e550b949b07d2c7b7ca046284175 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
companion object { | |
/** I2C command bit mask */ | |
private const val REGISTER_COMMAND = 0b10000000 | |
/** I2C command to auto increment */ | |
private const val REGISTER_COMMAND_AUTO_INC = 0b00100000 | |
/** I2C address of the TCS3472. */ | |
const val TCS3472_ADDRESS: UByte = 0x29U | |
/** I2C register for clear measurement. */ | |
const val REGISTER_CLEAR = REGISTER_COMMAND or REGISTER_COMMAND_AUTO_INC or 0x14 | |
/** I2C register for red measurement. */ | |
const val REGISTER_RED = REGISTER_COMMAND or REGISTER_COMMAND_AUTO_INC or 0x16 | |
/** I2C register for green measurement. */ | |
const val REGISTER_GREEN = REGISTER_COMMAND or REGISTER_COMMAND_AUTO_INC or 0x18 | |
/** I2C register for blue measurement. */ | |
const val REGISTER_BLUE = REGISTER_COMMAND or REGISTER_COMMAND_AUTO_INC or 0x1A | |
/** I2C register for enabling measurement. */ | |
const val REGISTER_ENABLE = REGISTER_COMMAND or 0 | |
/** I2C register for enabling rgbc sensor. */ | |
const val REGISTER_ENABLE_RGBC = 1 shl 1 | |
/** I2C register for controling the power switch. */ | |
const val REGISTER_ENABLE_POWER = 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment