]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/button.c
Update RISCC-V-RV32-SiFive_HiFive1_FreedomStudio project to latest tools and metal...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_FreedomStudio / freedom-metal / src / button.c
1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
3
4 #include <metal/button.h>
5 #include <metal/machine.h>
6
7 struct metal_button* metal_button_get (char *label)
8 {
9     int i;
10     struct metal_button *button;
11
12     if ((__METAL_DT_MAX_BUTTONS == 0) || (label == NULL)) {
13         return NULL;
14     }
15
16     for (i = 0; i < __METAL_DT_MAX_BUTTONS; i++) {
17         button = (struct metal_button*)__metal_button_table[i];
18         if (button->vtable->button_exist(button, label)) {
19             return button;
20         }
21     }
22     return NULL;
23 }
24
25 extern __inline__ struct metal_interrupt*
26     metal_button_interrupt_controller(struct metal_button *button);
27 extern __inline__ int metal_button_get_interrupt_id(struct metal_button *button);