1 /*! 2 * \file gpio-board.h 3 * 4 * \brief Target board GPIO driver implementation 5 * 6 * \copyright Revised BSD License, see section \ref LICENSE. 7 * 8 * \code 9 * ______ _ 10 * / _____) _ | | 11 * ( (____ _____ ____ _| |_ _____ ____| |__ 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \ 13 * _____) ) ____| | | || |_| ____( (___| | | | 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_| 15 * (C)2013-2017 Semtech 16 * 17 * \endcode 18 * 19 * \author Miguel Luis ( Semtech ) 20 * 21 * \author Gregory Cristian ( Semtech ) 22 */ 23 #ifndef __GPIO_BOARD_H__ 24 #define __GPIO_BOARD_H__ 25 26 #ifdef __cplusplus 27 extern "C" 28 { 29 #endif 30 31 #include "gpio.h" 32 33 /*! 34 * \brief Initializes the given GPIO object 35 * 36 * \param [IN] obj Pointer to the GPIO object 37 * \param [IN] pin Pin name ( please look in pinName-board.h file ) 38 * \param [IN] mode Pin mode [PIN_INPUT, PIN_OUTPUT, 39 * PIN_ALTERNATE_FCT, PIN_ANALOGIC] 40 * \param [IN] config Pin config [PIN_PUSH_PULL, PIN_OPEN_DRAIN] 41 * \param [IN] type Pin type [PIN_NO_PULL, PIN_PULL_UP, PIN_PULL_DOWN] 42 * \param [IN] value Default output value at initialization 43 */ 44 void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, PinTypes type, uint32_t value ); 45 46 /*! 47 * \brief Sets a user defined object pointer 48 * 49 * \param [IN] context User defined data object pointer to pass back 50 * on IRQ handler callback 51 */ 52 void GpioMcuSetContext( Gpio_t *obj, void* context ); 53 54 /*! 55 * \brief GPIO IRQ Initialization 56 * 57 * \param [IN] obj Pointer to the GPIO object 58 * \param [IN] irqMode IRQ mode [NO_IRQ, IRQ_RISING_EDGE, 59 * IRQ_FALLING_EDGE, IRQ_RISING_FALLING_EDGE] 60 * \param [IN] irqPriority IRQ priority [IRQ_VERY_LOW_PRIORITY, IRQ_LOW_PRIORITY 61 * IRQ_MEDIUM_PRIORITY, IRQ_HIGH_PRIORITY 62 * IRQ_VERY_HIGH_PRIORITY] 63 * \param [IN] irqHandler Callback function pointer 64 */ 65 void GpioMcuSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler ); 66 67 /*! 68 * \brief Removes the interrupt from the object 69 * 70 * \param [IN] obj Pointer to the GPIO object 71 */ 72 void GpioMcuRemoveInterrupt( Gpio_t *obj ); 73 74 /*! 75 * \brief Writes the given value to the GPIO output 76 * 77 * \param [IN] obj Pointer to the GPIO object 78 * \param [IN] value New GPIO output value 79 */ 80 void GpioMcuWrite( Gpio_t *obj, uint32_t value ); 81 82 /*! 83 * \brief Toggle the value to the GPIO output 84 * 85 * \param [IN] obj Pointer to the GPIO object 86 */ 87 void GpioMcuToggle( Gpio_t *obj ); 88 89 /*! 90 * \brief Reads the current GPIO input value 91 * 92 * \param [IN] obj Pointer to the GPIO object 93 * \retval value Current GPIO input value 94 */ 95 uint32_t GpioMcuRead( Gpio_t *obj ); 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif // __GPIO_BOARD_H__ 102