Skip to content

Add MagTag accelo IRQ pin #3940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2021
Merged

Conversation

caternuson
Copy link

Adds the ESP32S2 pin connected to the LIS3DH INT1 pin.

schem

Crude test (still learning details on all the interrupt config), but note that IRQ pin state tracks bit 7 in the LIS3DH's IRQ status register.

import time
import board
import digitalio
import adafruit_lis3dh

irq_pin = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
irq_pin.direction = digitalio.Direction.INPUT

lis = adafruit_lis3dh.LIS3DH_I2C(board.I2C(), address=0x19)

lis._write_register_byte(0x22, 0x40) # CTRL_REG3
lis._write_register_byte(0x24, 0x08) # CTRL_REG5
lis._write_register_byte(0x32, 0x20) # INT1_THS
lis._write_register_byte(0x33, 0x0A) # INT1_DURATION
lis._write_register_byte(0x30, 0x4C) # INT1_CFG

while True:
    print("IRQ PIN = {}   INT_SRC = 0b{:08b}".format(1 if irq_pin.value else 0, lis._read_register_byte(0x31)))
    time.sleep(0.5)

Output:

IRQ PIN = 0   INT_SRC = 0b00000100
IRQ PIN = 1   INT_SRC = 0b01000100
IRQ PIN = 1   INT_SRC = 0b01000100
IRQ PIN = 0   INT_SRC = 0b00010000
IRQ PIN = 1   INT_SRC = 0b01001000
IRQ PIN = 1   INT_SRC = 0b01001000
IRQ PIN = 0   INT_SRC = 0b00001000
IRQ PIN = 1   INT_SRC = 0b01001000
IRQ PIN = 0   INT_SRC = 0b00010000

@tannewt tannewt merged commit 0b0b476 into adafruit:main Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants