Statistics
| Branch: | Tag: | Revision:

amiro-os / os / core / inc / aos_interrupts.h @ 0128be0f

History | View | Annotate | Download (2.083 KB)

1 0128be0f Marc Rothmann
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2018  Thomas Schöpping et al.
4

5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY) without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/.
17
*/
18
19
#ifndef _AMIROOS_INTERRUPTS_H_
20
#define _AMIROOS_INTERRUPTS_H_
21
22
#include <hal.h>
23
24
/**
25
 * @brief   Interrupt configuration flag to autostart the interrupt when the interrupt system is started.
26
 */
27
#define AOS_INTERRUPT_AUTOSTART 0x1u
28
29
/**
30
 * @brief   Interrupt configuration structure.
31
 */
32
typedef struct {
33
  ioportid_t    port;      /**< Gpio port id. */
34
  uint8_t       pad;       /**< Gpio pad.     */
35
  uint8_t       flags;     /**< Interrupt configuration flags. */
36
  uint8_t       eventmode; /**< Pal event mode. */
37
  palcallback_t cb;        /**< Pal callback function. */
38
  uint8_t       cb_arg;    /**< Argument for the callback function. */
39
} aos_interrupt_cfg_t;
40
41
/**
42
 * @brief   Interrupt driver structure.
43
 */
44
typedef struct {
45
  aos_interrupt_cfg_t *interrupts; /**< Array of interrupt configurations. */
46
  uint8_t len;                     /**< Length of the interrupt configuration array. */
47
} aos_interrupt_driver_t;
48
49
#ifdef __cplusplus
50
extern "C" {
51
#endif
52
  void aosIntDriverInit(aos_interrupt_driver_t *intd, aos_interrupt_cfg_t *interrupt_cfg);
53
  void aosIntDriverStart(aos_interrupt_driver_t *intd);
54
  void aosIntDriverStop(aos_interrupt_driver_t *intd);
55
  void aosIntEnable(aos_interrupt_driver_t *intd, uint8_t channel);
56
  void aosIntDisable(aos_interrupt_driver_t *intd, uint8_t channel);
57
#ifdef __cplusplus
58
}
59
#endif
60
61
#endif /* _AMIROOS_INTERRUPTS_H_ */