GPIO#

This module provides a low-level interface to the Leaderboard’s GPIO ports, intended for switches and some lights. The code is fairly straightforward, and only slightly simplifies the Minions Driver.

group BSP_GPIO

Enums

enum port_t#

Values:

enumerator PORTA#
enumerator PORTB#
enumerator PORTC#
enumerator PORTD#
enumerator NUM_PORTS#
enum direction_t#

Values:

enumerator INPUT#
enumerator OUTPUT#

Functions

GPIO_TypeDef *GPIO_GetPort(port_t port)#
void BSP_GPIO_Init(port_t port, uint16_t mask, direction_t direction, bool pull_down)#

Initializes a GPIO port.

Parameters:
  • port – - port to initialize

  • mask – - pins

  • direction – - input or output

Returns:

None

uint16_t BSP_GPIO_Read(port_t port)#

Reads value of the specified port.

Parameters:

port – to read

Returns:

data of the port

void BSP_GPIO_Write(port_t port, uint16_t data)#

Writes data to a specified port.

Parameters:
  • port – port to write to

  • data – data to write

Returns:

None

uint8_t BSP_GPIO_Read_Pin(port_t port, uint16_t pinmask)#

Reads data from a specified pin (not applicalbe to output pins)

Reads data from a specified pin (not applicalbe to output pins)

Parameters:
  • port – The port to read from

  • pinmask – Mask from stm header file that says which pin to read from

  • port – The port to read from

  • pin – The pin to read from

Returns:

State of the pin

Returns:

State of the pin

void BSP_GPIO_Write_Pin(port_t port, uint16_t pinmask, bool state)#

Writes data to a specified pin.

Parameters:
  • port – The port to write to

  • pinmask – Mask from stm header file that says which pin to write too

  • state – true=ON or false=OFF

  • port – The port to write to

  • pin – The pin to write to

  • state – true=ON or false=OFF

Returns:

None

Returns:

None

uint8_t BSP_GPIO_Get_State(port_t port, uint16_t pin)#

Returns state of output pin (not applicable to input pins)

Parameters:
  • port – The port to get state from

  • pin – The pin to get state from

Returns:

1 if pin is high, 0 if low