Changes between Version 1 and Version 2 of TBR/User/BenGras


Ignore:
Timestamp:
May 5, 2015, 11:48:09 AM (4 years ago)
Author:
Ben Gras
Comment:

tweaked gpio api

Legend:

Unmodified
Added
Removed
Modified
  • TBR/User/BenGras

    v1 v2  
    22
    33{{{#!c
    4 typedef gpio_pin; /* a configured GPIO pin handle */
     4/* a configured GPIO pin handle. this is filled in by rtems_gpio_configure_pin_*
     5 * and can then be passed to other api functions.
     6 */
     7struct struct gpio_pin_handle;
    58
    6 /* GPIO configuration of current device - describes how many banks, how many pins
    7  * in each bank, and capabilities of each pin (analog/discrete i/o & other configuration.)
     9/* fill in gpio_pin struct to use this pin in a digital out manner.
     10 * must be currently unused.
     11 * pin_number is a number that is interpreted by the BSP and will be defined
     12 * with device-specific names such as BBB_P9_33, indicating pin 33 on header P9
     13 * on the board.
     14 *
     15 * the gpio_pin struct is then filled in and can be passed to other functions.
    816 */
    9 typedef gpio_conf;
     17rtems_gpio_configure_pin_digital_out(&gpio_pin_handle, pin_number);
    1018
    11 /* retrieve number of gpio banks & pins per bank, possibly more info */
    12 rtems_gpio_get_config(&gpio_conf);
     19/* for a digital_out pin, set it to logical high */
     20rtems_gpio_digital_set(&gpio_pin_handle);
    1321
    14 /* fill in gpio_pin struct to use this pin. must be currently unused. */
    15 rtems_gpio_configure_pin(&gpio_pin, bank_number, pin_number, GPIO_DIGITAL_OUTPUT);
    16 
    17 /* for a GPIO_DIGITAL_OUTPUT pin, set it to logical high */
    18 rtems_gpio_digital_set(&gpio_pin);
    19 
    20 /* for a GPIO_DIGITAL_OUTPUT pin, set it to logical low */
    21 rtems_gpio_digital_clear(&gpio_pin);
     22/* for a digital_out pin, set it to logical low */
     23rtems_gpio_digital_clear(&gpio_pin_handle);
    2224
    2325/* a currently configured pin is to be released and made unused, allowing repurposing. */
    24 rtems_gpio_release_pin(&gpio_pin);
     26rtems_gpio_release_pin(&gpio_pin_handle);
    2527}}}