Всем привет. Есть отладочная плата EVK1100. Установил AVR32 Studio под XP. Пишу обработчки прерывания для джойстика. Вот код для Joystick.h :
#ifndef JOYSTICK_H_ #define JOYSTICK_H_
#include <avr32/io.h> #include <sys/interrupts.h>
#include "global_define.h" #include "gpio.h" #include "usart.h" #include "compiler.h" #include "pm.h"
void init_joystick(volatile avr32_eic_t *set_eic); void detect_direction_joystick(void);
#endif /*JOYSTICK_H_*/
Вот код для Joystick.c : #include "joystick.h"
__int_handler *joystick_int(){ detect_direction_joystick(); return (void *) 0; }
void init_joystick(volatile avr32_eic_t *set_eic){ set_eic->mode = 0; set_eic->edge = 0; set_eic->level = 1; set_eic->filter = 0; set_eic->async = 1; set_eic->ier = 1; gpio_enable_module_pin(AVR32_EIC_EXTINT_8_PIN,AVR32_EIC_EXTINT_8_FUNCTION); set_interrupts_base((void *)AVR32_EIC_ADDRESS); register_interrupt((__int_handler)(joystick_int),AVR32_EIC_EXTINT_8_PIN / 32,AVR32_EIC_EXTINT_8_PIN % 32,INT3); init_interrupts(); }
void detect_direction_joystick(void){ usart_bw_write_char(EXAMPLE_USART,10); }
|