HnR'26 badge 0.0.3
Hack&Roll 2026 hardware badge I/O library
Loading...
Searching...
No Matches
hnr26_badge.h
Go to the documentation of this file.
1
18
19#pragma once
20
21#include <stdbool.h>
22#include <stdint.h>
23
24#include "aw9523.h"
25#include "esp_err.h"
26
30typedef uint8_t hnr26_badge_dice_t;
31
43
53 const hnr26_badge_dice_t dice_num, aw9523_pin_num_t* pin_num);
54
60esp_err_t hnr26_badge_init();
61
69esp_err_t hnr26_badge_get_led(const hnr26_badge_dice_t dice_num,
70 aw9523_pin_data_digital_t* is_on);
71
79esp_err_t hnr26_badge_set_led(const hnr26_badge_dice_t dice_num,
80 const aw9523_pin_data_digital_t is_on);
81
88
97
106
115
124
133
143
149esp_err_t hnr26_badge_destroy();
esp_err_t hnr26_badge_update_virtual_pins_state()
Update the GPIO status of all virtual pins on the AW9523 GPIO expander.
Definition hnr26_badge.c:179
esp_err_t hnr26_badge_init()
Initialise the I/O library.
Definition hnr26_badge.c:120
bool hnr26_badge_get_button_is_released(const hnr26_badge_button_t button)
Check if the given button has just been released.
Definition hnr26_badge.c:208
hnr26_badge_button_t
AW9523 GPIO expander virtual pin number of a button.
Definition hnr26_badge.h:35
@ HNR26_BADGE_BTN_B
Definition hnr26_badge.h:41
@ HNR26_BADGE_BTN_LEFT
Definition hnr26_badge.h:38
@ HNR26_BADGE_BTN_A
Definition hnr26_badge.h:40
@ HNR26_BADGE_BTN_UP
Definition hnr26_badge.h:36
@ HNR26_BADGE_BTN_DOWN
Definition hnr26_badge.h:37
@ HNR26_BADGE_BTN_RIGHT
Definition hnr26_badge.h:39
bool hnr26_badge_get_button_is_pressed(const hnr26_badge_button_t button)
Check if the given button has just been pressed.
Definition hnr26_badge.c:198
esp_err_t hnr26_badge_set_led(const hnr26_badge_dice_t dice_num, const aw9523_pin_data_digital_t is_on)
Set the LED status of a given dice face number.
Definition hnr26_badge.c:163
esp_err_t hnr26_badge_destroy()
Destructor function to remove resources when no longer used.
Definition hnr26_badge.c:218
bool hnr26_badge_get_button_state(const hnr26_badge_button_t button)
Get the last known state of the given button.
Definition hnr26_badge.c:190
esp_err_t hnr26_badge_get_virtual_pin_from_dice_num(const hnr26_badge_dice_t dice_num, aw9523_pin_num_t *pin_num)
Calculate the AW9523 GPIO expander virtual pin number from the given dice face number.
Definition hnr26_badge.c:110
bool hnr26_badge_get_previous_button_state(const hnr26_badge_button_t button)
Get the second last known state of the given button.
Definition hnr26_badge.c:194
bool hnr26_badge_get_button_is_idle(const hnr26_badge_button_t button)
Check if the given button has not been pressed during the last 2 checked states.
Definition hnr26_badge.c:213
bool hnr26_badge_get_button_is_held(const hnr26_badge_button_t button)
Check if the given button is being held down.
Definition hnr26_badge.c:203
esp_err_t hnr26_badge_get_led(const hnr26_badge_dice_t dice_num, aw9523_pin_data_digital_t *is_on)
Get the LED status of a given dice face number.
Definition hnr26_badge.c:149
uint8_t hnr26_badge_dice_t
Dice face number from 1 to 10 inclusive.
Definition hnr26_badge.h:30