Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Function

This section provides high level APIs to upper layer. More...

Overview

This section provides high level APIs to upper layer.

Functions

int mtk_os_hal_gpio_get_input (os_hal_gpio_pin pin, os_hal_gpio_data *pvalue)
 This function is used to get input data of the target GPIO. More...
 
int mtk_os_hal_gpio_set_output (os_hal_gpio_pin pin, os_hal_gpio_data out_val)
 This function is used to set output data of the target GPIO. More...
 
int mtk_os_hal_gpio_get_output (os_hal_gpio_pin pin, os_hal_gpio_data *pvalue)
 This function is used to get output data of the target GPIO. More...
 
int mtk_os_hal_gpio_set_direction (os_hal_gpio_pin pin, os_hal_gpio_direction dir)
 This function is used to set the direction of the target GPIO. More...
 
int mtk_os_hal_gpio_get_direction (os_hal_gpio_pin pin, os_hal_gpio_direction *pvalue)
 This function is used to get the direction of the target GPIO. More...
 
int mtk_os_hal_gpio_set_pullen_pullsel (os_hal_gpio_pin pin, bool enable, bool isup)
 This function is used to set the target GPIO to pull-up/pull-down state. More...
 

Function Documentation

int mtk_os_hal_gpio_get_input ( os_hal_gpio_pin  pin,
os_hal_gpio_data pvalue 
)

This function is used to get input data of the target GPIO.

Usage: OS-HAL driver should call it in GPIO get-input value function.

Parameters
[in]pin: Specifies the pin number to operate.(0~93)
[out]pvalue: Get DIN value and save it to address pvalue.
Returns
To indicate that whether this function call is successful or not.
If the return value is -EINVAL, it means that a wrong parameter(except for pin number) is given, and the parameter must be verified.
If the return value is -EPIN, it means that a wrong pin number is given, and the parameter must be verified.
If the return value is -ERROR, it means failure.
If the return value is 0, it means success.
int mtk_os_hal_gpio_set_output ( os_hal_gpio_pin  pin,
os_hal_gpio_data  out_val 
)

This function is used to set output data of the target GPIO.

Usage: OS-HAL driver should call it in GPIO set-output value function.

Parameters
[in]pin: Specifies the pin number to operate.(0~93)
[in]out_val: Represents output data of the target GPIO.
0, output low.
1, output high.
Returns
To indicate that whether this function call is successful or not.
If the return value is -EINVAL, it means that a wrong parameter(except for pin number) is given, and the parameter must be verified.
If the return value is -EPIN, it means that a wrong pin number is given, and the parameter must be verified.
If the return value is -ERROR, it means failure.
If the return value is 0, it means success.
int mtk_os_hal_gpio_get_output ( os_hal_gpio_pin  pin,
os_hal_gpio_data pvalue 
)

This function is used to get output data of the target GPIO.

Usage: OS-HAL driver should call it in GPIO get-output value function.

Parameters
[in]pin: Specifies the pin number to operate.(0~93)
[out]pvalue: Get DOUT value and save it to address pvalue
Returns
To indicate that whether this function call is successful or not.
If the return value is -EINVAL, it means that a wrong parameter(except for pin number) is given, and the parameter must be verified.
If the return value is -EPIN, it means that a wrong pin number is given, and the parameter must be verified.
If the return value is -ERROR, it means failure.
If the return value is 0, it means success.
int mtk_os_hal_gpio_set_direction ( os_hal_gpio_pin  pin,
os_hal_gpio_direction  dir 
)

This function is used to set the direction of the target GPIO.

Usage: OS-HAL driver should call it in GPIO set-direction function.

Parameters
[in]pin: Specifies the pin number to set.(0~93)
[in]dir: Specified the direction of target GPIO,
0, input.
1, output.
Returns
To indicate that whether this function call is successful or not.
If the return value is -EINVAL, it means that a wrong parameter(except for pin number) is given, and the parameter must be verified.
If the return value is -EPIN, it means that a wrong pin number is given, and the parameter must be verified.
If the return value is -ERROR, it means failure.
If the return value is 0, it means success.
int mtk_os_hal_gpio_get_direction ( os_hal_gpio_pin  pin,
os_hal_gpio_direction pvalue 
)

This function is used to get the direction of the target GPIO.

Usage: OS-HAL driver should call it in GPIO get-direction function.

Parameters
[in]pin: Specifies the pin number to operate.(0~93)
[out]pvalue: Get DIR value and save it to address pvalue
Returns
To indicate that whether this function call is successful or not.
If the return value is -EINVAL, it means that a wrong parameter(except for pin number) is given, and the parameter must be verified.
If the return value is -EPIN, it means that a wrong pin number is given, and the parameter must be verified.
If the return value is -ERROR, it means failure.
If the return value is 0, it means success.
int mtk_os_hal_gpio_set_pullen_pullsel ( os_hal_gpio_pin  pin,
bool  enable,
bool  isup 
)

This function is used to set the target GPIO to pull-up/pull-down state.

Usage: OS-HAL driver should call it when setting GPIO pull-up/pull-down state.

Parameters
[in]pin: Specifies the pin number to set.(0~93)
[in]enable: Specifies the pin pullen enable or disable. True means pullen enable; false means pullen disable.
[in]isup: Specifies the pin pullsel up or down. True means pullsel up; false means pullsel down.
Returns
To indicate that whether this function call is successful or not.
If the return value is -EINVAL, it means that a wrong parameter(except for pin number) is given, and the parameter must be verified.
If the return value is -EPIN, it means that a wrong pin number is given, and the parameter must be verified.
If the return value is -ERROR, it means failure.
If the return value is 0, it means success.