|
STM32 core 3.2.0-dev
Arduino core for STM32 based boards: API reference
|
← STM32duino documentation
|
Pin number conversion helpers, port register macros and default pin definitions. More...
#include <stdbool.h>#include <stdlib.h>#include "api/Common.h"#include "variant.h"#include "PinNames.h"#include "pins_arduino_analog.h"#include "pins_arduino_digital.h"Macros | |
| #define | PNUM_MASK 0xFF |
| Pin number mask, allows to retrieve the pin number without ALTx. | |
| #define | PNUM_NOT_DEFINED NUM_DIGITAL_PINS |
| Pin not defined. | |
| #define | PIN_SPI_SS 10 |
| #define | PIN_SPI_SS1 4 |
| #define | PIN_SPI_SS2 7 |
| #define | PIN_SPI_SS3 8 |
| #define | PIN_SPI_MOSI 11 |
| #define | PIN_SPI_MISO 12 |
| #define | PIN_SPI_SCK 13 |
| #define | PIN_WIRE_SDA 14 |
| #define | PIN_WIRE_SCL 15 |
| #define | PIN_I3C_SDA 14 |
| #define | PIN_I3C_SCL 15 |
| #define | NOT_AN_INTERRUPT (pin_size_t)NC |
| Value returned by digitalPinToInterrupt() when the pin cannot be used as an interrupt. | |
| #define | digitalPinToPinName(p) |
| Convert a digital pin number (Dxx) to a PinName (PX_n). | |
| #define | analogInputToDigitalPin(p) |
| Convert an analog pin number (Ax) to a digital pin number. | |
| #define | digitalPinToInterrupt(p) |
| Convert a digital pin number to an interrupt number. | |
| #define | digitalPinHasI2C(p) |
| Check whether a digital pin has an I2C (SDA or SCL) function. | |
| #define | digitalPinHasPWM(p) |
| Check whether a digital pin has a PWM (timer) function. | |
| #define | digitalPinHasSerial(p) |
| Check whether a digital pin has a UART (RX or TX) function. | |
| #define | digitalPinHasSPI(p) |
| Check whether a digital pin has an SPI (MOSI, MISO, SCLK or SSEL) function. | |
| #define | digitalPinToPort(p) |
| Get the GPIO port (GPIO_TypeDef pointer) of a digital pin. | |
| #define | digitalPinToBitMask(p) |
| Get the bit mask of a digital pin in its GPIO port registers. | |
| #define | analogInPinToBit(p) |
| Get the bit mask of an analog pin in its GPIO port registers. | |
| #define | portOutputRegister(P) |
| Get the address of the output data register of a GPIO port. | |
| #define | portInputRegister(P) |
| Get the address of the input data register of a GPIO port. | |
| #define | portSetRegister(P) |
| Get the address of the set register of a GPIO port. | |
| #define | portClearRegister(P) |
| #define | portModeRegister(P) |
| #define | portConfigRegister(P) |
| Get the address of the mode register of a GPIO port. | |
| #define | digitalPinIsValid(p) |
| Check whether a digital pin number is valid, i.e. | |
| #define | digitalPinFirstOccurence(p) |
| Get the first occurrence of a pin in digitalPin[]. | |
| #define | pinIsAnalogInput digitalpinIsAnalogInput |
| Convenient macro to handle Analog for Firmata, see digitalpinIsAnalogInput(). | |
| #define | ADC_RESOLUTION 10 |
| Default resolution of analogRead() values, in bits. | |
| #define | DACC_RESOLUTION 12 |
| Resolution of the DAC, in bits. | |
| #define | PWM_RESOLUTION 8 |
| Default resolution of analogWrite() values, in bits. | |
| #define | PWM_FREQUENCY 1000 |
| Default PWM frequency of analogWrite(), in Hertz. | |
| #define | PWM_MAX_DUTY_CYCLE 4095 |
| Maximum PWM duty cycle value. | |
Functions | |
| pin_size_t | pinNametoDigitalPin (PinName p) |
| Convert a PinName (PX_n) to a digital pin number. | |
| PinName | analogInputToPinName (pin_size_t pin) |
| Convert an analog pin number (Ax) to a PinName (PX_n). | |
| bool | digitalpinIsAnalogInput (pin_size_t pin) |
| Check whether a digital pin is an analog input. | |
| pin_size_t | digitalPinToAnalogInput (pin_size_t pin) |
| Get the analog input linked to a digital pin. | |
Pin number conversion helpers, port register macros and default pin definitions.
| #define analogInPinToBit | ( | p | ) |
Get the bit mask of an analog pin in its GPIO port registers.
| #define analogInputToDigitalPin | ( | p | ) |
Convert an analog pin number (Ax) to a digital pin number.
Used by the analogRead API to have A0 == 0, even if the analog pins are not contiguous in the digitalPin array.
| p | Analog pin number. |
| #define digitalPinFirstOccurence | ( | p | ) |
Get the first occurrence of a pin in digitalPin[].
Some pins could be duplicated in digitalPin[], this returns the digital pin number of the first occurrence of the linked PinName (PYx).
| p | Digital pin number. |
| #define digitalPinHasI2C | ( | p | ) |
Check whether a digital pin has an I2C (SDA or SCL) function.
| #define digitalPinHasPWM | ( | p | ) |
Check whether a digital pin has a PWM (timer) function.
| #define digitalPinHasSerial | ( | p | ) |
Check whether a digital pin has a UART (RX or TX) function.
| #define digitalPinHasSPI | ( | p | ) |
Check whether a digital pin has an SPI (MOSI, MISO, SCLK or SSEL) function.
| #define digitalPinIsValid | ( | p | ) |
Check whether a digital pin number is valid, i.e.
linked to a PinName.
| #define digitalPinToBitMask | ( | p | ) |
Get the bit mask of a digital pin in its GPIO port registers.
| #define digitalPinToInterrupt | ( | p | ) |
Convert a digital pin number to an interrupt number.
All pins could manage EXTI, so the pin number is used as interrupt number.
| p | Digital pin number. |
| #define digitalPinToPinName | ( | p | ) |
Convert a digital pin number (Dxx) to a PinName (PX_n).
The ALTX bits of the pin number are preserved. An analog pin number (Ax) is also accepted.
| p | Digital pin number. |
| #define digitalPinToPort | ( | p | ) |
Get the GPIO port (GPIO_TypeDef pointer) of a digital pin.
| #define portClearRegister | ( | P | ) |
| #define portConfigRegister | ( | P | ) |
Get the address of the mode register of a GPIO port.
Same as portModeRegister().
| #define portInputRegister | ( | P | ) |
Get the address of the input data register of a GPIO port.
| #define portModeRegister | ( | P | ) |
| #define portOutputRegister | ( | P | ) |
Get the address of the output data register of a GPIO port.
| #define portSetRegister | ( | P | ) |
Get the address of the set register of a GPIO port.
| PinName analogInputToPinName | ( | pin_size_t | pin | ) |
Convert an analog pin number (Ax) to a PinName (PX_n).
| pin | Analog pin number, Ax. |
| bool digitalpinIsAnalogInput | ( | pin_size_t | pin | ) |
Check whether a digital pin is an analog input.
| pin | Dx, x or PYn. |
| pin_size_t digitalPinToAnalogInput | ( | pin_size_t | pin | ) |
Get the analog input linked to a digital pin.
| pin | Dx, x or PYn. |
| pin_size_t pinNametoDigitalPin | ( | PinName | p | ) |
Convert a PinName (PX_n) to a digital pin number.
| p | PinName to convert. |