/*! \brief get GPIO pin output status \param[in] port \arg GPIOx(x = A,B,C,D,F) \param[in] pin \arg GPIO_PIN_x(x=0..15), GPIO_PIN_ALL \param[out] none \retval output state of gpio pin */ FlagStatus gpio_output_bit_get(uint32_t port, uint16_t pin) { if((uint32_t)RESET !=(GPIO_OCTL(port)&(pin))){ return SET; }else{ return RESET; } }
/*! \brief get GPIO pin output status \param[in] gpio_periph: GPIOx(x = A,B,C,F) only one parameter can be selected which is shown as below: \arg GPIOx(x = A,B,C,F) \param[in] pin: GPIO pin one or more parameters can be selected which are shown as below: \arg GPIO_PIN_x(x=0..15), GPIO_PIN_ALL \param[out] none \retval SET or RESET */ FlagStatus gpio_output_bit_get(uint32_t gpio_periph, uint32_t pin) { if((uint32_t)RESET != (GPIO_OCTL(gpio_periph)&(pin))){ return SET; }else{ return RESET; } }
/*! \brief get GPIO all pins output status \param[in] port \arg GPIOx(x = A,B,C,D,F) \param[out] none \retval output state of gpio all pins */ uint16_t gpio_output_port_get(uint32_t port) { return ((uint16_t)GPIO_OCTL(port)); }
/*! \brief write data to the specified GPIO port \param[in] port \arg GPIOx(x = A,B,C,D,F) \param[in] data \arg specify the value to be written to the port output data register \param[out] none \retval none */ void gpio_port_write(uint32_t port, uint16_t data) { GPIO_OCTL(port) = data; }
/*! \brief get GPIO all pins output status \param[in] gpio_periph: GPIOx(x = A,B,C,F) only one parameter can be selected which is shown as below: \arg GPIOx(x = A,B,C,F) \param[out] none \retval state of GPIO all pins */ uint16_t gpio_output_port_get(uint32_t gpio_periph) { return (uint16_t)GPIO_OCTL(gpio_periph); }
/*! \brief write data to the specified GPIO port \param[in] gpio_periph: GPIOx(x = A,B,C,F) only one parameter can be selected which is shown as below: \arg GPIOx(x = A,B,C,F) \param[in] data: specify the value to be written to the port output control register \param[out] none \retval none */ void gpio_port_write(uint32_t gpio_periph, uint16_t data) { GPIO_OCTL(gpio_periph) = (uint32_t)data; }