Version 1 (modified by Ben Gras, on 04/26/15 at 11:23:01) (diff) |
---|
Basic GPIO API just covering GPIO_DIGITAL_OUTPUT.
typedef gpio_pin; /* a configured GPIO pin handle */ /* GPIO configuration of current device - describes how many banks, how many pins * in each bank, and capabilities of each pin (analog/discrete i/o & other configuration.) */ typedef gpio_conf; /* retrieve number of gpio banks & pins per bank, possibly more info */ rtems_gpio_get_config(&gpio_conf); /* fill in gpio_pin struct to use this pin. must be currently unused. */ rtems_gpio_configure_pin(&gpio_pin, bank_number, pin_number, GPIO_DIGITAL_OUTPUT); /* for a GPIO_DIGITAL_OUTPUT pin, set it to logical high */ rtems_gpio_digital_set(&gpio_pin); /* for a GPIO_DIGITAL_OUTPUT pin, set it to logical low */ rtems_gpio_digital_clear(&gpio_pin); /* a currently configured pin is to be released and made unused, allowing repurposing. */ rtems_gpio_release_pin(&gpio_pin);