01.06.2014 Views

STM32W108C8

STM32W108C8

STM32W108C8

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

General-purpose input/outputs<br />

<strong>STM32W108C8</strong><br />

8.1.6 GPIO modes<br />

Analog mode<br />

Note:<br />

Analog mode enables analog functions, and disconnects a pin from the digital input and<br />

output logic. Only the following GPIO pins have analog functions:<br />

● PA4, PA5, PB5, PB6, PB7, and PC1 can be analog inputs to the ADC.<br />

● PB0 can be an external analog voltage reference input to the ADC, or it can output the<br />

internal analog voltage reference from the ADC.<br />

● PC6 and PC7 can connect to an optional 32.768 kHz crystal.<br />

When an external timing source is required, a 32.768 kHz crystal is commonly connected to<br />

PC6 and PC7. Alternatively, when PC7 is configured as a digital input, PC7 can accept a<br />

digital external clock input.<br />

When configured in analog mode:<br />

● The output drivers are disabled.<br />

● The internal pull-up and pull-down resistors are disabled.<br />

● The Schmitt trigger input is connected to a high logic level.<br />

● Reading GPIO_PxIN returns a constant 1.<br />

Input mode<br />

Input mode is used both for general purpose input and for on-chip peripheral inputs. Input<br />

floating mode disables the internal pull-up and pull-down resistors, leaving the pin in a highimpedance<br />

state. Input pull-up or pull-down mode enables either an internal pull-up or pulldown<br />

resistor based on the GPIO_PxOUT register. Setting a bit to 0 in GPIO_PxOUT<br />

enables the pull-down and setting a bit to 1 enables the pull up.<br />

When configured in input mode:<br />

● The output drivers are disabled.<br />

● An internal pull-up or pull-down resistor may be activated depending on<br />

GPIO_PxCFGH/L and GPIO_PxOUT.<br />

● The Schmitt trigger input is connected to the pin.<br />

● Reading GPIO_PxIN returns the input at the pin.<br />

● The input is also available to on-chip peripherals.<br />

Output mode<br />

Output mode provides a general purpose output under direct software control. Regardless<br />

of whether an output is configured as push-pull or open-drain, the GPIO's bit in the<br />

GPIO_PxOUT register controls the output. The GPIO_PxSET and GPIO_PxCLR registers<br />

can atomically set and clear bits within GPIO_PxOUT register. These set and clear registers<br />

simplify software using the output port because they eliminate the need to disable interrupts<br />

to perform an atomic read-modify-write operation of GPIO_PxOUT.<br />

59/215 Doc ID 018587 Rev 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!