本文整理汇总了C++中pio_handler_set函数的典型用法代码示例。如果您正苦于以下问题:C++ pio_handler_set函数的具体用法?C++ pio_handler_set怎么用?C++ pio_handler_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pio_handler_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (void)
{
// Insert system clock initialization code here (sysclk_init()).
sysclk_init();
board_init();
// Insert application code here, after the board has been initialized.
pmc_enable_periph_clk(ID_PIOA);
pio_set_input(PIOA, PIO_PA16, PIO_DEFAULT);
pio_pull_down(PIOA, (PIO_PA16), ENABLE);
pio_handler_set(PIOA, ID_PIOA, PIO_PA16, PIO_IT_RISE_EDGE, pin_riseedge_handler);
pio_enable_interrupt(PIOA,PIO_PA16);
pio_set_input(PIOA, PIO_PA17, PIO_DEFAULT);
pio_pull_down(PIOA, (PIO_PA17), ENABLE);
pio_handler_set(PIOA, ID_PIOA, PIO_PA17, PIO_IT_RISE_EDGE, pin_riseedge_handler);
pio_enable_interrupt(PIOA,PIO_PA17);
NVIC_EnableIRQ(PIOA_IRQn);
gpio_set_pin_low(LED0_GPIO);
gpio_set_pin_high(LED1_GPIO);
while(1){
}
}
示例2: configure_buttons
/**
* \brief Configure the Pushbuttons
*
* Configure the PIO as inputs and generate corresponding interrupt when
* pressed or released.
*/
static void configure_buttons(void)
{
// [main_button1_configure]
/* Configure Pushbutton 1 */
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, 10);
/* Interrupt on rising edge */
pio_handler_set(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_ID,
PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_ATTR, Button1_Handler);
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_1_ID);
pio_handler_set_priority(PIN_PUSHBUTTON_1_PIO,
(IRQn_Type) PIN_PUSHBUTTON_1_ID, IRQ_PRIOR_PIO);
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK);
// [main_button1_configure]
#ifndef BOARD_NO_PUSHBUTTON_2
// [main_button2_configure]
/* Configure Pushbutton 2 */
pmc_enable_periph_clk(PIN_PUSHBUTTON_2_ID);
pio_set_debounce_filter(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK, 10);
/* Interrupt on falling edge */
pio_handler_set(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_ID,
PIN_PUSHBUTTON_2_MASK, PIN_PUSHBUTTON_2_ATTR, Button2_Handler);
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_2_ID);
pio_handler_set_priority(PIN_PUSHBUTTON_2_PIO,
(IRQn_Type) PIN_PUSHBUTTON_2_ID, IRQ_PRIOR_PIO);
pio_enable_interrupt(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK);
// [main_button2_configure]
#endif
}
示例3: configure_buttons
/**
* \brief Configure the Pushbuttons
*
* Configure the PIO as inputs and generate corresponding interrupt when
* pressed or released.
*/
static void configure_buttons(void)
{
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
pmc_enable_periph_clk(PIN_PUSHBUTTON_2_ID);
pio_set_input(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, PIO_PULLUP | PIO_DEBOUNCE);
pio_set_input(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK, PIO_PULLUP | PIO_DEBOUNCE);
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, 10);
pio_set_debounce_filter(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK, 10);
pio_handler_set(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_ID, PIN_PUSHBUTTON_1_MASK, PIO_IT_FALL_EDGE | PIO_PULLUP, Button1_Handler);
pio_handler_set(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_ID, PIN_PUSHBUTTON_2_MASK, PIO_IT_FALL_EDGE | PIO_PULLUP, Button2_Handler);
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO , PIN_PUSHBUTTON_1_MASK);
pio_enable_interrupt(PIN_PUSHBUTTON_2_PIO , PIN_PUSHBUTTON_2_MASK);
NVIC_SetPriority((IRQn_Type) PIN_PUSHBUTTON_1_ID, 0);
NVIC_SetPriority((IRQn_Type) PIN_PUSHBUTTON_2_ID, 0);
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_1_ID);
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_2_ID);
}
示例4: configure_buttons
/**
* \brief Configure the Pushbuttons
*
* Configure the PIO as inputs and generate corresponding interrupt when
* pressed or released.
*/
static void configure_buttons(void)
{
pmc_enable_periph_clk(ID_BUT_2);
pmc_enable_periph_clk(ID_BUT_1);
pio_set_input(PORT_BUT_2, MASK_BUT_2, PIO_PULLUP | PIO_DEBOUNCE);
pio_set_input(PORT_BUT_1, MASK_BUT_1, PIO_PULLUP | PIO_DEBOUNCE);
pio_set_debounce_filter(PORT_BUT_2, MASK_BUT_2, 20);
pio_set_debounce_filter(PORT_BUT_1, MASK_BUT_1, 20);
pio_handler_set(PORT_BUT_2, ID_BUT_2, MASK_BUT_2, PIO_IT_FALL_EDGE , Button1_Handler );
pio_handler_set(PORT_BUT_1, ID_BUT_1, MASK_BUT_1, PIO_IT_FALL_EDGE , Button2_Handler );
pio_enable_interrupt(PORT_BUT_2, MASK_BUT_2);
pio_enable_interrupt(PORT_BUT_1, MASK_BUT_1);
NVIC_SetPriority((IRQn_Type) ID_PIOB, 2);
NVIC_SetPriority((IRQn_Type) ID_PIOC, 2);
NVIC_EnableIRQ(ID_BUT_2);
NVIC_EnableIRQ(ID_BUT_1);
}
示例5: config_hall_interrupt
void config_hall_interrupt (void){
pmc_enable_periph_clk(ID_HALL);
pio_set_input(PIOA, GPIO_HALLB, PIO_DEFAULT);
pio_pull_down(PIOA, GPIO_HALLB, ENABLE);
pio_handler_set(PIOA, ID_HALL, GPIO_HALLB, PIO_IT_RISE_EDGE, pin_riseedge_handler);
pio_enable_interrupt(PIOA, GPIO_HALLB);
pio_set_input(PIOA, GPIO_HALLC, PIO_DEFAULT);
pio_pull_down(PIOA, GPIO_HALLC, ENABLE);
pio_handler_set(PIOA, ID_HALL, GPIO_HALLC, PIO_IT_FALL_EDGE, pin_riseedge_handler);
pio_enable_interrupt(PIOA, GPIO_HALLC);
NVIC_DisableIRQ(PIOA_IRQn);
NVIC_ClearPendingIRQ(PIOA_IRQn);
NVIC_SetPriority(PIOA_IRQn, PRIORITY_MEASURE);
NVIC_EnableIRQ(PIOA_IRQn);
}
示例6: configure_interrupt_pio_RightWheel
/**************************************************************************
Configure the interrupt.
Digital Pin 12
**************************************************************************/
void configure_interrupt_pio_RightWheel(void)
{
pmc_enable_periph_clk(ID_PIOD); //Enable the module clock
pio_set_input(PIOD, PIO_PD8,PIO_PULLUP);
pio_handler_set(PIOD,ID_PIOD,PIO_PD8,PIO_IT_EDGE,pin_edge_handler);
pio_enable_interrupt(PIOD,PIO_PD8);
NVIC_EnableIRQ(PIOD_IRQn);
}
示例7: configure_buttons
/**
* \brief Configure the Pushbuttons
*
* Configure the PIO as inputs and generate corresponding interrupt when
* pressed or released.
*/
static void configure_buttons(void)
{
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
pio_set_input(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_ATTR);
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, 100);
pio_handler_set(PIN_PUSHBUTTON_1_PIO,PIN_PUSHBUTTON_1_ID, PIN_PUSHBUTTON_1_MASK,PIO_IT_FALL_EDGE, Button1_Handler);
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK);
NVIC_SetPriority(PIN_PUSHBUTTON_1_ID,0);
NVIC_EnableIRQ(PIN_PUSHBUTTON_1_ID);
pmc_enable_periph_clk(PIN_PUSHBUTTON_2_ID);
pio_set_input(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK, PIN_PUSHBUTTON_2_ATTR);
pio_set_debounce_filter(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK, 100);
pio_handler_set(PIN_PUSHBUTTON_2_PIO,PIN_PUSHBUTTON_2_ID, PIN_PUSHBUTTON_2_MASK,PIO_IT_FALL_EDGE, Button2_Handler);
pio_enable_interrupt(PIN_PUSHBUTTON_2_PIO, PIN_PUSHBUTTON_2_MASK);
NVIC_SetPriority(PIN_PUSHBUTTON_2_ID,1);
NVIC_EnableIRQ(PIN_PUSHBUTTON_2_ID);
}
示例8: pio_handler_set_pin
/**
* \brief Set an interrupt handler for the specified pin.
* The provided handler will be called with the triggering pin as its parameter
* as soon as an interrupt is detected.
*
* \param ul_pin Pin index to configure.
* \param ul_flag Pin flag.
* \param p_handler Interrupt handler function pointer.
*
* \return 0 if successful, 1 if the maximum number of sources has been defined.
*/
uint32_t pio_handler_set_pin(uint32_t ul_pin, uint32_t ul_flag,
void (*p_handler) (uint32_t, uint32_t))
{
Pio *p_pio = pio_get_pin_group(ul_pin);
uint32_t group_id = pio_get_pin_group_id(ul_pin);
uint32_t group_mask = pio_get_pin_group_mask(ul_pin);
return pio_handler_set(p_pio, group_id, group_mask, ul_flag, p_handler);
}
示例9: button_init
void button_init(uint32_t ul_id, Pio *p_pio, const uint32_t ul_mask, IRQn_Type IRQn, void (*p_handler) (uint32_t, uint32_t))
{
pmc_enable_periph_clk(ul_id);
pio_set_input(p_pio, ul_mask, PIO_PULLUP | PIO_DEBOUNCE);
pio_set_debounce_filter(p_pio, ul_mask, DEBOUNCE_FREQ);
pio_handler_set(p_pio, ul_id, ul_mask, PIO_IT_FALL_EDGE, p_handler);
pio_enable_interrupt(p_pio, ul_mask);
NVIC_EnableIRQ(IRQn);
}
示例10: configure_botao
void configure_botao(void)
{
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
pio_set_input(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_ATTR);
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, 10);
pio_handler_set(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_ID,PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_ATTR ,push_button_handle);
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK);
NVIC_SetPriority((IRQn_Type) PIN_PUSHBUTTON_1_ID, 0);
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_1_ID);
}
示例11: irq_init
static void irq_init(void) {
pio_configure_pin(DW_IRQ_IDX, DW_IRQ_FLAGS);
pio_pull_down(DW_IRQ_PIO, DW_IRQ_MASK, true);
pio_handler_set(DW_IRQ_PIO, DW_IRQ_PIO_ID, DW_IRQ_MASK, DW_IRQ_ATTR, irq_handler);
pio_enable_interrupt(DW_IRQ_PIO, DW_IRQ_MASK);
pio_handler_set_priority(DW_IRQ_PIO, DW_IRQ_IRQ, 0);
pmc_enable_periph_clk(DW_IRQ_PIO_ID);
}
示例12: init_vsync_interrupts
/**
* \brief Intialize Vsync_Handler.
*/
static void init_vsync_interrupts(void)
{
/* Initialize PIO interrupt handlers, see PIO definition in conf_board.h
**/
pio_handler_set(OV7740_VSYNC_PIO, OV7740_VSYNC_ID, OV7740_VSYNC_MASK,
OV7740_VSYNC_TYPE, vsync_handler);
/* Enable PIO controller IRQs */
NVIC_EnableIRQ((IRQn_Type)OV7740_VSYNC_ID);
}
示例13: configure_buttons
/**
* \brief Configure the Pushbuttons
*
* Configure the PIO as inputs and generate corresponding interrupt when
* pressed or released.
*/
static void configure_buttons(void)
{
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
pmc_enable_periph_clk(PIN_PUSHBUTTON_2_ID);
/**
* Configura entrada
*/
pio_set_input(PIN_PUSHBUTTON_1_PIO,PIN_PUSHBUTTON_1_MASK , PIO_PULLUP | PIO_DEBOUNCE);
pio_set_input(PIN_PUSHBUTTON_2_PIO,PIN_PUSHBUTTON_2_MASK , PIO_PULLUP | PIO_DEBOUNCE);
/*
* Configura divisor do clock para debounce
*/
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO,PIN_PUSHBUTTON_1_MASK ,20);
pio_set_debounce_filter(PIN_PUSHBUTTON_2_PIO,PIN_PUSHBUTTON_2_MASK ,20);
/*
* Configura interrupção para acontecer em borda de descida.
*/
pio_handler_set(PIN_PUSHBUTTON_1_PIO,PIN_PUSHBUTTON_1_ID,PIN_PUSHBUTTON_1_MASK ,PIN_PUSHBUTTON_1_ATTR ,Button1_Handler);
pio_handler_set(PIN_PUSHBUTTON_2_PIO,PIN_PUSHBUTTON_2_ID,PIN_PUSHBUTTON_2_MASK ,PIN_PUSHBUTTON_2_ATTR ,Button2_Handler);
/*
* Ativa interrupção no periférico B porta do botão
*/
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO,PIN_PUSHBUTTON_1_MASK);
pio_enable_interrupt(PIN_PUSHBUTTON_2_PIO,PIN_PUSHBUTTON_2_MASK);
/*
* Configura a prioridade da interrupção no pORTB
*/
NVIC_SetPriority(ID_PIOB,2);
NVIC_SetPriority(ID_PIOC,2);
/*
* Ativa interrupção no port B
*/
NVIC_EnableIRQ(ID_PIOB);
NVIC_EnableIRQ(ID_PIOC);
}
示例14: ui_init
void ui_init(void)
{
sleepmgr_lock_mode(SLEEPMGR_SLEEP_WFI);
/* Set handler for push button */
pio_handler_set(WAKEUP_PIO, WAKEUP_PIO_ID, WAKEUP_PIO_MASK,
WAKEUP_PIO_ATTR, ui_wakeup_handler);
/* Enable IRQ for button */
NVIC_EnableIRQ((IRQn_Type) WAKEUP_PIO_ID);
/* Initialize LED */
LED_Off(LED0);
}
示例15: ui_init
void ui_init(void)
{
/* Set handler for push button */
pio_handler_set(WAKEUP_PIO, WAKEUP_PIO_ID, WAKEUP_PIO_MASK,
WAKEUP_PIO_ATTR, ui_wakeup_handler);
/* Enable IRQ for button (PIOA) */
NVIC_EnableIRQ((IRQn_Type) WAKEUP_PIO_ID);
/* Initialize LEDs */
LED_Off(LED0);
LED_Off(LED1);
}