diff options
Diffstat (limited to 'libhw_cr/rp2040_include/libhw/rp2040_hwtimer.h')
-rw-r--r-- | libhw_cr/rp2040_include/libhw/rp2040_hwtimer.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libhw_cr/rp2040_include/libhw/rp2040_hwtimer.h b/libhw_cr/rp2040_include/libhw/rp2040_hwtimer.h new file mode 100644 index 0000000..40e4172 --- /dev/null +++ b/libhw_cr/rp2040_include/libhw/rp2040_hwtimer.h @@ -0,0 +1,25 @@ +/* libhw/rp2040_hwtimer.h - <libhw/generic/alarmclock.h> implementation for the RP2040's hardware timer + * + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +#ifndef _LIBHW_RP2040_HWTIMER_H_ +#define _LIBHW_RP2040_HWTIMER_H_ + +#include <libhw/generic/alarmclock.h> + +/** + * The RP2040 has one system "timer" with 4 alarm interrupts. + */ +enum rp2040_hwalarm_instance { + RP2040_HWALARM_0 = 0, + RP2040_HWALARM_1 = 1, + RP2040_HWALARM_2 = 2, + RP2040_HWALARM_3 = 3, + _RP2040_HWALARM_NUM, +}; + +lo_interface alarmclock rp2040_hwtimer(enum rp2040_hwalarm_instance alarm_num); + +#endif /* _LIBHW_RP2040_HWTIMER_H_ */ |