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/OV7725RegProg.h@46:a5eb9bd3bb55, 2017-03-30 (annotated)
- Committer:
- hazheng
- Date:
- Thu Mar 30 22:34:20 2017 +0000
- Revision:
- 46:a5eb9bd3bb55
- Parent:
- 36:7e747e19f660
Changed more code into pure C style. Finished driving complete circle! Both screen and camera works fine!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 35:ac4fcca21560 | 1 | #pragma once |
hazheng | 35:ac4fcca21560 | 2 | #ifndef OV7725_REG_PROG_H |
hazheng | 35:ac4fcca21560 | 3 | #define OV7725_REG_PROG_H |
hazheng | 35:ac4fcca21560 | 4 | |
hazheng | 35:ac4fcca21560 | 5 | #include "CamRegDefinitions.h" |
hazheng | 35:ac4fcca21560 | 6 | |
hazheng | 36:7e747e19f660 | 7 | #if defined(ARDUCAM_OV7725) |
hazheng | 36:7e747e19f660 | 8 | |
hazheng | 36:7e747e19f660 | 9 | #define CAM_SCCB_WRITE 0x42 |
hazheng | 36:7e747e19f660 | 10 | #define CAM_SCCB_READ 0x43 |
hazheng | 35:ac4fcca21560 | 11 | |
hazheng | 36:7e747e19f660 | 12 | #define CAM_PID_VALUE 0x77 |
hazheng | 36:7e747e19f660 | 13 | #define CAM_VER_VALUE 0x21 |
hazheng | 35:ac4fcca21560 | 14 | |
hazheng | 36:7e747e19f660 | 15 | #define CAM_PID_ADDR 0x0A |
hazheng | 36:7e747e19f660 | 16 | #define CAM_VER_ADDR 0x0B |
hazheng | 35:ac4fcca21560 | 17 | |
hazheng | 46:a5eb9bd3bb55 | 18 | //namespace OV7725Prog |
hazheng | 46:a5eb9bd3bb55 | 19 | //{ |
hazheng | 35:ac4fcca21560 | 20 | |
hazheng | 36:7e747e19f660 | 21 | const struct sensor_reg ResetProg[] = |
hazheng | 36:7e747e19f660 | 22 | { |
hazheng | 36:7e747e19f660 | 23 | {0x12, 0x80}, |
hazheng | 36:7e747e19f660 | 24 | {0xff, 0xff}, |
hazheng | 36:7e747e19f660 | 25 | }; |
hazheng | 36:7e747e19f660 | 26 | |
hazheng | 35:ac4fcca21560 | 27 | //#if (defined(RESOLUTION_WIDTH) && RESOLUTION_WIDTH == 320) && (defined(RESOLUTION_HEIGHT) && RESOLUTION_HEIGHT == 240) |
hazheng | 35:ac4fcca21560 | 28 | const struct sensor_reg QVGA[] = |
hazheng | 35:ac4fcca21560 | 29 | { |
hazheng | 35:ac4fcca21560 | 30 | {0x32,0x00}, |
hazheng | 35:ac4fcca21560 | 31 | {0x2a,0x00}, |
hazheng | 35:ac4fcca21560 | 32 | {0x11,0x02}, |
hazheng | 35:ac4fcca21560 | 33 | {0x12,0x46},//QVGA RGB565 |
hazheng | 35:ac4fcca21560 | 34 | {0x12,0x06}, |
hazheng | 35:ac4fcca21560 | 35 | |
hazheng | 35:ac4fcca21560 | 36 | |
hazheng | 35:ac4fcca21560 | 37 | {0x42,0x7f}, |
hazheng | 35:ac4fcca21560 | 38 | {0x4d,0x00},//0x09 |
hazheng | 35:ac4fcca21560 | 39 | {0x63,0xf0}, |
hazheng | 35:ac4fcca21560 | 40 | {0x64,0xff}, |
hazheng | 35:ac4fcca21560 | 41 | {0x65,0x20}, |
hazheng | 35:ac4fcca21560 | 42 | {0x66,0x00}, |
hazheng | 35:ac4fcca21560 | 43 | {0x67,0x00}, |
hazheng | 35:ac4fcca21560 | 44 | {0x69,0x5d}, |
hazheng | 35:ac4fcca21560 | 45 | |
hazheng | 35:ac4fcca21560 | 46 | |
hazheng | 35:ac4fcca21560 | 47 | {0x13,0xff}, |
hazheng | 35:ac4fcca21560 | 48 | {0x0d,0x81},//PLL |
hazheng | 35:ac4fcca21560 | 49 | {0x0f,0xc5}, |
hazheng | 35:ac4fcca21560 | 50 | {0x14,0x11}, |
hazheng | 35:ac4fcca21560 | 51 | {0x22,0xFF},//7f |
hazheng | 35:ac4fcca21560 | 52 | {0x23,0x01}, |
hazheng | 35:ac4fcca21560 | 53 | {0x24,0x34}, |
hazheng | 35:ac4fcca21560 | 54 | {0x25,0x3c}, |
hazheng | 35:ac4fcca21560 | 55 | {0x26,0xa1}, |
hazheng | 35:ac4fcca21560 | 56 | {0x2b,0x00}, |
hazheng | 35:ac4fcca21560 | 57 | {0x6b,0xaa}, |
hazheng | 35:ac4fcca21560 | 58 | {0x13,0xff}, |
hazheng | 35:ac4fcca21560 | 59 | |
hazheng | 35:ac4fcca21560 | 60 | {0x90,0x0a},// |
hazheng | 35:ac4fcca21560 | 61 | {0x91,0x01},// |
hazheng | 35:ac4fcca21560 | 62 | {0x92,0x01},// |
hazheng | 35:ac4fcca21560 | 63 | {0x93,0x01}, |
hazheng | 35:ac4fcca21560 | 64 | |
hazheng | 35:ac4fcca21560 | 65 | {0x94,0x5f}, |
hazheng | 35:ac4fcca21560 | 66 | {0x95,0x53}, |
hazheng | 35:ac4fcca21560 | 67 | {0x96,0x11}, |
hazheng | 35:ac4fcca21560 | 68 | {0x97,0x1a}, |
hazheng | 35:ac4fcca21560 | 69 | {0x98,0x3d}, |
hazheng | 35:ac4fcca21560 | 70 | {0x99,0x5a}, |
hazheng | 35:ac4fcca21560 | 71 | {0x9a,0x1e}, |
hazheng | 35:ac4fcca21560 | 72 | |
hazheng | 35:ac4fcca21560 | 73 | {0x9b,0x00},//set luma |
hazheng | 35:ac4fcca21560 | 74 | {0x9c,0x25},//set contrast |
hazheng | 35:ac4fcca21560 | 75 | {0xa7,0x65},//set saturation |
hazheng | 35:ac4fcca21560 | 76 | {0xa8,0x65},//set saturation |
hazheng | 35:ac4fcca21560 | 77 | {0xa9,0x80},//set hue |
hazheng | 35:ac4fcca21560 | 78 | {0xaa,0x80},//set hue |
hazheng | 35:ac4fcca21560 | 79 | |
hazheng | 35:ac4fcca21560 | 80 | {0x9e,0x81}, |
hazheng | 35:ac4fcca21560 | 81 | {0xa6,0x06}, |
hazheng | 35:ac4fcca21560 | 82 | |
hazheng | 35:ac4fcca21560 | 83 | {0x7e,0x0c}, |
hazheng | 35:ac4fcca21560 | 84 | {0x7f,0x16}, |
hazheng | 35:ac4fcca21560 | 85 | {0x80,0x2a}, |
hazheng | 35:ac4fcca21560 | 86 | {0x81,0x4e}, |
hazheng | 35:ac4fcca21560 | 87 | {0x82,0x61}, |
hazheng | 35:ac4fcca21560 | 88 | {0x83,0x6f}, |
hazheng | 35:ac4fcca21560 | 89 | {0x84,0x7b}, |
hazheng | 35:ac4fcca21560 | 90 | {0x85,0x86}, |
hazheng | 35:ac4fcca21560 | 91 | {0x86,0x8e}, |
hazheng | 35:ac4fcca21560 | 92 | {0x87,0x97}, |
hazheng | 35:ac4fcca21560 | 93 | {0x88,0xa4}, |
hazheng | 35:ac4fcca21560 | 94 | {0x89,0xaf}, |
hazheng | 35:ac4fcca21560 | 95 | {0x8a,0xc5}, |
hazheng | 35:ac4fcca21560 | 96 | {0x8b,0xd7}, |
hazheng | 35:ac4fcca21560 | 97 | {0x8c,0xe8}, |
hazheng | 35:ac4fcca21560 | 98 | {0x8d,0x20}, |
hazheng | 35:ac4fcca21560 | 99 | |
hazheng | 35:ac4fcca21560 | 100 | {0x33,0x00}, |
hazheng | 35:ac4fcca21560 | 101 | {0x22,0x99}, |
hazheng | 35:ac4fcca21560 | 102 | {0x23,0x03}, |
hazheng | 35:ac4fcca21560 | 103 | {0x4a,0x00}, |
hazheng | 35:ac4fcca21560 | 104 | {0x49,0x13}, |
hazheng | 35:ac4fcca21560 | 105 | {0x47,0x08}, |
hazheng | 35:ac4fcca21560 | 106 | {0x4b,0x14}, |
hazheng | 35:ac4fcca21560 | 107 | {0x4c,0x17}, |
hazheng | 35:ac4fcca21560 | 108 | {0x46,0x05}, |
hazheng | 35:ac4fcca21560 | 109 | {0x0e,0x75}, |
hazheng | 35:ac4fcca21560 | 110 | {0x0c,0x90}, |
hazheng | 35:ac4fcca21560 | 111 | {0x00,0xf0}, |
hazheng | 35:ac4fcca21560 | 112 | |
hazheng | 35:ac4fcca21560 | 113 | #if (defined(RESOLUTION_WIDTH) && RESOLUTION_WIDTH == 320) && (defined(RESOLUTION_HEIGHT) && RESOLUTION_HEIGHT == 240) |
hazheng | 35:ac4fcca21560 | 114 | {0x29, 0x50}, //Zoom |
hazheng | 35:ac4fcca21560 | 115 | {0x2C, 0x78}, //Zoom |
hazheng | 36:7e747e19f660 | 116 | #elif (defined(RESOLUTION_WIDTH) && RESOLUTION_WIDTH == 160) && (defined(RESOLUTION_HEIGHT) && RESOLUTION_HEIGHT == 120) |
hazheng | 35:ac4fcca21560 | 117 | {0x29, 0x28}, //Zoom |
hazheng | 35:ac4fcca21560 | 118 | {0x2C, 0x3C}, //Zoom |
hazheng | 36:7e747e19f660 | 119 | |
hazheng | 36:7e747e19f660 | 120 | #else |
hazheng | 36:7e747e19f660 | 121 | #error Must pick one valid resolution!! |
hazheng | 35:ac4fcca21560 | 122 | #endif |
hazheng | 35:ac4fcca21560 | 123 | // {0x29,0x50}, |
hazheng | 35:ac4fcca21560 | 124 | // {0x2C,0x78}, |
hazheng | 35:ac4fcca21560 | 125 | |
hazheng | 35:ac4fcca21560 | 126 | {0xff, 0xff}, |
hazheng | 35:ac4fcca21560 | 127 | |
hazheng | 35:ac4fcca21560 | 128 | |
hazheng | 35:ac4fcca21560 | 129 | }; |
hazheng | 35:ac4fcca21560 | 130 | //#endif //320 X 240 |
hazheng | 35:ac4fcca21560 | 131 | |
hazheng | 46:a5eb9bd3bb55 | 132 | //} |
hazheng | 35:ac4fcca21560 | 133 | |
hazheng | 35:ac4fcca21560 | 134 | |
hazheng | 35:ac4fcca21560 | 135 | |
hazheng | 36:7e747e19f660 | 136 | #endif //ARDUCAM_OV7725 |
hazheng | 36:7e747e19f660 | 137 | |
hazheng | 35:ac4fcca21560 | 138 | #endif //OV7725_REG_PROG_H |