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.
Dependencies: mbed
Pixy.h@0:4a23b84b733e, 2017-05-17 (annotated)
- Committer:
- ZHAW_Prometheus
- Date:
- Wed May 17 13:08:18 2017 +0000
- Revision:
- 0:4a23b84b733e
PixyTest2 Vers. 17.05.2017
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| ZHAW_Prometheus | 0:4a23b84b733e | 1 | #ifndef TUIASI_PIXY_H | 
| ZHAW_Prometheus | 0:4a23b84b733e | 2 | #define TUIASI_PIXY_H | 
| ZHAW_Prometheus | 0:4a23b84b733e | 3 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 4 | #include "mbed.h" | 
| ZHAW_Prometheus | 0:4a23b84b733e | 5 | #include "PixyLinkSPI.h" | 
| ZHAW_Prometheus | 0:4a23b84b733e | 6 | #include "PixyLinkI2C.h" | 
| ZHAW_Prometheus | 0:4a23b84b733e | 7 | #include "PixyLinkUART.h" | 
| ZHAW_Prometheus | 0:4a23b84b733e | 8 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 9 | struct Block { | 
| ZHAW_Prometheus | 0:4a23b84b733e | 10 | void print(Serial &pc) { | 
| ZHAW_Prometheus | 0:4a23b84b733e | 11 | pc.printf("sig: %d x: %d y: %d width: %d height: %d\n", signature, x, y, width, height); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 12 | }; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 13 | uint16_t signature; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 14 | uint16_t x; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 15 | uint16_t y; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 16 | uint16_t width; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 17 | uint16_t height; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 18 | }; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 19 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 20 | class Pixy | 
| ZHAW_Prometheus | 0:4a23b84b733e | 21 | { | 
| ZHAW_Prometheus | 0:4a23b84b733e | 22 | public: | 
| ZHAW_Prometheus | 0:4a23b84b733e | 23 | enum LinkType {SPI, I2C, UART}; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 24 | Pixy(LinkType linkType, PinName mosi_sda_tx, PinName miso_scl_rx, PinName sclk = NC); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 25 | ~Pixy(); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 26 | uint16_t getBlocks(uint16_t maxBlocks=1000); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 27 | int8_t setServos(uint16_t s0, uint16_t s1); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 28 | void setAddress(uint8_t addr); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 29 | void setSerialOutput(Serial *pc); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 30 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 31 | Block *blocks; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 32 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 33 | private: | 
| ZHAW_Prometheus | 0:4a23b84b733e | 34 | static const uint8_t PIXY_INITIAL_ARRAYSIZE = 30; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 35 | static const uint8_t PIXY_MAXIMUM_ARRAYSIZE = 130; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 36 | static const uint16_t PIXY_START_WORD = 0xaa55; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 37 | static const uint16_t PIXY_START_WORDX = 0x55aa; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 38 | static const uint8_t PIXY_DEFAULT_ADDR = 0x54; // I2C | 
| ZHAW_Prometheus | 0:4a23b84b733e | 39 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 40 | bool getStart(); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 41 | void resize(); | 
| ZHAW_Prometheus | 0:4a23b84b733e | 42 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 43 | bool skipStart; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 44 | uint16_t blockCount; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 45 | uint16_t blockArraySize; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 46 | |
| ZHAW_Prometheus | 0:4a23b84b733e | 47 | PixyLink *m_link; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 48 | Serial *pc; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 49 | }; | 
| ZHAW_Prometheus | 0:4a23b84b733e | 50 | #endif //TUIASI_PIXY_H |