Acrosser AR-ES6050FLD-W Manuel d'utilisateur Page 43

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 45
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 42
Revision: 1.0
3.7 API List and Descriptions
3.7.1 GPIO
1. Syntax:
Status_t getGpioCapability(uint32_t *pInputs, uint32_t *pOutput )
Description: This function shows the capability of each GPIO port that it is an output
port or an input port.
Parameters:
The returned value which is put at *pInput indicates whether the corresponding GPIO
ports are input ports or not. For example, say, the value at *pInput is 0x00000005, it
indicates that the ports GPIO0 and GPIO2 are both input ports.
The returned value which is put at *pOutput indicates whether the corresponding GPIO
ports are output ports or not. For example, say, the value at *pOutput is 0x000000FA, it
indicates that the ports GPIO7, GPIO6, GPIO5, GPIO4, GPIO3, GPIO1 are all output
ports. If the *pInput shows that a certain GPIO port is an input port and the *pOutput
shows that this port is an output port, this means this port can be configured as an input
port or an output port by invoking the ‘setGpioDirection( )’. If a certain GPIO port is
neither an input port nor an output port, this model does not enable this GPIO port.
Return Value: If the function gets the value successfully, it returns STATUS_SUCCESS,
any other returned value stands for error.
2. Syntax:
Status_t getGpioDirection( uint32_t Id, uint32_t *pDirection )
Description: Get the current state of GPIO input/output configuration.
Parameters:
The argument ‘Id’ has two formats of parameters. If ‘Id’ is ‘GPIO_ALL’, the returned
value at *pDirection shows the state of every GPIO port. A bit ‘1’ at the value of
*pDirection stands for an input port. A bit ‘0’ at the value of *pDirection stands for an
output port. For example, say, the *pDirection is 0x00000085, this indicates that the
ports GPIO7, GPIO2, GPIO0 are input ports. Other GPIO ports (if enabled) are output
ports. The other format of the argument ‘Id’ is that the ‘Id’ is ‘GPIO_ID0’ ~ ‘GPIO_ID32’.
For example, say, ‘Id’ is GPIO_ID2, the returned value of *pDirection is 0x1(input port)
or 0x0(output port).
Code Sample:
Case 1:
Status_t status;
uint32_t Direction;
status = getGpioDirection(GPIO_ALL, &Direction);
Case 2:
Status_t status;
43
Vue de la page 42
1 2 ... 38 39 40 41 42 43 44 45

Commentaires sur ces manuels

Pas de commentaire