• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pio_handler_set函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pio_handler_set函数的典型用法代码示例。如果您正苦于以下问题:C++ pio_handler_set函数的具体用法?C++ pio_handler_set怎么用?C++ pio_handler_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pio_handler_set函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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){
		
	}
}
开发者ID:caiotoledo,项目名称:Cubli_2015,代码行数:29,代码来源:main.c


示例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
}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:35,代码来源:main.c


示例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);
	}
开发者ID:ericmcgomes,项目名称:entregas,代码行数:23,代码来源:main.c


示例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);	
		
}
开发者ID:smazon,项目名称:Entregas,代码行数:24,代码来源:ili93xx_example.c


示例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);
}
开发者ID:caiotoledo,项目名称:Cubli_2015,代码行数:18,代码来源:Motor.c


示例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);

 }
开发者ID:Tative21,项目名称:P2-DanicaKragic,代码行数:13,代码来源:InterruptPioRightWheel.c


示例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);
	}
开发者ID:Cbrazioli,项目名称:Entregas,代码行数:24,代码来源:main.c


示例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);
}
开发者ID:AbhishekShah212,项目名称:School_Projects,代码行数:20,代码来源:pio_handler.c


示例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);
}
开发者ID:jkmiller11,项目名称:PEM_prototype,代码行数:9,代码来源:buttons.c


示例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);
}
开发者ID:kaiostrippoli,项目名称:Entregas,代码行数:10,代码来源:ili93xx_example.c


示例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);
}
开发者ID:erudisill,项目名称:decawave-cph-sam4s,代码行数:10,代码来源:cs_listener.c


示例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);
}
开发者ID:marekr,项目名称:asf,代码行数:13,代码来源:unit_tests.c


示例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);
}
开发者ID:RenanLoyola,项目名称:Maua-trabalhos,代码行数:48,代码来源:ili93xx_example.c


示例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);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:11,代码来源:ui.c


示例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);
}
开发者ID:Mazetti,项目名称:asf,代码行数:11,代码来源:ui.c


示例16: configure_buttons

static void configure_buttons(void)
{	
	pmc_enable_periph_clk(ID_BUT_2);
	pmc_enable_periph_clk(ID_BUT_3);
	/**
	* Configura entrada
	*/ 
	pio_set_input(PORT_BUT_2, MASK_BUT_2, PIO_PULLUP | PIO_DEBOUNCE);
	pio_set_input(PORT_BUT_3, MASK_BUT_3, PIO_PULLUP | PIO_DEBOUNCE);
	
	/*
	 * Configura divisor do clock para debounce
	 */
	pio_set_debounce_filter(PORT_BUT_2,MASK_BUT_2, 100);
	pio_set_debounce_filter(PORT_BUT_3,MASK_BUT_3, 100);
	
	/* 
	*	Configura interrupção para acontecer em borda de descida.
	*/
	pio_handler_set(PORT_BUT_2,ID_BUT_2,MASK_BUT_2,PIO_IT_FALL_EDGE,Button2_Handler);
	pio_handler_set(PORT_BUT_3,ID_BUT_3,MASK_BUT_3,PIO_IT_FALL_EDGE,Button3_Handler);
				
	/*
	*	Ativa interrupção no periférico B porta do botão
	*/	
	pio_enable_interrupt(PORT_BUT_2,MASK_BUT_2);
	pio_enable_interrupt(PORT_BUT_3,MASK_BUT_3);
	
	/*
	*	Configura a prioridade da interrupção no PORTB E PORTC
	*/
	NVIC_SetPriority(PIOB_IRQn, 10);
	NVIC_SetPriority(PIOC_IRQn, 10);
	
	/*
	*	Ativa interrupção no port B e C
	*/
	NVIC_EnableIRQ(PIOB_IRQn);
	NVIC_EnableIRQ(PIOC_IRQn);
		
}
开发者ID:kaiostrippoli,项目名称:Entregas,代码行数:41,代码来源:ili93xx_example.c


示例17: ui_init

