Skip to content

File syn_port_gpio.h

FileList > port > syn_port_gpio.h

Go to the source code of this file

GPIO port interface — functions the user must implement. More...

  • #include "../common/syn_defs.h"

Public Functions

Type Name
SYN_Status syn_port_gpio_deinit (SYN_GPIO_Pin pin)
De-initialize a GPIO pin, returning it to its reset state.
SYN_Status syn_port_gpio_init (SYN_GPIO_Pin pin, SYN_GPIO_Mode mode)
Initialize a GPIO pin with the given mode.
SYN_GPIO_State syn_port_gpio_read (SYN_GPIO_Pin pin)
Read the current logical state of a pin.
SYN_Status syn_port_gpio_toggle (SYN_GPIO_Pin pin)
Toggle the state of an output pin.
SYN_Status syn_port_gpio_write (SYN_GPIO_Pin pin, SYN_GPIO_State state)
Write a logical state to an output pin.

Detailed Description

To use SyntropicOS GPIO functionality, provide strong definitions of every function declared here in your platform-specific source file.

If you compile syn_port_stubs.c, any function you forget to implement will link to a weak stub that fires an assert, making integration mistakes visible at runtime.

Public Functions Documentation

function syn_port_gpio_deinit

De-initialize a GPIO pin, returning it to its reset state.

SYN_Status syn_port_gpio_deinit (
    SYN_GPIO_Pin pin
) 

Parameters:

  • pin Pin to de-initialize.

Returns:

SYN_OK on success.


function syn_port_gpio_init

Initialize a GPIO pin with the given mode.

SYN_Status syn_port_gpio_init (
    SYN_GPIO_Pin pin,
    SYN_GPIO_Mode mode
) 

Parameters:

  • pin Platform-specific pin identifier.
  • mode Desired pin mode (input, output, etc.).

Returns:

SYN_OK on success, or an error code.


function syn_port_gpio_read

Read the current logical state of a pin.

SYN_GPIO_State syn_port_gpio_read (
    SYN_GPIO_Pin pin
) 

Parameters:

  • pin Pin to read.

Returns:

SYN_GPIO_HIGH or SYN_GPIO_LOW.


function syn_port_gpio_toggle

Toggle the state of an output pin.

SYN_Status syn_port_gpio_toggle (
    SYN_GPIO_Pin pin
) 

Parameters:

  • pin Pin to toggle.

Returns:

SYN_OK on success.


function syn_port_gpio_write

Write a logical state to an output pin.

SYN_Status syn_port_gpio_write (
    SYN_GPIO_Pin pin,
    SYN_GPIO_State state
) 

Parameters:

  • pin Pin to write.
  • state SYN_GPIO_HIGH or SYN_GPIO_LOW.

Returns:

SYN_OK on success.



The documentation for this class was generated from the following file src/syntropic/port/syn_port_gpio.h