├── DFRobot_OSD.cpp ├── DFRobot_OSD.h ├── LICENSE ├── README.md ├── README_CN.md ├── examples └── DFRobot_OSD │ └── DFRobot_OSD.ino ├── keywords.txt ├── library.properties └── resources ├── images ├── OSD.png ├── config.png ├── eeprom1.png ├── eeprom2.png └── putout.png └── tool └── TheDotFactory-0.1.4.7z /DFRobot_OSD.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file DFRobot_OSD.cpp 3 | * @brief Define the infrastructure DFRobot_OSD class 4 | * @details This is a Library for OSD,the function is the superposition of characters. 5 | * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) 6 | * @license The MIT License (MIT) 7 | * @author [Luyuhao](yuhao.lu@dfrobot.com) 8 | * @maintainer [qsjhyy](yihuan.huang@dfrobot.com) 9 | * @version V1.0 10 | * @date 2022-05-19 11 | * @url https://github.com/DFRobot/DFRobot_OSD 12 | */ 13 | #include 14 | #include 15 | 16 | void DFRobot_OSD::writeAddrData(unsigned char addr, unsigned char value){ 17 | digitalWrite(nCS , LOW); 18 | SPI.transfer(addr); 19 | SPI.transfer(value); 20 | digitalWrite(nCS ,HIGH); 21 | } 22 | 23 | void DFRobot_OSD::writeData(unsigned char value){ 24 | digitalWrite(nCS , LOW); 25 | SPI.transfer(value); 26 | digitalWrite(nCS ,HIGH); 27 | } 28 | 29 | void DFRobot_OSD::clear(void){ 30 | unsigned int i; 31 | writeAddrData(DMAH, 0x00); // address 32 | writeAddrData(DMAL, 0); 33 | writeAddrData(DMM, 0x01); 34 | for (i = 0; i < (16*30); i++) { 35 | writeData(0); 36 | } 37 | writeData(0xff); 38 | } 39 | 40 | void DFRobot_OSD::displayChar(unsigned char row, unsigned char col, unsigned short addr){ 41 | unsigned short k; 42 | unsigned char addrH, j; 43 | 44 | k = row * 30 + col; 45 | addrH = k >> 8; 46 | writeAddrData(OSDBL,0X00); 47 | writeAddrData(DMM, 0x40); 48 | writeAddrData(DMAH, addrH | 0x2); 49 | writeAddrData(DMAL, k); 50 | j = CHAR_LBC << 5; 51 | if ((addr >> 8) != 0) 52 | j |= 0x10; 53 | writeAddrData(DMDI, j); 54 | writeAddrData(DMAH, addrH); 55 | writeAddrData(DMAL, k); 56 | writeAddrData(DMDI, addr); 57 | writeAddrData(VM0, 0x48); 58 | } 59 | 60 | void DFRobot_OSD::displayString(unsigned char row, unsigned char col, const char *s){ 61 | unsigned short k; 62 | unsigned char addrH, j; 63 | unsigned char c; 64 | unsigned short value; 65 | c = *s++; 66 | int flag = 0; 67 | k = row * 30 + col; 68 | writeAddrData(OSDBL,0X00); 69 | while (c != 0){ 70 | flag = 0; 71 | int i = 0; 72 | for(i = 0;i < 34;i++){ 73 | if (c == tAsciiAddr[i].ascii){ 74 | value = tAsciiAddr[i].addr; 75 | flag = 1; 76 | } 77 | } 78 | if(flag == 0){ 79 | if ((c >= '0') && (c <='9')) 80 | value = ((c == '0')? 10 : c - '1' + 1); 81 | else if ((c >= 'A') && (c <= 'Z')) 82 | value = (c - 'A' + 11); 83 | else if ((c >= 'a') && (c <= 'z')) 84 | value = (c - 'a' + 37); 85 | else 86 | value = (0x00); 87 | } 88 | 89 | addrH = k >> 8; 90 | writeAddrData(DMM, 0x40); 91 | writeAddrData(DMAH, addrH | 0x2); 92 | writeAddrData(DMAL, k); 93 | j = CHAR_LBC << 5; 94 | if ((value >> 8) != 0) 95 | j |= 0x10; 96 | writeAddrData(DMDI, j); 97 | writeAddrData(DMAH, addrH); 98 | writeAddrData(DMAL, k); 99 | writeAddrData(DMDI, value); 100 | c = *s++; 101 | k = k+1; 102 | } 103 | writeAddrData(VM0, 0x48); 104 | } 105 | 106 | void DFRobot_OSD::displayString(unsigned char row, unsigned char col, String s){ 107 | const char *str = s.c_str(); 108 | displayString(row,col,str); 109 | } 110 | 111 | void DFRobot_OSD::init(){ 112 | pinMode(nCS,OUTPUT); 113 | SPI.begin(); 114 | writeAddrData(VM0, 0x42); // Software Reset, takes 100us, PAL/NTSC???? 115 | writeAddrData(DMAH, 0x00); // address 116 | writeAddrData(DMAL, 68); 117 | writeAddrData(OSDM, 0x00); 118 | } 119 | 120 | DFRobot_OSD::DFRobot_OSD(int CS){ 121 | nCS = CS; 122 | } 123 | 124 | DFRobot_OSD::~DFRobot_OSD(){ 125 | 126 | } 127 | 128 | void DFRobot_OSD::writeAT7456E(unsigned short addr, int *dt){ 129 | unsigned char addrH, n; 130 | addrH = (addr >> 8); 131 | 132 | writeAddrData(VM0, (0x00)); 133 | delay(30); 134 | writeAddrData(CMAH, addr); 135 | 136 | writeAddrData(DMM, 0); 137 | 138 | for (n = 0; n < 54; n++) { 139 | char i = *dt; 140 | writeAddrData(CMAL, n | (addrH << 6)); 141 | writeAddrData(CMDI, i); 142 | dt++; 143 | } 144 | writeAddrData(CMM, RAM_NVM); 145 | delay(10); 146 | 147 | writeAddrData(VM0, 0x01<<3); 148 | } 149 | 150 | void DFRobot_OSD::storeChar(unsigned short addr,int temp[]){ 151 | int buf[54] = {0}; 152 | int dt[54] = {0}; 153 | int i = 0; 154 | int n = 0; 155 | int *p; 156 | for(i = 0;i < 54;i++){ 157 | if(i < 8){ 158 | dt[i] = 0; 159 | } 160 | else 161 | dt[i] = temp[i-8]; 162 | } 163 | for(i = 0;i < 18;i++){ 164 | p = extend(dt[i*2]); 165 | buf[n++] = *p; 166 | buf[n++] = *(p+1); 167 | p = extend(dt[i*2+1]); 168 | buf[n++] = *p; 169 | } 170 | writeAT7456E(addr,buf); 171 | } 172 | 173 | int *DFRobot_OSD::extend(int src){ 174 | int i = 0; 175 | src = unified(src); 176 | static int tar[2]; 177 | tar[0] = 0; 178 | tar[1] = 0; 179 | for(i = 0;i < 4;i++){ 180 | if((src>>i) & 0x01){ 181 | tar[0] = 0x02 |(tar[0]<< 2); 182 | } 183 | else 184 | tar[0] = 0x01|(tar[0]<< 2); 185 | } 186 | for(i = 4;i < 8;i++){ 187 | if((src>>i) & 0x01){ 188 | tar[1] = 0x02 | (tar[1] << 2); 189 | } 190 | else 191 | tar[1] = 0x01| (tar[1] << 2); 192 | } 193 | return tar; 194 | } 195 | 196 | int DFRobot_OSD::unified(int src){ 197 | int num = 0; 198 | int i = 0; 199 | for(i = 0;i<8;i++){ 200 | num = (num << 1)|((src >> i)&0x01); 201 | } 202 | return num; 203 | } -------------------------------------------------------------------------------- /DFRobot_OSD.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file DFRobot_OSD.h 3 | * @brief Define infrastructure of DFRobot_OSD class 4 | * @details This is a Library for OSD,the function is the superposition of characters. 5 | * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) 6 | * @license The MIT License (MIT) 7 | * @author [Luyuhao](yuhao.lu@dfrobot.com) 8 | * @maintainer [qsjhyy](yihuan.huang@dfrobot.com) 9 | * @version V1.0 10 | * @date 2022-05-19 11 | * @url https://github.com/DFRobot/DFRobot_OSD 12 | */ 13 | #ifndef _DFRobot_OSD_H_ 14 | #define _DFRobot_OSD_H_ 15 | 16 | #include 17 | 18 | 19 | // #define ENABLE_DBG //!< Open this macro and you can see the details of the program 20 | #ifdef ENABLE_DBG 21 | #define DBG(...) {Serial.print("[");Serial.print(__FUNCTION__); Serial.print("(): "); Serial.print(__LINE__); Serial.print(" ] "); Serial.println(__VA_ARGS__);} 22 | #else 23 | #define DBG(...) 24 | #endif 25 | 26 | 27 | /* at7456 */ 28 | #define VM0 0x00 ///< Video Mode0 29 | #define VM1 0x01 ///< Video Mode1 30 | #define HOS 0x02 ///< Horizontal Offset 31 | #define VOS 0x03 ///< Vertical Offset 32 | #define DMM 0x04 ///< Display Memory Mode 33 | #define DMAH 0x05 ///< Display Memory Address High 34 | #define DMAL 0x06 ///< Display Memory Address Low 35 | #define DMDI 0x07 ///< Display Memory Data In 36 | #define CMM 0x08 ///< Character Memory Mode 37 | #define CMAH 0x09 ///< Character Memory Address High 38 | #define CMAL 0x0a ///< Character Memory Address Low 39 | #define CMDI 0x0b ///< Character Memory Data In 40 | #define OSDM 0x0c ///< OSD Insertion Mux 41 | #define RB0 0x10 ///< Row 0 Brightness 42 | #define RB1 0x11 ///< Row 1 Brightness 43 | #define RB2 0x12 ///< Row 2 Brightness 44 | #define RB3 0x13 ///< Row 3 Brightness 45 | #define RB4 0x14 ///< Row 4 Brightness 46 | #define RB5 0x15 ///< Row 5 Brightness 47 | #define RB6 0x16 ///< Row 6 Brightness 48 | #define RB7 0x17 ///< Row 7 Brightness 49 | #define RB8 0x18 ///< Row 8 Brightness 50 | #define RB9 0x19 ///< Row 9 Brightness 51 | #define RB10 0x1a ///< Row 10 Brightness 52 | #define RB11 0x1b ///< Row 11 Brightness 53 | #define RB12 0x1c ///< Row 12 Brightness 54 | #define RB13 0x1d ///< Row 13 Brightness 55 | #define RB14 0x1e ///< Row 14 Brightness 56 | #define RB15 0x1f ///< Row 15 Brightness 57 | #define OSDBL 0x6c ///< OSD Black Level 58 | #define STAT 0x20 ///< Status 59 | #define DMDO 0x30 ///< Display Memory Data Out 60 | #define CMDO 0x40 ///< Character Memory Data Out 61 | #define NVM_RAM 0x50 ///< Read the fonts in the NVM into the mirror RAM 62 | #define RAM_NVM 0xa0 ///< Write the database data in the mirror RAM to the NVM 63 | /* VM0 */ 64 | #define NTSC (0 << 6) ///< D6 --- Vidoe Standard Select 65 | #define PAL (1 << 6) 66 | #define SYNC_AUTO (0 << 4) ///< D5,D4 --- Sync Select Mode 67 | #define SYNC_EXTERNAL (2 << 4) 68 | #define SYNC_INTERNAL (3 << 4) 69 | #define OSD_ENABLE (1 << 3) ///< D3 --- Enable Display of OSD image 70 | #define OSD_DISABLE (0 << 3) 71 | #define SOFT_RESET (1 << 1) ///< D1 --- Software Reset 72 | #define VOUT_ENABLE (0 << 0) 73 | #define VOUT_DISABLE (1 << 0) 74 | /* VM1 */ 75 | #define BACKGND_0 (0 << 4) ///< Background level WHT% 76 | #define BACKGND_7 (1 << 4) 77 | #define BACKGND_14 (2 << 4) 78 | #define BACKGND_21 (3 << 4) 79 | #define BACKGND_28 (4 << 4) 80 | #define BACKGND_35 (5 << 4) 81 | #define BACKGND_42 (6 << 4) 82 | #define BACKGND_49 (7 << 4) 83 | #define BLINK_TIME40 (0 << 2) ///< Blink cycle, ms 84 | #define BLINK_TIME80 (1 << 2) 85 | #define BLINK_TIME120 (2 << 2) 86 | #define BLINK_TIME160 (3 << 2) ///< Scintillation ratio(ON : OFF) 87 | #define BLINK_DUTY_1_1 0 ///< BT : BT 88 | #define BLINK_DUTY_1_2 1 ///< BT : 2BT 89 | #define BLINK_DUTY_1_3 2 ///< BT : 3BT 90 | #define BLINK_DUTY_3_1 3 ///< 3BT : BT // DMM 91 | #define SPI_BIT16 (0 << 6) ///< use 16bit When writing characters, and the character attribute is from the DMM[5:3] 92 | #define SPI_BIT8 (1 << 6) ///< Write characters in 8bit, and character attributes are written separately 93 | #define CHAR_LBC (1 << 5) ///< The local background 94 | #define CHAR_BLK (1 << 4) ///< blinking display 95 | #define CHAR_INV (1 << 3) ///< display negative image 96 | #define CLEAR_SRAM (1 << 2) ///< clear,20us 97 | #define VETICAL_SYNC (1 << 1) ///< The command is in sync with the action 98 | #define AUTO_INC (1 << 0) ///< The character address automatically increases 99 | /* RBi */ 100 | #define BLACK_LEVEL_0 (0 << 2) ///< 0% white level 101 | #define BLACK_LEVEL_10 (1 << 2) ///< 10% white level 102 | #define BLACK_LEVEL_20 (2 << 2) ///< 20% white level 103 | #define BLACK_LEVEL_30 (3 << 2) ///< 30% white level 104 | #define WHITE_LEVEL_120 (0 << 0) ///< 120% white level 105 | #define WHITE_LEVEL_100 (1 << 0) ///< 110% white level 106 | #define WHITE_LEVEL_90 (2 << 0) ///< 90% white level 107 | #define WHITE_LEVEL_80 (3 << 0) ///< 80% white level 108 | /* STAT */ 109 | #define PAL_DETECT (1 << 0) ///< Check the PAL signal 110 | #define NTSC_DETECT (1 << 1) ///< Check the NTSC signal 111 | #define LOS_DETECT (1 << 2) ///< Check the LOS signal 112 | #define VSYNC (1 << 4) ///< synchronous 113 | 114 | /** 115 | * @struct AsciiAddr 116 | * @brief Ascii corresponding address struct 117 | */ 118 | typedef struct 119 | { 120 | char ascii; 121 | short addr; 122 | }AsciiAddr; 123 | 124 | const AsciiAddr tAsciiAddr[]={ 125 | {' ',0x00}, 126 | {'(',0x3f}, 127 | {')',0x40}, 128 | {'.',0x41}, 129 | {'?',0x42}, 130 | {';',0x43}, 131 | {':',0x44}, 132 | {',',0x45}, 133 | {'\'',0x46}, 134 | {'/',0x47}, 135 | {'"',0x48}, 136 | {'-',0x49}, 137 | {'<',0x4a}, 138 | {'>',0x4b}, 139 | {'@',0x4c}, 140 | {'!',0x121}, 141 | {'#',0x123}, 142 | {'$',0x124}, 143 | {'%',0x125}, 144 | {'&',0x126}, 145 | {'(',0x128}, 146 | {')',0x129}, 147 | {'*',0x12a}, 148 | {'+',0x12b}, 149 | {'_',0x12d}, 150 | {'=',0x13d}, 151 | {'[',0x15b}, 152 | {']',0x15d}, 153 | {'^',0x15e}, 154 | {'`',0x160}, 155 | {'{',0x17b}, 156 | {'|',0x17c}, 157 | {'}',0x17d}, 158 | {'~',0x17e}, 159 | }; 160 | 161 | class DFRobot_OSD 162 | { 163 | public: 164 | /** 165 | * @fn DFRobot_OSD 166 | * @brief Constructor 167 | * @param CS - CS selection pin 168 | * @return None 169 | */ 170 | DFRobot_OSD(int CS); 171 | ~DFRobot_OSD(); 172 | 173 | /** 174 | * @fn init 175 | * @brief Init function 176 | * @return None 177 | */ 178 | void init(); 179 | 180 | /** 181 | * @fn displayChar 182 | * @brief display char 183 | * @param row - Horizontal coordinate, range(0,15) 184 | * @param col - Vertical coordinate, range(0,29) 185 | * @param value - addr of char in eeprom 186 | * @return None 187 | */ 188 | void displayChar(unsigned char row, unsigned char col, unsigned short addr); 189 | 190 | /** 191 | * @fn displayChar 192 | * @brief display string 193 | * @param row - Horizontal coordinate, range(0,15) 194 | * @param col - Vertical coordinate, range(0,29) 195 | * @param s - String 196 | * @return None 197 | */ 198 | void displayString(unsigned char row, unsigned char col, const char *s); 199 | void displayString(unsigned char row, unsigned char col, String s); 200 | 201 | /** 202 | * @fn clear 203 | * @brief Clear screen 204 | * @return None 205 | */ 206 | void clear(void); 207 | 208 | /** 209 | * @fn storeChar 210 | * @brief Write the custom character to the OSD, replacing the original character 211 | * @param addr - Address of the stored character 212 | * @param dt - Array generated through the tool 213 | * @return None 214 | */ 215 | void storeChar(unsigned short addr,int dt[]); 216 | 217 | private: 218 | void writeAddrData(unsigned char addr, unsigned char dat); 219 | void writeAT7456E(unsigned short addr, int *dt); 220 | void writeData(unsigned char dat); 221 | int * extend(int src); 222 | int unified(int src); 223 | 224 | private: 225 | int nCS; 226 | }; 227 | 228 | #endif 229 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 DFRobot Co.Ltd 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DFRobot_OSD 2 | * [中文版](./README_CN.md) 3 | 4 | OSD is the abbreviation of On-screen Display, this is a screen menu adjustment display technology to add different menu-style characters on the screen display. 5 | 6 | FireBeetle OSD Character Overlay Module is a new product presented by DFRobot. It adopts AT7456E OSD chip. This is a single-channel OSD module, equipped with functions like video drive, sync separator, video separate switch, etc. It comes with 512 bytes EEPROM user-defined storage space. After connected to video sources (AV Signals), the display covers 540x192 pixels which can show 16x30 characters on the screen. Users can also call font library to show characters and images. 7 | 8 | This FireBeetle OSD Character Overlay Module is compatible with FireBeetle series interfaces and can be directly plugged into FireBeetle mainboards. This module can be widely applied to device character display and time display of monitor device such as road cameras, home automation. 9 | 10 | ![产品实物图](./resources/images/OSD.png) 11 | 12 | 13 | ## Product Link (https://www.dfrobot.com/product-1700.html) 14 | SKU: DFR0515 15 | 16 | 17 | ## Table of Contents 18 | 19 | * [Summary](#summary) 20 | * [Installation](#installation) 21 | * [Methods](#methods) 22 | * [Compatibility](#compatibility) 23 | * [History](#history) 24 | * [Credits](#credits) 25 | 26 | 27 | ## Summary 28 | 29 | * This is a Library for OSD,the function is the superposition of characters.And You can display certain characters on screen. 30 | 31 | 32 | ## Installation 33 | 34 | There two methods: 35 | 36 | 1. To use this library, first download the library file, paste it into the \Arduino\libraries directory, then open the examples folder and run the demo in the folder. 37 | 2. Search the DFRobot_OSD library from the Arduino Software Library Manager and download it. 38 | 39 | 40 | ## Methods 41 | 42 | ```C++ 43 | 44 | /** 45 | * @fn DFRobot_OSD 46 | * @brief Constructor 47 | * @param CS - CS selection pin 48 | * @return None 49 | */ 50 | DFRobot_OSD(int CS); 51 | ~DFRobot_OSD(); 52 | 53 | /** 54 | * @fn init 55 | * @brief Init function 56 | * @return None 57 | */ 58 | void init(); 59 | 60 | /** 61 | * @fn displayChar 62 | * @brief display char 63 | * @param row - Horizontal coordinate, range(0,15) 64 | * @param col - Vertical coordinate, range(0,29) 65 | * @param value - addr of char in eeprom 66 | * @return None 67 | */ 68 | void displayChar(unsigned char row, unsigned char col, unsigned short addr); 69 | 70 | /** 71 | * @fn displayChar 72 | * @brief display string 73 | * @param row - Horizontal coordinate, range(0,15) 74 | * @param col - Vertical coordinate, range(0,29) 75 | * @param s - String 76 | * @return None 77 | */ 78 | void displayString(unsigned char row, unsigned char col, const char *s); 79 | void displayString(unsigned char row, unsigned char col, String s); 80 | 81 | /** 82 | * @fn clear 83 | * @brief Clear screen 84 | * @return None 85 | */ 86 | void clear(void); 87 | 88 | /** 89 | * @fn storeChar 90 | * @brief Write the custom character to the OSD, replacing the original character 91 | * @param addr - Address of the stored character 92 | * @param dt - Array generated through the tool 93 | * @return None 94 | */ 95 | void storeChar(unsigned short addr,int dt[]); 96 | 97 | ``` 98 | 99 | 100 | ## Compatibility 101 | 102 | MCU | Work Well | Work Wrong | Untested | Remarks 103 | -------------------- | :----------: | :----------: | :---------: | :----: 104 | FireBeetle-Board328P | √ | | | 105 | FireBeetle-ESP8266 | √ | | | 106 | FireBeetle-ESP32 | √ | | | 107 | Arduino Leonardo | √ | | | 108 | 109 | 110 | ## History 111 | 112 | - 2017-9-27 - Version 1.0.0 released. 113 | 114 | 115 | ## Credits 116 | 117 | Written by Luyuhao(yuhao.lu@dfrobot.com), 2017. (Welcome to our [website](https://www.dfrobot.com/)) 118 | 119 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # DFRobot_OSD 2 | * [English Version](./README.md) 3 | 4 | OSD是On-screen Display的简称,即屏幕菜单式调节方式。这是一种在屏幕上附加各类菜单式字符的技术。DFRobot新推出的OSD视频字符叠加模块,采用AT7456E高性能视频字符叠加芯片,该芯片集成了512Byte的EEPROM用户自定义存储空间,是一款单通道、单色随屏显示发生器,具备视频驱动、同步分离器、视频分离开关等功能。在接入视频源后(AV信号),可在视频上覆盖一层540x192像素点,可显示16x30个字符。用户可调取字库来显示相应文字或图案。 Firebeetle OSD字符叠加模块,兼容FireBeetle萤火虫接口,可以直接插接在FireBeetle萤火虫系列主板上。 5 | 6 | ![产品实物图](./resources/images/OSD.png) 7 | 8 | 9 | ## 产品链接 (https://www.dfrobot.com.cn/goods-1604.html) 10 | SKU: DFR0515 11 | 12 | 13 | ## 目录 14 | 15 | * [概述](#概述) 16 | * [库安装](#库安装) 17 | * [方法](#方法) 18 | * [兼容性](#兼容性) 19 | * [历史](#历史) 20 | * [创作者](#创作者) 21 | 22 | 23 | ## 概述 24 | 25 | * 这是一个用于OSD的库,函数是字符的叠加。你可以在屏幕上显示某些字符 26 | 27 | 28 | ## 库安装 29 | 30 | 这里有2种安装方法: 31 | 32 | 1. 使用此库前,请首先下载库文件,将其粘贴到\Arduino\libraries目录中,然后打开examples文件夹并在该文件夹中运行演示。 33 | 2. 直接在Arduino软件库管理中搜索下载 DFRobot_OSD 库。 34 | 35 | 36 | ## 方法 37 | 38 | ```C++ 39 | 40 | /** 41 | * @fn DFRobot_OSD 42 | * @brief Constructor 43 | * @param CS - CS selection pin 44 | * @return None 45 | */ 46 | DFRobot_OSD(int CS); 47 | ~DFRobot_OSD(); 48 | 49 | /** 50 | * @fn init 51 | * @brief Init function 52 | * @return None 53 | */ 54 | void init(); 55 | 56 | /** 57 | * @fn displayChar 58 | * @brief display char 59 | * @param row - Horizontal coordinate, range(0,15) 60 | * @param col - Vertical coordinate, range(0,29) 61 | * @param value - addr of char in eeprom 62 | * @return None 63 | */ 64 | void displayChar(unsigned char row, unsigned char col, unsigned short addr); 65 | 66 | /** 67 | * @fn displayChar 68 | * @brief display string 69 | * @param row - Horizontal coordinate, range(0,15) 70 | * @param col - Vertical coordinate, range(0,29) 71 | * @param s - String 72 | * @return None 73 | */ 74 | void displayString(unsigned char row, unsigned char col, const char *s); 75 | void displayString(unsigned char row, unsigned char col, String s); 76 | 77 | /** 78 | * @fn clear 79 | * @brief Clear screen 80 | * @return None 81 | */ 82 | void clear(void); 83 | 84 | /** 85 | * @fn storeChar 86 | * @brief Write the custom character to the OSD, replacing the original character 87 | * @param addr - Address of the stored character 88 | * @param dt - Array generated through the tool 89 | * @return None 90 | */ 91 | void storeChar(unsigned short addr,int dt[]); 92 | 93 | ``` 94 | 95 | 96 | ## 兼容性 97 | 98 | MCU | Work Well | Work Wrong | Untested | Remarks 99 | -------------------- | :----------: | :----------: | :---------: | :----: 100 | FireBeetle-Board328P | √ | | | 101 | FireBeetle-ESP8266 | √ | | | 102 | FireBeetle-ESP32 | √ | | | 103 | Arduino Leonardo | √ | | | 104 | 105 | 106 | ## 历史 107 | 108 | - 2017-9-27 - 1.0.0 版本 109 | 110 | 111 | ## 创作者 112 | 113 | Written by Luyuhao(yuhao.lu@dfrobot.com), 2017. (Welcome to our [website](https://www.dfrobot.com/)) 114 | 115 | -------------------------------------------------------------------------------- /examples/DFRobot_OSD/DFRobot_OSD.ino: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file periodMeasure.ino 3 | * @brief character superimposition. 4 | * @n This example Set characters on the screen. 5 | * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) 6 | * @license The MIT License (MIT) 7 | * @author [Luyuhao](yuhao.lu@dfrobot.com) 8 | * @maintainer [qsjhyy](yihuan.huang@dfrobot.com) 9 | * @version V1.0 10 | * @date 2017-10-09 11 | * @url https://github.com/DFRobot/DFRobot_OSD 12 | */ 13 | #include 14 | 15 | /*select CS pin*/ 16 | #ifdef __AVR__ 17 | int cs = 3; 18 | #elif defined ESP_PLATFORM 19 | int cs = D3; 20 | #elif defined __ets__ 21 | int cs = D3; 22 | #else 23 | #error unknow board 24 | #endif 25 | 26 | DFRobot_OSD osd(cs); 27 | 28 | /*Define Chinese characters*/ 29 | int buf0[36] = {0x02,0x80,0x02,0x40,0x7F,0xE0,0x42,0x00,0x42,0x00,0x7A,0x40,0x4A,0x40,0x4A,0x80,0x49,0x20,0x5A,0xA0,0x44,0x60,0x88,0x20}; 30 | int buf1[36] = {0x20,0x00,0x25,0xE0,0x75,0x20,0x29,0x20,0xFD,0x40,0x21,0x40,0x7D,0x20,0xC5,0x20,0x7D,0x20,0x45,0xC0,0x7D,0x00,0x45,0x00}; 31 | int buf2[36] = {0x20,0x00,0x2F,0xC0,0x24,0x40,0xF4,0x40,0x24,0x80,0x64,0xE0,0x74,0x20,0xA6,0x20,0x25,0x40,0x28,0x80,0x29,0x40,0x32,0x20}; 32 | int buf3[36] = {0x3F,0x00,0x2A,0xE0,0xFA,0x20,0x2E,0xA0,0x2A,0xA0,0xFE,0xA0,0x2A,0x40,0xAB,0x40,0xBE,0xA0,0xA3,0x20,0xE2,0x00,0xBF,0xE0}; 33 | 34 | void setup(){ 35 | osd.init(); 36 | osd.clear(); 37 | /* Write the custom character to the OSD, replacing the original character*/ 38 | /* Expand 0xe0 to 0x0e0, the high 8 bits indicate page number and the low 8 bits indicate the inpage address.*/ 39 | osd.storeChar(0xe0,buf0); 40 | osd.storeChar(0xe1,buf1); 41 | osd.storeChar(0xe2,buf2); 42 | osd.storeChar(0xe3,buf3); 43 | /*Displays custom characters*/ 44 | osd.displayChar(2,2,0xe0); 45 | osd.displayChar(2,3,0xe1); 46 | osd.displayChar(2,4,0xe2); 47 | osd.displayChar(2,5,0xe3); 48 | /*display character*/ 49 | osd.displayChar(9,9,0x11d); 50 | osd.displayChar(9,10,0x11e); 51 | osd.displayChar(8,11,0x10f); 52 | /*display String*/ 53 | const char* str1 = "DFRobot"; 54 | String str2 = "2017.9.12"; 55 | String str3(3.14); 56 | 57 | osd.displayString(14,21,str1); 58 | osd.displayString(2,19,str2); 59 | osd.displayString(4,19,str3); 60 | osd.displayString(4,2,"hello world!"); 61 | } 62 | 63 | void loop(){ 64 | 65 | } -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Grove - Serial LCD GRB BackLight 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | DFRobot_OSD KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | DFRobot_OSD KEYWORD2 14 | init KEYWORD2 15 | displayChar KEYWORD2 16 | displayString KEYWORD2 17 | clear KEYWORD2 18 | storeChar KEYWORD2 19 | writeAT7456E KEYWORD2 20 | 21 | ####################################### 22 | # Constants (LITERAL1) 23 | ####################################### 24 | VM0 LITERAL1 25 | VM1 LITERAL1 26 | HOS LITERAL1 27 | VOS LITERAL1 28 | DMM LITERAL1 29 | DMAH LITERAL1 30 | DMAL LITERAL1 31 | DMDI LITERAL1 32 | CMM LITERAL1 33 | CMAH LITERAL1 34 | CMAL LITERAL1 35 | CMDI LITERAL1 36 | OSDM LITERAL1 37 | RB0 LITERAL1 38 | RB1 LITERAL1 39 | RB2 LITERAL1 40 | RB3 LITERAL1 41 | RB4 LITERAL1 42 | RB5 LITERAL1 43 | RB6 LITERAL1 44 | RB7 LITERAL1 45 | RB8 LITERAL1 46 | RB9 LITERAL1 47 | RB10 LITERAL1 48 | RB11 LITERAL1 49 | RB12 LITERAL1 50 | RB13 LITERAL1 51 | RB14 LITERAL1 52 | RB15 LITERAL1 53 | OSDBL LITERAL1 54 | STAT LITERAL1 55 | DMDO LITERAL1 56 | CMDO LITERAL1 57 | NVM_RAM LITERAL1 58 | RAM_NVM LITERAL1 59 | NTSC LITERAL1 60 | PAL LITERAL1 61 | SYNC_AUTO LITERAL1 62 | SYNC_EXTERNAL LITERAL1 63 | SYNC_INTERNAL LITERAL1 64 | OSD_ENABLE LITERAL1 65 | OSD_DISABLE LITERAL1 66 | SOFT_RESET LITERAL1 67 | VOUT_ENABLE LITERAL1 68 | VOUT_DISABLE LITERAL1 69 | BACKGND_0 LITERAL1 70 | BACKGND_7 LITERAL1 71 | BACKGND_14 LITERAL1 72 | BACKGND_21 LITERAL1 73 | BACKGND_28 LITERAL1 74 | BACKGND_35 LITERAL1 75 | BACKGND_42 LITERAL1 76 | BACKGND_49 LITERAL1 77 | BLINK_TIME40 LITERAL1 78 | BLINK_TIME80 LITERAL1 79 | BLINK_TIME120 LITERAL1 80 | BLINK_TIME160 LITERAL1 81 | BLINK_DUTY_1_1 LITERAL1 82 | BLINK_DUTY_1_2 LITERAL1 83 | BLINK_DUTY_1_3 LITERAL1 84 | BLINK_DUTY_3_1 LITERAL1 85 | SPI_BIT16 LITERAL1 86 | SPI_BIT8 LITERAL1 87 | CHAR_LBC LITERAL1 88 | CHAR_BLK LITERAL1 89 | CHAR_INV LITERAL1 90 | CLEAR_SRAM LITERAL1 91 | VETICAL_SYNC LITERAL1 92 | AUTO_INC LITERAL1 93 | BLACK_LEVEL_0 LITERAL1 94 | BLACK_LEVEL_10 LITERAL1 95 | BLACK_LEVEL_20 LITERAL1 96 | BLACK_LEVEL_30 LITERAL1 97 | WHITE_LEVEL_120 LITERAL1 98 | WHITE_LEVEL_100 LITERAL1 99 | WHITE_LEVEL_90 LITERAL1 100 | WHITE_LEVEL_80 LITERAL1 101 | PAL_DETECT LITERAL1 102 | NTSC_DETECT LITERAL1 103 | LOS_DETECT LITERAL1 104 | VSYNC LITERAL1 105 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=DFRobot_OSD 2 | version=1.0.0 3 | author=DFRobot 4 | maintainer=qsjhyy 5 | sentence=This is a Library for OSD,the function is the superposition of characters(SKU: DFR0515). 6 | paragraph=This is a Library for OSD,the function is the superposition of characters.And You can display certain characters on screen. 7 | category=Display 8 | url=https://github.com/DFRobot/DFRobot_OSD 9 | architectures=* 10 | -------------------------------------------------------------------------------- /resources/images/OSD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DFRobot/DFRobot_OSD/212b5a3e44d034efecd3675b4093eaac87656823/resources/images/OSD.png -------------------------------------------------------------------------------- /resources/images/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DFRobot/DFRobot_OSD/212b5a3e44d034efecd3675b4093eaac87656823/resources/images/config.png -------------------------------------------------------------------------------- /resources/images/eeprom1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DFRobot/DFRobot_OSD/212b5a3e44d034efecd3675b4093eaac87656823/resources/images/eeprom1.png -------------------------------------------------------------------------------- /resources/images/eeprom2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DFRobot/DFRobot_OSD/212b5a3e44d034efecd3675b4093eaac87656823/resources/images/eeprom2.png -------------------------------------------------------------------------------- /resources/images/putout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DFRobot/DFRobot_OSD/212b5a3e44d034efecd3675b4093eaac87656823/resources/images/putout.png -------------------------------------------------------------------------------- /resources/tool/TheDotFactory-0.1.4.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DFRobot/DFRobot_OSD/212b5a3e44d034efecd3675b4093eaac87656823/resources/tool/TheDotFactory-0.1.4.7z --------------------------------------------------------------------------------