[En-Nut-Discussion] GPIO_CFG Definitions

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Jul 17 11:32:34 CEST 2012


>>>>> "Henrik" == Henrik Maier <hmnews at proconx.com> writes:

    Henrik> Hi all, It seems to become harder and harder to have a generic
    Henrik> GPIO API available considering that the chip manufacturers are
    Henrik> adding more and more features to their pins. From initial input,
    Henrik> output and pull-up we now have several alternate functions,
    Henrik> speed options and so forth.

    Henrik> I don't see anything wrong with the platform specific Nut/OS
    Henrik> drivers using API functions from the CMSIS, libavr or the STM32
    Henrik> Standard Peripheral Library. Wouldn't that save a lot of time ?

I am thinking about our nut/app examples. They should run on all supported
platforms. The examples should not need fancy settings, or they will cause
problems on a different platform.  They should only ask for basic things like
input/output/multidrive, ADC analog where supported and maybe
pullup and DAC. Did I forget some basic setting?

But these common capabilities should be supported by the generic GPIO Api.

Anything more fancy will only run on a dedicated platform and on a
different platform the code needs to be check for needed changes in the code
or if it can work at all. 

So maybe we should split up the flags in two, like
GpioPinConfig(int Port, uint_fast8_t Pin, uint_fast8_t Common_Flags, uint32_t
Fancy_flags)
Or Fancy_flags are set/queried in platform specific code.

For generic examples/code, Fancy_flags must be Null and GpioPinConfig should
only return success if it can reproduce common_flags and fancy_flags if
given.

B.t.w, as enabling/ disabling the Output for Multidrive via such a
GpioPinConfig() function might get slow, I propose to add something like

GpioPinOutput(int Port, uint_fast8_t Pin, uint_fast8_t enable)


GpioPinToggle(int Port, uint_fast8_t Pin)
would also come handy.

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