this is more or less a question about wording. I am designing an API and need to figure out whether or not the namespace name used is correct or needs to be refactored.

The namespace is called GPIO and inside this namespace are modules to configure a pin. That means, there're routines for configuring a PWM and an ADC on pins in this namespace. Also things like using the pin for I2C or SPI are grouped.

As I am only a hobbyist when it comes to electrical engineering, I am worried that the name of the namespace is confusing, misleading, or plainly wrong - because I gathered those routines/modules under the name of GPIO.

I have always thought that GPIO just means that a pin has possibly many features that can be configured. But when you lookup wikipedia or almost all other sources on the web, then a GPIO seems to be limited to only digital io capabilities and maybe configure a pull up or pull down resistor.

So, what exactly does the term GPIO mean? Is it really limited to digital IO?

Is it correct to say: I configure this GPIO as a PWM. I configure that GPIO as a timer.

Or is it wrong?

  • \$\begingroup\$ General Purpose Input Output. On many controllers, the GPIO pins have multiple functions as you are asking. Sometimes pins have only digital in and out only and are still called GPIO if they are configurable I think. \$\endgroup\$
    – kenny
    Aug 19, 2014 at 0:14

1 Answer 1


No, because you can have ADC or PWM capabilities independent of a GPIO. E.g., the 32-pin variants of the ATmega328 have two pins that are exclusively ADC inputs (pins 19 and 22) without any digital I/O capability. So you can configure pins as PWM, ADC, GPIO, etc., but GPIO is a discrete concept from the other functions.

  • \$\begingroup\$ So a GPIO is a digital input or output, and the other uses like ADC are different uses of the same pin? And couldn't you argue that PWM is a GPIO function, since it's pulse width modulation of a digital output? (Not trying to be contrary here, just trying to better understand your answer.) \$\endgroup\$
    – Duncan C
    Aug 19, 2014 at 0:32
  • \$\begingroup\$ @DuncanC: GPIO is an input/output under software control. PWM pins are under hardware control, so they lose the "general purpose" functionality. Yes, you can configure and shape the waveform generated, but you can't force the output to a persistent value outside of the PWM parameters. \$\endgroup\$ Aug 19, 2014 at 0:35
  • 1
    \$\begingroup\$ @DuncanC - pins have behaviours (or functions). GPIO is a behaviour (function) of a pin. It is meaningless to take about GPIO outside the context of a pin. Even if every pin could have GPIO behaviour (function), the pin is still the thing which has behaviour (function), the pin does not stop being a pin when it has an ADC behaviour (or function), but it stops being a GPIO. If you read a datasheet it is usually clear GPIO is just a peripheral subsystem, like any other. IMHO Ignacio Vazquez-Abrams's answer is exactly correct. +1 \$\endgroup\$
    – gbulmer
    Aug 19, 2014 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.