Nut/OS  5.0.5
API Reference
gpio.h
Go to the documentation of this file.
00001 
00038 #ifndef _AVR32_GPIO_H_
00039 #define _AVR32_GPIO_H_
00040 
00041 #include <arch/avr32.h>
00042 #include <avr32/io.h>
00043 
00044 #include <dev/gpio.h>
00045 
00046 typedef struct
00047 {
00048   unsigned char pin;              
00049   unsigned char function;         
00050 } gpio_map_t[];
00051 
00052 extern int gpio_enable_module(const gpio_map_t gpiomap, unsigned int size);
00053 
00054 void inline gpio_enable_module_pin(unsigned int pin, unsigned int function)
00055 {
00056     unsigned int peripheral = 0;
00057     switch ( function )
00058     {
00059     case 0:     peripheral = GPIO_CFG_PERIPHERAL0;      break;
00060     case 1:     peripheral = GPIO_CFG_PERIPHERAL1;      break;
00061     case 2:     peripheral = GPIO_CFG_PERIPHERAL2;      break;
00062     default:
00063         while(1); // Unrecognized peripheral choice
00064         break;
00065     }
00066     GpioPinConfigSet( pin >> 5, pin & 0x1F, peripheral );
00067     //enable_module_pin(pin >> 5, _BV(pin & 0x1F), peripheral);
00068 }
00069 
00070 
00071 #endif  // _AVR32_GPIO_H_