forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Milestone
Description
CircuitPython version and board name
Adafruit CircuitPython 10.0.3 on 2025-10-17; M5Stack Cardputer with ESP32S3
Board ID:m5stack_cardputer
Cardputer ADVCode/REPL
from adafruit_tca8418 import TCA8418
import board
import busio
import time
import cardputer_keyboard
cardputer_keyboard.detach_serial()
cardputer_keyboard.KEYBOARD.deinit()
i2c = busio.I2C(board.KB_A_1, board.KB_A_0)
tca = TCA8418(i2c)
# set up all R0-R4 pins and C0-C3 pins as keypads
KEYPADPINS = (
TCA8418.R0,
TCA8418.R1,
TCA8418.R2,
TCA8418.R3,
TCA8418.R4,
TCA8418.R5,
TCA8418.R6,
TCA8418.R7,
TCA8418.C0,
TCA8418.C1,
TCA8418.C2,
TCA8418.C3,
TCA8418.C4,
TCA8418.C5,
TCA8418.C6,
TCA8418.C7,
TCA8418.C8,
TCA8418.C9,
)
# make them inputs with pullups
for pin in KEYPADPINS:
tca.keypad_mode[pin] = True
# make sure the key pins generate FIFO events
tca.enable_int[pin] = True
# we will stick events into the FIFO queue
tca.event_mode_fifo[pin] = True
# turn on INT output pin
tca.key_intenable = True
while True:
if tca.key_int:
# first figure out how big the queue is
events = tca.events_count
# now print each event in the queue
for _ in range(events):
keyevent = tca.next_event
print("\tKey event: 0x%02X - key #%d " % (keyevent, keyevent & 0x7F), end="")
if keyevent & 0x80:
print("key down")
else:
print("key up")
tca.key_int = True # clear the IRQ by writing 1 to it
time.sleep(0.01)Behavior
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.
Description
Hello. I get an error trying to access cardputer_keyboard.KEYBOARD. The board restarts. No such issue with 9.2.9
Additional information
No response