5 get gpio status – IBASE IBD185 User Manual

Page 12

Advertising
background image

12 IBD185 User Guide

1.3.5 Get GPIO Status

Read the GPIO pin group status of the MCU

The status of a GPIO pin is represented by a byte of bitmap that groups

8 pins status in one register. This status bitmap is only valid for output

pins. Therefore the retrieved status bitmap should be masked with the

pin configurations of this group.

Request

Header Size

Command

Data

CRC

0xFF

0xEE

0x00

GET_GPIO_STATUS

GPIO Group Index

The “GPIO Group Index” is count from 0 and can be calculated simply by

a formula: GPIO Group Index = (GPIO Pin Index/8)

Reply

Header Size

Command

Data CRC

0xFF

0xEE

Size of

GpioGrpStatus

structure

GET_GPIO_STATUS GpioGrpStatus

structure

Device reply a packet without “Data” field (“Size” is 0, none “Data”)

means fail. If the request performed successfully, device will reply a

packet with specific data structure. The format is listed below:

GpioGrpStatus Structure

Field Type

Description

Group Index

byte

Group Index

0x00 – 1st group index

0x01 – 2nd group index
……

0xFF – All of the groups

Group Status Array of

byte

Status bitmap of grouped pins

bit 0 .. bit 7 for each of the pin signal and the

bitmapping define is

listed below :

0[bit] – signal level Low (logic 0)

1[bit] – signal level High (logic 1)

Host can retrieve status of all GPIO pins by sending a request packet with

designating the field “Group Index” in “GpioGrpStatus” as 0xFF.

Device will reply a packet with all GPIO pins status in sequential bytes

array. The “Group Status[]” bytes array are in order of the GPIO group

index. Besides, the bit sequence in a “Group Status” byte is mapping to

the order of pin index in the same GPIO group.

Advertising