
fix Security breach found by Tencent Blade Team please refer to security advisory - CVE-2020-11068
108 lines
3.0 KiB
C
108 lines
3.0 KiB
C
/*!
|
|
* \file gpio-ioe.h
|
|
*
|
|
* \brief IO expander driver implementation (based on the sx1509)
|
|
*
|
|
* \copyright Revised BSD License, see section \ref LICENSE.
|
|
*
|
|
* \code
|
|
* ______ _
|
|
* / _____) _ | |
|
|
* ( (____ _____ ____ _| |_ _____ ____| |__
|
|
* \____ \| ___ | (_ _) ___ |/ ___) _ \
|
|
* _____) ) ____| | | || |_| ____( (___| | | |
|
|
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
|
|
* (C)2013-2017 Semtech
|
|
*
|
|
* \endcode
|
|
*
|
|
* \author Miguel Luis ( Semtech )
|
|
*
|
|
* \author Gregory Cristian ( Semtech )
|
|
*/
|
|
#ifndef __GPIO_IOE_H__
|
|
#define __GPIO_IOE_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include "gpio.h"
|
|
|
|
/*!
|
|
* \brief Initializes the given GPIO object
|
|
*
|
|
* \param [IN] obj Pointer to the GPIO object
|
|
* \param [IN] pin Pin name ( please look in pinName-board.h file )
|
|
* \param [IN] mode Pin mode [PIN_INPUT, PIN_OUTPUT,
|
|
* PIN_ALTERNATE_FCT, PIN_ANALOGIC]
|
|
* \param [IN] config Pin config [PIN_PUSH_PULL, PIN_OPEN_DRAIN]
|
|
* \param [IN] type Pin type [PIN_NO_PULL, PIN_PULL_UP, PIN_PULL_DOWN]
|
|
* \param [IN] value Default output value at initialization
|
|
*/
|
|
void GpioIoeInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, PinTypes type, uint32_t value );
|
|
|
|
/*!
|
|
* \brief Sets a user defined object pointer
|
|
*
|
|
* \param [IN] context User defined data object pointer to pass back
|
|
* on IRQ handler callback
|
|
*/
|
|
void GpioIoeSetContext( Gpio_t *obj, void* context );
|
|
|
|
/*!
|
|
* \brief GPIO IRQ Initialization
|
|
*
|
|
* \param [IN] obj Pointer to the GPIO object
|
|
* \param [IN] irqMode IRQ mode [NO_IRQ, IRQ_RISING_EDGE,
|
|
* IRQ_FALLING_EDGE, IRQ_RISING_FALLING_EDGE]
|
|
* \param [IN] irqPriority IRQ priority [IRQ_VERY_LOW_PRIORITY, IRQ_LOW_PRIORITY
|
|
* IRQ_MEDIUM_PRIORITY, IRQ_HIGH_PRIORITY
|
|
* IRQ_VERY_HIGH_PRIORITY]
|
|
* \param [IN] irqHandler Callback function pointer
|
|
*/
|
|
void GpioIoeSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler );
|
|
|
|
/*!
|
|
* \brief Removes the interrupt from the object
|
|
*
|
|
* \param [IN] obj Pointer to the GPIO object
|
|
*/
|
|
void GpioIoeRemoveInterrupt( Gpio_t *obj );
|
|
|
|
/*!
|
|
* \brief Writes the given value to the GPIO output
|
|
*
|
|
* \param [IN] obj Pointer to the GPIO object
|
|
* \param [IN] value New GPIO output value
|
|
*/
|
|
void GpioIoeWrite( Gpio_t *obj, uint32_t value );
|
|
|
|
/*!
|
|
* \brief Toggle the value to the GPIO output
|
|
*
|
|
* \param [IN] obj Pointer to the GPIO object
|
|
*/
|
|
void GpioIoeToggle( Gpio_t *obj );
|
|
|
|
/*!
|
|
* \brief Reads the current GPIO input value
|
|
*
|
|
* \param [IN] obj Pointer to the GPIO object
|
|
* \retval value Current GPIO input value
|
|
*/
|
|
uint32_t GpioIoeRead( Gpio_t *obj );
|
|
|
|
/*!
|
|
* \brief GpioIoeInterruptHandler callback function.
|
|
*/
|
|
void GpioIoeInterruptHandler( void );
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // __GPIO_IOE_H__
|