Documentation

See Class Github for the example documentation

Embedded Controller HAL Library

Written by: Your Name

Program: C/C++

IDE/Compiler: Keil uVision 5

OS: WIn10

MCU: STM32F411RE, Nucleo-64

Table of Contents

GPIO Digital InOut

Header File

#include "ecGPIO.h"

GPIO_init()

Initializes GPIO pins with default setting and Enables GPIO Clock. Mode: In/Out/AF/Analog

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

  • mode: INPUT(0), OUTPUT(1), AF(02), ANALOG (03)

Example code

GPIO_mode()

Configures GPIO pin modes: In/Out/AF/Analog

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

  • mode: INPUT (0), OUTPUT (1), AF(02), ANALOG (03)

Example code

GPIO_write()

Write the data to GPIO pin: High, Low

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

  • output: LOW(0), HIGH(1)

Example code

GPIO_read()

Read the data from GPIO pin

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

Example code

GPIO_ospeed()

Configures output speed of GPIO pin : Low, Mid, Fast, High

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

  • speed: LOW_SPEED(0), MID_SPEED(1), FAST_SPEED(2) , HIGH_SPEED(3)

Example code

GPIO_otype()

Configures output type of GPIO pin: Push-Pull / Open-Drain

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

  • type: PUSH_PULL(0), OPEN_DRAIN(1)

Example code

GPIO_pupdr()

Configures Pull-up/Pull-down mode of GPIO pin: No Pull-up, Pull-down/ Pull-up/ Pull-down/ Reserved

Parameters

  • Port: Port Number, GPIOA~GPIOH

  • pin: pin number (int) 0~15

  • pupd: NO_PUPD(0), PULL_UP(1), PULL_DOWN(2), RESERVED(3)

Example code

Class or Header name

Function Name

Parameters

  • p1

  • p2

Example code

Last updated

Was this helpful?