/* Trigger an output GPIO pin's output. Using this function on a gpio pin which is set to input mode is undefined. */
int32_t hal_gpio_output_toggle(gpio_dev_t *gpio)
/* Trigger an output GPIO pin's output. Using this function on a gpio pin which is set to input mode is undefined. */
int32_t hal_gpio_output_toggle(gpio_dev_t *gpio)
{
    uint8_t level = 0;
    level = hal_gpio_pin_get_val((enum HAL_GPIO_PIN_T)gpio->port);
    level ^= 1;
    hal_gpio_pin_set_dir((enum HAL_GPIO_PIN_T)gpio->port, HAL_GPIO_DIR_OUT, level);
	return 0;
}