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 Mar 09 19:21:50 2017 +0000
Revision:
34:f79db3bc2f86
Parent:
32:5badeff825dc
Child:
35:ac4fcca21560
Simplify the spio read/write process.

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 32:5badeff825dc 26 #define FIFO_SIZE1 0x42 //Camera write FIFO size[7:0] for burst to read
hazheng 32:5badeff825dc 27 #define FIFO_SIZE2 0x43 //Camera write FIFO size[15:8]
hazheng 32:5badeff825dc 28 #define FIFO_SIZE3 0x44 //Camera write FIFO size[18:16
hazheng 32:5badeff825dc 29
hazheng 32:5badeff825dc 30 #define BURST_FIFO_READ 0x3C //Burst FIFO read operation
hazheng 32:5badeff825dc 31 #define SINGLE_FIFO_READ 0x3D //Single FIFO read operation
hazheng 29:f87d8790f57d 32
hazheng 28:271fc8445e89 33 bool ardu_cam_init();
hazheng 28:271fc8445e89 34
hazheng 29:f87d8790f57d 35 void ardu_cam_set_mode(uint8_t mode);
hazheng 29:f87d8790f57d 36
hazheng 29:f87d8790f57d 37 void ardu_cam_start_capture();
hazheng 29:f87d8790f57d 38
hazheng 32:5badeff825dc 39 uint32_t ardu_cam_get_fifo_length();
hazheng 32:5badeff825dc 40
hazheng 32:5badeff825dc 41 void ardu_cam_print_debug();
hazheng 32:5badeff825dc 42
hazheng 34:f79db3bc2f86 43 //uint8_t ardu_cam_read_reg(uint8_t addr);
hazheng 34:f79db3bc2f86 44
hazheng 34:f79db3bc2f86 45 //void ardu_cam_write_reg(uint8_t addr, uint8_t data);
hazheng 34:f79db3bc2f86 46
hazheng 34:f79db3bc2f86 47 //int ardu_cam_bus_write(int address, int value);
hazheng 34:f79db3bc2f86 48
hazheng 34:f79db3bc2f86 49 //uint8_t ardu_cam_bus_read(int address);
hazheng 34:f79db3bc2f86 50
hazheng 28:271fc8445e89 51 #endif //ARDU_CAM_H