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:
Wed Mar 01 16:31:36 2017 +0000
Revision:
29:f87d8790f57d
Parent:
28:271fc8445e89
Child:
32:5badeff825dc
Added test code for ArduCam. Cam is not working yet.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hazheng 28:271fc8445e89 1 #pragma once
hazheng 28:271fc8445e89 2 #ifndef ARDU_CAM_H
hazheng 28:271fc8445e89 3 #define ARDU_CAM_H
hazheng 28:271fc8445e89 4
hazheng 29:f87d8790f57d 5 #include <mbed.h>
hazheng 28:271fc8445e89 6 #include "PinAssignment.h"
hazheng 28:271fc8445e89 7
hazheng 29:f87d8790f57d 8 #define ARDUCHIP_TEST1 0x00 //TEST register
hazheng 29:f87d8790f57d 9 #define ARDUCHIP_TEST_MSG 0x72
hazheng 29:f87d8790f57d 10
hazheng 29:f87d8790f57d 11 #define ARDUCHIP_CAP_CTRL 0x01 //Capture Control Register
hazheng 29:f87d8790f57d 12
hazheng 29:f87d8790f57d 13 #define ARDUCHIP_MODE 0x02 //Mode register
hazheng 29:f87d8790f57d 14 //#define MCU2LCD_MODE 0x00
hazheng 29:f87d8790f57d 15 //#define CAM2LCD_MODE 0x01
hazheng 29:f87d8790f57d 16 #define MCU2LCD_MODE 0x01
hazheng 29:f87d8790f57d 17 #define CAM2LCD_MODE 0x02
hazheng 29:f87d8790f57d 18 //#define LCD2MCU_MODE 0x04
hazheng 29:f87d8790f57d 19
hazheng 29:f87d8790f57d 20 #define ARDUCHIP_FIFO 0x04 //FIFO and I2C control
hazheng 29:f87d8790f57d 21 #define FIFO_CLEAR_MASK 0x01
hazheng 29:f87d8790f57d 22 #define FIFO_START_MASK 0x02
hazheng 29:f87d8790f57d 23 #define FIFO_RDPTR_RST_MASK 0x10
hazheng 29:f87d8790f57d 24 #define FIFO_WRPTR_RST_MASK 0x20
hazheng 29:f87d8790f57d 25
hazheng 29:f87d8790f57d 26
hazheng 28:271fc8445e89 27 bool ardu_cam_init();
hazheng 28:271fc8445e89 28
hazheng 29:f87d8790f57d 29 void ardu_cam_set_mode(uint8_t mode);
hazheng 29:f87d8790f57d 30
hazheng 29:f87d8790f57d 31 void ardu_cam_start_capture();
hazheng 29:f87d8790f57d 32
hazheng 29:f87d8790f57d 33 uint8_t ardu_cam_read_reg(uint8_t addr);
hazheng 29:f87d8790f57d 34
hazheng 29:f87d8790f57d 35 void ardu_cam_write_reg(uint8_t addr, uint8_t data);
hazheng 29:f87d8790f57d 36
hazheng 29:f87d8790f57d 37 int ardu_cam_bus_write(int address, int value);
hazheng 29:f87d8790f57d 38
hazheng 29:f87d8790f57d 39 uint8_t ardu_cam_bus_read(int address);
hazheng 29:f87d8790f57d 40
hazheng 28:271fc8445e89 41 #endif //ARDU_CAM_H