hdo  beta
Datové struktry | Definice maker | Funkce
Dokumentace souboru /home/mrazik/Documents/web/old/hdo/at91lib/peripherals/pio/pio.h
#include <board.h>

Zobrazit zdrojový text tohoto souboru.

Datové struktry

struct  Pin

Definice maker

#define PIO_PERIPH_A   0
 The pin is controlled by the associated signal of peripheral A.
#define PIO_PERIPH_B   1
 The pin is controlled by the associated signal of peripheral B.
#define PIO_INPUT   2
 The pin is an input.
#define PIO_OUTPUT_0   3
 The pin is an output and has a default level of 0.
#define PIO_OUTPUT_1   4
 The pin is an output and has a default level of 1.
#define PIO_DEFAULT   (0 << 0)
 Default pin configuration (no attribute).
#define PIO_PULLUP   (1 << 0)
 The internal pin pull-up is active.
#define PIO_DEGLITCH   (1 << 1)
 The internal glitch filter is active.
#define PIO_OPENDRAIN   (1 << 2)
 The pin is open-drain.
#define PIO_LISTSIZE(pPins)   (sizeof(pPins) / sizeof(Pin))

Funkce

unsigned char PIO_Configure (const Pin *list, unsigned int size)
void PIO_Set (const Pin *pin)
void PIO_Clear (const Pin *pin)
unsigned char PIO_Get (const Pin *pin)
unsigned int PIO_GetISR (const Pin *pin)
unsigned char PIO_GetOutputDataStatus (const Pin *pin)

Detailní popis

Purpose

This file provides a basic API for PIO configuration and usage of user-controlled pins. Please refer to the board.h file for a list of available pin definitions.

Usage

  1. Define a constant pin description array such as the following one, using the existing definitions provided by the board.h file if possible:
           const Pin pPins[] = {PIN_USART0_TXD, PIN_USART0_RXD};
    
    Alternatively, it is possible to add new pins by provided the full Pin structure:
        // Pin instance to configure PA10 & PA11 as inputs with the internal
        // pull-up enabled.
        const Pin pPins = {
             (1 << 10) | (1 << 11),
             AT91C_BASE_PIOA,
             AT91C_ID_PIOA,
             PIO_INPUT,
             PIO_PULLUP
        };
    
  2. Configure a pin array by calling PIO_Configure() with a pointer to the array and its size (which is computed using the PIO_LISTSIZE macro).
  3. Change and get the value of a user-controlled pin using the PIO_Set, PIO_Clear and PIO_Get methods.
  4. Get the level being currently output by a user-controlled pin configured as an output using PIO_GetOutputDataStatus().

Definice v souboru pio.h.


Dokumentace k definicím maker

#define PIO_LISTSIZE (   pPins)    (sizeof(pPins) / sizeof(Pin))

Calculates the size of an array of Pin instances. The array must be defined locally (i.e. not a pointer), otherwise the computation will not be correct.

Parametry:
pPinsLocal array of Pin instances.
Návratová hodnota:
Number of elements in array.

Definice je uvedena na řádku 110 v souboru pio.h.

Používá se v main().


Dokumentace funkcí

void PIO_Clear ( const Pin pin)

Sets a low output level on all the PIOs defined in the given Pin instance. This has no immediate effects on PIOs that are not output, but the PIO controller will memorize the value they are changed to outputs.

Parametry:
pinPointer to a Pin instance describing one or more pins.

Definice je uvedena na řádku 280 v souboru pio.c.

Odkazuje se na Pin::mask a Pin::pio.

unsigned char PIO_Configure ( const Pin list,
unsigned int  size 
)

Configures a list of Pin instances, each of which can either hold a single pin or a group of pins, depending on the mask value; all pins are configured by this function. The size of the array must also be provided and is easily computed using PIO_LISTSIZE whenever its length is not known in advance.

Parametry:
listPointer to a list of Pin instances.
sizeSize of the Pin list (calculated using PIO_LISTSIZE).
Návratová hodnota:
1 if the pins have been configured properly; otherwise 0.

Definice je uvedena na řádku 217 v souboru pio.c.

Odkazuje se na Pin::attribute, Pin::id, Pin::mask, Pin::pio, PIO_DEGLITCH, PIO_INPUT, PIO_OPENDRAIN, PIO_OUTPUT_0, PIO_OUTPUT_1, PIO_PERIPH_A, PIO_PERIPH_B, PIO_PULLUP a Pin::type.

unsigned char PIO_Get ( const Pin pin)

Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0. This method returns the actual value that is being read on the pin. To return the supposed output value of a pin, use PIO_GetOutputDataStatus() instead.

Parametry:
pinPointer to a Pin instance describing one or more pins.
Návratová hodnota:
1 if the Pin instance contains at least one PIO that currently has a high level; otherwise 0.

Definice je uvedena na řádku 294 v souboru pio.c.

Odkazuje se na Pin::mask, Pin::pio, PIO_OUTPUT_0, PIO_OUTPUT_1 a Pin::type.

unsigned int PIO_GetISR ( const Pin pin)

Returns the value of ISR for the PIO controller of the pin. Reading this register acknoledges all the ITs.

Parametry:
pinPointer to a Pin instance describing one or more pins.

Definice je uvedena na řádku 342 v souboru pio.c.

Odkazuje se na Pin::pio.

unsigned char PIO_GetOutputDataStatus ( const Pin pin)

Returns 1 if one or more PIO of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead.

Parametry:
pinPointer to a Pin instance describing one or more pins.
Návratová hodnota:
1 if the Pin instance contains at least one PIO that is configured to output a high level; otherwise 0.

Definice je uvedena na řádku 325 v souboru pio.c.

Odkazuje se na Pin::mask a Pin::pio.

void PIO_Set ( const Pin pin)

Sets a high output level on all the PIOs defined in the given Pin instance. This has no immediate effects on PIOs that are not output, but the PIO controller will memorize the value they are changed to outputs.

Parametry:
pinPointer to a Pin instance describing one or more pins.

Definice je uvedena na řádku 269 v souboru pio.c.

Odkazuje se na Pin::mask a Pin::pio.