You are here

GPIO_EV_CMP (0x84)

The GPIO_EV_CMP event can be generated for either of the comparators. The event can be sent:

  • when the comparison results change;

  • periodically with the predefined repeat interval.

For more detailed information see Section 8.3, “Comparator module event”.

Byte 0 GPIO_EV_CMP Event ID (0x84).
Byte 1 CNT CNT byte value is incremented each time after the event arises.
Byte 2 CMP0_OUT Result of comparison for CMP0 comparator.
Byte 3 CMP1_OUT Result of comparison for CMP1 comparator.
Byte 4 EVENT_COND0 Condition of sending the event for CMP0 comparator.
Byte 5 EVENT_COND1 Condition of sending the event for CMP1 comparator.
Byte 6..7 Reserved Reserved

Event is an 8-byte array of the following format:

Byte 0: GPIO_EV_CMP (0x84)

Event ID (event type). This byte will contain 0x84.

Byte 1: CNT

CNT byte value is incremented each time after the GPIO_EV_CMP event arises.

Byte 2: CMP0_OUT

The result of comparison for CMP0 comparator. This byte contains valid data only if Byte 4: EVENT_COND0 is not GPIO_CMP_EV_NONE (0x00).

The comparator output can be inverted with Bit 5: CMP0_INV in Byte 2: CMP_CFG of GPIO_SET_CMP_CFG command.

If CMP0_INV = 0:

  • 0, if VIN+ < VIN-;

  • 1, if VIN+ > VIN-.

If CMP0_INV = 1:

  • 0, if VIN+ > VIN-;

  • 1, if VIN+ < VIN-.

Byte 3: CMP1_OUT

The result of comparison for CMP1 comparator. This byte contains valid data only if Byte 5: EVENT_COND1 is not GPIO_CMP_EV_NONE (0x00).

The comparator output can be inverted with Bit 4: CMP1_INV in Byte 2: CMP_CFG of GPIO_SET_CMP_CFG command.

If CMP1_INV = 0:

  • 0, if VIN+ > VIN-;

  • 1, if VIN+ < VIN-.

If CMP1_INV = 1:

  • 0, if VIN+ < VIN-;

  • 1, if VIN+ > VIN-.

Byte 4: EVENT_COND0

This byte contains the current event for CMP0 comparator. The following events are possible:

GPIO_CMP_EV_NONE (0x00)

The CMP0 comparator has not taken part in generation of the event. Data, stored in Byte 2: CMP0_OUT, is not valid.

GPIO_CMP_EV_CHANGE (0x01)

The event is sent because CMP0 comparator output value has changed.

GPIO_CMP_EV_ALWAYS (0x02)

The event is sent periodically with the predefined repeat interval.

Byte 5: EVENT_COND1

This byte contains current event for CMP1 comparator. The following events are possible:

GPIO_CMP_EV_NONE (0x00)

The CMP1 comparator has not taken part in generation of the event. Data, stored in Byte 3: CMP1_OUT, is not valid.

GPIO_CMP_EV_CHANGE (0x01)

The event is sent because CMP1 comparator output value has changed.

GPIO_CMP_EV_ALWAYS (0x02)

The event is sent periodically with the predefined repeat interval.

Bytes 6..7: Reserved

These bytes are reserved for future usage.

For convenience GPIO_EV_CMP structure is declared in reports.h file.