Greg Steiert / maxim-dev

Dependents:   MAX34417_demo MAXREFDES1265 MAXREFDES1265

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Parent:
targets/hal/TARGET_Atmel/TARGET_SAM_CortexM4/config/TARGET_SAMG55/conf_extint.h@107:414e9c822e99
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 107:414e9c822e99 1 /**
mbed_official 107:414e9c822e99 2 * \file
mbed_official 107:414e9c822e99 3 *
mbed_official 107:414e9c822e99 4 * \brief SAM G55 External Interrupt Driver Configuration Header
mbed_official 107:414e9c822e99 5 *
mbed_official 107:414e9c822e99 6 * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved.
mbed_official 107:414e9c822e99 7 *
mbed_official 107:414e9c822e99 8 * \asf_license_start
mbed_official 107:414e9c822e99 9 *
mbed_official 107:414e9c822e99 10 * \page License
mbed_official 107:414e9c822e99 11 *
mbed_official 107:414e9c822e99 12 * Redistribution and use in source and binary forms, with or without
mbed_official 107:414e9c822e99 13 * modification, are permitted provided that the following conditions are met:
mbed_official 107:414e9c822e99 14 *
mbed_official 107:414e9c822e99 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 107:414e9c822e99 16 * this list of conditions and the following disclaimer.
mbed_official 107:414e9c822e99 17 *
mbed_official 107:414e9c822e99 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 107:414e9c822e99 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 107:414e9c822e99 20 * and/or other materials provided with the distribution.
mbed_official 107:414e9c822e99 21 *
mbed_official 107:414e9c822e99 22 * 3. The name of Atmel may not be used to endorse or promote products derived
mbed_official 107:414e9c822e99 23 * from this software without specific prior written permission.
mbed_official 107:414e9c822e99 24 *
mbed_official 107:414e9c822e99 25 * 4. This software may only be redistributed and used in connection with an
mbed_official 107:414e9c822e99 26 * Atmel microcontroller product.
mbed_official 107:414e9c822e99 27 *
mbed_official 107:414e9c822e99 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
mbed_official 107:414e9c822e99 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 107:414e9c822e99 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
mbed_official 107:414e9c822e99 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
mbed_official 107:414e9c822e99 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 107:414e9c822e99 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
mbed_official 107:414e9c822e99 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
mbed_official 107:414e9c822e99 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
mbed_official 107:414e9c822e99 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
mbed_official 107:414e9c822e99 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 107:414e9c822e99 38 * POSSIBILITY OF SUCH DAMAGE.
mbed_official 107:414e9c822e99 39 *
mbed_official 107:414e9c822e99 40 * \asf_license_stop
mbed_official 107:414e9c822e99 41 *
mbed_official 107:414e9c822e99 42 */
mbed_official 107:414e9c822e99 43 #ifndef CONF_EXTINT_H_INCLUDED
mbed_official 107:414e9c822e99 44 #define CONF_EXTINT_H_INCLUDED
mbed_official 107:414e9c822e99 45
mbed_official 107:414e9c822e99 46 #include <asf.h>
mbed_official 107:414e9c822e99 47
mbed_official 107:414e9c822e99 48 /**
mbed_official 107:414e9c822e99 49 * Push button definitions for sleep mode and active mode
mbed_official 107:414e9c822e99 50 * @{
mbed_official 107:414e9c822e99 51 */
mbed_official 107:414e9c822e99 52 #define PIN_PUSHBUTTON_WAKEUP_PIO PIOA
mbed_official 107:414e9c822e99 53 #define PIN_PUSHBUTTON_WAKEUP_MASK PIO_PA2
mbed_official 107:414e9c822e99 54 #define PIN_PUSHBUTTON_WAKEUP_ID ID_PIOA
mbed_official 107:414e9c822e99 55 #define PIN_PUSHBUTTON_WAKEUP_ATTR PIO_DEFAULT
mbed_official 107:414e9c822e99 56 /** @} */
mbed_official 107:414e9c822e99 57
mbed_official 107:414e9c822e99 58 /** Wakeup pin for wait mode: SW0 */
mbed_official 107:414e9c822e99 59 #define WAKEUP_WAIT_INPUT_ID (1u << 2)
mbed_official 107:414e9c822e99 60 /** Wakeup pin for backup mode: Touchscreen controller IRQ pin */
mbed_official 107:414e9c822e99 61 #define WAKEUP_BACKUP_INPUT_ID (1u << 2)
mbed_official 107:414e9c822e99 62
mbed_official 107:414e9c822e99 63 void button_cb(void);
mbed_official 107:414e9c822e99 64 static inline void button_handler(uint32_t ul_id, uint32_t ul_mask);
mbed_official 107:414e9c822e99 65
mbed_official 107:414e9c822e99 66 /* Button Initialize */
mbed_official 107:414e9c822e99 67 static inline void button_init(void)
mbed_official 107:414e9c822e99 68 {
mbed_official 107:414e9c822e99 69 /* Adjust PIO debounce filter parameters, using 10 Hz filter. */
mbed_official 107:414e9c822e99 70 pio_set_debounce_filter(PIN_PUSHBUTTON_WAKEUP_PIO,
mbed_official 107:414e9c822e99 71 PIN_PUSHBUTTON_WAKEUP_MASK, 10);
mbed_official 107:414e9c822e99 72
mbed_official 107:414e9c822e99 73 /* Initialize PIO interrupt handlers, see PIO definition in board.h. */
mbed_official 107:414e9c822e99 74 pio_handler_set(PIN_PUSHBUTTON_WAKEUP_PIO, PIN_PUSHBUTTON_WAKEUP_ID,
mbed_official 107:414e9c822e99 75 PIN_PUSHBUTTON_WAKEUP_MASK, PIN_PUSHBUTTON_WAKEUP_ATTR,
mbed_official 107:414e9c822e99 76 button_handler);
mbed_official 107:414e9c822e99 77
mbed_official 107:414e9c822e99 78 /* Enable PIO controller IRQs. */
mbed_official 107:414e9c822e99 79 NVIC_EnableIRQ((IRQn_Type)PIN_PUSHBUTTON_WAKEUP_ID);
mbed_official 107:414e9c822e99 80
mbed_official 107:414e9c822e99 81 /* Enable PIO line interrupts. */
mbed_official 107:414e9c822e99 82 pio_enable_interrupt(PIN_PUSHBUTTON_WAKEUP_PIO,
mbed_official 107:414e9c822e99 83 PIN_PUSHBUTTON_WAKEUP_MASK);
mbed_official 107:414e9c822e99 84 }
mbed_official 107:414e9c822e99 85
mbed_official 107:414e9c822e99 86 /**
mbed_official 107:414e9c822e99 87 * \brief Handler for button interrupt.
mbed_official 107:414e9c822e99 88 *
mbed_official 107:414e9c822e99 89 * \note This interrupt is for waking up from sleep mode or exiting from active
mbed_official 107:414e9c822e99 90 * mode.
mbed_official 107:414e9c822e99 91 */
mbed_official 107:414e9c822e99 92 static inline void button_handler(uint32_t ul_id, uint32_t ul_mask)
mbed_official 107:414e9c822e99 93 {
mbed_official 107:414e9c822e99 94 if (PIN_PUSHBUTTON_WAKEUP_ID == ul_id &&
mbed_official 107:414e9c822e99 95 PIN_PUSHBUTTON_WAKEUP_MASK == ul_mask) {
mbed_official 107:414e9c822e99 96 button_cb();
mbed_official 107:414e9c822e99 97 }
mbed_official 107:414e9c822e99 98 }
mbed_official 107:414e9c822e99 99
mbed_official 107:414e9c822e99 100 #endif