.. _gpio: GPIO ==== Each LeafLabs board comes with ready-to-use General Purpose Input/Output (GPIO) pins, which are numbered starting from zero. These numbers are listed on your board's silkscreen, next to where the pin is broken out to a header. Many pins may additionally be used for special features or peripheral functions. .. contents:: Contents :local: .. _gpio-pin-maps: Pin Maps -------- The hardware documentation for your board lists each pin's capabilities, by pin number: .. TODO [0.1.0] Uncomment Mini and Native GPIO links * :ref:`Maple ` * :ref:`Maple RET6 Edition ` .. * :ref:`Maple Mini ` .. * :ref:`Maple Native ` The current and voltage limitations were determined using the STM32 datasheets. In particular, only some GPIO pins are **5V tolerant**, which means that applying 5 volts to a pin and reading it as input or allowing it to drain to ground will not damage that pin. Connecting a voltage higher than 3.3V to a non-5V tolerant pin may damage your board. .. _gpio-modes: GPIO Modes ---------- Each of the GPIO pins on a Maple board may be configured using pinMode() to behave in a number of ways: as a digital output pin, or as an analog input pin, etc., depending on the particular pin. A ``WiringPinMode`` value specifies the complete set of possible configurations; not every pin can have all of these modes. For example, on the Maple, pin 15 may have mode ``INPUT_ANALOG``, but not ``PWM``. See your :ref:`board's pin maps ` and its silkscreen for more information on what functionality is available on each pin. .. doxygenenum:: WiringPinMode Function Reference ------------------ - :ref:`pinMode() ` - :ref:`digitalRead() ` - :ref:`digitalWrite() ` - :ref:`analogRead() ` - :ref:`pwmWrite() ` (Maple's equivalent to ``analogWrite()``; see the :ref:`analogWrite() reference ` for differences from the Arduino version). .. _gpio-recommended-reading: Recommended Reading ------------------- * ST Documentation for the STM32F103 series of microcontrollers: * `Reference Manual `_ (pdf) * `Programming Manual `_ (PDF; assembly language and register reference)