-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirq_handler.py
36 lines (25 loc) · 934 Bytes
/
irq_handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from machine import Pin, Timer
from fsm import FSM
import shared_obj
def press_button(pin: Pin) -> None:
""" IRQ executed when the push button is pressed
Args:
pin (Pin): The IRQ requieres a pin to perform some action with it (not needed in all cases)
"""
shared_obj.debounce_button = True
def timeout(t : Timer) -> None:
"""IRQ executed when a timer rings
Args:
t (Timer): The IRQ requieres a timer to perform some action with it (not needed in all cases)
"""
shared_obj.digital_clock.increment()
shared_obj.clear_display = True
def get_temp(t : Timer) -> None:
"""IRQ executed when a timer rings
Args:
t (Timer): The IRQ requieres a timer to perform some action with it (not needed in all cases)
"""
shared_obj.temp_counter += 1
if shared_obj.temp_counter == 300:
shared_obj.read_aht10 = True
shared_obj.temp_counter = 0