![]() ![]() will be written/returned and the number of bytes to receive via your serial port (SPI, I2C or UART). You also need to write recv(), which takes a pointer to a data buffer where the received data It returns the number of bytes successfully sent.Įxtern uint8_t send(uint8_t *data, uint8_t len) bytes to send via your serial port (SPI, I2C or UART). You need to write send(), which takes a pointer to the data you want to send and the number of ![]() Here is some code that might help get you started:Ġxae, // first byte of no_checksum_sync (little endian -> least-significant byte first)Ġx0e, // this is the version request type Go ahead and code it up for your controller, paying special attention to how to initialize the communication interface on your platform, whether it's SPI, I2C or UART serial. The version request-response (above) is a simple way to test communication between your controller and Pixy2. Pixy2 will respond with the packet bytes below (or similar, depending on the hardware/firmware versions.) Response packets always have checksums so the receiver (your controller) can test data integrity:Ġxaf // first byte of checksum_sync (little endian -> least-significant byte first)Ġx0f // this is the version response typeĠx0d // first byte of data checksum (little endian -> least-significant byte first)Ġx00 // first byte of hardware version (little endian -> least-significant byte first)Ġx0a // first byte of firmware build number (little endian -> least-significant byte first)Ġx00 // second byte of firmware build numberĠ圆7 // byte 0 of firmware type ASCII stringĠ圆5 // byte 1 of firmware type ASCII stringĠ圆e // byte 2 of firmware type ASCII stringĠ圆5 // byte 3 of firmware type ASCII stringĠx72 // byte 4 of firmware type ASCII stringĠ圆1 // byte 5 of firmware type ASCII stringĠ圆c // byte 6 of firmware type ASCII stringĠx00 // byte 7 of firmware type ASCII stringĠx00 // byte 8 of firmware type ASCII stringĠx00 // byte 9 of firmware type ASCII string (Normally, request packets are sent without using checksums.):Ġxae // first byte of no_checksum_sync (little endian -> least-significant byte first) For example, here is a packet to request the hardware/firmware version data chunk. Communication with Pixy2 begins by sending a request packet.
0 Comments
Leave a Reply. |