RS232 control for TVOne products
spk_tvone_mbed.cpp@13:4d659b89a457, 2012-11-03 (annotated)
- Committer:
- tobyspark
- Date:
- Sat Nov 03 20:09:46 2012 +0000
- Revision:
- 13:4d659b89a457
- Parent:
- 11:90e5a72a0034
- Child:
- 14:da403a01f9ef
Better debug messages
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tobyspark | 0:533cfae24a1b | 1 | // *spark audio-visual |
tobyspark | 0:533cfae24a1b | 2 | // RS232 Control for TV-One products |
tobyspark | 0:533cfae24a1b | 3 | // Good for 1T-C2-750, others will need some extra work |
tobyspark | 1:349d6da461df | 4 | |
tobyspark | 1:349d6da461df | 5 | /* Copyright (c) 2011 Toby Harris, MIT License |
tobyspark | 1:349d6da461df | 6 | * |
tobyspark | 1:349d6da461df | 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
tobyspark | 1:349d6da461df | 8 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
tobyspark | 1:349d6da461df | 9 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
tobyspark | 1:349d6da461df | 10 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
tobyspark | 1:349d6da461df | 11 | * furnished to do so, subject to the following conditions: |
tobyspark | 1:349d6da461df | 12 | * |
tobyspark | 1:349d6da461df | 13 | * The above copyright notice and this permission notice shall be included in all copies or |
tobyspark | 1:349d6da461df | 14 | * substantial portions of the Software. |
tobyspark | 1:349d6da461df | 15 | * |
tobyspark | 1:349d6da461df | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
tobyspark | 1:349d6da461df | 17 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
tobyspark | 1:349d6da461df | 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
tobyspark | 1:349d6da461df | 19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
tobyspark | 1:349d6da461df | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
tobyspark | 1:349d6da461df | 21 | */ |
tobyspark | 0:533cfae24a1b | 22 | |
tobyspark | 0:533cfae24a1b | 23 | #include "spk_tvone_mbed.h" |
tobyspark | 0:533cfae24a1b | 24 | #include "mbed.h" |
tobyspark | 0:533cfae24a1b | 25 | |
tobyspark | 0:533cfae24a1b | 26 | SPKTVOne::SPKTVOne(PinName txPin, PinName rxPin, PinName signWritePin, PinName signErrorPin, Serial *debugSerial) |
tobyspark | 0:533cfae24a1b | 27 | { |
tobyspark | 0:533cfae24a1b | 28 | // Create Serial connection for TVOne unit comms |
tobyspark | 0:533cfae24a1b | 29 | // Creating our own as this is exclusively for TVOne comms |
tobyspark | 9:42c83cac2f6d | 30 | serial = new Serial(txPin, rxPin); |
tobyspark | 0:533cfae24a1b | 31 | serial->baud(57600); |
tobyspark | 0:533cfae24a1b | 32 | |
tobyspark | 0:533cfae24a1b | 33 | if (signWritePin != NC) writeDO = new DigitalOut(signWritePin); |
tobyspark | 0:533cfae24a1b | 34 | else writeDO = NULL; |
tobyspark | 0:533cfae24a1b | 35 | |
tobyspark | 0:533cfae24a1b | 36 | if (signErrorPin != NC) errorDO = new DigitalOut(signErrorPin); |
tobyspark | 0:533cfae24a1b | 37 | else errorDO = NULL; |
tobyspark | 0:533cfae24a1b | 38 | |
tobyspark | 0:533cfae24a1b | 39 | // Link up debug Serial object |
tobyspark | 0:533cfae24a1b | 40 | // Passing in shared object as debugging is shared between all DVI mixer functions |
tobyspark | 0:533cfae24a1b | 41 | debug = debugSerial; |
tobyspark | 0:533cfae24a1b | 42 | } |
tobyspark | 0:533cfae24a1b | 43 | |
tobyspark | 10:5f398fc9b5c1 | 44 | bool SPKTVOne::command(uint8_t channel, uint8_t window, int32_t func, int32_t payload) |
tobyspark | 10:5f398fc9b5c1 | 45 | { |
tobyspark | 10:5f398fc9b5c1 | 46 | int ackBuff[standardAckLength]; |
tobyspark | 10:5f398fc9b5c1 | 47 | |
tobyspark | 11:90e5a72a0034 | 48 | bool success = command(writeCommandType, ackBuff, standardAckLength, channel, window, func, payload); |
tobyspark | 11:90e5a72a0034 | 49 | |
tobyspark | 11:90e5a72a0034 | 50 | // TASK: Check return payload is what we tried to set it to |
tobyspark | 11:90e5a72a0034 | 51 | char payloadStr[7]; |
tobyspark | 11:90e5a72a0034 | 52 | for (int i = 0; i < 6; i++) |
tobyspark | 11:90e5a72a0034 | 53 | { |
tobyspark | 11:90e5a72a0034 | 54 | payloadStr[i] = ackBuff[11+i]; |
tobyspark | 11:90e5a72a0034 | 55 | } |
tobyspark | 11:90e5a72a0034 | 56 | payloadStr[6] = NULL; |
tobyspark | 11:90e5a72a0034 | 57 | |
tobyspark | 11:90e5a72a0034 | 58 | int payloadBack = strtol (payloadStr, NULL, 16); |
tobyspark | 11:90e5a72a0034 | 59 | |
tobyspark | 11:90e5a72a0034 | 60 | if (payload != payloadBack) |
tobyspark | 11:90e5a72a0034 | 61 | { |
tobyspark | 11:90e5a72a0034 | 62 | success = false; |
tobyspark | 13:4d659b89a457 | 63 | if (debug) debug->printf("TVOne return value (%d) is not what was set (%d). Channel: %#x, Window: %#x, Function: %#x \r\n", payloadBack, payload, channel, window, func); |
tobyspark | 11:90e5a72a0034 | 64 | } |
tobyspark | 11:90e5a72a0034 | 65 | return success; |
tobyspark | 11:90e5a72a0034 | 66 | } |
tobyspark | 11:90e5a72a0034 | 67 | |
tobyspark | 11:90e5a72a0034 | 68 | bool SPKTVOne::readCommand(uint8_t channel, uint8_t window, int32_t func, int32_t &payload) |
tobyspark | 11:90e5a72a0034 | 69 | { |
tobyspark | 11:90e5a72a0034 | 70 | int ackBuff[standardAckLength]; |
tobyspark | 11:90e5a72a0034 | 71 | |
tobyspark | 11:90e5a72a0034 | 72 | bool success = command(readCommandType, ackBuff, standardAckLength, channel, window, func, payload); |
tobyspark | 11:90e5a72a0034 | 73 | |
tobyspark | 11:90e5a72a0034 | 74 | char payloadStr[7]; |
tobyspark | 11:90e5a72a0034 | 75 | for (int i = 0; i < 6; i++) |
tobyspark | 11:90e5a72a0034 | 76 | { |
tobyspark | 11:90e5a72a0034 | 77 | payloadStr[i] = ackBuff[11+i]; |
tobyspark | 11:90e5a72a0034 | 78 | } |
tobyspark | 11:90e5a72a0034 | 79 | payloadStr[6] = NULL; |
tobyspark | 11:90e5a72a0034 | 80 | |
tobyspark | 11:90e5a72a0034 | 81 | payload = strtol (payloadStr, NULL, 16); |
tobyspark | 10:5f398fc9b5c1 | 82 | |
tobyspark | 10:5f398fc9b5c1 | 83 | return success; |
tobyspark | 10:5f398fc9b5c1 | 84 | } |
tobyspark | 10:5f398fc9b5c1 | 85 | |
tobyspark | 10:5f398fc9b5c1 | 86 | bool SPKTVOne::command(commandType readWrite, int* ackBuffer, int ackLength, uint8_t channel, uint8_t window, int32_t func, int32_t payload) |
tobyspark | 0:533cfae24a1b | 87 | { |
tobyspark | 0:533cfae24a1b | 88 | char i; |
tobyspark | 0:533cfae24a1b | 89 | |
tobyspark | 0:533cfae24a1b | 90 | // TASK: Sign start of serial command write |
tobyspark | 0:533cfae24a1b | 91 | if (writeDO) *writeDO = 1; |
tobyspark | 0:533cfae24a1b | 92 | |
tobyspark | 0:533cfae24a1b | 93 | // TASK: discard anything waiting to be read |
tobyspark | 0:533cfae24a1b | 94 | while (serial->readable()) { |
tobyspark | 0:533cfae24a1b | 95 | serial->getc(); |
tobyspark | 0:533cfae24a1b | 96 | } |
tobyspark | 0:533cfae24a1b | 97 | |
tobyspark | 0:533cfae24a1b | 98 | // TASK: Create the bytes of command |
tobyspark | 0:533cfae24a1b | 99 | |
tobyspark | 0:533cfae24a1b | 100 | uint8_t cmd[8]; |
tobyspark | 0:533cfae24a1b | 101 | uint8_t checksum = 0; |
tobyspark | 0:533cfae24a1b | 102 | |
tobyspark | 0:533cfae24a1b | 103 | // CMD |
tobyspark | 10:5f398fc9b5c1 | 104 | cmd[0] = readWrite<<7 | 1<<2; |
tobyspark | 0:533cfae24a1b | 105 | // CHA |
tobyspark | 0:533cfae24a1b | 106 | cmd[1] = channel; |
tobyspark | 0:533cfae24a1b | 107 | // WINDOW |
tobyspark | 0:533cfae24a1b | 108 | cmd[2] = window; |
tobyspark | 0:533cfae24a1b | 109 | // OUTPUT & FUNCTION |
tobyspark | 0:533cfae24a1b | 110 | // cmd[3] cmd[4] |
tobyspark | 0:533cfae24a1b | 111 | // output 0 = 0000xxx xxxxxxx |
tobyspark | 0:533cfae24a1b | 112 | // function = xxxXXXX XXXXXXX |
tobyspark | 0:533cfae24a1b | 113 | cmd[3] = func >> 8; |
tobyspark | 0:533cfae24a1b | 114 | cmd[4] = func & 0xFF; |
tobyspark | 0:533cfae24a1b | 115 | // PAYLOAD |
tobyspark | 0:533cfae24a1b | 116 | cmd[5] = (payload >> 16) & 0xFF; |
tobyspark | 0:533cfae24a1b | 117 | cmd[6] = (payload >> 8) & 0xFF; |
tobyspark | 0:533cfae24a1b | 118 | cmd[7] = payload & 0xFF; |
tobyspark | 0:533cfae24a1b | 119 | |
tobyspark | 0:533cfae24a1b | 120 | // TASK: Write the bytes of command to RS232 as correctly packaged 20 characters of ASCII |
tobyspark | 10:5f398fc9b5c1 | 121 | |
tobyspark | 11:90e5a72a0034 | 122 | if (readWrite == writeCommandType) |
tobyspark | 0:533cfae24a1b | 123 | { |
tobyspark | 10:5f398fc9b5c1 | 124 | for (i=0; i<8; i++) checksum += cmd[i]; |
tobyspark | 10:5f398fc9b5c1 | 125 | serial->printf("F%02X%02X%02X%02X%02X%02X%02X%02X%02X\r", cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], checksum); |
tobyspark | 0:533cfae24a1b | 126 | } |
tobyspark | 11:90e5a72a0034 | 127 | if (readWrite == readCommandType) |
tobyspark | 10:5f398fc9b5c1 | 128 | { |
tobyspark | 10:5f398fc9b5c1 | 129 | for (i=0; i<5; i++) checksum += cmd[i]; |
tobyspark | 10:5f398fc9b5c1 | 130 | serial->printf("F%02X%02X%02X%02X%02X%02X\r", cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], checksum); |
tobyspark | 10:5f398fc9b5c1 | 131 | } |
tobyspark | 10:5f398fc9b5c1 | 132 | |
tobyspark | 0:533cfae24a1b | 133 | // TASK: Check the unit's return string, to enable return to main program as soon as unit is ready |
tobyspark | 0:533cfae24a1b | 134 | |
tobyspark | 0:533cfae24a1b | 135 | // Handling the timing of this return is critical to effective control. |
tobyspark | 0:533cfae24a1b | 136 | // Returning the instant something is received back overloads the processor, as does anything until the full 20 char acknowledgement. |
tobyspark | 0:533cfae24a1b | 137 | // TVOne turn out to say that receipt of the ack doesn't guarantee the unit is ready for the next command. |
tobyspark | 0:533cfae24a1b | 138 | // According to the manual, operations typically take 30ms, and to simplify programming you can throttle commands to every 100ms. |
tobyspark | 0:533cfae24a1b | 139 | // 100ms is too slow for us. Going with returning after 30ms if we've received an acknowledgement, returning after 100ms otherwise. |
tobyspark | 10:5f398fc9b5c1 | 140 | |
tobyspark | 10:5f398fc9b5c1 | 141 | const int safePeriod = 100; |
tobyspark | 10:5f398fc9b5c1 | 142 | const int clearPeriod = 30; |
tobyspark | 10:5f398fc9b5c1 | 143 | |
tobyspark | 9:42c83cac2f6d | 144 | bool ackReceived = false; |
tobyspark | 9:42c83cac2f6d | 145 | bool success = false; |
tobyspark | 9:42c83cac2f6d | 146 | Timer timer; |
tobyspark | 0:533cfae24a1b | 147 | |
tobyspark | 10:5f398fc9b5c1 | 148 | i = 0; |
tobyspark | 9:42c83cac2f6d | 149 | timer.start(); |
tobyspark | 10:5f398fc9b5c1 | 150 | while (timer.read_ms() < safePeriod) |
tobyspark | 10:5f398fc9b5c1 | 151 | { |
tobyspark | 10:5f398fc9b5c1 | 152 | if (ackReceived && timer.read_ms() > clearPeriod) |
tobyspark | 10:5f398fc9b5c1 | 153 | { |
tobyspark | 10:5f398fc9b5c1 | 154 | break; |
tobyspark | 10:5f398fc9b5c1 | 155 | } |
tobyspark | 9:42c83cac2f6d | 156 | if (!ackReceived && serial->readable()) |
tobyspark | 10:5f398fc9b5c1 | 157 | { |
tobyspark | 10:5f398fc9b5c1 | 158 | ackBuffer[i] = serial->getc(); |
tobyspark | 10:5f398fc9b5c1 | 159 | i++; |
tobyspark | 10:5f398fc9b5c1 | 160 | if (i == ackLength) |
tobyspark | 9:42c83cac2f6d | 161 | { |
tobyspark | 10:5f398fc9b5c1 | 162 | ackReceived = true; |
tobyspark | 10:5f398fc9b5c1 | 163 | if (ackBuffer[0] == 'F' && ackBuffer[1] == '4') // TVOne start of message, acknowledgement with no error, rest will be repeat of sent command |
tobyspark | 9:42c83cac2f6d | 164 | { |
tobyspark | 10:5f398fc9b5c1 | 165 | success = true; |
tobyspark | 0:533cfae24a1b | 166 | } |
tobyspark | 0:533cfae24a1b | 167 | } |
tobyspark | 10:5f398fc9b5c1 | 168 | } |
tobyspark | 9:42c83cac2f6d | 169 | } |
tobyspark | 9:42c83cac2f6d | 170 | timer.stop(); |
tobyspark | 0:533cfae24a1b | 171 | |
tobyspark | 0:533cfae24a1b | 172 | // TASK: Sign end of write |
tobyspark | 0:533cfae24a1b | 173 | |
tobyspark | 0:533cfae24a1b | 174 | if (writeDO) *writeDO = 0; |
tobyspark | 0:533cfae24a1b | 175 | |
tobyspark | 0:533cfae24a1b | 176 | if (!success) { |
tobyspark | 0:533cfae24a1b | 177 | if (errorDO) { |
tobyspark | 0:533cfae24a1b | 178 | signErrorTimeout.detach(); |
tobyspark | 0:533cfae24a1b | 179 | signErrorTimeout.attach(this, &SPKTVOne::signErrorOff, 0.25); |
tobyspark | 0:533cfae24a1b | 180 | *errorDO = 1; |
tobyspark | 0:533cfae24a1b | 181 | } |
tobyspark | 0:533cfae24a1b | 182 | |
tobyspark | 0:533cfae24a1b | 183 | if (debug) { |
tobyspark | 13:4d659b89a457 | 184 | debug->printf("TVOne serial error. Time from finishing writing command: %ims \r\n", timer.read_ms()); |
tobyspark | 0:533cfae24a1b | 185 | } |
tobyspark | 0:533cfae24a1b | 186 | }; |
tobyspark | 0:533cfae24a1b | 187 | |
tobyspark | 0:533cfae24a1b | 188 | return success; |
tobyspark | 0:533cfae24a1b | 189 | } |
tobyspark | 0:533cfae24a1b | 190 | |
tobyspark | 11:90e5a72a0034 | 191 | bool SPKTVOne::setCustomResolutions() |
tobyspark | 0:533cfae24a1b | 192 | { |
tobyspark | 11:90e5a72a0034 | 193 | bool ok = true;; |
tobyspark | 11:90e5a72a0034 | 194 | int unlocked = 0; |
tobyspark | 11:90e5a72a0034 | 195 | int locked = 1; |
tobyspark | 11:90e5a72a0034 | 196 | |
tobyspark | 11:90e5a72a0034 | 197 | ok = ok && command(0, 0, kTV1FunctionAdjustFrontPanelLock, locked); |
tobyspark | 11:90e5a72a0034 | 198 | |
tobyspark | 11:90e5a72a0034 | 199 | ok = ok && set1920x480(kTV1ResolutionTripleHeadVGAp60); |
tobyspark | 11:90e5a72a0034 | 200 | ok = ok && set1600x600(kTV1ResolutionDualHeadSVGAp60); |
tobyspark | 11:90e5a72a0034 | 201 | ok = ok && set2048x768(kTV1ResolutionDualHeadXGAp60); |
tobyspark | 11:90e5a72a0034 | 202 | |
tobyspark | 11:90e5a72a0034 | 203 | ok = ok && command(0, 0, kTV1FunctionAdjustFrontPanelLock, unlocked); |
tobyspark | 11:90e5a72a0034 | 204 | |
tobyspark | 11:90e5a72a0034 | 205 | return ok; |
tobyspark | 0:533cfae24a1b | 206 | } |
tobyspark | 0:533cfae24a1b | 207 | |
tobyspark | 3:03e7e7b7a870 | 208 | bool SPKTVOne::setHDCPOn(bool state) |
tobyspark | 0:533cfae24a1b | 209 | { |
tobyspark | 11:90e5a72a0034 | 210 | bool ok; |
tobyspark | 0:533cfae24a1b | 211 | |
tobyspark | 0:533cfae24a1b | 212 | // Turn HDCP off on the output |
tobyspark | 3:03e7e7b7a870 | 213 | ok = command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsHDCPRequired, state); |
tobyspark | 3:03e7e7b7a870 | 214 | ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsHDCPStatus, state); |
tobyspark | 0:533cfae24a1b | 215 | // Likewise on inputs A and B |
tobyspark | 3:03e7e7b7a870 | 216 | ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustSourceHDCPAdvertize, state); |
tobyspark | 3:03e7e7b7a870 | 217 | ok = ok && command(0, kTV1WindowIDB, kTV1FunctionAdjustSourceHDCPAdvertize, state); |
tobyspark | 3:03e7e7b7a870 | 218 | ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustSourceHDCPStatus, state); |
tobyspark | 3:03e7e7b7a870 | 219 | ok = ok && command(0, kTV1WindowIDB, kTV1FunctionAdjustSourceHDCPStatus, state); |
tobyspark | 0:533cfae24a1b | 220 | |
tobyspark | 0:533cfae24a1b | 221 | return ok; |
tobyspark | 0:533cfae24a1b | 222 | } |
tobyspark | 0:533cfae24a1b | 223 | |
tobyspark | 11:90e5a72a0034 | 224 | bool SPKTVOne::set1920x480(int resStoreNumber) |
tobyspark | 0:533cfae24a1b | 225 | { |
tobyspark | 11:90e5a72a0034 | 226 | bool ok; |
tobyspark | 11:90e5a72a0034 | 227 | |
tobyspark | 11:90e5a72a0034 | 228 | ok = command(0, 0, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber); |
tobyspark | 11:90e5a72a0034 | 229 | if (ok) |
tobyspark | 11:90e5a72a0034 | 230 | { |
tobyspark | 11:90e5a72a0034 | 231 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionInterlaced, 0); |
tobyspark | 11:90e5a72a0034 | 232 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqCoarseH, 31475); |
tobyspark | 11:90e5a72a0034 | 233 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqFineH, 31475); |
tobyspark | 11:90e5a72a0034 | 234 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveH, 1920); |
tobyspark | 11:90e5a72a0034 | 235 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveV, 480); |
tobyspark | 11:90e5a72a0034 | 236 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartH, 240); |
tobyspark | 11:90e5a72a0034 | 237 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartV, 5); |
tobyspark | 11:90e5a72a0034 | 238 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionCLKS, 2400); |
tobyspark | 11:90e5a72a0034 | 239 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionLines, 525); |
tobyspark | 11:90e5a72a0034 | 240 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncH, 192); |
tobyspark | 11:90e5a72a0034 | 241 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncV, 30); |
tobyspark | 11:90e5a72a0034 | 242 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncPolarity, 0); |
tobyspark | 11:90e5a72a0034 | 243 | } |
tobyspark | 11:90e5a72a0034 | 244 | |
tobyspark | 11:90e5a72a0034 | 245 | return ok; |
tobyspark | 0:533cfae24a1b | 246 | } |
tobyspark | 0:533cfae24a1b | 247 | |
tobyspark | 11:90e5a72a0034 | 248 | bool SPKTVOne::set1600x600(int resStoreNumber) |
tobyspark | 0:533cfae24a1b | 249 | { |
tobyspark | 11:90e5a72a0034 | 250 | bool ok; |
tobyspark | 11:90e5a72a0034 | 251 | |
tobyspark | 11:90e5a72a0034 | 252 | ok = command(0, 0, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber); |
tobyspark | 11:90e5a72a0034 | 253 | if (ok) |
tobyspark | 11:90e5a72a0034 | 254 | { |
tobyspark | 11:90e5a72a0034 | 255 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionInterlaced, 0); |
tobyspark | 11:90e5a72a0034 | 256 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqCoarseH, 37879); |
tobyspark | 11:90e5a72a0034 | 257 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqFineH, 37879); |
tobyspark | 11:90e5a72a0034 | 258 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveH, 1600); |
tobyspark | 11:90e5a72a0034 | 259 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveV, 600); |
tobyspark | 11:90e5a72a0034 | 260 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartH, 192); |
tobyspark | 11:90e5a72a0034 | 261 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartV, 14); |
tobyspark | 11:90e5a72a0034 | 262 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionCLKS, 2112); |
tobyspark | 11:90e5a72a0034 | 263 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionLines, 628); |
tobyspark | 11:90e5a72a0034 | 264 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncH, 160); |
tobyspark | 11:90e5a72a0034 | 265 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncV, 13); |
tobyspark | 11:90e5a72a0034 | 266 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncPolarity, 0); |
tobyspark | 11:90e5a72a0034 | 267 | } |
tobyspark | 11:90e5a72a0034 | 268 | |
tobyspark | 11:90e5a72a0034 | 269 | return ok; |
tobyspark | 0:533cfae24a1b | 270 | } |
tobyspark | 0:533cfae24a1b | 271 | |
tobyspark | 11:90e5a72a0034 | 272 | bool SPKTVOne::set2048x768(int resStoreNumber) |
tobyspark | 2:af9e9ab63b23 | 273 | { |
tobyspark | 11:90e5a72a0034 | 274 | bool ok; |
tobyspark | 11:90e5a72a0034 | 275 | |
tobyspark | 11:90e5a72a0034 | 276 | ok = command(0, 0, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber); |
tobyspark | 11:90e5a72a0034 | 277 | if (ok) |
tobyspark | 11:90e5a72a0034 | 278 | { |
tobyspark | 11:90e5a72a0034 | 279 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionInterlaced, 0); |
tobyspark | 11:90e5a72a0034 | 280 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqCoarseH, 48363); |
tobyspark | 11:90e5a72a0034 | 281 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqFineH, 48363); |
tobyspark | 11:90e5a72a0034 | 282 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveH, 2048); |
tobyspark | 11:90e5a72a0034 | 283 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveV, 768); |
tobyspark | 11:90e5a72a0034 | 284 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartH, 224); |
tobyspark | 11:90e5a72a0034 | 285 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartV, 11); |
tobyspark | 11:90e5a72a0034 | 286 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionCLKS, 2688); |
tobyspark | 11:90e5a72a0034 | 287 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionLines, 806); |
tobyspark | 11:90e5a72a0034 | 288 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncH, 368); |
tobyspark | 11:90e5a72a0034 | 289 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncV, 24); |
tobyspark | 11:90e5a72a0034 | 290 | ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncPolarity, 0); |
tobyspark | 11:90e5a72a0034 | 291 | } |
tobyspark | 11:90e5a72a0034 | 292 | |
tobyspark | 11:90e5a72a0034 | 293 | return ok; |
tobyspark | 2:af9e9ab63b23 | 294 | } |
tobyspark | 2:af9e9ab63b23 | 295 | |
tobyspark | 0:533cfae24a1b | 296 | void SPKTVOne::signErrorOff() { |
tobyspark | 0:533cfae24a1b | 297 | *errorDO = 0; |
tobyspark | 0:533cfae24a1b | 298 | } |