RS232 control for TVOne products
Embed:
(wiki syntax)
Show/hide line numbers
spk_tvone_mbed.h
00001 // *spark audio-visual 00002 // RS232 Control for TV-One products 00003 // Good for 1T-C2-750, others will need some extra work 00004 00005 /* Copyright (c) 2011 Toby Harris, MIT License 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00008 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00009 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00010 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00011 * furnished to do so, subject to the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included in all copies or 00014 * substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00017 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00018 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00019 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00021 */ 00022 00023 #ifndef SPKTVOne_mBed_h 00024 #define SPKTVOne_mBed_h 00025 00026 #include "spk_tvone.h" 00027 #include "mbed.h" 00028 00029 class SPKTVOne 00030 { 00031 public: 00032 SPKTVOne(PinName txPin, PinName rxPin, PinName signWritePin = NC, PinName signErrorPin = NC, Serial *debugSerial = NULL); 00033 00034 enum commandType {writeCommandType = 0, readCommandType = 1}; 00035 static const int standardAckLength = 20; 00036 00037 bool command(uint8_t channel, uint8_t window, int32_t func, int32_t payload); 00038 bool readCommand(uint8_t channel, uint8_t window, int32_t func, int32_t &payload); 00039 00040 struct processorType {int version; int productType; int boardType;}; 00041 processorType getProcessorType(); 00042 00043 int getResolution(int device = 0); 00044 int getEDID(); 00045 bool setResolution(int resolution, int edidSlot); 00046 bool setHDCPOn(bool state); 00047 00048 enum aspectType { aspectFit = 1, aspectHFill = 2, aspectVFill = 3, aspect1to1 = 4, aspectSPKFill }; 00049 aspectType getAspect(); 00050 bool setAspect(aspectType aspect); 00051 00052 bool uploadEDID(FILE* file, int edidSlotIndex); 00053 bool uploadImage(FILE* file, int sisIndex); 00054 bool setMatroxResolutions(bool digitalEdition = true); 00055 00056 void setCommandTimeoutPeriod(int millis); 00057 int getCommandTimeoutPeriod(); 00058 void setCommandMinimumPeriod(int millis); 00059 void increaseCommandPeriods(int millis); 00060 void resetCommandPeriods(); 00061 00062 int millisSinceLastCommandSent(); 00063 00064 private: 00065 struct processorType processor; 00066 00067 bool command(commandType readWrite, int* ackBuffer, int ackLength, uint8_t channel, uint8_t window, int32_t func, int32_t payload); 00068 bool uploadFile(char command, FILE* file, int dataLength, int index); 00069 00070 bool getResolutionParams(int resStoreNumber, int &horizpx, int &vertpx); 00071 00072 bool set1920x480(int resStoreNumber); 00073 bool set1600x600(int resStoreNumber); 00074 bool set2048x768(int resStoreNumber, bool digitalEdition); 00075 00076 Serial *serial; 00077 Serial *debug; 00078 00079 int commandTimeoutPeriod; 00080 int commandMinimumPeriod; 00081 00082 Timer timer; 00083 Ticker timerCheckTicker; 00084 void timerCheck(); 00085 00086 DigitalOut *writeDO; 00087 DigitalOut *errorDO; 00088 Timeout signErrorTimeout; 00089 void signErrorOff(); 00090 }; 00091 00092 #endif
Generated on Wed Jul 13 2022 01:23:55 by 1.7.2