pixy Libari 2
Dependents: PES PES1 PES4 PES3
Pixy.h
- Committer:
- Shukle
- Date:
- 2017-04-19
- Revision:
- 2:b0a6783fb615
- Parent:
- 1:a57585d5e81b
File content as of revision 2:b0a6783fb615:
#ifndef PIXY_H #define PIXY_H #include "mbed.h" #include "PixyLinkI2C.h" struct Block { void print(Serial &pc) { pc.printf("sig: %d x: %d y: %d width: %d height: %d\n", signature, x, y, width, height); }; uint16_t signature; uint16_t x; uint16_t y; uint16_t width; uint16_t height; }; class Pixy { public: Pixy(PinName mosi_sda_tx, PinName miso_scl_rx); ~Pixy(); uint16_t getBlocks(uint16_t maxBlocks=1000); int8_t setServos(uint16_t s0, uint16_t s1); void setAddress(uint8_t addr); void setSerialOutput(Serial *pc); Block *blocks; private: static const uint8_t PIXY_INITIAL_ARRAYSIZE = 30; static const uint8_t PIXY_MAXIMUM_ARRAYSIZE = 130; static const uint16_t PIXY_START_WORD = 0xaa55; static const uint16_t PIXY_START_WORDX = 0x55aa; static const uint8_t PIXY_DEFAULT_ADDR = 0xAC; // I2C Adresse bool getStart(); void resize(); bool skipStart; uint16_t blockCount; uint16_t blockArraySize; PixyLink *m_link; Serial *pc; }; #endif //PIXY_H