Pixy2 command API. More...
#include "pixy2_protocol.h"
Go to the source code of this file.
Classes | |
struct | pixy2_led |
Pixy2 setLED() command arguments. More... | |
struct | pixy2_lamp |
Pixy2 setLamp() command arguments. More... | |
Macros | |
#define | PIXY2_REQUEST(t, l, p, c) |
Prepare a Pixy2 request message. | |
#define | PIXY2_REPLY(l, p, c) |
Prepare a Pixy2 reply message. | |
Functions | |
int | pixy2_print_version (struct pixy2_transport *t) |
Print firmware and hardware information. | |
int | pixy2_set_led (struct pixy2_transport *t, struct pixy2_led *led) |
Send the setLED command. | |
int | pixy2_set_lamp (struct pixy2_transport *t, struct pixy2_lamp *lamp) |
Send the setLamp command. | |
Pixy2 command API.
This file offers some utility macros and implementation of various commands documented in 1.
#define PIXY2_REPLY | ( | l, | |
p, | |||
c | |||
) |
Prepare a Pixy2 reply message.
Use this to create a pixy2_message structure required for receiving a reply from the Pixy2 camera.
l | expected reply payload length |
p | address to use for storing the payload data |
c | boolean indicating if checksum should be performed or not |
newly | created pixy2_message structure |
#define PIXY2_REQUEST | ( | t, | |
l, | |||
p, | |||
c | |||
) |
Prepare a Pixy2 request message.
Use this to create a pixy2_message structure required for sending a request to the Pixy2 camera.
t | request type - one of Pixy2RequestTypes |
l | request payload length |
p | pointer to payload data |
c | boolean indicating if checksum should be performed or not |
newly | created pixy2_message structure |
int pixy2_print_version | ( | struct pixy2_transport * | t | ) |
Print firmware and hardware information.
Use this to print the firmware and hardware version of the Pixy2 camera.
t | pointer to the generic transport layer data |
0 | if success |
negative | errno code if error |
int pixy2_set_lamp | ( | struct pixy2_transport * | t, |
struct pixy2_lamp * | lamp | ||
) |
Send the setLamp command.
Use this to toggle the upper/lower LEDs (via the setLamp() command).
t | pointer to the generic transport layer data |
lamp | pointer to the setLamp command arguments |
0 | if success |
negative | errno code if error |
int pixy2_set_led | ( | struct pixy2_transport * | t, |
struct pixy2_led * | led | ||
) |
Send the setLED command.
Use this to configure the RGB LED (via the setLED() command).
t | pointer to the generic transport layer data |
led | pointer to the setLED command arguments |
0 | if success |
negative | errno code if error |