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:
Mon Mar 13 02:43:53 2017 +0000
Revision:
35:ac4fcca21560
Parent:
34:f79db3bc2f86
Child:
36:7e747e19f660
Added More test code for camera.

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 35:ac4fcca21560 11 //#define ARDUCHIP_VER_NUM 0x55
hazheng 35:ac4fcca21560 12 #define ARDUCHIP_VER_NUM 0x61
hazheng 35:ac4fcca21560 13
hazheng 29:f87d8790f57d 14 #define ARDUCHIP_CAP_CTRL 0x01 //Capture Control Register
hazheng 29:f87d8790f57d 15
hazheng 29:f87d8790f57d 16 #define ARDUCHIP_MODE 0x02 //Mode register
hazheng 29:f87d8790f57d 17 //#define MCU2LCD_MODE 0x00
hazheng 29:f87d8790f57d 18 //#define CAM2LCD_MODE 0x01
hazheng 29:f87d8790f57d 19 #define MCU2LCD_MODE 0x01
hazheng 29:f87d8790f57d 20 #define CAM2LCD_MODE 0x02
hazheng 29:f87d8790f57d 21 //#define LCD2MCU_MODE 0x04
hazheng 29:f87d8790f57d 22
hazheng 29:f87d8790f57d 23 #define ARDUCHIP_FIFO 0x04 //FIFO and I2C control
hazheng 29:f87d8790f57d 24 #define FIFO_CLEAR_MASK 0x01
hazheng 29:f87d8790f57d 25 #define FIFO_START_MASK 0x02
hazheng 29:f87d8790f57d 26 #define FIFO_RDPTR_RST_MASK 0x10
hazheng 29:f87d8790f57d 27 #define FIFO_WRPTR_RST_MASK 0x20
hazheng 29:f87d8790f57d 28
hazheng 32:5badeff825dc 29 #define FIFO_SIZE1 0x42 //Camera write FIFO size[7:0] for burst to read
hazheng 32:5badeff825dc 30 #define FIFO_SIZE2 0x43 //Camera write FIFO size[15:8]
hazheng 32:5badeff825dc 31 #define FIFO_SIZE3 0x44 //Camera write FIFO size[18:16
hazheng 32:5badeff825dc 32
hazheng 32:5badeff825dc 33 #define BURST_FIFO_READ 0x3C //Burst FIFO read operation
hazheng 32:5badeff825dc 34 #define SINGLE_FIFO_READ 0x3D //Single FIFO read operation
hazheng 29:f87d8790f57d 35
hazheng 28:271fc8445e89 36 bool ardu_cam_init();
hazheng 28:271fc8445e89 37
hazheng 29:f87d8790f57d 38 void ardu_cam_set_mode(uint8_t mode);
hazheng 29:f87d8790f57d 39
hazheng 29:f87d8790f57d 40 void ardu_cam_start_capture();
hazheng 29:f87d8790f57d 41
hazheng 32:5badeff825dc 42 uint32_t ardu_cam_get_fifo_length();
hazheng 32:5badeff825dc 43
hazheng 32:5badeff825dc 44 void ardu_cam_print_debug();
hazheng 32:5badeff825dc 45
hazheng 34:f79db3bc2f86 46 //uint8_t ardu_cam_read_reg(uint8_t addr);
hazheng 34:f79db3bc2f86 47
hazheng 34:f79db3bc2f86 48 //void ardu_cam_write_reg(uint8_t addr, uint8_t data);
hazheng 34:f79db3bc2f86 49
hazheng 34:f79db3bc2f86 50 //int ardu_cam_bus_write(int address, int value);
hazheng 34:f79db3bc2f86 51
hazheng 34:f79db3bc2f86 52 //uint8_t ardu_cam_bus_read(int address);
hazheng 34:f79db3bc2f86 53
hazheng 28:271fc8445e89 54 #endif //ARDU_CAM_H