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 haofan Zheng

Committer:
hazheng
Date:
Thu Apr 20 21:04:10 2017 +0000
Revision:
100:ffbeefc9e218
Parent:
92:e9bd429f16b5
Better version of Intersection detection.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hazheng 92:e9bd429f16b5 1 /**
hazheng 92:e9bd429f16b5 2 * @file CamRegBuf.h
hazheng 92:e9bd429f16b5 3 * @brief The header file for the camera register buffer class.
hazheng 92:e9bd429f16b5 4 * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu>
hazheng 92:e9bd429f16b5 5 *
hazheng 92:e9bd429f16b5 6 */
hazheng 30:ff7f83ad6369 7 #pragma once
hazheng 30:ff7f83ad6369 8 #ifndef CAM_REG_BUF_H
hazheng 30:ff7f83ad6369 9 #define CAM_REG_BUF_H
hazheng 30:ff7f83ad6369 10
hazheng 30:ff7f83ad6369 11 #include <mbed.h>
hazheng 30:ff7f83ad6369 12
hazheng 30:ff7f83ad6369 13 struct sensor_reg;
hazheng 30:ff7f83ad6369 14
hazheng 92:e9bd429f16b5 15 /**
hazheng 92:e9bd429f16b5 16 * @class CamRegBuf
hazheng 92:e9bd429f16b5 17 * @brief The camera register buffer class. This class is used to load the register program to the camera (slave device) register through the SCCB control. And it can also just write/read a single byte to/from a specific register.
hazheng 92:e9bd429f16b5 18 */
hazheng 30:ff7f83ad6369 19 class CamRegBuf
hazheng 30:ff7f83ad6369 20 {
hazheng 30:ff7f83ad6369 21 public:
hazheng 92:e9bd429f16b5 22 /**
hazheng 92:e9bd429f16b5 23 * @brief The constructor for the CamRegBuf class.
hazheng 92:e9bd429f16b5 24 * @param writeAddr The write address for the slave device.
hazheng 92:e9bd429f16b5 25 * @param readAddr The read address for the slave device.
hazheng 92:e9bd429f16b5 26 */
hazheng 87:15fcf7891bf9 27 CamRegBuf(uint8_t writeAddr, uint8_t readAddr);
hazheng 30:ff7f83ad6369 28
hazheng 92:e9bd429f16b5 29 /**
hazheng 92:e9bd429f16b5 30 * @brief The destructor for the CamRegBuf class.
hazheng 92:e9bd429f16b5 31 */
hazheng 30:ff7f83ad6369 32 ~CamRegBuf();
hazheng 30:ff7f83ad6369 33
hazheng 92:e9bd429f16b5 34 /**
hazheng 92:e9bd429f16b5 35 * @brief The method that used to write a single byte to a specific register. NOTE: It is a Blocking method. Do not use during the running state!!
hazheng 92:e9bd429f16b5 36 * @param RegAddr The register address.
hazheng 92:e9bd429f16b5 37 * @param Data The byte that needs to write.
hazheng 92:e9bd429f16b5 38 */
hazheng 30:ff7f83ad6369 39 void SCCBWrite(const uint8_t RegAddr, uint8_t Data);
hazheng 30:ff7f83ad6369 40
hazheng 92:e9bd429f16b5 41 /**
hazheng 92:e9bd429f16b5 42 * @brief The method that used to read a single byte from a specific register. NOTE: It is a Blocking method. Do not use during the running state!!
hazheng 92:e9bd429f16b5 43 * @param RegAddr The register address.
hazheng 92:e9bd429f16b5 44 * @return The byte that read from the register.
hazheng 92:e9bd429f16b5 45 */
hazheng 30:ff7f83ad6369 46 uint8_t SCCBRead(const uint8_t RegAddr);
hazheng 30:ff7f83ad6369 47
hazheng 32:5badeff825dc 48 //int32_t I2CBufferRead(int32_t ucDevAddr, uint8_t *ucBuffer, int32_t ulSize);
hazheng 32:5badeff825dc 49
hazheng 32:5badeff825dc 50 //int32_t I2CBufferWrite(int32_t ucDevAddr, uint8_t *ucBuffer, int32_t ulSize);
hazheng 32:5badeff825dc 51
hazheng 30:ff7f83ad6369 52 //Blocking method. Do not use during the running state!!
hazheng 92:e9bd429f16b5 53 //void ReadRegisters();
hazheng 30:ff7f83ad6369 54
hazheng 92:e9bd429f16b5 55 /**
hazheng 92:e9bd429f16b5 56 * @brief The method that used to write a entire program to the slave device. NOTE: It is a Blocking method. Do not use during the running state!!
hazheng 92:e9bd429f16b5 57 * @param reglist The program (A array of sensor_reg) that needs to write.
hazheng 92:e9bd429f16b5 58 */
hazheng 30:ff7f83ad6369 59 void WriteRegSet(const struct sensor_reg * reglist);
hazheng 30:ff7f83ad6369 60
hazheng 30:ff7f83ad6369 61 private:
hazheng 92:e9bd429f16b5 62 uint8_t m_writeAddr; /*!< @brief The write address for the slave device. */
hazheng 30:ff7f83ad6369 63
hazheng 92:e9bd429f16b5 64 uint8_t m_readAddr; /*!< @brief The read address for the slave device. */
hazheng 30:ff7f83ad6369 65
hazheng 92:e9bd429f16b5 66 I2C m_sccbCtrl; /*!< @brief The I2C connection to the slave device. */
hazheng 30:ff7f83ad6369 67 };
hazheng 30:ff7f83ad6369 68
hazheng 30:ff7f83ad6369 69 #endif //CAM_REG_BUF_H