2 gpio pin use, 1 querying gpio pin status, At#gpio=<pin>,2<cr – Rainbow Electronics GE863-GPS low power User Manual

Page 81

Advertising
background image





GE863-GPS Software User Guide

1vv0300724 Rev. 3 - 05/07/07

Reproduction forbidden w ithout Telit Communications S.p.A. w ritten authorization - All Rights Reserved

page 81 of 122

In this case, the GPIO4 pin was successfully put in input direction.

3.6.2 GPIO pin use

After having set-up the GPIO pin direction you can query the input status of an INPUT pin or set the
output status of an OUTPUT pin.

3.6.2.1 Querying GPIO pin status

To query for the pin status:

Send command

AT#GPIO=<pin>,2<cr>

where:
<pin> is the GPIO pin number at which the command applies:

1 – GPIO1

10 – GPIO10

2 – GPIO2

11 – GPIO11

3 – GPIO3

12 – GPIO12

4 – GPIO4

13 – GPIO13

5 – GPIO5

14 – GPIO14

6 – GPIO6

15 – GPIO15

7 – GPIO7

16 – GPIO16

8 – GPIO8

17 – GPIO17

9 – GPIO9

18 – GPIO18

wait for response in the format:

#GPIO: <dir>,<stat>
OK

where:

<dir> - GPIO<pin> direction setting
<stat> - status of the pin
0 - LOW
1 - HIGH

NOTE: In case the GPIO pin direction is set to ALTERNATE FUNCTION (2), then the reported
<stat> has no meaning and shall not kept as valid, but shall be threaten as a dummy value.

TIP: The query reports depending on the pin direction:

-

the read pin status in case the direction is input;

-

the previously set pin status in case the direction is output.

In any case, you can know if the pin at the query moment is high or low and the pin direction.

For example:
1- Let's assume you want to query the GPIO3 pin for its status:
command:

Advertising