FRDM-IMX93 for NXP CUP
FRDM-IMX93 support for NXP CUP
 
Loading...
Searching...
No Matches
pixy2_command.h File Reference

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.
 

Detailed Description

Pixy2 command API.

This file offers some utility macros and implementation of various commands documented in 1.

Macro Definition Documentation

◆ PIXY2_REPLY

#define PIXY2_REPLY (   l,
  p,
 
)
Value:
{ \
.hdr.sync0 = PIXY2_REPLY_SYNC0, \
.hdr.sync1 = PIXY2_REPLY_SYNC1, \
.hdr.len = l, \
.hdr.checksum = c, \
.payload = (uint8_t *)p, \
}
#define PIXY2_REPLY_SYNC1
Definition pixy2_protocol.h:120
#define PIXY2_REPLY_SYNC0
Definition pixy2_protocol.h:118

Prepare a Pixy2 reply message.

Use this to create a pixy2_message structure required for receiving a reply from the Pixy2 camera.

Parameters
lexpected reply payload length
paddress to use for storing the payload data
cboolean indicating if checksum should be performed or not
Return values
newlycreated pixy2_message structure

◆ PIXY2_REQUEST

#define PIXY2_REQUEST (   t,
  l,
  p,
 
)
Value:
{ \
.hdr.sync0 = PIXY2_REQUEST_SYNC0(c), \
.hdr.sync1 = PIXY2_REQUEST_SYNC1(c), \
.hdr.type = t, \
.hdr.len = l, \
.checksum = c, \
.payload = (uint8_t *)p, \
}
#define PIXY2_REQUEST_SYNC0(checksum)
Get the value of SYNC0 based on checksum being enabled or not.
Definition pixy2_protocol.h:130
#define PIXY2_REQUEST_SYNC1(checksum)
Get the value of SYNC1 based on checksum being enabled or not.
Definition pixy2_protocol.h:142

Prepare a Pixy2 request message.

Use this to create a pixy2_message structure required for sending a request to the Pixy2 camera.

Parameters
trequest type - one of Pixy2RequestTypes
lrequest payload length
ppointer to payload data
cboolean indicating if checksum should be performed or not
Return values
newlycreated pixy2_message structure

Function Documentation

◆ pixy2_print_version()

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.

Parameters
tpointer to the generic transport layer data
Return values
0if success
negativeerrno code if error

◆ pixy2_set_lamp()

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).

Parameters
tpointer to the generic transport layer data
lamppointer to the setLamp command arguments
Return values
0if success
negativeerrno code if error

◆ pixy2_set_led()

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).

Parameters
tpointer to the generic transport layer data
ledpointer to the setLED command arguments
Return values
0if success
negativeerrno code if error