Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 * \file
sahilmgandhi 18:6a4db94011d3 3 *
sahilmgandhi 18:6a4db94011d3 4 * \brief SAM External Interrupt Driver
sahilmgandhi 18:6a4db94011d3 5 *
sahilmgandhi 18:6a4db94011d3 6 * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved.
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * \asf_license_start
sahilmgandhi 18:6a4db94011d3 9 *
sahilmgandhi 18:6a4db94011d3 10 * \page License
sahilmgandhi 18:6a4db94011d3 11 *
sahilmgandhi 18:6a4db94011d3 12 * Redistribution and use in source and binary forms, with or without
sahilmgandhi 18:6a4db94011d3 13 * modification, are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 14 *
sahilmgandhi 18:6a4db94011d3 15 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 16 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 17 *
sahilmgandhi 18:6a4db94011d3 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 19 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 20 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 21 *
sahilmgandhi 18:6a4db94011d3 22 * 3. The name of Atmel may not be used to endorse or promote products derived
sahilmgandhi 18:6a4db94011d3 23 * from this software without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 24 *
sahilmgandhi 18:6a4db94011d3 25 * 4. This software may only be redistributed and used in connection with an
sahilmgandhi 18:6a4db94011d3 26 * Atmel microcontroller product.
sahilmgandhi 18:6a4db94011d3 27 *
sahilmgandhi 18:6a4db94011d3 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
sahilmgandhi 18:6a4db94011d3 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
sahilmgandhi 18:6a4db94011d3 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
sahilmgandhi 18:6a4db94011d3 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
sahilmgandhi 18:6a4db94011d3 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sahilmgandhi 18:6a4db94011d3 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sahilmgandhi 18:6a4db94011d3 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sahilmgandhi 18:6a4db94011d3 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
sahilmgandhi 18:6a4db94011d3 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
sahilmgandhi 18:6a4db94011d3 38 * POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 39 *
sahilmgandhi 18:6a4db94011d3 40 * \asf_license_stop
sahilmgandhi 18:6a4db94011d3 41 *
sahilmgandhi 18:6a4db94011d3 42 */
sahilmgandhi 18:6a4db94011d3 43 /*
sahilmgandhi 18:6a4db94011d3 44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
sahilmgandhi 18:6a4db94011d3 45 */
sahilmgandhi 18:6a4db94011d3 46 #ifndef EXTINT_H_INCLUDED
sahilmgandhi 18:6a4db94011d3 47 #define EXTINT_H_INCLUDED
sahilmgandhi 18:6a4db94011d3 48
sahilmgandhi 18:6a4db94011d3 49 /**
sahilmgandhi 18:6a4db94011d3 50 * \defgroup asfdoc_sam0_extint_group SAM External Interrupt Driver (EXTINT)
sahilmgandhi 18:6a4db94011d3 51 *
sahilmgandhi 18:6a4db94011d3 52 * This driver for Atmel&reg; | SMART SAM devices provides an interface for the configuration
sahilmgandhi 18:6a4db94011d3 53 * and management of external interrupts generated by the physical device pins,
sahilmgandhi 18:6a4db94011d3 54 * including edge detection. The following driver API modes are covered by this
sahilmgandhi 18:6a4db94011d3 55 * manual:
sahilmgandhi 18:6a4db94011d3 56 *
sahilmgandhi 18:6a4db94011d3 57 * - Polled APIs
sahilmgandhi 18:6a4db94011d3 58 * \if EXTINT_CALLBACK_MODE
sahilmgandhi 18:6a4db94011d3 59 * - Callback APIs
sahilmgandhi 18:6a4db94011d3 60 * \endif
sahilmgandhi 18:6a4db94011d3 61 *
sahilmgandhi 18:6a4db94011d3 62 * The following peripherals are used by this module:
sahilmgandhi 18:6a4db94011d3 63 * - EIC (External Interrupt Controller)
sahilmgandhi 18:6a4db94011d3 64 *
sahilmgandhi 18:6a4db94011d3 65 * The following devices can use this module:
sahilmgandhi 18:6a4db94011d3 66 * - Atmel | SMART SAM D20/D21
sahilmgandhi 18:6a4db94011d3 67 * - Atmel | SMART SAM R21
sahilmgandhi 18:6a4db94011d3 68 * - Atmel | SMART SAM D10/D11
sahilmgandhi 18:6a4db94011d3 69 * - Atmel | SMART SAM L21
sahilmgandhi 18:6a4db94011d3 70 * - Atmel | SMART SAM DAx
sahilmgandhi 18:6a4db94011d3 71 * - Atmel | SMART SAM C20/C21
sahilmgandhi 18:6a4db94011d3 72 *
sahilmgandhi 18:6a4db94011d3 73 * The outline of this documentation is as follows:
sahilmgandhi 18:6a4db94011d3 74 * - \ref asfdoc_sam0_extint_prerequisites
sahilmgandhi 18:6a4db94011d3 75 * - \ref asfdoc_sam0_extint_module_overview
sahilmgandhi 18:6a4db94011d3 76 * - \ref asfdoc_sam0_extint_special_considerations
sahilmgandhi 18:6a4db94011d3 77 * - \ref asfdoc_sam0_extint_extra_info
sahilmgandhi 18:6a4db94011d3 78 * - \ref asfdoc_sam0_extint_examples
sahilmgandhi 18:6a4db94011d3 79 * - \ref asfdoc_sam0_extint_api_overview
sahilmgandhi 18:6a4db94011d3 80 *
sahilmgandhi 18:6a4db94011d3 81 *
sahilmgandhi 18:6a4db94011d3 82 * \section asfdoc_sam0_extint_prerequisites Prerequisites
sahilmgandhi 18:6a4db94011d3 83 *
sahilmgandhi 18:6a4db94011d3 84 * There are no prerequisites for this module.
sahilmgandhi 18:6a4db94011d3 85 *
sahilmgandhi 18:6a4db94011d3 86 *
sahilmgandhi 18:6a4db94011d3 87 * \section asfdoc_sam0_extint_module_overview Module Overview
sahilmgandhi 18:6a4db94011d3 88 *
sahilmgandhi 18:6a4db94011d3 89 * The External Interrupt (EXTINT) module provides a method of asynchronously
sahilmgandhi 18:6a4db94011d3 90 * detecting rising edge, falling edge or specific level detection on individual
sahilmgandhi 18:6a4db94011d3 91 * I/O pins of a device. This detection can then be used to trigger a software
sahilmgandhi 18:6a4db94011d3 92 * interrupt or event, or polled for later use if required. External interrupts
sahilmgandhi 18:6a4db94011d3 93 * can also optionally be used to automatically wake up the device from sleep
sahilmgandhi 18:6a4db94011d3 94 * mode, allowing the device to conserve power while still being able to react
sahilmgandhi 18:6a4db94011d3 95 * to an external stimulus in a timely manner.
sahilmgandhi 18:6a4db94011d3 96 *
sahilmgandhi 18:6a4db94011d3 97 * \subsection asfdoc_sam0_extint_logical_channels Logical Channels
sahilmgandhi 18:6a4db94011d3 98 * The External Interrupt module contains a number of logical channels, each of
sahilmgandhi 18:6a4db94011d3 99 * which is capable of being individually configured for a given pin routing,
sahilmgandhi 18:6a4db94011d3 100 * detection mode, and filtering/wake up characteristics.
sahilmgandhi 18:6a4db94011d3 101 *
sahilmgandhi 18:6a4db94011d3 102 * Each individual logical external interrupt channel may be routed to a single
sahilmgandhi 18:6a4db94011d3 103 * physical device I/O pin in order to detect a particular edge or level of the
sahilmgandhi 18:6a4db94011d3 104 * incoming signal.
sahilmgandhi 18:6a4db94011d3 105 *
sahilmgandhi 18:6a4db94011d3 106 * \subsection asfdoc_sam0_extint_module_overview_nmi_chanel NMI Channels
sahilmgandhi 18:6a4db94011d3 107 *
sahilmgandhi 18:6a4db94011d3 108 * One or more Non Maskable Interrupt (NMI) channels are provided within each
sahilmgandhi 18:6a4db94011d3 109 * physical External Interrupt Controller module, allowing a single physical pin
sahilmgandhi 18:6a4db94011d3 110 * of the device to fire a single NMI interrupt in response to a particular
sahilmgandhi 18:6a4db94011d3 111 * edge or level stimulus. A NMI cannot, as the name suggests, be disabled in
sahilmgandhi 18:6a4db94011d3 112 * firmware and will take precedence over any in-progress interrupt sources.
sahilmgandhi 18:6a4db94011d3 113 *
sahilmgandhi 18:6a4db94011d3 114 * NMIs can be used to implement critical device features such as forced
sahilmgandhi 18:6a4db94011d3 115 * software reset or other functionality where the action should be executed in
sahilmgandhi 18:6a4db94011d3 116 * preference to all other running code with a minimum amount of latency.
sahilmgandhi 18:6a4db94011d3 117 *
sahilmgandhi 18:6a4db94011d3 118 * \subsection asfdoc_sam0_extint_module_overview_filtering Input Filtering and Detection
sahilmgandhi 18:6a4db94011d3 119 *
sahilmgandhi 18:6a4db94011d3 120 * To reduce the possibility of noise or other transient signals causing
sahilmgandhi 18:6a4db94011d3 121 * unwanted device wake-ups, interrupts and/or events via an external interrupt
sahilmgandhi 18:6a4db94011d3 122 * channel, a hardware signal filter can be enabled on individual channels. This
sahilmgandhi 18:6a4db94011d3 123 * filter provides a Majority-of-Three voter filter on the incoming signal, so
sahilmgandhi 18:6a4db94011d3 124 * that the input state is considered to be the majority vote of three
sahilmgandhi 18:6a4db94011d3 125 * subsequent samples of the pin input buffer. The possible sampled input and
sahilmgandhi 18:6a4db94011d3 126 * resulting filtered output when the filter is enabled is shown in
sahilmgandhi 18:6a4db94011d3 127 * \ref asfdoc_sam0_extint_filter_table "the table below".
sahilmgandhi 18:6a4db94011d3 128 *
sahilmgandhi 18:6a4db94011d3 129 * \anchor asfdoc_sam0_extint_filter_table
sahilmgandhi 18:6a4db94011d3 130 * <table>
sahilmgandhi 18:6a4db94011d3 131 * <caption>Sampled Input and Rresulting Filtered Output</caption>
sahilmgandhi 18:6a4db94011d3 132 * <tr>
sahilmgandhi 18:6a4db94011d3 133 * <th>Input Sample 1</th>
sahilmgandhi 18:6a4db94011d3 134 * <th>Input Sample 2</th>
sahilmgandhi 18:6a4db94011d3 135 * <th>Input Sample 3</th>
sahilmgandhi 18:6a4db94011d3 136 * <th>Filtered Output</th>
sahilmgandhi 18:6a4db94011d3 137 * </tr>
sahilmgandhi 18:6a4db94011d3 138 * <tr>
sahilmgandhi 18:6a4db94011d3 139 * <td>0</td> <td>0</td> <td>0</td> <td>0</td>
sahilmgandhi 18:6a4db94011d3 140 * </tr>
sahilmgandhi 18:6a4db94011d3 141 * <tr>
sahilmgandhi 18:6a4db94011d3 142 * <td>0</td> <td>0</td> <td>1</td> <td>0</td>
sahilmgandhi 18:6a4db94011d3 143 * </tr>
sahilmgandhi 18:6a4db94011d3 144 * <tr>
sahilmgandhi 18:6a4db94011d3 145 * <td>0</td> <td>1</td> <td>0</td> <td>0</td>
sahilmgandhi 18:6a4db94011d3 146 * </tr>
sahilmgandhi 18:6a4db94011d3 147 * <tr>
sahilmgandhi 18:6a4db94011d3 148 * <td>0</td> <td>1</td> <td>1</td> <td>1</td>
sahilmgandhi 18:6a4db94011d3 149 * </tr>
sahilmgandhi 18:6a4db94011d3 150 * <tr>
sahilmgandhi 18:6a4db94011d3 151 * <td>1</td> <td>0</td> <td>0</td> <td>0</td>
sahilmgandhi 18:6a4db94011d3 152 * </tr>
sahilmgandhi 18:6a4db94011d3 153 * <tr>
sahilmgandhi 18:6a4db94011d3 154 * <td>1</td> <td>0</td> <td>1</td> <td>1</td>
sahilmgandhi 18:6a4db94011d3 155 * </tr>
sahilmgandhi 18:6a4db94011d3 156 * <tr>
sahilmgandhi 18:6a4db94011d3 157 * <td>1</td> <td>1</td> <td>0</td> <td>1</td>
sahilmgandhi 18:6a4db94011d3 158 * </tr>
sahilmgandhi 18:6a4db94011d3 159 * <tr>
sahilmgandhi 18:6a4db94011d3 160 * <td>1</td> <td>1</td> <td>1</td> <td>1</td>
sahilmgandhi 18:6a4db94011d3 161 * </tr>
sahilmgandhi 18:6a4db94011d3 162 * </table>
sahilmgandhi 18:6a4db94011d3 163 *
sahilmgandhi 18:6a4db94011d3 164 * \subsection asfdoc_sam0_extint_module_overview_events Events and Interrupts
sahilmgandhi 18:6a4db94011d3 165 *
sahilmgandhi 18:6a4db94011d3 166 * Channel detection states may be polled inside the application for synchronous
sahilmgandhi 18:6a4db94011d3 167 * detection, or events and interrupts may be used for asynchronous behavior.
sahilmgandhi 18:6a4db94011d3 168 * Each channel can be configured to give an asynchronous hardware event (which
sahilmgandhi 18:6a4db94011d3 169 * may in turn trigger actions in other hardware modules) or an asynchronous
sahilmgandhi 18:6a4db94011d3 170 * software interrupt.
sahilmgandhi 18:6a4db94011d3 171 *
sahilmgandhi 18:6a4db94011d3 172 * \note The connection of events between modules requires the use of the
sahilmgandhi 18:6a4db94011d3 173 * \ref asfdoc_sam0_events_group "SAM Event System Driver (EVENTS)"
sahilmgandhi 18:6a4db94011d3 174 * to route output event of one module to the input event of another.
sahilmgandhi 18:6a4db94011d3 175 * For more information on event routing, refer to the event driver
sahilmgandhi 18:6a4db94011d3 176 * documentation.
sahilmgandhi 18:6a4db94011d3 177 *
sahilmgandhi 18:6a4db94011d3 178 * \subsection asfdoc_sam0_extint_module_overview_physical Physical Connection
sahilmgandhi 18:6a4db94011d3 179 *
sahilmgandhi 18:6a4db94011d3 180 * \ref asfdoc_sam0_extint_int_connections "The diagram below" shows how this
sahilmgandhi 18:6a4db94011d3 181 * module is interconnected within the device.
sahilmgandhi 18:6a4db94011d3 182 *
sahilmgandhi 18:6a4db94011d3 183 * \anchor asfdoc_sam0_extint_int_connections
sahilmgandhi 18:6a4db94011d3 184 * \dot
sahilmgandhi 18:6a4db94011d3 185 * digraph overview {
sahilmgandhi 18:6a4db94011d3 186 * node [label="Port Pad" shape=square] pad;
sahilmgandhi 18:6a4db94011d3 187 *
sahilmgandhi 18:6a4db94011d3 188 * subgraph driver {
sahilmgandhi 18:6a4db94011d3 189 * node [label="Peripheral MUX" shape=trapezium] pinmux;
sahilmgandhi 18:6a4db94011d3 190 * node [label="EIC Module" shape=ellipse] eic;
sahilmgandhi 18:6a4db94011d3 191 * node [label="Other Peripheral Modules" shape=ellipse style=filled fillcolor=lightgray] peripherals;
sahilmgandhi 18:6a4db94011d3 192 * }
sahilmgandhi 18:6a4db94011d3 193 *
sahilmgandhi 18:6a4db94011d3 194 * pinmux -> eic;
sahilmgandhi 18:6a4db94011d3 195 * pad -> pinmux;
sahilmgandhi 18:6a4db94011d3 196 * pinmux -> peripherals;
sahilmgandhi 18:6a4db94011d3 197 * }
sahilmgandhi 18:6a4db94011d3 198 * \enddot
sahilmgandhi 18:6a4db94011d3 199 *
sahilmgandhi 18:6a4db94011d3 200 * \section asfdoc_sam0_extint_special_considerations Special Considerations
sahilmgandhi 18:6a4db94011d3 201 *
sahilmgandhi 18:6a4db94011d3 202 * Not all devices support disabling of the NMI channel(s) detection mode - see
sahilmgandhi 18:6a4db94011d3 203 * your device datasheet.
sahilmgandhi 18:6a4db94011d3 204 *
sahilmgandhi 18:6a4db94011d3 205 *
sahilmgandhi 18:6a4db94011d3 206 * \section asfdoc_sam0_extint_extra_info Extra Information
sahilmgandhi 18:6a4db94011d3 207 *
sahilmgandhi 18:6a4db94011d3 208 * For extra information, see \ref asfdoc_sam0_extint_extra. This includes:
sahilmgandhi 18:6a4db94011d3 209 * - \ref asfdoc_sam0_extint_extra_acronyms
sahilmgandhi 18:6a4db94011d3 210 * - \ref asfdoc_sam0_extint_extra_dependencies
sahilmgandhi 18:6a4db94011d3 211 * - \ref asfdoc_sam0_extint_extra_errata
sahilmgandhi 18:6a4db94011d3 212 * - \ref asfdoc_sam0_extint_extra_history
sahilmgandhi 18:6a4db94011d3 213 *
sahilmgandhi 18:6a4db94011d3 214 *
sahilmgandhi 18:6a4db94011d3 215 * \section asfdoc_sam0_extint_examples Examples
sahilmgandhi 18:6a4db94011d3 216 *
sahilmgandhi 18:6a4db94011d3 217 * For a list of examples related to this driver, see
sahilmgandhi 18:6a4db94011d3 218 * \ref asfdoc_sam0_extint_exqsg.
sahilmgandhi 18:6a4db94011d3 219 *
sahilmgandhi 18:6a4db94011d3 220 *
sahilmgandhi 18:6a4db94011d3 221 * \section asfdoc_sam0_extint_api_overview API Overview
sahilmgandhi 18:6a4db94011d3 222 * @{
sahilmgandhi 18:6a4db94011d3 223 */
sahilmgandhi 18:6a4db94011d3 224
sahilmgandhi 18:6a4db94011d3 225 #include <compiler.h>
sahilmgandhi 18:6a4db94011d3 226 #include <pinmux.h>
sahilmgandhi 18:6a4db94011d3 227
sahilmgandhi 18:6a4db94011d3 228 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 229 extern "C" {
sahilmgandhi 18:6a4db94011d3 230 #endif
sahilmgandhi 18:6a4db94011d3 231
sahilmgandhi 18:6a4db94011d3 232 /**
sahilmgandhi 18:6a4db94011d3 233 * \brief External interrupt edge detection configuration enum.
sahilmgandhi 18:6a4db94011d3 234 *
sahilmgandhi 18:6a4db94011d3 235 * Enum for the possible signal edge detection modes of the External
sahilmgandhi 18:6a4db94011d3 236 * Interrupt Controller module.
sahilmgandhi 18:6a4db94011d3 237 */
sahilmgandhi 18:6a4db94011d3 238 enum extint_detect {
sahilmgandhi 18:6a4db94011d3 239 /** No edge detection. Not allowed as a NMI detection mode on some
sahilmgandhi 18:6a4db94011d3 240 * devices. */
sahilmgandhi 18:6a4db94011d3 241 EXTINT_DETECT_NONE = 0,
sahilmgandhi 18:6a4db94011d3 242 /** Detect rising signal edges. */
sahilmgandhi 18:6a4db94011d3 243 EXTINT_DETECT_RISING = 1,
sahilmgandhi 18:6a4db94011d3 244 /** Detect falling signal edges. */
sahilmgandhi 18:6a4db94011d3 245 EXTINT_DETECT_FALLING = 2,
sahilmgandhi 18:6a4db94011d3 246 /** Detect both signal edges. */
sahilmgandhi 18:6a4db94011d3 247 EXTINT_DETECT_BOTH = 3,
sahilmgandhi 18:6a4db94011d3 248 /** Detect high signal levels. */
sahilmgandhi 18:6a4db94011d3 249 EXTINT_DETECT_HIGH = 4,
sahilmgandhi 18:6a4db94011d3 250 /** Detect low signal levels. */
sahilmgandhi 18:6a4db94011d3 251 EXTINT_DETECT_LOW = 5,
sahilmgandhi 18:6a4db94011d3 252 };
sahilmgandhi 18:6a4db94011d3 253
sahilmgandhi 18:6a4db94011d3 254 /**
sahilmgandhi 18:6a4db94011d3 255 * \brief External interrupt internal pull configuration enum.
sahilmgandhi 18:6a4db94011d3 256 *
sahilmgandhi 18:6a4db94011d3 257 * Enum for the possible pin internal pull configurations.
sahilmgandhi 18:6a4db94011d3 258 *
sahilmgandhi 18:6a4db94011d3 259 * \note Disabling the internal pull resistor is not recommended if the driver
sahilmgandhi 18:6a4db94011d3 260 * is used in interrupt (callback) mode, due the possibility of floating
sahilmgandhi 18:6a4db94011d3 261 * inputs generating continuous interrupts.
sahilmgandhi 18:6a4db94011d3 262 */
sahilmgandhi 18:6a4db94011d3 263 enum extint_pull {
sahilmgandhi 18:6a4db94011d3 264 /** Internal pull-up resistor is enabled on the pin. */
sahilmgandhi 18:6a4db94011d3 265 EXTINT_PULL_UP = SYSTEM_PINMUX_PIN_PULL_UP,
sahilmgandhi 18:6a4db94011d3 266 /** Internal pull-down resistor is enabled on the pin. */
sahilmgandhi 18:6a4db94011d3 267 EXTINT_PULL_DOWN = SYSTEM_PINMUX_PIN_PULL_DOWN,
sahilmgandhi 18:6a4db94011d3 268 /** Internal pull resistor is disconnected from the pin. */
sahilmgandhi 18:6a4db94011d3 269 EXTINT_PULL_NONE = SYSTEM_PINMUX_PIN_PULL_NONE,
sahilmgandhi 18:6a4db94011d3 270 };
sahilmgandhi 18:6a4db94011d3 271
sahilmgandhi 18:6a4db94011d3 272 /** The EIC is clocked by GCLK_EIC. */
sahilmgandhi 18:6a4db94011d3 273 #define EXTINT_CLK_GCLK 0
sahilmgandhi 18:6a4db94011d3 274 /** The EIC is clocked by CLK_ULP32K. */
sahilmgandhi 18:6a4db94011d3 275 #define EXTINT_CLK_ULP32K 1
sahilmgandhi 18:6a4db94011d3 276
sahilmgandhi 18:6a4db94011d3 277 /**
sahilmgandhi 18:6a4db94011d3 278 * \brief External Interrupt Controller channel configuration structure.
sahilmgandhi 18:6a4db94011d3 279 *
sahilmgandhi 18:6a4db94011d3 280 * Configuration structure for the edge detection mode of an external
sahilmgandhi 18:6a4db94011d3 281 * interrupt channel.
sahilmgandhi 18:6a4db94011d3 282 */
sahilmgandhi 18:6a4db94011d3 283 struct extint_chan_conf {
sahilmgandhi 18:6a4db94011d3 284 /** GPIO pin the NMI should be connected to. */
sahilmgandhi 18:6a4db94011d3 285 uint32_t gpio_pin;
sahilmgandhi 18:6a4db94011d3 286 /** MUX position the GPIO pin should be configured to. */
sahilmgandhi 18:6a4db94011d3 287 uint32_t gpio_pin_mux;
sahilmgandhi 18:6a4db94011d3 288 /** Internal pull to enable on the input pin. */
sahilmgandhi 18:6a4db94011d3 289 enum extint_pull gpio_pin_pull;
sahilmgandhi 18:6a4db94011d3 290 #if (SAML21) || (SAMC20) || (SAMC21)
sahilmgandhi 18:6a4db94011d3 291 /** Enable asynchronous edge detection. */
sahilmgandhi 18:6a4db94011d3 292 bool enable_async_edge_detection;
sahilmgandhi 18:6a4db94011d3 293 #else
sahilmgandhi 18:6a4db94011d3 294 /** Wake up the device if the channel interrupt fires during sleep mode. */
sahilmgandhi 18:6a4db94011d3 295 bool wake_if_sleeping;
sahilmgandhi 18:6a4db94011d3 296 #endif
sahilmgandhi 18:6a4db94011d3 297 /** Filter the raw input signal to prevent noise from triggering an
sahilmgandhi 18:6a4db94011d3 298 * interrupt accidentally, using a 3 sample majority filter. */
sahilmgandhi 18:6a4db94011d3 299 bool filter_input_signal;
sahilmgandhi 18:6a4db94011d3 300 /** Edge detection mode to use. */
sahilmgandhi 18:6a4db94011d3 301 enum extint_detect detection_criteria;
sahilmgandhi 18:6a4db94011d3 302 };
sahilmgandhi 18:6a4db94011d3 303
sahilmgandhi 18:6a4db94011d3 304 /**
sahilmgandhi 18:6a4db94011d3 305 * \brief External Interrupt event enable/disable structure.
sahilmgandhi 18:6a4db94011d3 306 *
sahilmgandhi 18:6a4db94011d3 307 * Event flags for the \ref extint_enable_events() and
sahilmgandhi 18:6a4db94011d3 308 * \ref extint_disable_events().
sahilmgandhi 18:6a4db94011d3 309 */
sahilmgandhi 18:6a4db94011d3 310 struct extint_events {
sahilmgandhi 18:6a4db94011d3 311 /** If \c true, an event will be generated when an external interrupt
sahilmgandhi 18:6a4db94011d3 312 * channel detection state changes. */
sahilmgandhi 18:6a4db94011d3 313 bool generate_event_on_detect[32 * EIC_INST_NUM];
sahilmgandhi 18:6a4db94011d3 314 };
sahilmgandhi 18:6a4db94011d3 315
sahilmgandhi 18:6a4db94011d3 316 /**
sahilmgandhi 18:6a4db94011d3 317 * \brief External Interrupt Controller NMI configuration structure.
sahilmgandhi 18:6a4db94011d3 318 *
sahilmgandhi 18:6a4db94011d3 319 * Configuration structure for the edge detection mode of an external
sahilmgandhi 18:6a4db94011d3 320 * interrupt NMI channel.
sahilmgandhi 18:6a4db94011d3 321 */
sahilmgandhi 18:6a4db94011d3 322 struct extint_nmi_conf {
sahilmgandhi 18:6a4db94011d3 323 /** GPIO pin the NMI should be connected to. */
sahilmgandhi 18:6a4db94011d3 324 uint32_t gpio_pin;
sahilmgandhi 18:6a4db94011d3 325 /** MUX position the GPIO pin should be configured to. */
sahilmgandhi 18:6a4db94011d3 326 uint32_t gpio_pin_mux;
sahilmgandhi 18:6a4db94011d3 327 /** Internal pull to enable on the input pin. */
sahilmgandhi 18:6a4db94011d3 328 enum extint_pull gpio_pin_pull;
sahilmgandhi 18:6a4db94011d3 329 /** Filter the raw input signal to prevent noise from triggering an
sahilmgandhi 18:6a4db94011d3 330 * interrupt accidentally, using a 3 sample majority filter. */
sahilmgandhi 18:6a4db94011d3 331 bool filter_input_signal;
sahilmgandhi 18:6a4db94011d3 332 /** Edge detection mode to use. Not all devices support all possible
sahilmgandhi 18:6a4db94011d3 333 * detection modes for NMIs.
sahilmgandhi 18:6a4db94011d3 334 */
sahilmgandhi 18:6a4db94011d3 335 enum extint_detect detection_criteria;
sahilmgandhi 18:6a4db94011d3 336 #if (SAML21) || (SAMC20) || (SAMC21)
sahilmgandhi 18:6a4db94011d3 337 /** Enable asynchronous edge detection. */
sahilmgandhi 18:6a4db94011d3 338 bool enable_async_edge_detection;
sahilmgandhi 18:6a4db94011d3 339 #endif
sahilmgandhi 18:6a4db94011d3 340 };
sahilmgandhi 18:6a4db94011d3 341
sahilmgandhi 18:6a4db94011d3 342 #if EXTINT_CALLBACK_MODE == true
sahilmgandhi 18:6a4db94011d3 343 /** Type definition for an EXTINT module callback function. */
sahilmgandhi 18:6a4db94011d3 344 typedef void (*extint_callback_t)(void);
sahilmgandhi 18:6a4db94011d3 345
sahilmgandhi 18:6a4db94011d3 346 #ifndef EIC_NUMBER_OF_INTERRUPTS
sahilmgandhi 18:6a4db94011d3 347 # define EIC_NUMBER_OF_INTERRUPTS 16
sahilmgandhi 18:6a4db94011d3 348 #endif
sahilmgandhi 18:6a4db94011d3 349 #endif
sahilmgandhi 18:6a4db94011d3 350
sahilmgandhi 18:6a4db94011d3 351 #if !defined(__DOXYGEN__)
sahilmgandhi 18:6a4db94011d3 352 /** \internal
sahilmgandhi 18:6a4db94011d3 353 * Internal EXTINT module device instance structure definition.
sahilmgandhi 18:6a4db94011d3 354 */
sahilmgandhi 18:6a4db94011d3 355 struct _extint_module {
sahilmgandhi 18:6a4db94011d3 356 # if EXTINT_CALLBACK_MODE == true
sahilmgandhi 18:6a4db94011d3 357 /** Asynchronous channel callback table, for user-registered handlers. */
sahilmgandhi 18:6a4db94011d3 358 extint_callback_t callbacks[EIC_NUMBER_OF_INTERRUPTS];
sahilmgandhi 18:6a4db94011d3 359 # else
sahilmgandhi 18:6a4db94011d3 360 /** Dummy value to ensure the struct has at least one member. */
sahilmgandhi 18:6a4db94011d3 361 uint8_t _dummy;
sahilmgandhi 18:6a4db94011d3 362 # endif
sahilmgandhi 18:6a4db94011d3 363 };
sahilmgandhi 18:6a4db94011d3 364
sahilmgandhi 18:6a4db94011d3 365 /**
sahilmgandhi 18:6a4db94011d3 366 * \brief Retrieves the base EIC module address from a given channel number.
sahilmgandhi 18:6a4db94011d3 367 *
sahilmgandhi 18:6a4db94011d3 368 * Retrieves the base address of a EIC hardware module associated with the
sahilmgandhi 18:6a4db94011d3 369 * given external interrupt channel.
sahilmgandhi 18:6a4db94011d3 370 *
sahilmgandhi 18:6a4db94011d3 371 * \param[in] channel External interrupt channel index to convert
sahilmgandhi 18:6a4db94011d3 372 *
sahilmgandhi 18:6a4db94011d3 373 * \return Base address of the associated EIC module.
sahilmgandhi 18:6a4db94011d3 374 */
sahilmgandhi 18:6a4db94011d3 375 static inline Eic * _extint_get_eic_from_channel(
sahilmgandhi 18:6a4db94011d3 376 const uint8_t channel)
sahilmgandhi 18:6a4db94011d3 377 {
sahilmgandhi 18:6a4db94011d3 378 uint8_t eic_index = (channel / 32);
sahilmgandhi 18:6a4db94011d3 379
sahilmgandhi 18:6a4db94011d3 380 if (eic_index < EIC_INST_NUM) {
sahilmgandhi 18:6a4db94011d3 381 /* Array of available EICs. */
sahilmgandhi 18:6a4db94011d3 382 Eic *const eics[EIC_INST_NUM] = EIC_INSTS;
sahilmgandhi 18:6a4db94011d3 383
sahilmgandhi 18:6a4db94011d3 384 return eics[eic_index];
sahilmgandhi 18:6a4db94011d3 385 } else {
sahilmgandhi 18:6a4db94011d3 386 Assert(false);
sahilmgandhi 18:6a4db94011d3 387 return NULL;
sahilmgandhi 18:6a4db94011d3 388 }
sahilmgandhi 18:6a4db94011d3 389 }
sahilmgandhi 18:6a4db94011d3 390
sahilmgandhi 18:6a4db94011d3 391 /**
sahilmgandhi 18:6a4db94011d3 392 * \brief Retrieves the base EIC module address from a given NMI channel number.
sahilmgandhi 18:6a4db94011d3 393 *
sahilmgandhi 18:6a4db94011d3 394 * Retrieves the base address of a EIC hardware module associated with the
sahilmgandhi 18:6a4db94011d3 395 * given non-maskable external interrupt channel.
sahilmgandhi 18:6a4db94011d3 396 *
sahilmgandhi 18:6a4db94011d3 397 * \param[in] nmi_channel Non-Maskable interrupt channel index to convert
sahilmgandhi 18:6a4db94011d3 398 *
sahilmgandhi 18:6a4db94011d3 399 * \return Base address of the associated EIC module.
sahilmgandhi 18:6a4db94011d3 400 */
sahilmgandhi 18:6a4db94011d3 401 static inline Eic * _extint_get_eic_from_nmi(
sahilmgandhi 18:6a4db94011d3 402 const uint8_t nmi_channel)
sahilmgandhi 18:6a4db94011d3 403 {
sahilmgandhi 18:6a4db94011d3 404 uint8_t eic_index = nmi_channel;
sahilmgandhi 18:6a4db94011d3 405
sahilmgandhi 18:6a4db94011d3 406 if (eic_index < EIC_INST_NUM) {
sahilmgandhi 18:6a4db94011d3 407 /* Array of available EICs. */
sahilmgandhi 18:6a4db94011d3 408 Eic *const eics[EIC_INST_NUM] = EIC_INSTS;
sahilmgandhi 18:6a4db94011d3 409
sahilmgandhi 18:6a4db94011d3 410 return eics[eic_index];
sahilmgandhi 18:6a4db94011d3 411 } else {
sahilmgandhi 18:6a4db94011d3 412 Assert(false);
sahilmgandhi 18:6a4db94011d3 413 return NULL;
sahilmgandhi 18:6a4db94011d3 414 }
sahilmgandhi 18:6a4db94011d3 415 }
sahilmgandhi 18:6a4db94011d3 416 #endif
sahilmgandhi 18:6a4db94011d3 417
sahilmgandhi 18:6a4db94011d3 418 /** \name Event Management
sahilmgandhi 18:6a4db94011d3 419 * @{
sahilmgandhi 18:6a4db94011d3 420 */
sahilmgandhi 18:6a4db94011d3 421
sahilmgandhi 18:6a4db94011d3 422 void extint_enable_events(
sahilmgandhi 18:6a4db94011d3 423 struct extint_events *const events);
sahilmgandhi 18:6a4db94011d3 424
sahilmgandhi 18:6a4db94011d3 425 void extint_disable_events(
sahilmgandhi 18:6a4db94011d3 426 struct extint_events *const events);
sahilmgandhi 18:6a4db94011d3 427
sahilmgandhi 18:6a4db94011d3 428 /** @} */
sahilmgandhi 18:6a4db94011d3 429
sahilmgandhi 18:6a4db94011d3 430 /** \name Configuration and Initialization (Channel)
sahilmgandhi 18:6a4db94011d3 431 * @{
sahilmgandhi 18:6a4db94011d3 432 */
sahilmgandhi 18:6a4db94011d3 433
sahilmgandhi 18:6a4db94011d3 434 void extint_chan_get_config_defaults(
sahilmgandhi 18:6a4db94011d3 435 struct extint_chan_conf *const config);
sahilmgandhi 18:6a4db94011d3 436
sahilmgandhi 18:6a4db94011d3 437 void extint_chan_set_config(
sahilmgandhi 18:6a4db94011d3 438 const uint8_t channel,
sahilmgandhi 18:6a4db94011d3 439 const struct extint_chan_conf *const config);
sahilmgandhi 18:6a4db94011d3 440
sahilmgandhi 18:6a4db94011d3 441 /** @} */
sahilmgandhi 18:6a4db94011d3 442
sahilmgandhi 18:6a4db94011d3 443 /** \name Configuration and Initialization (NMI)
sahilmgandhi 18:6a4db94011d3 444 * @{
sahilmgandhi 18:6a4db94011d3 445 */
sahilmgandhi 18:6a4db94011d3 446
sahilmgandhi 18:6a4db94011d3 447 /**
sahilmgandhi 18:6a4db94011d3 448 * \brief Initializes an External Interrupt NMI channel configuration structure to defaults.
sahilmgandhi 18:6a4db94011d3 449 *
sahilmgandhi 18:6a4db94011d3 450 * Initializes a given External Interrupt NMI channel configuration structure
sahilmgandhi 18:6a4db94011d3 451 * to a set of known default values. This function should be called on all new
sahilmgandhi 18:6a4db94011d3 452 * instances of these configuration structures before being modified by the
sahilmgandhi 18:6a4db94011d3 453 * user application.
sahilmgandhi 18:6a4db94011d3 454 *
sahilmgandhi 18:6a4db94011d3 455 * The default configuration is as follows:
sahilmgandhi 18:6a4db94011d3 456 * \li Input filtering disabled
sahilmgandhi 18:6a4db94011d3 457 * \li Detect falling edges of a signal
sahilmgandhi 18:6a4db94011d3 458 * \li Asynchronous edge detection is disabled
sahilmgandhi 18:6a4db94011d3 459 *
sahilmgandhi 18:6a4db94011d3 460 * \param[out] config Configuration structure to initialize to default values
sahilmgandhi 18:6a4db94011d3 461 */
sahilmgandhi 18:6a4db94011d3 462 static inline void extint_nmi_get_config_defaults(
sahilmgandhi 18:6a4db94011d3 463 struct extint_nmi_conf *const config)
sahilmgandhi 18:6a4db94011d3 464 {
sahilmgandhi 18:6a4db94011d3 465 /* Sanity check arguments */
sahilmgandhi 18:6a4db94011d3 466 Assert(config);
sahilmgandhi 18:6a4db94011d3 467
sahilmgandhi 18:6a4db94011d3 468 /* Default configuration values */
sahilmgandhi 18:6a4db94011d3 469 config->gpio_pin = 0;
sahilmgandhi 18:6a4db94011d3 470 config->gpio_pin_mux = 0;
sahilmgandhi 18:6a4db94011d3 471 config->gpio_pin_pull = EXTINT_PULL_UP;
sahilmgandhi 18:6a4db94011d3 472 config->filter_input_signal = false;
sahilmgandhi 18:6a4db94011d3 473 config->detection_criteria = EXTINT_DETECT_FALLING;
sahilmgandhi 18:6a4db94011d3 474 #if (SAML21) || (SAMC20) || (SAMC21)
sahilmgandhi 18:6a4db94011d3 475 config->enable_async_edge_detection = false;
sahilmgandhi 18:6a4db94011d3 476 #endif
sahilmgandhi 18:6a4db94011d3 477
sahilmgandhi 18:6a4db94011d3 478 }
sahilmgandhi 18:6a4db94011d3 479
sahilmgandhi 18:6a4db94011d3 480 enum status_code extint_nmi_set_config(
sahilmgandhi 18:6a4db94011d3 481 const uint8_t nmi_channel,
sahilmgandhi 18:6a4db94011d3 482 const struct extint_nmi_conf *const config);
sahilmgandhi 18:6a4db94011d3 483
sahilmgandhi 18:6a4db94011d3 484 /** @} */
sahilmgandhi 18:6a4db94011d3 485
sahilmgandhi 18:6a4db94011d3 486 /** \name Detection testing and clearing (channel)
sahilmgandhi 18:6a4db94011d3 487 * @{
sahilmgandhi 18:6a4db94011d3 488 */
sahilmgandhi 18:6a4db94011d3 489
sahilmgandhi 18:6a4db94011d3 490 /**
sahilmgandhi 18:6a4db94011d3 491 * \brief Retrieves the edge detection state of a configured channel.
sahilmgandhi 18:6a4db94011d3 492 *
sahilmgandhi 18:6a4db94011d3 493 * Reads the current state of a configured channel, and determines
sahilmgandhi 18:6a4db94011d3 494 * if the detection criteria of the channel has been met.
sahilmgandhi 18:6a4db94011d3 495 *
sahilmgandhi 18:6a4db94011d3 496 * \param[in] channel External Interrupt channel index to check
sahilmgandhi 18:6a4db94011d3 497 *
sahilmgandhi 18:6a4db94011d3 498 * \return Status of the requested channel's edge detection state.
sahilmgandhi 18:6a4db94011d3 499 * \retval true If the channel's edge/level detection criteria was met
sahilmgandhi 18:6a4db94011d3 500 * \retval false If the channel has not detected its configured criteria
sahilmgandhi 18:6a4db94011d3 501 */
sahilmgandhi 18:6a4db94011d3 502 static inline bool extint_chan_is_detected(
sahilmgandhi 18:6a4db94011d3 503 const uint8_t channel)
sahilmgandhi 18:6a4db94011d3 504 {
sahilmgandhi 18:6a4db94011d3 505 Eic *const eic_module = _extint_get_eic_from_channel(channel);
sahilmgandhi 18:6a4db94011d3 506 uint32_t eic_mask = (1UL << (channel % 32));
sahilmgandhi 18:6a4db94011d3 507
sahilmgandhi 18:6a4db94011d3 508 return (eic_module->INTFLAG.reg & eic_mask);
sahilmgandhi 18:6a4db94011d3 509 }
sahilmgandhi 18:6a4db94011d3 510
sahilmgandhi 18:6a4db94011d3 511 /**
sahilmgandhi 18:6a4db94011d3 512 * \brief Clears the edge detection state of a configured channel.
sahilmgandhi 18:6a4db94011d3 513 *
sahilmgandhi 18:6a4db94011d3 514 * Clears the current state of a configured channel, readying it for
sahilmgandhi 18:6a4db94011d3 515 * the next level or edge detection.
sahilmgandhi 18:6a4db94011d3 516 *
sahilmgandhi 18:6a4db94011d3 517 * \param[in] channel External Interrupt channel index to check
sahilmgandhi 18:6a4db94011d3 518 */
sahilmgandhi 18:6a4db94011d3 519 static inline void extint_chan_clear_detected(
sahilmgandhi 18:6a4db94011d3 520 const uint8_t channel)
sahilmgandhi 18:6a4db94011d3 521 {
sahilmgandhi 18:6a4db94011d3 522 Eic *const eic_module = _extint_get_eic_from_channel(channel);
sahilmgandhi 18:6a4db94011d3 523 uint32_t eic_mask = (1UL << (channel % 32));
sahilmgandhi 18:6a4db94011d3 524
sahilmgandhi 18:6a4db94011d3 525 eic_module->INTFLAG.reg = eic_mask;
sahilmgandhi 18:6a4db94011d3 526 }
sahilmgandhi 18:6a4db94011d3 527
sahilmgandhi 18:6a4db94011d3 528 /** @} */
sahilmgandhi 18:6a4db94011d3 529
sahilmgandhi 18:6a4db94011d3 530 /** \name Detection Testing and Clearing (NMI)
sahilmgandhi 18:6a4db94011d3 531 * @{
sahilmgandhi 18:6a4db94011d3 532 */
sahilmgandhi 18:6a4db94011d3 533
sahilmgandhi 18:6a4db94011d3 534 /**
sahilmgandhi 18:6a4db94011d3 535 * \brief Retrieves the edge detection state of a configured NMI channel.
sahilmgandhi 18:6a4db94011d3 536 *
sahilmgandhi 18:6a4db94011d3 537 * Reads the current state of a configured NMI channel, and determines
sahilmgandhi 18:6a4db94011d3 538 * if the detection criteria of the NMI channel has been met.
sahilmgandhi 18:6a4db94011d3 539 *
sahilmgandhi 18:6a4db94011d3 540 * \param[in] nmi_channel External Interrupt NMI channel index to check
sahilmgandhi 18:6a4db94011d3 541 *
sahilmgandhi 18:6a4db94011d3 542 * \return Status of the requested NMI channel's edge detection state.
sahilmgandhi 18:6a4db94011d3 543 * \retval true If the NMI channel's edge/level detection criteria was met
sahilmgandhi 18:6a4db94011d3 544 * \retval false If the NMI channel has not detected its configured criteria
sahilmgandhi 18:6a4db94011d3 545 */
sahilmgandhi 18:6a4db94011d3 546 static inline bool extint_nmi_is_detected(
sahilmgandhi 18:6a4db94011d3 547 const uint8_t nmi_channel)
sahilmgandhi 18:6a4db94011d3 548 {
sahilmgandhi 18:6a4db94011d3 549 Eic *const eic_module = _extint_get_eic_from_nmi(nmi_channel);
sahilmgandhi 18:6a4db94011d3 550
sahilmgandhi 18:6a4db94011d3 551 return (eic_module->NMIFLAG.reg & EIC_NMIFLAG_NMI);
sahilmgandhi 18:6a4db94011d3 552 }
sahilmgandhi 18:6a4db94011d3 553
sahilmgandhi 18:6a4db94011d3 554 /**
sahilmgandhi 18:6a4db94011d3 555 * \brief Clears the edge detection state of a configured NMI channel.
sahilmgandhi 18:6a4db94011d3 556 *
sahilmgandhi 18:6a4db94011d3 557 * Clears the current state of a configured NMI channel, readying it for
sahilmgandhi 18:6a4db94011d3 558 * the next level or edge detection.
sahilmgandhi 18:6a4db94011d3 559 *
sahilmgandhi 18:6a4db94011d3 560 * \param[in] nmi_channel External Interrupt NMI channel index to check
sahilmgandhi 18:6a4db94011d3 561 */
sahilmgandhi 18:6a4db94011d3 562 static inline void extint_nmi_clear_detected(
sahilmgandhi 18:6a4db94011d3 563 const uint8_t nmi_channel)
sahilmgandhi 18:6a4db94011d3 564 {
sahilmgandhi 18:6a4db94011d3 565 Eic *const eic_module = _extint_get_eic_from_nmi(nmi_channel);
sahilmgandhi 18:6a4db94011d3 566
sahilmgandhi 18:6a4db94011d3 567 eic_module->NMIFLAG.reg = EIC_NMIFLAG_NMI;
sahilmgandhi 18:6a4db94011d3 568 }
sahilmgandhi 18:6a4db94011d3 569
sahilmgandhi 18:6a4db94011d3 570 /** @} */
sahilmgandhi 18:6a4db94011d3 571
sahilmgandhi 18:6a4db94011d3 572 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 573 }
sahilmgandhi 18:6a4db94011d3 574 #endif
sahilmgandhi 18:6a4db94011d3 575
sahilmgandhi 18:6a4db94011d3 576 /** @} */
sahilmgandhi 18:6a4db94011d3 577
sahilmgandhi 18:6a4db94011d3 578 #if EXTINT_CALLBACK_MODE == true
sahilmgandhi 18:6a4db94011d3 579 # include "extint_callback.h"
sahilmgandhi 18:6a4db94011d3 580 #endif
sahilmgandhi 18:6a4db94011d3 581
sahilmgandhi 18:6a4db94011d3 582 /**
sahilmgandhi 18:6a4db94011d3 583 * \page asfdoc_sam0_extint_extra Extra Information for EXTINT Driver
sahilmgandhi 18:6a4db94011d3 584 *
sahilmgandhi 18:6a4db94011d3 585 * \section asfdoc_sam0_extint_extra_acronyms Acronyms
sahilmgandhi 18:6a4db94011d3 586 * The table below presents the acronyms used in this module:
sahilmgandhi 18:6a4db94011d3 587 *
sahilmgandhi 18:6a4db94011d3 588 * <table>
sahilmgandhi 18:6a4db94011d3 589 * <tr>
sahilmgandhi 18:6a4db94011d3 590 * <th>Acronym</th>
sahilmgandhi 18:6a4db94011d3 591 * <th>Description</th>
sahilmgandhi 18:6a4db94011d3 592 * </tr>
sahilmgandhi 18:6a4db94011d3 593 * <tr>
sahilmgandhi 18:6a4db94011d3 594 * <td>EIC</td>
sahilmgandhi 18:6a4db94011d3 595 * <td>External Interrupt Controller</td>
sahilmgandhi 18:6a4db94011d3 596 * </tr>
sahilmgandhi 18:6a4db94011d3 597 * <tr>
sahilmgandhi 18:6a4db94011d3 598 * <td>MUX</td>
sahilmgandhi 18:6a4db94011d3 599 * <td>Multiplexer</td>
sahilmgandhi 18:6a4db94011d3 600 * </tr>
sahilmgandhi 18:6a4db94011d3 601 * <tr>
sahilmgandhi 18:6a4db94011d3 602 * <td>NMI</td>
sahilmgandhi 18:6a4db94011d3 603 * <td>Non-Maskable Interrupt</td>
sahilmgandhi 18:6a4db94011d3 604 * </tr>
sahilmgandhi 18:6a4db94011d3 605 * </table>
sahilmgandhi 18:6a4db94011d3 606 *
sahilmgandhi 18:6a4db94011d3 607 *
sahilmgandhi 18:6a4db94011d3 608 * \section asfdoc_sam0_extint_extra_dependencies Dependencies
sahilmgandhi 18:6a4db94011d3 609 * This driver has the following dependencies:
sahilmgandhi 18:6a4db94011d3 610 *
sahilmgandhi 18:6a4db94011d3 611 * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver"
sahilmgandhi 18:6a4db94011d3 612 *
sahilmgandhi 18:6a4db94011d3 613 *
sahilmgandhi 18:6a4db94011d3 614 * \section asfdoc_sam0_extint_extra_errata Errata
sahilmgandhi 18:6a4db94011d3 615 * There are no errata related to this driver.
sahilmgandhi 18:6a4db94011d3 616 *
sahilmgandhi 18:6a4db94011d3 617 *
sahilmgandhi 18:6a4db94011d3 618 * \section asfdoc_sam0_extint_extra_history Module History
sahilmgandhi 18:6a4db94011d3 619 * An overview of the module history is presented in the table below, with
sahilmgandhi 18:6a4db94011d3 620 * details on the enhancements and fixes made to the module since its first
sahilmgandhi 18:6a4db94011d3 621 * release. The current version of this corresponds to the newest version in
sahilmgandhi 18:6a4db94011d3 622 * the table.
sahilmgandhi 18:6a4db94011d3 623 *
sahilmgandhi 18:6a4db94011d3 624 * <table>
sahilmgandhi 18:6a4db94011d3 625 * <tr>
sahilmgandhi 18:6a4db94011d3 626 * <th>Changelog</th>
sahilmgandhi 18:6a4db94011d3 627 * </tr>
sahilmgandhi 18:6a4db94011d3 628 * <tr>
sahilmgandhi 18:6a4db94011d3 629 * <td>
sahilmgandhi 18:6a4db94011d3 630 * \li Driver updated to follow driver type convention.
sahilmgandhi 18:6a4db94011d3 631 * \li Removed \c %extint_reset(), \c %extint_disable() and
sahilmgandhi 18:6a4db94011d3 632 * \c extint_enable() functions. Added internal function
sahilmgandhi 18:6a4db94011d3 633 * \c %_system_extint_init().
sahilmgandhi 18:6a4db94011d3 634 * \li Added configuration EXTINT_CLOCK_SOURCE in conf_extint.h.
sahilmgandhi 18:6a4db94011d3 635 * \li Removed configuration EXTINT_CALLBACKS_MAX in conf_extint.h, and
sahilmgandhi 18:6a4db94011d3 636 * added channel parameter in the register functions
sahilmgandhi 18:6a4db94011d3 637 * \c %extint_register_callback() and \c %extint_unregister_callback().
sahilmgandhi 18:6a4db94011d3 638 * </td>
sahilmgandhi 18:6a4db94011d3 639 * </tr>
sahilmgandhi 18:6a4db94011d3 640 * <tr>
sahilmgandhi 18:6a4db94011d3 641 * <td>Updated interrupt handler to clear interrupt flag before calling
sahilmgandhi 18:6a4db94011d3 642 * callback function.</td>
sahilmgandhi 18:6a4db94011d3 643 * </tr>
sahilmgandhi 18:6a4db94011d3 644 * <tr>
sahilmgandhi 18:6a4db94011d3 645 * <td>Updated initialization function to also enable the digital interface
sahilmgandhi 18:6a4db94011d3 646 * clock to the module if it is disabled.</td>
sahilmgandhi 18:6a4db94011d3 647 * </tr>
sahilmgandhi 18:6a4db94011d3 648 * <tr>
sahilmgandhi 18:6a4db94011d3 649 * <td>Initial Release</td>
sahilmgandhi 18:6a4db94011d3 650 * </tr>
sahilmgandhi 18:6a4db94011d3 651 * </table>
sahilmgandhi 18:6a4db94011d3 652 */
sahilmgandhi 18:6a4db94011d3 653
sahilmgandhi 18:6a4db94011d3 654 /**
sahilmgandhi 18:6a4db94011d3 655 * \page asfdoc_sam0_extint_exqsg Examples for EXTINT Driver
sahilmgandhi 18:6a4db94011d3 656 *
sahilmgandhi 18:6a4db94011d3 657 * This is a list of the available Quick Start guides (QSGs) and example
sahilmgandhi 18:6a4db94011d3 658 * applications for \ref asfdoc_sam0_extint_group.
sahilmgandhi 18:6a4db94011d3 659 * QSGs are simple examples with step-by-step instructions to configure and
sahilmgandhi 18:6a4db94011d3 660 * use this driver in a selection of use cases. Note that QSGs can be compiled
sahilmgandhi 18:6a4db94011d3 661 * as a standalone application or be added to the user application.
sahilmgandhi 18:6a4db94011d3 662 *
sahilmgandhi 18:6a4db94011d3 663 * - \subpage asfdoc_sam0_extint_basic_use_case
sahilmgandhi 18:6a4db94011d3 664 * \if EXTINT_CALLBACK_MODE
sahilmgandhi 18:6a4db94011d3 665 * - \subpage asfdoc_sam0_extint_callback_use_case
sahilmgandhi 18:6a4db94011d3 666 * \endif
sahilmgandhi 18:6a4db94011d3 667 *
sahilmgandhi 18:6a4db94011d3 668 * \page asfdoc_sam0_extint_document_revision_history Document Revision History
sahilmgandhi 18:6a4db94011d3 669 *
sahilmgandhi 18:6a4db94011d3 670 * <table>
sahilmgandhi 18:6a4db94011d3 671 * <tr>
sahilmgandhi 18:6a4db94011d3 672 * <th>Doc. Rev.</td>
sahilmgandhi 18:6a4db94011d3 673 * <th>Date</td>
sahilmgandhi 18:6a4db94011d3 674 * <th>Comments</td>
sahilmgandhi 18:6a4db94011d3 675 * </tr>
sahilmgandhi 18:6a4db94011d3 676 * <tr>
sahilmgandhi 18:6a4db94011d3 677 * <td>E</td>
sahilmgandhi 18:6a4db94011d3 678 * <td>06/2015</td>
sahilmgandhi 18:6a4db94011d3 679 * <td>Added support for SAML21, SAMC21, and SAMDAx.</td>
sahilmgandhi 18:6a4db94011d3 680 * </tr>
sahilmgandhi 18:6a4db94011d3 681 * <tr>
sahilmgandhi 18:6a4db94011d3 682 * <td>D</td>
sahilmgandhi 18:6a4db94011d3 683 * <td>12/2014</td>
sahilmgandhi 18:6a4db94011d3 684 * <td>Added support for SAMR21 and SAMD10/D11.</td>
sahilmgandhi 18:6a4db94011d3 685 * </tr>
sahilmgandhi 18:6a4db94011d3 686 * <tr>
sahilmgandhi 18:6a4db94011d3 687 * <td>C</td>
sahilmgandhi 18:6a4db94011d3 688 * <td>01/2014</td>
sahilmgandhi 18:6a4db94011d3 689 * <td>Added support for SAMD21.</td>
sahilmgandhi 18:6a4db94011d3 690 * </tr>
sahilmgandhi 18:6a4db94011d3 691 * <tr>
sahilmgandhi 18:6a4db94011d3 692 * <td>B</td>
sahilmgandhi 18:6a4db94011d3 693 * <td>06/2013</td>
sahilmgandhi 18:6a4db94011d3 694 * <td>Added additional documentation on the event system. Corrected
sahilmgandhi 18:6a4db94011d3 695 * documentation typos.</td>
sahilmgandhi 18:6a4db94011d3 696 * </tr>
sahilmgandhi 18:6a4db94011d3 697 * <tr>
sahilmgandhi 18:6a4db94011d3 698 * <td>A</td>
sahilmgandhi 18:6a4db94011d3 699 * <td>06/2013</td>
sahilmgandhi 18:6a4db94011d3 700 * <td>Initial release</td>
sahilmgandhi 18:6a4db94011d3 701 * </tr>
sahilmgandhi 18:6a4db94011d3 702 * </table>
sahilmgandhi 18:6a4db94011d3 703 */
sahilmgandhi 18:6a4db94011d3 704
sahilmgandhi 18:6a4db94011d3 705 #endif