FRDM-IMX93 for NXP CUP
FRDM-IMX93 support for NXP CUP
 
Loading...
Searching...
No Matches
pixy2_protocol.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
17#ifndef _PIXY2_PROTOCOL_H_
18#define _PIXY2_PROTOCOL_H_
19
20#include "pixy2_transport.h"
21
33#define PIXY2_REQUEST_GET_VERSION 0xe
35#define PIXY2_REQUEST_SET_LED 0x14
37#define PIXY2_REQUEST_SET_LAMP 0x16
39#define PIXY2_REQUEST_GET_MAIN_FEATURES 0x30
40
56#define PIXY2_REPLY_GET_VERSION 0xf
58#define PIXY2_REPLY_SET_LED 0x1
60#define PIXY2_REPLY_SET_LAMP 0x1
62#define PIXY2_REPLY_GET_MAIN_FEATURES 0x31
64#define PIXY2_REPLY_ERROR 0x3
65
83#define PIXY2_OK 0
85#define PIXY2_ERROR -1
87#define PIXY2_BUSY -2
89#define PIXY2_CHECKSUM_ERROR -3
91#define PIXY2_TIMEOUT -4
93#define PIXY2_BUTTON_OVERRIDE -5
95#define PIXY2_PROG_CHANGING -6
96
109#define PIXY2_REQUEST_SYNC0_NO_CHECKSUM 0xae
111#define PIXY2_REQUEST_SYNC1_NO_CHECKSUM 0xc1
113#define PIXY2_REQUEST_SYNC0_CHECKSUM 0xaf
115#define PIXY2_REQUEST_SYNC1_CHECKSUM 0xc1
116
118#define PIXY2_REPLY_SYNC0 0xaf
120#define PIXY2_REPLY_SYNC1 0xc1
121
130#define PIXY2_REQUEST_SYNC0(checksum) \
131 ((checksum) ? \
132 PIXY2_REQUEST_SYNC0_CHECKSUM : PIXY2_REQUEST_SYNC0_NO_CHECKSUM)
133
142#define PIXY2_REQUEST_SYNC1(checksum) \
143 ((checksum) ? \
144 PIXY2_REQUEST_SYNC1_CHECKSUM : PIXY2_REQUEST_SYNC1_NO_CHECKSUM)
145
158int pixy2_to_errno(int32_t result);
159
175 struct pixy2_message *req,
176 struct pixy2_message *reply);
177
178#endif /* _PIXY2_PROTOCOL_H_ */
int pixy2_to_errno(int32_t result)
Convert a Pixy2 status code to errno-like code.
Definition pixy2_protocol.c:32
int pixy2_protocol_transceive(struct pixy2_transport *t, struct pixy2_message *req, struct pixy2_message *reply)
Send a request, wait for its reply and validate it.
Definition pixy2_protocol.c:54
Pixy2 transport layer API.
Definition pixy2_transport.h:66
Pixy2 transport layer structure.
Definition pixy2_transport.h:83