ZHCSIJ2C July 2018 – April 2024 DS90UB935-Q1
PRODUCTION DATA
本节举例说明了如何配置 DS90UB935-Q1 和 DS90UB936-Q1 以监测 DS90UB935-Q1 GPIO1 上的电压并设置警报,而后可将 DS90UB936-Q1 上的 INT 引脚置位。
# DS90UB935-Q1 Settings
WriteI2C(0x17,0x3E) # Enable Sensor, Select GPIO1 to sense
WriteI2C(0x18,0x80) # Enable Sensor Gain Setting (Use Default)
WriteI2C(0x1A,0x62) # Set Sensor Upper and Lower Limits (Use Default)
WriteI2C(0x1D,0x3F) # Enable Sensor Alarms
WriteI2C(0x1E,0x7F) # Enable Sending Alarms over BCC
# Register 0x57 readout (bits 2 and 3), indicates if the voltage on the GPIO1 is below or above the thresholds set in the register 0x1A.
# DS90UB936-Q1 Settings
WriteI2C(0x23,0x81) # Enable Interrupts, Enable Interrupts for the camera attached to RX0
WriteI2C(0x4C,0x01) # Enable Writes to RX0 registers
WriteI2C(0xD8,0x08) # Interrupt on change in Sensor Status
# Register 0x51 and 0x52 readouts indicate Sensor data. Register 0x24[7] bit readout indicates the Alarm bit. The alarm bit can be routed to GPIO3/INT through GPIO_PIN_CTL and GPIO_OUT_SRC registers.