Enable EXTINT0 for PB00 (hopefully)

This commit is contained in:
Erki 2022-07-11 18:54:26 +03:00
parent bbe259c29a
commit c27f7a9450
7 changed files with 40 additions and 3 deletions

View File

@ -108,7 +108,14 @@ drivers:
eic_arch_wakeupen7: false
eic_arch_wakeupen8: false
eic_arch_wakeupen9: false
optional_signals: []
optional_signals:
- identifier: EXTERNAL_IRQ_0:EXTINT/0
pad: PA00
mode: Enabled
configuration: null
definition: Atmel:SAMD21_Drivers:0.0.1::SAMD21E17A-MF::optional_signal_definition::EIC.EXTINT.0
name: EIC/EXTINT/0
label: EXTINT/0
variant: null
clocks:
domain_group:
@ -709,6 +716,12 @@ drivers:
clocks:
domain_group: null
pads:
PA00:
name: PA00
definition: Atmel:SAMD21_Drivers:0.0.1::SAMD21E17A-MF::pad::PA00
mode: Digital input
user_label: PA00
configuration: null
OUT_LED_TX:
name: PA06
definition: Atmel:SAMD21_Drivers:0.0.1::SAMD21E17A-MF::pad::PA06

View File

@ -21,6 +21,7 @@
#define GPIO_PIN_FUNCTION_G 6
#define GPIO_PIN_FUNCTION_H 7
#define PA00 GPIO(GPIO_PORTA, 0)
#define OUT_LED_TX GPIO(GPIO_PORTA, 6)
#define OUT_XBEE_REMOTE_RESET GPIO(GPIO_PORTA, 7)
#define IN_UART_TX GPIO(GPIO_PORTA, 8)

View File

@ -682,6 +682,10 @@
#endif
// </e>
#ifndef CONFIG_EIC_EXTINT_MAP
#define CONFIG_EIC_EXTINT_MAP {0, PIN_PA00}, {0, 32},
#endif
// <<< end of configuration section >>>
#endif // HPL_EIC_CONFIG_H

View File

@ -25,6 +25,19 @@ void EXTERNAL_IRQ_0_init(void)
{
_gclk_enable_channel(EIC_GCLK_ID, CONF_GCLK_EIC_SRC);
// Set pin direction to input
gpio_set_pin_direction(PA00, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(PA00,
// <y> Pull configuration
// <id> pad_pull_config
// <GPIO_PULL_OFF"> Off
// <GPIO_PULL_UP"> Pull-up
// <GPIO_PULL_DOWN"> Pull-down
GPIO_PULL_OFF);
gpio_set_pin_function(PA00, PINMUX_PA00A_EIC_EXTINT0);
ext_irq_init();
}

View File

@ -10,11 +10,17 @@
#include "driver_init.h"
#include "utils.h"
static void button_on_PA00_pressed(void)
{
}
/**
* Example of using EXTERNAL_IRQ_0
*/
void EXTERNAL_IRQ_0_example(void)
{
ext_irq_register(PIN_PA00, button_on_PA00_pressed);
}
/**

View File

@ -33,7 +33,7 @@
#include "hal_ext_irq.h"
#define EXT_IRQ_AMOUNT 0
#define EXT_IRQ_AMOUNT 2
/**
* \brief Driver version

View File

@ -69,7 +69,7 @@ static int ffs(int v)
}
#endif
#define EXT_IRQ_AMOUNT 0
#define EXT_IRQ_AMOUNT 2
/**
* \brief EXTINTx and pin number map