{ "info": { "author": "Stefan Mavrodiev", "author_email": "support@olimex.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Scientific/Engineering :: Visualization" ], "description": "=======================\nMOD-OLED-128x64 Library\n=======================\n\nIntroduction\n------------\nPython library for interfacing MOD-OLED-128x64 with OLinuXino boards.\nSSD1306 controller support SPI, I2C and parallel interface, but with\nthis module only I2C is usable.\n\nBy default i2c-1 and i2c-2 buses use 100kHz clock. This means that you can \nachieve around 8 frames per second. You can use i2c-0 which in most OLinuXino boards\nis running at 400kHz (around 25 fps, because this bus is used also for the PMU module).\nYou can speed things up by using smaller than 128x64 display area.\n\nRequirements\n------------\nThis package needs the following modules:\n\n- smbus-cffi\n\nInstallation\n------------\n\nFrom GitHub:\n\n.. code-block:: bash\n\n git clone https://github.com/SelfDestroyer/pyMOD-OLED.git\n cd pyMOD-OLED\n python setup.py install\n\nFrom PyPi:\n\n.. code-block:: bash\n\n wget https://pypi.python.org/packages/source/m/mod-oled-128x64/mod-oled-128x64-0.0.3.tar.gz\n tar -zxf mod-oled-128x64-0.0.3.tar.gz\n cd mod-oled-128x64-0.0.3\n python setup.py install\n\nUsing pip:\n\n.. code-block:: bash\n\n pip install mod-oled-128x64\n\nUsage\n-----\nThere are 3 modules in this package:\n\n- OLED - Main class for control. Here you can make all the setup that you need.\n- Font - Contains basic font table and has ability to write characters from it.\n- Graphics - Basic drawing methods - pixel, line and circle.\n\n\nTo import module use:\n\n.. code-block:: python\n\n from oled import OLED\n from oled import Font\n from oled import Graphics\n\n\nComplete example:\n\n.. code-block:: python\n\n from oled import OLED\n from oled import Font\n from oled import Graphics\n\n # Connect to the display on /dev/i2c-0\n dis = OLED(0)\n\n # Start communication\n dis.begin()\n\n # Start basic initialization\n dis.initialize()\n\n # Do additional configuration\n dis.set_memory_addressing_mode(0)\n dis.set_column_address(0, 127)\n dis.set_page_address(0, 7)\n\n # Clear display\n dis.clear()\n\n # Set font scale x2\n f = Font(2)\n\n # Print some large text\n f.print_string(6, 0, \"OLIMEX LTD\")\n\n # Change font to 5x7\n f.scale = 1\n f.print_string(0, 24, \"MOD-OLED-128x64\")\n f.print_string(0, 32, \"olimex.com\")\n\n # Send video buffer to display\n dis.update()\n\n # Make horizontal scroll\n dis.horizontal_scroll_setup(dis.LEFT_SCROLL, 3, 3, 7)\n dis.activate_scroll()\n\n # Only the last scroll setup is active\n dis.horizontal_scroll_setup(dis.LEFT_SCROLL, 4, 4, 7)\n dis.activate_scroll()\n\n # Draw line\n Graphics.draw_pixel(0, 0)\n Graphics.draw_line(0, 60, 100, 63)\n dis.update()\n\nClasses and methods\n-------------------\n\n**class class oled.OLED(i2c, address=60)**\n\n *activate_scroll()*\n\n Activate Scroll (2Fh)\n\n This command starts the motion of scrolling and should only be\n issued after the scroll setup parameters have been defined by\n the scrolling setup commands :26h/27h/29h/2Ah . The setting in\n the last scrolling setup command overwrites the setting in the\n previous scrolling setup commands.\n\n The following actions are prohibited after the scrolling is\n activated\n RAM access (Data write or read)\n\n Changing the horizontal scroll setup parameters\n\n *begin()*\n\n Create communication object\n\n *charge_pump_setting(on)*\n\n Charge Pump Regulator (8Dh)\n\n Parameters:\n **on** -- True - Enable charge pump during display on False -\n Disable charge pump(RESET)\n\n *clear(update=True)*\n\n Clear video buffer\n\n Parameters:\n **update** -- If true send the empty buffer to the controller\n\n *close()*\n\n Close I2C bus and delete communication object\n\n *deactivate_scroll()*\n\n Deactivate scroll (2Eh)\n\n This command stops the motion of scrolling. After sending 2Eh\n command to deactivate the scrolling action,the ram data needs to\n be rewritten.\n\n *entire_display_on(status)*\n\n Entire Display ON (A4h/A5h)\n\n A4h command enable display outputs according to the GDDRAM\n contents.If A5h command is issued, then by using A4h command,\n the display will resume to the GDDRAM contents. In other words,\n A4h command resumes the display from entire display \u201cON\u201d stage.\n A5h command forces the entire display to be \u201cON\u201d, regardless of\n the contents of the display data RAM.\n\n Parameters:\n **status** -- True - Entire display ON. Output ignores RAM\n content False - Resume to RAM content display (RESET). Output\n follows RAM content\n\n *horizontal_scroll_setup(direction, start_page, end_page, speed)*\n\n Horizontal Scroll Setup (26h/27h)\n\n This command consists of consecutive bytes to set up the\n horizontal scroll parameters and determines the scrolling start\n page, end page and scrolling speed. Before issuing this command\n the horizontal scroll must be deactivated (2Eh). Otherwise, RAM\n content may be corrupted.\n\n Parameters:\n * **direction** -- 0 - Right Horizontal Scroll 1 - Left\n Horizontal Scroll\n\n * **start_page** -- Define start page address - PAGE0 ~\n PAGE7\n\n * **end_page** -- Define end page address - PAGE0 ~ PAGE7\n\n * **speed** -- Set time interval between each roll step in\n terms of frame frequency: 0 - 5 frames 1 - 64 frames 2 -\n 128 frames 3 - 256 frames 4 - 3 frames 5 - 4 frames 6 - 25\n frames 7 - 2 frames\n\n Raises ValueError:\n Start page cannot be larger than end page\n\n *initialize()*\n\n Basic display initialization\n\n *send_data(data)*\n\n Send data in packets by 16 bytes\n\n Parameters:\n **data** -- Data to be send\n\n *send_nop()*\n\n NOP (E3h)\n\n No operation command\n\n *set_column_address(column_start_address, column_end_address)*\n\n Set Column Address (21h)\n\n This triple byte command specifies column start address and end\n address of the display data RAM. This command also sets the\n column address pointer to column start address. This pointer is\n used to define the current read/write column address in graphic\n display data RAM. If horizontal address increment mode is\n enabled by command 20h, after finishing read/write one column\n data, it is incremented automatically to the next column\n address. Whenever the column address pointer finishes accessing\n the end column address, it is reset back to start column address\n and the row address is incremented to the next row.\n\n Parameters:\n * **column_start_address** -- Column start address, range :\n 0-127d, (RESET=0d)\n\n * **column_end_address** -- Column end address, range :\n 0-127d, (RESET =127d)\n\n Raises MethodError:\n This command is only for horizontal or vertical addressing\n mode.\n\n *set_com_pins_configuration(configuration, remap)*\n\n Set COM Pins Hardware Configuration (DAh)\n\n This command sets the COM signals pin configuration to match the\n OLED panel hardware layout. Refer to datasheet section 10.1.18\n for detailed information.\n\n Parameters:\n * **configuration** -- 0 - Sequential COM pin\n configuration, 1 - Alternative COM pin configuration\n (RESET)\n\n * **remap** -- 0 - Disable COM Left/Right remap (RESET) 1 -\n Enable COM Left/Right remap\n\n *set_contrast_control(contrast)*\n\n Set Contrast Control for BANK0 (81h)\n\n This command sets the Contrast Setting of the display. The chip\n has 256 contrast steps from 00h to FFh. The segment output\n current increases as the contrast step value increases.\n\n Parameters:\n **contrast** -- Double byte command to select 1 out of 256\n contrast steps. Contrast increases as the value increases.\n (RESET = 7Fh )\n\n *set_deselect_level(level)*\n\n Set Vcomh deselect level (DBh)\n\n This command adjust the Vcomh regulator output.\n\n Parameters:\n **level** -- 0, 1 or 2 0 ~ 0.65 * Vcc 1 ~ 0.77 * Vcc (RESET)\n 2 ~ 0.83 * Vcc\n\n *set_display_clock(divider, osc_freq)*\n\n Set Display Clock Divide Ratio/Oscillator Frequency (D5h)\n\n This command consists of two functions:\n\n * Display Clock Divide Ratio (D)(A[3:0])\n\n Set the divide ratio to generate DCLK (Display Clock) from\n CLK. The divide ratio is from 1 to 16, with reset value = 1.\n Please refer to section 8.3 for the details relationship of\n DCLK and CLK.\n\n * Oscillator Frequency (A[7:4])\n\n Program the oscillator frequency Fosc that is the source of\n CLK if CLS pin is pulled high. The 4-bit value results in 16\n different frequency settings available as shown below. The\n default setting is 1000b.\n\n Parameters:\n * **divider** -- Define the divide ratio (D) of the display\n clocks (DCLK): Dvide ration = DIVIDER + 1, RESET is 0\n (divide ratio = 1)\n\n * **osc_freq** -- Set the Oscillator Frequncy, Fosc.\n Oscillator Frequency increases with the value of OSC_FREQ\n and vice versa. RESET is 1000b. Range: 0000b ~ 1111b.\n\n *set_display_offset(offset)*\n\n Set Display Offset (D3h)\n\n This is a double byte command. The second command specifies\n the mapping of the display start line to one of COM0~COM63\n (assuming that COM0 is the display start line then the\n display start line register is equal to 0). For example, to\n move the COM16 towards the COM0 direction by 16 lines the\n 6-bit data in the second byte should be given as 010000b. To\n move in the opposite direction by 16 lines the 6-bit data\n should be given by 64 \u2013 16, so the second byte would be\n 100000b.\n\n Parameters:\n **offset** -- Set vertical shift by COM from 0d~63d The value\n is reset to 00h after RESET.\n\n *set_display_on_off(on)*\n\n Set Display ON/OFF (AEh/AFh)\n\n These single byte commands are used to turn the OLED panel\n display ON or OFF. When the display is ON, the selected circuits\n by Set Master Configuration command will be turned ON. When the\n display is OFF, those circuits will be turned OFF and the\n segment and common output are in VSS state and high impedance\n state, respectively.\n\n Parameters:\n **on** -- True - Display ON False - Display OFF\n\n *set_display_start_line(start_line)*\n\n Set Display Start Line (40h~7Fh)\n\n This command sets the Display Start Line register to determine\n starting address of display RAM, by selecting a value from 0 to\n 63. With value equal to 0, RAM row 0 is mapped to COM0. With\n value equal to 1, RAM row 1 is mapped to COM0 and so on.\n\n Parameters:\n **start_line** -- Set display RAM display start line register\n from 0-63. Display start line register is reset to 000000b\n during RESET.\n\n *set_higher_column(column)*\n\n Set Higher Column Start Address for Page Addressing Mode\n (10h~1Fh)\n\n This command specifies the higher nibble of the 8-bit column\n start address for the display data RAM under Page Addressing\n Mode. The column address will be incremented by each data\n access.\n\n Parameters:\n **column** -- Set the higher nibble of the column start\n address register for Page Addressing Mode using X[3:0] as\n data bits. The initial display line register is reset to\n 0000b after RESET.\n\n Raises MethodError:\n This command is only for page addressing mode\n\n *set_inverse_display(inverse)*\n\n Set Normal/Inverse Display (A6h/A7h)\n\n This command sets the display to be either normal or inverse. In\n normal display a RAM data of 1 indicates an \u201cON\u201d pixel while in\n inverse display a RAM data of 0 indicates an \u201cON\u201d pixel.\n\n Parameters:\n **inverse** -- True - Inverse display False - ormal display\n (RESET)\n\n *set_lower_column(column)*\n\n Set Lower Column Start Address for Page Addressing Mode\n (00h~0Fh)\n\n This command specifies the lower nibble of the 8-bit column\n start address for the display data RAM under Page Addressing\n Mode. The column address will be incremented by each data\n access.\n\n Parameters:\n **column** -- Set the lower nibble of the column start\n address register for Page Addressing Mode using X[3:0] as\n data bits. The initial display line register is reset to\n 0000b after RESET.\n\n Raises MethodError:\n This command is only for page addressing mode\n\n *set_memory_addressing_mode(mode)*\n\n Set Memory Addressing Mode (20h)\n\n There are 3 different memory addressing mode in SSD1306: page\n addressing mode, horizontal addressing mode and vertical\n addressing mode. This command sets the way of memory addressing\n into one of the above three modes. In there, \u201cCOL\u201d means the\n graphic display data RAM column.\n\n Parameters:\n **mode** --\n\n 2 - Page addressing mode In page addressing mode, after the\n display RAM is read/written, the column address pointer is\n increased automatically by 1. If the column address pointer\n reaches column end address, the column address pointer is\n reset to column start address and page address pointer is not\n changed. Users have to set the new page and column addresses\n in order to access the next page RAM content.\n\n 0 - Horizontal addressing mode In horizontal addressing mode,\n after the display RAM is read/written, the column address\n pointer is increased automatically by 1. If the column\n address pointer reaches column end address, the column\n address pointer is reset to column start address and page\n address pointer is increased by 1. When both column and page\n address pointers reach the end address, the pointers are\n reset to column start address and page start address.\n\n 1 - Vertical addressing mode In vertical addressing mode,\n after the display RAM is read/written, the page address\n pointer is increased automatically by 1. If the page address\n pointer reaches the page end address, the page address\n pointer is reset to page start address and column address\n pointer is increased by 1. When both column and page address\n pointers reach the end address, the pointers are reset to\n column start address and page start address\n\n *set_multiplex_ratio(ratio)*\n\n Set Multiplex Ratio (A8h)\n\n This command switches the default 63 multiplex mode to any\n multiplex ratio, ranging from 16 to 63. The output pads\n COM0~COM63 will be switched to the corresponding COM signal.\n\n Parameters:\n **ratio** -- Set MUX ratio to N+1 MUX N=A[5:0] : from 16MUX\n to 64MUX, RESET= 111111b (i.e. 63d, 64MUX) A[5:0] from 0 to\n 14 are invalid entry.\n\n *set_page_address(page_start_address, page_end_address)*\n\n Set Page Address (22h)\n\n This triple byte command specifies page start address and end\n address of the display data RAM. This command also sets the page\n address pointer to page start address. This pointer is used to\n define the current read/write page address in graphic display\n data RAM. If vertical address increment mode is enabled by\n command 20h, after finishing read/write one page data, it is\n incremented automatically to the next page address. Whenever\n the page\n\n address pointer finishes accessing the end page address, it\n is reset back to start page address.\n\n Parameters:\n * **page_start_address** -- Page start Address, range :\n 0-7d, (RESET = 0d)\n\n * **page_end_address** -- Page end Address, range : 0-7d,\n (RESET = 7d)\n\n Raises MethodError:\n This command is only for horizontal or vertical addressing\n mode.\n\n *set_page_start_address(page)*\n\n Set Page Start Address for Page Addressing Mode (B0h~B7h)\n\n This command positions the page start address from 0 to 7 in\n GDDRAM under Page Addressing Mode.\n\n Parameters:\n **page** -- Set GDDRAM Page Start Address (PAGE0~PAGE7) for\n Page Addressing Mode using X[2:0].\n\n Raises MethodError:\n This command is only for page addressing mode\n\n *set_precharge_period(phase1, phase2)*\n\n Set Pre-charge Period (D9h)\n\n This command is used to set the duration of the pre-charge\n period. The interval is counted in number of DCLK, where RESET\n equals 2 DCLKs.\n\n Parameters:\n * **phase1** -- Phase 1 period of up to 15 DCLK clocks, 0\n is invalid entry (RESET = 2h)\n\n * **phase2** -- Phase 2 period of up to 15 DCLK clocks, 0\n is invalid entry (RESET = 2h)\n\n *set_scan_direction(remapped)*\n\n Set COM Output Scan Direction (C0h/C8h)\n\n This command sets the scan direction of the COM output allowing\n layout flexibility in the OLED module design. Additionally, the\n display will show once this command is issued. For example, if\n this command is sent during normal display then the graphic\n display will be vertically flipped immediately.\n\n Parameters:\n **remapped** -- True - remapped mode. Scan from COM[N-1] to\n COM0 False - normal mode. Scan from COM0 to COM[N \u20131] (RESET)\n Where N is the Multiplex ratio.\n\n *set_segment_remap(remap)*\n\n Set Segment Re-map (A0h/A1h)\n\n This command changes the mapping between the display data column\n address and the segment driver. It allows flexibility in OLED\n module design. Please refer to Table 9-1.\n\n This command only affects subsequent data input. Data already\n stored in GDDRAM will have no changes.\n\n Parameters:\n **remap** -- True - column address 127 is mapped to SEG0\n False - column address 0 is mapped to SEG0 (RESET)\n\n *set_vertical_scroll_area(start, count)*\n\n Set Vertical Scroll Area(A3h)\n\n This command consists of 3 consecutive bytes to set up the\n vertical scroll area. For the continuous vertical scroll\n function (command 29/2Ah), the number of rows that in vertical\n scrolling can be set smaller or equal to the MUX ratio.\n\n Parameters:\n * **start** -- Set No. of rows in top fixed area. The No.\n of rows in top fixed area is referenced to the top of the\n GDDRAM (i.e. row 0).[RESET =0]\n\n * **count** -- Set No. of rows in scroll area. This is the\n number of rows to be used for vertical scrolling. The\n scroll area starts in the first row below the top fixed\n area. [RESET = 64]\n\n Raises ValueError:\n\n *update()*\n\n Send video buffer to the controller\n\n *vertical_and_horizontal_scroll_setup(direction, start_page, end_page, speed, vertical_offset)*\n\n Continuous Vertical and Horizontal Scroll Setup (29h/2Ah)\n\n This command consists of 6 consecutive bytes to set up the\n continuous vertical scroll parameters and determines the\n scrolling start page, end page, scrolling speed and vertical\n scrolling offset.\n\n The bytes B[2:0], C[2:0] and D[2:0] of command 29h/2Ah are for\n the setting of the continuous horizontal scrolling. The byte\n E[5:0] is for the setting of the continuous vertical scrolling\n offset. All these bytes together are for the setting of\n continuous diagonal (horizontal + vertical) scrolling. If the\n vertical scrolling offset byte E[5:0] is set to zero, then only\n horizontal scrolling is performed (like command 26/27h).\n\n Before issuing this command the scroll must be deactivated\n (2Eh). Otherwise, RAM content may be corrupted.\n\n Parameters:\n * **direction** -- 0 - Vertical and Right Horizontal Scroll\n 1 - Vertical and Left Horizontal Scroll\n\n * **start_page** -- Define start page address - PAGE0 ~\n PAGE7\n\n * **end_page** -- Define end page address - PAGE0 ~ PAGE7\n\n * **speed** -- Set time interval between each roll step in\n terms of frame frequency: 0 - 5 frames 1 - 64 frames 2 -\n 128 frames 3 - 256 frames 4 - 3 frames 5 - 4 frames 6 - 25\n frames 7 - 2 frames\n\n * **vertical_offset** -- Vertical scrolling offset e.g. 01h\n refer to offset = 1 row 3Fh refer to offset = 63 rows\n\n Raises ValueError:\n Start page cannot be larger than end page\n\n\n**class class oled.Font(scale=1)**\n\n *print_char(x, y, ch)*\n\n Print single char at location\n\n Parameters:\n * **x** -- X location\n\n * **y** -- Y location\n\n * **ch** -- ASCII code for char\n\n *print_string(x0, y0, string)*\n\n Print string to display.\n\n Parameters:\n * **x0** -- Start X position\n\n * **y0** -- Start Y position\n\n * **string** -- String to display\n\n Returns: None\n\n\n**class class oled.Graphics**\n\n *classmethod draw_circle(x0, y0, r)*\n\n Draw singled circle\n\n Parameters:\n * **x0** -- Center x location\n\n * **y0** -- Center y location\n\n * **r** -- Radius\n\n *classmethod draw_line(x0, y0, x1, y1)*\n\n Draw single line\n\n Parameters:\n * **x0** -- Start x location\n\n * **y0** -- Start y location\n\n * **x1** -- End x location\n\n * **y1** -- End y location\n\n *classmethod draw_pixel(x, y, on=True)*\n\n Draw single pixel to video buffer\n\n Parameters:\n * **x** -- X location\n\n * **y** -- Y location\n\n * **on** -- True - Set pixel, False - clear pixel\n\n0.0.4 (2015-03-21)\n==================\n\n- Fixed pypi archieve.\n\n0.0.3 (2015-06-18)\n==================\n\n- Added detailed readme\n\n0.0.1 (2015-06-17)\n==================\n\n- Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SelfDestroyer/pyMOD-OLED", "keywords": "oled OLinuXino", "license": "GPL2", "maintainer": null, "maintainer_email": null, "name": "mod-oled-128x64", "package_url": "https://pypi.org/project/mod-oled-128x64/", "platform": "ARM", "project_url": "https://pypi.org/project/mod-oled-128x64/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/SelfDestroyer/pyMOD-OLED" }, "release_url": "https://pypi.org/project/mod-oled-128x64/0.0.4/", "requires_dist": null, "requires_python": null, "summary": "Control module for MOD-OLED-128x64", "version": "0.0.4" }, "last_serial": 2018548, "releases": { "0.0.2": [], "0.0.3": [ { "comment_text": "", "digests": { "md5": "c66c4c3fdad69a9b4d82c10b20b71523", "sha256": "b9f4f5e04e51b8afe8fdb7f823702e93b91af9b62f9753682352ed0e74fe419a" }, "downloads": -1, "filename": "mod-oled-128x64-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c66c4c3fdad69a9b4d82c10b20b71523", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32888, "upload_time": "2015-06-18T08:17:05", "url": "https://files.pythonhosted.org/packages/c0/a7/f45e6d401d2b6256547528a9550d346c43477b17afe60aef9d86b554b88d/mod-oled-128x64-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "6488120a8de67704103b1c0997e9f48c", "sha256": "6c366f1bd48bca10e0b6bca0e9e86e7703c5e977eb45c469d7083b0419a338b3" }, "downloads": -1, "filename": "mod-oled-128x64-0.0.4.tar.gz", "has_sig": false, "md5_digest": "6488120a8de67704103b1c0997e9f48c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33025, "upload_time": "2016-03-21T12:31:03", "url": "https://files.pythonhosted.org/packages/47/be/c9188ff20a98143b44bcac44339187a5c3ea7d4f5926c488d31c22346869/mod-oled-128x64-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6488120a8de67704103b1c0997e9f48c", "sha256": "6c366f1bd48bca10e0b6bca0e9e86e7703c5e977eb45c469d7083b0419a338b3" }, "downloads": -1, "filename": "mod-oled-128x64-0.0.4.tar.gz", "has_sig": false, "md5_digest": "6488120a8de67704103b1c0997e9f48c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33025, "upload_time": "2016-03-21T12:31:03", "url": "https://files.pythonhosted.org/packages/47/be/c9188ff20a98143b44bcac44339187a5c3ea7d4f5926c488d31c22346869/mod-oled-128x64-0.0.4.tar.gz" } ] }