void ui_init(void)
{
	// Enable PIO clock for button inputs
	pmc_enable_periph_clk(ID_PIOA);
	pmc_enable_periph_clk(ID_PIOB);
	// Set handler for PA15
	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_On(LED0_GPIO);
	LED_Off(LED1_GPIO);
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:13,代码来源:ui.c


示例18: initMPU60X0

int initMPU60X0(void)
{
	twi_options_t twi_options;
	
	twi_options.master_clk	= BOARD_MCK;
	twi_options.speed		= MPU60X0_SPEED;
	twi_options.chip		= MPU60X0_BASE_ADDRESS;

	// Enable External Interrupt Controller Line.
	// Enable interrupts with priority higher than USB.
	pio_set_input(PIOA, MPU60X0_BODY_INT_PIN, MPU60X0_BODY_INT_FUNCTION);
	pio_configure_interrupt(PIOA, MPU60X0_BODY_INT_PIN, MPU60X0_BODY_INT_FUNCTION);
	pio_handler_set(PIOA, ID_PIOA, MPU60X0_BODY_INT_PIN, PIO_IT_RISE_EDGE, MPU60X0BodyInterrupt);
	
	pio_set_input(PIOA, MPU60X0_HEAD_INT_PIN, MPU60X0_HEAD_INT_FUNCTION);
	pio_configure_interrupt(PIOA, MPU60X0_HEAD_INT_PIN, MPU60X0_HEAD_INT_FUNCTION);
	pio_handler_set(PIOA, ID_PIOA, MPU60X0_HEAD_INT_PIN, PIO_IT_RISE_EDGE, MPU60X0HeadInterrupt);
	
	NVIC_EnableIRQ(PIOA_IRQn);
	pio_enable_interrupt(PIOA, MPU60X0_BODY_INT_PIN);
	pio_enable_interrupt(PIOA, MPU60X0_HEAD_INT_PIN);
	
	// Initialize TWI driver with options.
	if (TWI_SUCCESS != twi_master_init(TWI0, &twi_options))
	{
		// Disable the interrupts.
		pio_disable_interrupt(PIOA, MPU60X0_BODY_INT_PIN);
		pio_disable_interrupt(PIOA, MPU60X0_HEAD_INT_PIN);
	
		return(-1);
	}

	// Enable both RX and TX
	TWI0->TWI_IER = TWI_IER_TXRDY | TWI_IER_RXRDY;

	return(0);
}
开发者ID:Bidski,项目名称:TAJ3850,代码行数:37,代码来源:mpu60X0.c


示例19: ui_init

/**
 * \name Main user interface functions
 * @{
 */
void ui_init(void)
{
	/* Enable PIO clock for button inputs */
	pmc_enable_periph_clk(RESUME_PIO_ID);
	pmc_enable_periph_clk(ID_PIOA);
	/* Set handler for wakeup */
	pio_handler_set(RESUME_PIO, RESUME_PIO_ID, RESUME_PIO_MASK,
			RESUME_PIO_ATTR, ui_wakeup_handler);
	/* Enable IRQ for button (PIOB) */
	NVIC_EnableIRQ((IRQn_Type)RESUME_PIO_ID);
	pio_configure_pin(RESUME_PIN, RESUME_PIO_ATTR);

	/* Initialize LEDs */
	LED_Off(LED0);
}
开发者ID:Timvrakas,项目名称:samd21_gcc,代码行数:19,代码来源:ui.c


示例20: configure_button

/**
 *  \brief Configure the Pushbutton.
 */
static void configure_button(void)
{
    /* Enable the peripheral clock for the push button on board. */
    pmc_enable_periph_clk(PUSHBUTTON_ID);

    /* Configure PIOs as input pins. */
    pio_configure(PUSHBUTTON_PIO, PUSHBUTTON_TYPE, PUSHBUTTON_MASK,
                  PUSHBUTTON_ATTR);

    /* Adjust PIO debounce filter parameters. */
    pio_set_debounce_filter(PUSHBUTTON_PIO, PUSHBUTTON_MASK,
                            PUSHBUTTON_FILTER_GLITCH_VAULE);

    /* Initialize PIO interrupt handler, interrupt on rising edge. */
    pio_handler_set(PUSHBUTTON_PIO, PUSHBUTTON_ID, PUSHBUTTON_MASK,
                    PUSHBUTTON_ATTR, button_handler);
}
开发者ID:Tjalling7,项目名称:asf,代码行数:20,代码来源:wdt_example.c



注:本文中的pio_handler_set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pioctl函数代码示例发布时间:2022-05-30
下一篇:
C++ pio_configure函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap