STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
Hal

Classes

struct  PinMap
 Pin, peripheral instance and alternate function of one pin mapping entry. More...
 

Macros

#define GPIO_AF_NONE   0
 
#define STM_LL_GPIO_PIN(X)   (pin_map_ll[STM_PIN(X)])
 
#define NP   0U
 No peripheral.
 

Functions

bool pin_in_pinmap (PinName pin, const PinMap *map)
 Check whether a pin is present in a pinmap.
 
void pin_function (PinName pin, int function)
 Configure a pin: mode, speed, output type, pull-up/pull-down and alternate function.
 
static PinName pin_pinName (const PinMap *map)
 Get the pin name of a PinMap entry.
 
void pinmap_pinout (PinName pin, const PinMap *map)
 Configure a pin from a pinmap entry matching the pin.
 
void * pinmap_find_peripheral (PinName pin, const PinMap *map)
 Find the peripheral associated with a pin.
 
void * pinmap_peripheral (PinName pin, const PinMap *map)
 Find the peripheral associated with a pin, ignoring NC pins.
 
PinName pinmap_find_pin (void *peripheral, const PinMap *map)
 Find the pin associated with a peripheral.
 
PinName pinmap_pin (void *peripheral, const PinMap *map)
 Find the pin associated with a peripheral, ignoring NP peripherals.
 
uint32_t pinmap_find_function (PinName pin, const PinMap *map)
 Find the function associated with a pin.
 
uint32_t pinmap_function (PinName pin, const PinMap *map)
 Find the function associated with a pin, ignoring NC pins.
 
void * pinmap_merge_peripheral (void *a, void *b)
 Merge two peripheral pointers that may be NP.
 

Variables

const uint32_t pin_map_ll [16]
 Even if MP1 support some dual pad (analog switch), we don't consider it because its behavior is different from H7 and almost useless.
 

Detailed Description

Function Documentation

◆ pin_function()

void pin_function ( PinName  pin,
int  function 
)

Configure a pin: mode, speed, output type, pull-up/pull-down and alternate function.

Parameters
pinPin name.
functionPin function, encoded with the STM_PIN_* macros.
Note
Error_Handler is called if the pin is NC or the mode is unknown.
On series with dualpad analog switch (Pxy_C pins), the analog switch is also configured, and the GPIO configuration is skipped when an analog function is requested on the dualpad pin.

◆ pin_in_pinmap()

bool pin_in_pinmap ( PinName  pin,
const PinMap *  map 
)

Check whether a pin is present in a pinmap.

Parameters
pinPin name to look for.
mapPinMap array, terminated by an entry with pin NC.
Returns
true if the pin is found in the map, false otherwise.

◆ pin_pinName()

static PinName pin_pinName ( const PinMap *  map)
inlinestatic

Get the pin name of a PinMap entry.

Parameters
mapPinMap entry.
Returns
Pin name stored in the entry.

◆ pinmap_find_function()

uint32_t pinmap_find_function ( PinName  pin,
const PinMap *  map 
)

Find the function associated with a pin.

Parameters
pinPin name.
mapPinMap array, terminated by an entry with pin NC.
Returns
Function value, or NC cast to uint32_t if not found.

◆ pinmap_find_peripheral()

void * pinmap_find_peripheral ( PinName  pin,
const PinMap *  map 
)

Find the peripheral associated with a pin.

Parameters
pinPin name.
mapPinMap array, terminated by an entry with pin NC.
Returns
Peripheral pointer, or NP if not found.

◆ pinmap_find_pin()

PinName pinmap_find_pin ( void *  peripheral,
const PinMap *  map 
)

Find the pin associated with a peripheral.

Parameters
peripheralPeripheral pointer.
mapPinMap array, terminated by an entry with peripheral NP.
Returns
Pin name, or NC if not found.

◆ pinmap_function()

uint32_t pinmap_function ( PinName  pin,
const PinMap *  map 
)

Find the function associated with a pin, ignoring NC pins.

Parameters
pinPin name.
mapPinMap array, terminated by an entry with pin NC.
Returns
Function value, or NC cast to uint32_t if the pin is NC or not found.

◆ pinmap_merge_peripheral()

void * pinmap_merge_peripheral ( void *  a,
void *  b 
)

Merge two peripheral pointers that may be NP.

Parameters
aFirst peripheral pointer.
bSecond peripheral pointer.
Returns
The peripheral that is set, or a if both are the same. NP if they conflict.

◆ pinmap_peripheral()

void * pinmap_peripheral ( PinName  pin,
const PinMap *  map 
)

Find the peripheral associated with a pin, ignoring NC pins.

Parameters
pinPin name.
mapPinMap array, terminated by an entry with pin NC.
Returns
Peripheral pointer, or NP if the pin is NC or not found.

◆ pinmap_pin()

PinName pinmap_pin ( void *  peripheral,
const PinMap *  map 
)

Find the pin associated with a peripheral, ignoring NP peripherals.

Parameters
peripheralPeripheral pointer.
mapPinMap array, terminated by an entry with peripheral NP.
Returns
Pin name, or NC if the peripheral is NP or not found.

◆ pinmap_pinout()

void pinmap_pinout ( PinName  pin,
const PinMap *  map 
)

Configure a pin from a pinmap entry matching the pin.

Parameters
pinPin name. Nothing is done if the pin is NC.
mapPinMap array, terminated by an entry with pin NC.
Note
Error_Handler is called if the pin is not found in the map.

Variable Documentation

◆ pin_map_ll

const uint32_t pin_map_ll[16]
extern

Even if MP1 support some dual pad (analog switch), we don't consider it because its behavior is different from H7 and almost useless.

Switches remains open all the time. No need to configure it