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
Hardwares/CamRegBuf.h@32:5badeff825dc, 2017-03-02 (annotated)
- Committer:
- hazheng
- Date:
- Thu Mar 02 23:56:42 2017 +0000
- Revision:
- 32:5badeff825dc
- Parent:
- 30:ff7f83ad6369
- Child:
- 87:15fcf7891bf9
Successfully get the first picture from the camera and displayed on the computer screen.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 30:ff7f83ad6369 | 1 | #pragma once |
hazheng | 30:ff7f83ad6369 | 2 | #ifndef CAM_REG_BUF_H |
hazheng | 30:ff7f83ad6369 | 3 | #define CAM_REG_BUF_H |
hazheng | 30:ff7f83ad6369 | 4 | |
hazheng | 30:ff7f83ad6369 | 5 | #include <mbed.h> |
hazheng | 30:ff7f83ad6369 | 6 | |
hazheng | 30:ff7f83ad6369 | 7 | namespace SW |
hazheng | 30:ff7f83ad6369 | 8 | { |
hazheng | 30:ff7f83ad6369 | 9 | class Core; |
hazheng | 30:ff7f83ad6369 | 10 | } |
hazheng | 30:ff7f83ad6369 | 11 | |
hazheng | 30:ff7f83ad6369 | 12 | struct sensor_reg; |
hazheng | 30:ff7f83ad6369 | 13 | |
hazheng | 30:ff7f83ad6369 | 14 | class CamRegBuf |
hazheng | 30:ff7f83ad6369 | 15 | { |
hazheng | 30:ff7f83ad6369 | 16 | public: |
hazheng | 30:ff7f83ad6369 | 17 | CamRegBuf(SW::Core & core, uint8_t writeAddr, uint8_t readAddr); |
hazheng | 30:ff7f83ad6369 | 18 | |
hazheng | 30:ff7f83ad6369 | 19 | ~CamRegBuf(); |
hazheng | 30:ff7f83ad6369 | 20 | |
hazheng | 30:ff7f83ad6369 | 21 | //Blocking method. Do not use during the running state!! |
hazheng | 30:ff7f83ad6369 | 22 | void SCCBWrite(const uint8_t RegAddr, uint8_t Data); |
hazheng | 30:ff7f83ad6369 | 23 | |
hazheng | 30:ff7f83ad6369 | 24 | //Blocking method. Do not use during the running state!! |
hazheng | 30:ff7f83ad6369 | 25 | uint8_t SCCBRead(const uint8_t RegAddr); |
hazheng | 30:ff7f83ad6369 | 26 | |
hazheng | 32:5badeff825dc | 27 | //int32_t I2CBufferRead(int32_t ucDevAddr, uint8_t *ucBuffer, int32_t ulSize); |
hazheng | 32:5badeff825dc | 28 | |
hazheng | 32:5badeff825dc | 29 | //int32_t I2CBufferWrite(int32_t ucDevAddr, uint8_t *ucBuffer, int32_t ulSize); |
hazheng | 32:5badeff825dc | 30 | |
hazheng | 30:ff7f83ad6369 | 31 | //Blocking method. Do not use during the running state!! |
hazheng | 30:ff7f83ad6369 | 32 | void ReadRegisters(); |
hazheng | 30:ff7f83ad6369 | 33 | |
hazheng | 30:ff7f83ad6369 | 34 | //Blocking method. Do not use during the running state!! |
hazheng | 30:ff7f83ad6369 | 35 | void WriteRegSet(const struct sensor_reg * reglist); |
hazheng | 30:ff7f83ad6369 | 36 | |
hazheng | 30:ff7f83ad6369 | 37 | private: |
hazheng | 30:ff7f83ad6369 | 38 | uint8_t m_writeAddr; |
hazheng | 30:ff7f83ad6369 | 39 | |
hazheng | 30:ff7f83ad6369 | 40 | uint8_t m_readAddr; |
hazheng | 30:ff7f83ad6369 | 41 | |
hazheng | 30:ff7f83ad6369 | 42 | SW::Core & m_core; |
hazheng | 30:ff7f83ad6369 | 43 | |
hazheng | 30:ff7f83ad6369 | 44 | I2C m_sccbCtrl; |
hazheng | 30:ff7f83ad6369 | 45 | }; |
hazheng | 30:ff7f83ad6369 | 46 | |
hazheng | 30:ff7f83ad6369 | 47 | #endif //CAM_REG_BUF_H |