Configuring AVR32 pin direction

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm looking in gpio.h and gpio.c for a function on setting the direction of a GPIO pin in AVR32. (Equivalent to writing to bit in DDRD on AVR.)

 

The files have all sorts of nice functions for setting and clearing _output_ pins and reading from input pins. But what I need is a convenient mechanism to change pin direction.

 

 

Thanks,

Borge

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many of the ASF gpio routines do several things, eg.
gpio_enable_gpio_pin(uint32_t pin) sets a pin to be an I/O and an input.
gpio_set_gpio_pin(uint32_t pin) and gpio_clear_gpio_pin(uint32_t pin) and gpio_tgl_gpio_pin(uint32_t pin) sets a pin to be an I/O output and then set it high, low or toggled.
gpio_configure_pin(uint32_t pin, uint32_t flags) uses flags to set all sorts of stuff for one pin and gpio_configure_group(uint32_t port, uint32_t mask, uint32_t flags) does the same for multiple pins on a port.