Skip to content

Commit 7165b6a

Browse files
committed
sendPinStateQuery
1 parent bf3f08f commit 7165b6a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

FirmataMarshaller.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,19 @@ const
256256
FirmataStream->write(config);
257257
}
258258

259+
/**
260+
* Send a pin state query to the Firmata host application. The resulting sysex message will have
261+
* a PIN_STATE_RESPONSE command byte, followed by the pin number, the pin mode and a stream of
262+
* bits to indicate any *data* written to the pin (pin state).
263+
* @param pin The pin to query
264+
* @note The pin state is any data written to the pin (i.e. pin state != pin value)
265+
*/
266+
void FirmataMarshaller::sendPinStateQuery(uint8_t pin)
267+
const
268+
{
269+
sendSysex(PIN_STATE_QUERY, 1, &pin);
270+
}
271+
259272
/**
260273
* Send a sysex message where all values after the command byte are packet as 2 7-bit bytes
261274
* (this is not always the case so this function is not always used to send sysex messages).

FirmataMarshaller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class FirmataMarshaller
4949
void sendDigital(uint8_t pin, uint8_t value) const;
5050
void sendDigitalPort(uint8_t portNumber, uint16_t portData) const;
5151
void sendPinMode(uint8_t pin, uint8_t config) const;
52+
void sendPinStateQuery(uint8_t pin) const;
5253
void sendString(const char *string) const;
5354
void sendSysex(uint8_t command, size_t bytec, uint8_t *bytev) const;
5455

0 commit comments

Comments
 (0)