mirror of
https://github.com/espressif/openthread.git
synced 2026-09-12 04:00:10 +00:00
[diag] add gpio mode commands (#8391)
This commit adds diag commands for setting the GPIO mode to resolve the conflict https://github.com/openthread/openthread/issues/8362.
This commit is contained in:
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (261)
|
||||
#define OPENTHREAD_API_VERSION (262)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -56,6 +56,16 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This enumeration defines the gpio modes.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OT_GPIO_MODE_INPUT = 0, ///< Input mode without pull resistor.
|
||||
OT_GPIO_MODE_OUTPUT = 1, ///< Output mode.
|
||||
} otGpioMode;
|
||||
|
||||
/**
|
||||
* This function processes a factory diagnostics command line.
|
||||
*
|
||||
@@ -155,6 +165,34 @@ otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue);
|
||||
*/
|
||||
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue);
|
||||
|
||||
/**
|
||||
* This function sets the gpio mode.
|
||||
*
|
||||
* @param[in] aGpio The gpio number.
|
||||
* @param[out] aMode The gpio mode.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the gpio mode.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on the platform.
|
||||
*
|
||||
*/
|
||||
otError otPlatDiagGpioSetMode(uint32_t aGpio, otGpioMode aMode);
|
||||
|
||||
/**
|
||||
* This function gets the gpio mode.
|
||||
*
|
||||
* @param[in] aGpio The gpio number.
|
||||
* @param[out] aValue A pointer where to put gpio value.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully got the gpio value.
|
||||
* @retval OT_ERROR_FAILED The gpio is neither in input nor output mode. For example, if the gpio is in
|
||||
* analog mode.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported or @p aMode is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on the platform.
|
||||
*
|
||||
*/
|
||||
otError otPlatDiagGpioGetMode(uint32_t aGpio, otGpioMode *aMode);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user