高木のpixy2
Dependents: 00_yotsuba 10_motor-test 00_yotsuba 200_yotsuba_21
camera.h@1:91c45dda6be1, 2021-03-04 (annotated)
- Committer:
- THtakahiro702286
- Date:
- Thu Mar 04 14:20:55 2021 +0000
- Revision:
- 1:91c45dda6be1
- Parent:
- 0:12ef615ee47f
out raw
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
THtakahiro702286 | 0:12ef615ee47f | 1 | #ifndef CAMERA_H |
THtakahiro702286 | 0:12ef615ee47f | 2 | #define CAMERA_H |
THtakahiro702286 | 0:12ef615ee47f | 3 | |
THtakahiro702286 | 0:12ef615ee47f | 4 | #include "mbed.h" |
THtakahiro702286 | 0:12ef615ee47f | 5 | #include "lpf.h" |
THtakahiro702286 | 0:12ef615ee47f | 6 | |
THtakahiro702286 | 0:12ef615ee47f | 7 | class Cam |
THtakahiro702286 | 0:12ef615ee47f | 8 | { |
THtakahiro702286 | 0:12ef615ee47f | 9 | public: |
THtakahiro702286 | 0:12ef615ee47f | 10 | Cam(PinName mosi_sda_tx, PinName miso_scl_rx, PinName sclk); |
THtakahiro702286 | 0:12ef615ee47f | 11 | void SPIloop(); |
THtakahiro702286 | 0:12ef615ee47f | 12 | |
THtakahiro702286 | 0:12ef615ee47f | 13 | uint16_t ballX(); |
THtakahiro702286 | 0:12ef615ee47f | 14 | uint16_t ballY(); |
THtakahiro702286 | 0:12ef615ee47f | 15 | uint16_t ballWidth(); |
THtakahiro702286 | 0:12ef615ee47f | 16 | uint16_t ballHeight(); |
THtakahiro702286 | 0:12ef615ee47f | 17 | |
THtakahiro702286 | 0:12ef615ee47f | 18 | uint16_t blueX(); |
THtakahiro702286 | 0:12ef615ee47f | 19 | uint16_t blueY(); |
THtakahiro702286 | 0:12ef615ee47f | 20 | uint16_t blueWidth(); |
THtakahiro702286 | 0:12ef615ee47f | 21 | uint16_t blueHeight(); |
THtakahiro702286 | 0:12ef615ee47f | 22 | |
THtakahiro702286 | 0:12ef615ee47f | 23 | uint16_t yellowX(); |
THtakahiro702286 | 0:12ef615ee47f | 24 | uint16_t yellowY(); |
THtakahiro702286 | 0:12ef615ee47f | 25 | uint16_t yellowWidth(); |
THtakahiro702286 | 0:12ef615ee47f | 26 | uint16_t yellowHeight(); |
THtakahiro702286 | 0:12ef615ee47f | 27 | |
THtakahiro702286 | 0:12ef615ee47f | 28 | uint16_t getData(int i); |
THtakahiro702286 | 1:91c45dda6be1 | 29 | // uint16_t rawBallCenterX(); |
THtakahiro702286 | 1:91c45dda6be1 | 30 | // uint16_t rawBallCenterY(); |
THtakahiro702286 | 1:91c45dda6be1 | 31 | // uint16_t rawBallWidth(); |
THtakahiro702286 | 1:91c45dda6be1 | 32 | // uint16_t rawBallHeight(); |
THtakahiro702286 | 1:91c45dda6be1 | 33 | // uint16_t rawBlueCenterX(); |
THtakahiro702286 | 1:91c45dda6be1 | 34 | // uint16_t rawBlueCenterY(); |
THtakahiro702286 | 1:91c45dda6be1 | 35 | // uint16_t rawBlueWidth(); |
THtakahiro702286 | 1:91c45dda6be1 | 36 | // uint16_t rawBlueHeight(); |
THtakahiro702286 | 1:91c45dda6be1 | 37 | // uint16_t rawYellowCenterX(); |
THtakahiro702286 | 1:91c45dda6be1 | 38 | // uint16_t rawYellowCenterY(); |
THtakahiro702286 | 1:91c45dda6be1 | 39 | // uint16_t rawYellowWidth(); |
THtakahiro702286 | 1:91c45dda6be1 | 40 | // uint16_t rawYellowHeight(); |
THtakahiro702286 | 0:12ef615ee47f | 41 | |
THtakahiro702286 | 0:12ef615ee47f | 42 | bool ballSignal(); |
THtakahiro702286 | 0:12ef615ee47f | 43 | bool blueSignal(); |
THtakahiro702286 | 0:12ef615ee47f | 44 | bool yellowSignal(); |
THtakahiro702286 | 0:12ef615ee47f | 45 | |
THtakahiro702286 | 0:12ef615ee47f | 46 | uint8_t pixydata[14+42]; |
THtakahiro702286 | 0:12ef615ee47f | 47 | private: |
THtakahiro702286 | 0:12ef615ee47f | 48 | SPI spi; |
THtakahiro702286 | 0:12ef615ee47f | 49 | Thread thread; |
THtakahiro702286 | 0:12ef615ee47f | 50 | uint8_t sendData[6]; |
THtakahiro702286 | 0:12ef615ee47f | 51 | uint16_t data[24]; |
THtakahiro702286 | 0:12ef615ee47f | 52 | uint16_t ballData[7]; |
THtakahiro702286 | 0:12ef615ee47f | 53 | uint16_t blueData[7]; |
THtakahiro702286 | 0:12ef615ee47f | 54 | uint16_t yellowData[7]; |
THtakahiro702286 | 0:12ef615ee47f | 55 | bool ballSig,blueSig,yellowSig; |
THtakahiro702286 | 0:12ef615ee47f | 56 | lpf *ball[4],*blue[4],*yellow[4]; |
THtakahiro702286 | 0:12ef615ee47f | 57 | }; |
THtakahiro702286 | 0:12ef615ee47f | 58 | #endif |