SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
RemovedSources/OV7725RegBuf.h.txt@36:7e747e19f660, 2017-03-14 (annotated)
- Committer:
- hazheng
- Date:
- Tue Mar 14 22:23:15 2017 +0000
- Revision:
- 36:7e747e19f660
- Parent:
- Hardwares/OV7725RegBuf.h@31:f29f71336710
Removed trash codes. Made it easier to switch different camera.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 31:f29f71336710 | 1 | #pragma once |
hazheng | 31:f29f71336710 | 2 | #ifndef OV7725_REG_BUF_H |
hazheng | 31:f29f71336710 | 3 | #define OV7725_REG_BUF_H |
hazheng | 31:f29f71336710 | 4 | |
hazheng | 31:f29f71336710 | 5 | #include <mbed.h> |
hazheng | 31:f29f71336710 | 6 | #include "OV7725RegAddr.h" |
hazheng | 31:f29f71336710 | 7 | |
hazheng | 31:f29f71336710 | 8 | #define WRITE_DEFAULT_REG_ON |
hazheng | 31:f29f71336710 | 9 | #define WRITE_ORIGIN_REG_ON |
hazheng | 31:f29f71336710 | 10 | |
hazheng | 31:f29f71336710 | 11 | namespace SW |
hazheng | 31:f29f71336710 | 12 | { |
hazheng | 31:f29f71336710 | 13 | class Core; |
hazheng | 31:f29f71336710 | 14 | } |
hazheng | 31:f29f71336710 | 15 | |
hazheng | 31:f29f71336710 | 16 | class OV7725RegBuf |
hazheng | 31:f29f71336710 | 17 | { |
hazheng | 31:f29f71336710 | 18 | public: |
hazheng | 31:f29f71336710 | 19 | OV7725RegBuf(SW::Core & core); |
hazheng | 31:f29f71336710 | 20 | |
hazheng | 31:f29f71336710 | 21 | ~OV7725RegBuf(); |
hazheng | 31:f29f71336710 | 22 | |
hazheng | 31:f29f71336710 | 23 | uint8_t * GetData(); |
hazheng | 31:f29f71336710 | 24 | |
hazheng | 31:f29f71336710 | 25 | static bool IsAddressReserved(const uint8_t addr); |
hazheng | 31:f29f71336710 | 26 | |
hazheng | 31:f29f71336710 | 27 | //Blocking method. Do not use during the running state!! |
hazheng | 31:f29f71336710 | 28 | void SCCBWrite(const uint8_t RegAddr, uint8_t Data); |
hazheng | 31:f29f71336710 | 29 | |
hazheng | 31:f29f71336710 | 30 | //Blocking method. Do not use during the running state!! |
hazheng | 31:f29f71336710 | 31 | uint8_t SCCBRead(const uint8_t RegAddr); |
hazheng | 31:f29f71336710 | 32 | |
hazheng | 31:f29f71336710 | 33 | //Blocking method. Do not use during the running state!! |
hazheng | 31:f29f71336710 | 34 | void ReadRegisters(); |
hazheng | 31:f29f71336710 | 35 | |
hazheng | 31:f29f71336710 | 36 | #ifdef WRITE_DEFAULT_REG_ON |
hazheng | 31:f29f71336710 | 37 | void WriteDefaultRegisters(); |
hazheng | 31:f29f71336710 | 38 | #endif |
hazheng | 31:f29f71336710 | 39 | |
hazheng | 31:f29f71336710 | 40 | #ifdef WRITE_ORIGIN_REG_ON |
hazheng | 31:f29f71336710 | 41 | void WriteOriginalRegisters(); |
hazheng | 31:f29f71336710 | 42 | #endif |
hazheng | 31:f29f71336710 | 43 | |
hazheng | 31:f29f71336710 | 44 | private: |
hazheng | 31:f29f71336710 | 45 | uint8_t * m_data; |
hazheng | 31:f29f71336710 | 46 | |
hazheng | 31:f29f71336710 | 47 | SW::Core & m_core; |
hazheng | 31:f29f71336710 | 48 | |
hazheng | 31:f29f71336710 | 49 | I2C m_sccbCtrl; |
hazheng | 31:f29f71336710 | 50 | }; |
hazheng | 31:f29f71336710 | 51 | |
hazheng | 31:f29f71336710 | 52 | #endif //OV7725_REG_BUF_H |