hdo
beta
|
#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) |
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
const Pin pPins[] = {PIN_USART0_TXD, PIN_USART0_RXD};
// 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 };
Definice v souboru pio.h.
#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.
pPins | Local array of Pin instances. |
Definice je uvedena na řádku 110 v souboru pio.h.
Používá se v main().
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.
pin | Pointer to a Pin instance describing one or more pins. |
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.
list | Pointer to a list of Pin instances. |
size | Size of the Pin list (calculated using PIO_LISTSIZE). |
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.
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.
pin | Pointer to a Pin instance describing one or more pins. |
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 | ) |
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.
pin | Pointer to a Pin instance describing one or more pins. |
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.
pin | Pointer to a Pin instance describing one or more pins. |