Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of pixy by
Pixy.h
00001 #ifndef TUIASI_PIXY_H 00002 #define TUIASI_PIXY_H 00003 00004 #include "mbed.h" 00005 #include "PixyLinkSPI.h" 00006 #include "PixyLinkI2C.h" 00007 #include "PixyLinkUART.h" 00008 00009 struct Block { 00010 void print(Serial &pc) { 00011 pc.printf("sig: %d x: %d y: %d width: %d height: %d\n", signature, x, y, width, height); 00012 }; 00013 uint16_t signature; 00014 uint16_t x; 00015 uint16_t y; 00016 uint16_t width; 00017 uint16_t height; 00018 }; 00019 00020 class Pixy 00021 { 00022 public: 00023 enum LinkType {SPI, I2C, UART}; 00024 Pixy(LinkType linkType, PinName mosi_sda_tx, PinName miso_scl_rx, PinName sclk = NC); 00025 Pixy(PinName tx, PinName rx); 00026 ~Pixy(); 00027 uint16_t getBlocks(uint16_t maxBlocks=1000); 00028 int8_t setServos(uint16_t s0, uint16_t s1); 00029 void setAddress(uint8_t addr); 00030 void setSerialOutput(Serial *pc); 00031 00032 Block *blocks; 00033 00034 private: 00035 static const uint8_t PIXY_INITIAL_ARRAYSIZE = 30; 00036 static const uint8_t PIXY_MAXIMUM_ARRAYSIZE = 130; 00037 static const uint16_t PIXY_START_WORD = 0xaa55; 00038 static const uint16_t PIXY_START_WORDX = 0x55aa; 00039 static const uint8_t PIXY_DEFAULT_ADDR = 0x54; // I2C 00040 00041 bool getStart(); 00042 void resize(); 00043 00044 bool skipStart; 00045 uint16_t blockCount; 00046 uint16_t blockArraySize; 00047 00048 PixyLink *m_link; 00049 Serial *pc; 00050 }; 00051 #endif //TUIASI_PIXY_H
Generated on Sat Jul 16 2022 01:56:55 by
 1.7.2 
    