/* Retrieves the state of a gpio pin that is configured as an output. 
Reads the current logical output level of a gpio pin and returns the current level as a boolean value. */
bool gpio_pin_get_output_level(const uint8_t gpio_pin)
/* Retrieves the state of a gpio pin that is configured as an output. 
Reads the current logical output level of a gpio pin and returns the current level as a boolean value. */
bool gpio_pin_get_output_level(const uint8_t gpio_pin)
{
	uint32_t regval = 0;
	if (gpio_pin < 16) {
		regval = GPIO0->DATAOUT.reg;
		regval &= (1 << gpio_pin);
	} else if (gpio_pin < 32) {
		regval = GPIO1->DATAOUT.reg;
		regval &= (1 << (gpio_pin % 16));
	} else {
		regval = GPIO2->DATAOUT.reg;
		regval &= (1 << (gpio_pin % 16));
	}
	return regval;
}