info:avr32_gpio_writing
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
info:avr32_gpio_writing [2009/04/28 08:49] – tomgee | info:avr32_gpio_writing [2009/04/29 09:59] (current) – tomgee | ||
---|---|---|---|
Line 48: | Line 48: | ||
If you want a pure output you should also clear the ODMER otherwise you have an open drain driver if the device is populated with it.\\ | If you want a pure output you should also clear the ODMER otherwise you have an open drain driver if the device is populated with it.\\ | ||
And last but not least you should also clear the PUER to keep your power consumption low. | And last but not least you should also clear the PUER to keep your power consumption low. | ||
+ | |||
+ | ===== Setting Clock ===== | ||
+ | |||
+ | pm_freq_param_t osc; | ||
+ | osc.cpu_f = 66000000; | ||
+ | osc.osc0_f = FOSC0; | ||
+ | osc.osc0_startup = FOSC0_STARTUP; | ||
+ | osc.pba_f = 33000000; | ||
+ | pm_configure_clocks(& | ||
+ | |||
+ | |||
+ | You can set and reset the port pins directly. Here is an example for PORTB: | ||
+ | Code: | ||
+ | volatile avr32_gpio_port_t *gpio_port_b = ( volatile avr32_gpio_port_t * ) & | ||
+ | |||
+ | gpio_port_b-> | ||
+ | gpio_port_b-> | ||
+ | |||
+ | |||
+ | ===== Setting PIO Faster ===== | ||
+ | |||
+ | This is faster, because you don't have to call a function (saving and restoring of all registers => stack). | ||
+ | |||
+ | If you want to set or reset a pin of PORTA: | ||
+ | |||
+ | volatile avr32_gpio_port_t *gpio_port_a = ( volatile avr32_gpio_port_t * ) & | ||
+ | |||
+ | gpio_port_a-> | ||
+ | gpio_port_a-> | ||
+ | |||
+ | |||
+ | You can also set or reset more than one pin at the same time. |
info/avr32_gpio_writing.1240922954.txt.gz · Last modified: 2009/04/28 08:49 by tomgee