[En-Nut-Discussion] NutGpio Api and Multidrive for AVR

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Sep 24 14:29:43 CEST 2012


Hello,

as the AVR has no clean division between function and setup with it's
PORT/PIN/DDR registers, I think it is impossible in the NutGpio Api to have
GpioPinSetLow()/ GpioPinSetHigh()work as expected with the Port configures
once as pure GPIO_CFG_OUTPUT and other as GPIO_CFG_MULTIDRIVE.For that goal,
I added GpioPinDrive() and GpioPinRelease() to the Api. For example to drive
a shared active low line
we now need the following sequence
Setup:
NutGpioPinConfig(...,  GPIO_CFG_OUTPUT|GPIO_CFG_MULTIDRIVE|GPIO_CFG_PULLUP);
Drive Low:
NutGpioPinSetLow(...)
NutGpioPinDrive(...)
Release:
NutGpioPinRelease(...)
NutGpioPinSetHigh(...)

The last NutGpioPinSetHig makes sure the AVR pullup turns on the internal
pullup. For non-AVR architectures, NutGpioPinSetLow(...)  and
NutGpioPinDrive(...) are empty function in most cases

That way the OWI bus example can work for AVR too. 

I hope this API extension is considered okay.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list