From 589f064959d513ac288303d0e9f2628c4330bd2a Mon Sep 17 00:00:00 2001 From: Willem Oldemans Date: Tue, 8 Feb 2022 19:27:00 +0100 Subject: [PATCH] updated firmware --- CAD/MiliOhmMeter/fp-info-cache | 100 +- .../lib/U8g2/src/clib/u8x8_d_il3820_296x128.c | 552 ----- .../lib/U8g2/src/clib/u8x8_d_ist3020.c | 200 -- .../lib/U8g2/src/clib/u8x8_d_ist7920.c | 202 -- .../lib/U8g2/src/clib/u8x8_d_ks0108.c | 344 ---- .../lib/U8g2/src/clib/u8x8_d_lc7981.c | 470 ----- .../lib/U8g2/src/clib/u8x8_d_ld7032_60x32.c | 243 --- .../lib/U8g2/src/clib/u8x8_d_ls013b7dh03.c | 197 -- .../lib/U8g2/src/clib/u8x8_d_max7219.c | 459 ----- .../lib/U8g2/src/clib/u8x8_d_pcd8544_84x48.c | 166 -- .../lib/U8g2/src/clib/u8x8_d_pcf8812.c | 193 -- .../lib/U8g2/src/clib/u8x8_d_pcf8814_hx1230.c | 198 -- .../lib/U8g2/src/clib/u8x8_d_sbn1661.c | 217 -- .../lib/U8g2/src/clib/u8x8_d_sed1330.c | 351 ---- .../lib/U8g2/src/clib/u8x8_d_sh1106_64x32.c | 215 -- .../lib/U8g2/src/clib/u8x8_d_sh1106_72x40.c | 216 -- .../lib/U8g2/src/clib/u8x8_d_sh1107.c | 501 ----- .../lib/U8g2/src/clib/u8x8_d_sh1108.c | 225 --- .../lib/U8g2/src/clib/u8x8_d_sh1122.c | 287 --- .../lib/U8g2/src/clib/u8x8_d_ssd1305.c | 389 ---- .../lib/U8g2/src/clib/u8x8_d_ssd1306_128x32.c | 252 --- .../src/clib/u8x8_d_ssd1306_128x64_noname.c | 465 ----- .../U8g2/src/clib/u8x8_d_ssd1306_2040x16.c | 213 -- .../lib/U8g2/src/clib/u8x8_d_ssd1306_48x64.c | 215 -- .../lib/U8g2/src/clib/u8x8_d_ssd1306_64x32.c | 258 --- .../lib/U8g2/src/clib/u8x8_d_ssd1306_64x48.c | 213 -- .../lib/U8g2/src/clib/u8x8_d_ssd1306_72x40.c | 266 --- .../lib/U8g2/src/clib/u8x8_d_ssd1306_96x16.c | 213 -- .../lib/U8g2/src/clib/u8x8_d_ssd1309.c | 288 --- .../lib/U8g2/src/clib/u8x8_d_ssd1316.c | 236 --- .../lib/U8g2/src/clib/u8x8_d_ssd1317.c | 241 --- .../lib/U8g2/src/clib/u8x8_d_ssd1318.c | 317 --- .../lib/U8g2/src/clib/u8x8_d_ssd1325.c | 435 ---- .../lib/U8g2/src/clib/u8x8_d_ssd1326.c | 277 --- .../lib/U8g2/src/clib/u8x8_d_ssd1327.c | 952 --------- .../lib/U8g2/src/clib/u8x8_d_ssd1329.c | 298 --- .../lib/U8g2/src/clib/u8x8_d_ssd1606_172x72.c | 394 ---- .../U8g2/src/clib/u8x8_d_ssd1607_200x200.c | 718 ------- .../lib/U8g2/src/clib/u8x8_d_st7511.c | 214 -- .../lib/U8g2/src/clib/u8x8_d_st75256.c | 1776 ----------------- .../lib/U8g2/src/clib/u8x8_d_st7528.c | 313 --- .../lib/U8g2/src/clib/u8x8_d_st75320.c | 271 --- .../lib/U8g2/src/clib/u8x8_d_st7565.c | 1281 ------------ .../lib/U8g2/src/clib/u8x8_d_st7567.c | 1000 ---------- .../U8g2/src/clib/u8x8_d_st7586s_erc240160.c | 256 --- .../U8g2/src/clib/u8x8_d_st7586s_s028hn118a.c | 246 --- .../lib/U8g2/src/clib/u8x8_d_st7588.c | 256 --- .../lib/U8g2/src/clib/u8x8_d_st7920.c | 236 --- .../lib/U8g2/src/clib/u8x8_d_t6963.c | 564 ------ .../lib/U8g2/src/clib/u8x8_d_uc1601.c | 188 -- .../lib/U8g2/src/clib/u8x8_d_uc1604.c | 240 --- .../lib/U8g2/src/clib/u8x8_d_uc1608.c | 512 ----- .../lib/U8g2/src/clib/u8x8_d_uc1610.c | 297 --- .../lib/U8g2/src/clib/u8x8_d_uc1611.c | 633 ------ .../lib/U8g2/src/clib/u8x8_d_uc1617.c | 324 --- .../lib/U8g2/src/clib/u8x8_d_uc1638.c | 223 --- .../lib/U8g2/src/clib/u8x8_d_uc1701_dogs102.c | 203 -- .../U8g2/src/clib/u8x8_d_uc1701_mini12864.c | 205 -- MilliOhmMeter_FW/src/board.h | 9 +- MilliOhmMeter_FW/src/display.cpp | 136 +- MilliOhmMeter_FW/src/display.h | 55 +- MilliOhmMeter_FW/src/main.cpp | 11 +- MilliOhmMeter_FW/src/measure.cpp | 46 +- 63 files changed, 197 insertions(+), 21274 deletions(-) delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_il3820_296x128.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist3020.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist7920.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ks0108.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_lc7981.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ld7032_60x32.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ls013b7dh03.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_max7219.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcd8544_84x48.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8812.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8814_hx1230.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sbn1661.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sed1330.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_64x32.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_72x40.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1107.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1108.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1122.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1305.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x32.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x64_noname.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_2040x16.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_48x64.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x32.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x48.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_72x40.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_96x16.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1309.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1316.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1317.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1318.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1325.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1326.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1327.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1329.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1606_172x72.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1607_200x200.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7511.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75256.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7528.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75320.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7565.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7567.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_erc240160.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_s028hn118a.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7588.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7920.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_t6963.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1601.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1604.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1608.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1610.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1611.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1617.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1638.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_dogs102.c delete mode 100644 MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_mini12864.c diff --git a/CAD/MiliOhmMeter/fp-info-cache b/CAD/MiliOhmMeter/fp-info-cache index 888a2db..8d84a68 100644 --- a/CAD/MiliOhmMeter/fp-info-cache +++ b/CAD/MiliOhmMeter/fp-info-cache @@ -1,4 +1,4 @@ -19948114310011227 +19970759019357951 Battery BatteryHolder_Bulgin_BX0036_1xC Bulgin Battery Holder, BX0036, Battery Type C (https://www.bulgin.com/products/pub/media/bulgin/data/Battery_holders.pdf) @@ -28049,6 +28049,13 @@ Surface mounted pin header SMD 1x02 1.27mm single row style2 pin1 right 2 2 Connector_PinHeader_1.27mm +PinHeader_1x02_P1.27mm_Vertical_small_CrtYd +Through hole straight pin header, 1x02, 1.27mm pitch, single row +Through hole pin header THT 1x02 1.27mm single row +0 +2 +2 +Connector_PinHeader_1.27mm PinHeader_1x03_P1.27mm_Horizontal Through hole angled pin header, 1x03, 1.27mm pitch, 4.0mm pin length, single row Through hole angled pin header THT 1x03 1.27mm single row @@ -33950,6 +33957,13 @@ Surface mounted socket strip SMD 1x06 1.00mm single row style2 pin1 right 6 6 Connector_PinSocket_1.00mm +PinSocket_1x06_P1.00mm_Vertical_small_CrtYd +Through hole straight socket strip, 1x06, 1.00mm pitch, single row (https://gct.co/files/drawings/bc065.pdf), script generated +Through hole socket strip THT 1x06 1.00mm single row +0 +6 +6 +Connector_PinSocket_1.00mm PinSocket_1x07_P1.00mm_Vertical Through hole straight socket strip, 1x07, 1.00mm pitch, single row (https://gct.co/files/drawings/bc065.pdf), script generated Through hole socket strip THT 1x07 1.00mm single row @@ -58793,6 +58807,13 @@ MySymbols 2 2 MySymbols +AntennaTrace + + +0 +1 +1 +MySymbols BKA30D-R05 @@ -58835,6 +58856,13 @@ SOP65P637X110-28N 29 29 MySymbols +SWD_Programming_pads +Through hole straight pin header, 1x04, 2.54mm pitch, single row +Through hole pin header THT 1x04 2.54mm single row +0 +4 +4 +MySymbols TestPoint_SMD_R @@ -58869,6 +58897,13 @@ slids_switch_spdt 0 5 4 +MySymbols +wifi antenna + + +0 +2 +2 NetTie NetTie-2_SMD_Pad0.5mm Net tie, 2 pin, 0.5mm square SMD pads @@ -64519,6 +64554,13 @@ UQFN NoLead 75 49 Package_DFN_QFN +USP-9B01 + + +0 +9 +9 +Package_DFN_QFN VDFN-8-1EP_2x2mm_P0.5mm_EP0.9x1.7mm 8-Lead Very Thin Dual Flatpack No-Lead (LZ) - 2x3x0.9 mm Body [VDFN] (see Microchip Packaging Specification 00000049BS.pdf) DFN 0.5 @@ -72771,6 +72813,34 @@ TO-264-5 Vertical RM 3.81mm 0 5 5 +Panelization +mouse-bite-1mm-slot + + +0 +0 +0 +Panelization +mouse-bite-2.54mm-slot + + +0 +0 +0 +Panelization +mouse-bite-2mm-slot + + +0 +0 +0 +Panelization +mouse-bite-3mm-slot + + +0 +0 +0 Potentiometer_SMD Potentiometer_ACP_CA6-VSMD_Vertical Potentiometer, vertical, ACP CA6-VSMD, http://www.acptechnologies.com/wp-content/uploads/2017/06/01-ACP-CA6.pdf @@ -74130,6 +74200,13 @@ iot lora sigfox 57 57 RF_Module +CR95HF-VMD5T + + +0 +33 +33 +RF_Module CYBLE-21Pin-10x10mm Cypress EZ-BLE PRoC Module (Bluetooth Smart) 21 Pin Module Cypress BT Bluetooth @@ -74374,6 +74451,13 @@ nRF24L01 adapter breakout 0 8 8 +RF_NFC +QFN50P500X500X100-33N + + +0 +33 +33 RF_Shielding Laird_Technologies_97-2002_25.40x25.40mm Laird Technologies 97-2002 EZ PEEL Shielding Cabinet One Piece SMD 25.40x25.40mm (https://assets.lairdtech.com/home/brandworld/files/Board%20Level%20Shields%20Catalog%20Download.pdf) @@ -76517,6 +76601,20 @@ gas sensor 6 6 Sensor +SCD30 + + +0 +7 +7 +Sensor +SGP30 +SGP30 Gas Sensor + +0 +7 +7 +Sensor SHT1x SHT1x SHT1x diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_il3820_296x128.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_il3820_296x128.c deleted file mode 100644 index 18d6f3d..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_il3820_296x128.c +++ /dev/null @@ -1,552 +0,0 @@ -/* - - u8x8_d_il3820_296x128.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - il3820: 200x300x1 - - command - 0x22: assign actions - 0x20: execute actions - - action for command 0x022 are (more or less guessed) - bit 7: Enable Clock - bit 6: Enable Charge Pump - bit 5: Load Temparture Value (???) - bit 4: Load LUT (???) - bit 3: Initial Display (???) - bit 2: Pattern Display --> Requires about 945ms with the LUT from below - bit 1: Disable Charge Pump - bit 0: Disable Clock - - Disable Charge Pump and Clock require about 10ms - Enable Charge Pump and Clock require about 100 to 300ms - - Notes: - - Introduced a refresh display message, which copies RAM to display - - Charge pump is always enabled. Charge pump can be enabled/disabled via power save message - - U8x8 will not really work because of the two buffers in the SSD1606, however U8g2 should be ok. - - LUT for the 296x128 device (IL3820) - LUT (cmd: 0x032 has 30 bytes) - section 6.8 of the datasheet mentions 256 bits = 32 bytes for the LUT - chapter 7 tells 30 bytes - - according to section 6.8: - 20 bytes waveform - 10 bytes timing - 1 byte named as VSH/VSL - 1 empty byte - according to the command table, the lut has 240 bits (=30 bytes * 8 bits) - - - LUT / Refresh time - total_refresh_time = (refresh_lines + dummy_lines*2)*TGate*TS_Sum/f_OSC - - f_OSC=1MHz (according to the datasheets) - refreh_lines = 296 (for the waveshare display, 0x045 cmd) - dummy_lines = 22 (for the upcoming u8g2 code, 0x03a cmd) - TGate = 62 (POR default, 0x03b cmd) - TS_Sum: Sum of all TS entries of the second part of the LUT - f_OSC: 1MHz according to the datasheet. - - so we have - - total_refresh_time = 21080*TS_Sum/1000000 = 21ms * TS_Sum - - - This file includes two devices: - u8x8_d_il3820_296x128 --> includes LUT which is probably from the WaveShare 2.9 Vendor - u8x8_d_il3820_v2_296x128 --> includes LUT which was optimized for faster speed and lesser flicker - -*/ - -/* Waveform part of the LUT (20 bytes) */ -/* bit 7/6: 1 - 1 transition */ -/* bit 5/4: 1 - 0 transition */ -/* bit 3/2: 0 - 1 transition */ -/* bit 1/0: 0 - 0 transition */ -/* 00 – VSS */ -/* 01 – VSH */ -/* 10 – VSL */ -/* 11 – NA */ - - -#include "u8x8.h" - -/*=================================================*/ -/* common code for all devices */ - - -static const uint8_t u8x8_d_il3820_296x128_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x22, 0xc0), /* enable clock and charge pump */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(200), /* according to my measures it may take up to 150ms */ - U8X8_DLY(100), /* but it might take longer */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_il3820_296x128_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - /* disable clock and charge pump only, deep sleep is not entered, because we will loose RAM content */ - U8X8_CA(0x22, 0x02), /* only disable charge pump, HW reset seems to be required if the clock is disabled */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(20), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -// static const uint8_t u8x8_d_il3820_296x128_flip0_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - -// static const uint8_t u8x8_d_il3820_296x128_flip1_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - - -static const u8x8_display_info_t u8x8_il3820_296x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 120, - /* pre_chip_disable_wait_ns = */ 60, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 50, /* IL3820 */ - /* sck_pulse_width_ns = */ 125, /* IL3820: 125ns, clock cycle = 250ns */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 37, /* 37*8 = 296 */ - /* tile_hight = */ 16, /* 16*8 = 128 */ - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 296, - /* pixel_height = */ 128 -}; - - -static uint8_t *u8x8_convert_tile_for_il3820(uint8_t *t) -{ - uint8_t i; - static uint8_t buf[8]; - uint8_t *pbuf = buf; - - for( i = 0; i < 8; i++ ) - { - *pbuf++ = ~(*t++); - } - return buf; -} - -static void u8x8_d_il3820_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) U8X8_NOINLINE; -static void u8x8_d_il3820_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) -{ - uint16_t x; - uint8_t c, page; - uint8_t *ptr; - u8x8_cad_StartTransfer(u8x8); - - page = u8x8->display_info->tile_height; - page --; - page -= (((u8x8_tile_t *)arg_ptr)->y_pos); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - //u8x8_cad_SendCmd(u8x8, 0x011 ); /* cursor increment mode */ - //u8x8_cad_SendArg(u8x8, 7); - - u8x8_cad_SendCmd(u8x8, 0x04f ); /* set cursor column */ - u8x8_cad_SendArg(u8x8, x&255); - u8x8_cad_SendArg(u8x8, x>>8); - - u8x8_cad_SendCmd(u8x8, 0x04e ); /* set cursor row */ - u8x8_cad_SendArg(u8x8, page); - - u8x8_cad_SendCmd(u8x8, 0x024 ); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, 8, u8x8_convert_tile_for_il3820(ptr)); - ptr += 8; - x += 8; - c--; - } while( c > 0 ); - - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); -} - - - -static const uint8_t u8x8_d_il3820_exec_1000dly_seq[] = { - // assumes, that the start transfer has happend - U8X8_CA(0x22, 0x04), /* display update seq. option: pattern display */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static void u8x8_d_il3820_first_init(u8x8_t *u8x8) -{ - u8x8_ClearDisplay(u8x8); - - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x032); // program update sequence - u8x8_cad_SendMultipleArg(u8x8, 8, 0x055); // all black - u8x8_cad_SendMultipleArg(u8x8, 12, 0x0aa); // all white - u8x8_cad_SendMultipleArg(u8x8, 10, 0x022); // 830ms - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_exec_1000dly_seq); - -} - -#ifdef OBSOLETE -static void u8x8_d_il3820_second_init(u8x8_t *u8x8) -{ - u8x8_ClearDisplay(u8x8); - - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x032); // program update sequence - u8x8_cad_SendMultipleArg(u8x8, 20, 0x000); // do nothing - u8x8_cad_SendMultipleArg(u8x8, 10, 0x011); // 414ms dly - /* reuse sequence from above, ok some time is wasted here, */ - /* delay could be lesser */ - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_exec_1000dly_seq); -} -#endif - - -/*=================================================*/ -/* first version, LUT from WaveShare */ - - -/* http://www.waveshare.com/wiki/File:2.9inch_e-Paper_Module_code.7z */ -static const uint8_t u8x8_d_il3820_296x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x10, 0x00), /* Deep Sleep mode Control: Disable */ - U8X8_C(0x01), - U8X8_A(295 % 256), U8X8_A(295/256), U8X8_A(0), - - - U8X8_CA(0x03, 0x00), /* Gate Driving voltage: 15V (lowest value)*/ - U8X8_CA(0x04, 0x0a), /* Source Driving voltage: 15V (mid value and POR)*/ - - //U8X8_CA(0x22, 0xc0), /* display update seq. option: enable clk, enable CP, .... todo: this is never activated */ - - //U8X8_CA(0x0b, 7), /* Set Delay of gate and source non overlap period, POR = 7 */ - U8X8_CA(0x2c, 0xa8), /* write vcom value*/ - U8X8_CA(0x3a, 0x16), /* dummy lines POR=22 (0x016) */ - U8X8_CA(0x3b, 0x08), /* gate time POR=0x08*/ - U8X8_CA(0x3c, 0x33), /* select boarder waveform */ - //U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - - - U8X8_CA(0x11, 0x07), /* Define data entry mode, x&y inc, x first*/ - - U8X8_CAA(0x44, 0, 29), /* RAM x start & end, issue 920: end should be (128/8)-1=15. */ - U8X8_CAAAA(0x45, 0, 0, 295&255, 295>>8), /* RAM y start & end */ - - //U8X8_CA(0x4e, 0), /* set x pos, 0..29? */ - //U8X8_CAA(0x4f, 0, 0), /* set y pos, 0...320??? */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_il3820_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -/* -0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -measured 1582 ms -*/ - U8X8_C(0x32), /* write LUT register*/ - /* original values */ - U8X8_A(0x50), - U8X8_A(0xaa), - U8X8_A(0x55), - U8X8_A(0xaa), - U8X8_A(0x11), - - U8X8_A(0x11), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - /* Timing part of the LUT, 20 Phases with 4 bit each: 10 bytes */ - U8X8_A(0xff), - U8X8_A(0xff), - U8X8_A(0x3f), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - U8X8_CA(0x22, 0x04), /* display update seq. option: pattern display, assumes clk and charge pump are enabled */ - U8X8_C(0x20), /* execute sequence */ - - U8X8_DLY(250), /* delay for 1620ms. The current sequence takes 1582ms */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(120), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_il3820_296x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_il3820_296x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_init_seq); - - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_powersave0_seq); - u8x8_d_il3820_first_init(u8x8); - - /* usually the DISPLAY_INIT message leaves the display in power save state */ - /* however this is not done for e-paper devices, see: */ - /* https://github.com/olikraus/u8g2/wiki/internal#powersave-mode */ - - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_il3820_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_to_display_seq); - break; - default: - return 0; - } - return 1; -} - -/*=================================================*/ -/* second version for the IL3820 display */ - - -/* http://www.waveshare.com/wiki/File:2.9inch_e-Paper_Module_code.7z */ -static const uint8_t u8x8_d_il3820_v2_296x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - // U8X8_CA(0x10, 0x00), /* Deep Sleep mode Control: POR: Normal mode */ - U8X8_C(0x01), - U8X8_A(295 % 256), U8X8_A(295/256), U8X8_A(0), - - /* the driving voltagesmust not be that high, in order to aviod level change after */ - /* some seconds (which happens with 0xea */ - U8X8_CA(0x03, 0x75), /* Gate Driving voltage: +/-15V =0x00 POR (+22/-20V) = 0x0ea*/ - U8X8_CA(0x04, 0x0a), /* Source Driving voltage: (POR=0x0a=15V), max=0x0e*/ - - U8X8_CA(0x0b, 7), /* Set Delay of gate and source non overlap period, POR = 7 */ - U8X8_CA(0x2c, 0xa8), /* write vcom value*/ - U8X8_CA(0x3a, 0x16), /* dummy lines POR=22 (0x016) */ - U8X8_CA(0x3b, 0x08), /* gate time POR=0x08*/ - U8X8_CA(0x3c, 0x33), /* select boarder waveform */ - - U8X8_CA(0x11, 0x07), /* Define data entry mode, x&y inc, x first*/ - U8X8_CAA(0x44, 0, 29), /* RAM x start & end, 32*4=128 */ - U8X8_CAAAA(0x45, 0, 0, 295&255, 295>>8), /* RAM y start & end, 0..295 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_il3820_v2_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - -/* -0xaa, 0x09, 0x09, 0x19, 0x19, -0x11, 0x11, 0x11, 0x11, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, - -0x75, 0x77, 0x77, 0x77, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00 -measured 1240 ms -*/ - U8X8_C(0x32), /* write LUT register*/ - /* https://github.com/olikraus/u8g2/issues/347 */ - U8X8_A(0xaa), - U8X8_A(0x09), - U8X8_A(0x09), - U8X8_A(0x19), - U8X8_A(0x19), - - U8X8_A(0x11), - U8X8_A(0x11), - U8X8_A(0x11), - U8X8_A(0x11), - U8X8_A(0x00), - - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - /* Timing part of the LUT, 20 Phases with 4 bit each: 10 bytes */ - U8X8_A(0x75), - U8X8_A(0x77), - U8X8_A(0x77), - U8X8_A(0x77), - U8X8_A(0x07), - - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - U8X8_CA(0x22, 0x04), /* display update seq. option: pattern display */ - U8X8_C(0x20), /* execute sequence */ - - U8X8_DLY(250), /* delay for 1400ms. The current sequence takes 1240ms, it was reported, that longer delays are better */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - - U8X8_DLY(250), - U8X8_DLY(150), /* extended, #318 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_il3820_v2_296x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_il3820_296x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - - u8x8_d_helper_display_init(u8x8); - - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_v2_296x128_init_seq); - - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_powersave0_seq); - u8x8_d_il3820_first_init(u8x8); - /* u8x8_d_il3820_second_init(u8x8); */ /* not required, u8g2.begin() will also clear the display once more */ - - /* usually the DISPLAY_INIT message leaves the display in power save state */ - /* however this is not done for e-paper devices, see: */ - /* https://github.com/olikraus/u8g2/wiki/internal#powersave-mode */ - - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_296x128_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_il3820_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_il3820_v2_to_display_seq); - break; - default: - return 0; - } - return 1; -} - - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist3020.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist3020.c deleted file mode 100644 index cfeca84..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist3020.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - - u8x8_d_ist3020.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_ist3020_erc19264_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a4), /* all pixel off, issue 142 */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ist3020_erc19264_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ist3020_erc19264_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ist3020_erc19264_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_ist3020_erc19264_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* IST3020 datasheet, page 56 */ - /* pre_chip_disable_wait_ns = */ 150, /* IST3020 datasheet, page 56 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 100, /* IST3020 datasheet, page 56 */ - /* sck_pulse_width_ns = */ 100, /* IST3020 datasheet, page 56 */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* IST3020 datasheet, page 54 */ - /* write_pulse_width_ns = */ 60, /* IST3020 datasheet, page 54 */ - /* tile_width = */ 24, /* width of 24*8=192 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 64, - /* pixel_width = */ 192, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_d_ist3020_erc19264_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ab), /* build in osc on, used in ER code, but not mentioned in data sheet */ - U8X8_C(0x0ae), /* display off */ - - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* FIX: LCD bias 1/7, old value was 1/9 (0x0a2) */ - - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x020), /* v0 voltage resistor ratio */ - U8X8_CA(0x081, 0x019), /* set contrast, contrast value (from ER code: 45) */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ist3020_erc19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ist3020_erc19264_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ist3020_erc19264_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ist3020_erc19264_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ist3020_erc19264_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ist3020_erc19264_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ist3020_erc19264_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist7920.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist7920.c deleted file mode 100644 index 9f7fd75..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ist7920.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - - u8x8_d_ist7920.c - - this is NOT ST7920! - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_ist7920_128x128_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x03d), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ist7920_128x128_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x03c), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ist7920_128x128_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x064), /* Display Ctrl: Bit3: SHL 2:ADC 1:EON, 0:REV */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ist7920_128x128_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x068), /* Display Ctrl: Bit3: SHL 2:ADC 1:EON, 0:REV */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_ist7920_128x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 90, /* IST7920 datasheet, page 48 */ - /* pre_chip_disable_wait_ns = */ 90, /* IST7920 datasheet, page 48 */ - /* reset_pulse_width_ms = */ 10, - /* post_reset_wait_ms = */ 20, /* IST7920 Startup Seq.. */ - /* sda_setup_time_ns = */ 45, /* IST7920 datasheet, page 48 */ - /* sck_pulse_width_ns = */ 130, /* IST7920 datasheet, page 48 */ - /* sck_clock_hz = */ 3000000UL, /* IST7920 datasheet: 260ns */ - /* spi_mode = */ 0, /* active high, rising edge (not verified) */ - /* i2c_bus_clock_100kHz = */ 4, /* 400kHz according to IST7920 datasheet */ - /* data_setup_time_ns = */ 60, /* IST7920 datasheet, page 47 */ - /* write_pulse_width_ns = */ 150, /* IST7920 datasheet, page 47 */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -/* 1/128 Duty, 1/10 Bias, 128x128 round display */ -static const uint8_t u8x8_d_ist7920_128x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x076), /* Software Reset */ - U8X8_DLY(50), - U8X8_C(0x03c), /* display off */ - - - U8X8_CA(0x090, 128), /* Set Duty */ - //U8X8_CAA(0x0b2, 0x011, 0x00), /* Set Frame Control */ - - U8X8_CA(0x030, 16), /* Set Bias 0: 1/8, 8: 1/9, 16: 1/10, 24: 1/11, 48: 1/12 ... */ - U8X8_CA(0x031, 0x03f), /* Set voltage generate clock(31H/11H) */ - //U8X8_CA(0x032, 0x015), /* Temperature compensation */ - U8X8_CA(0x033, 0x020), /* Power Control */ - U8X8_DLY(100), - U8X8_CA(0x033, 0x02c), /* Power Control */ - U8X8_DLY(100), - U8X8_C(0xfd), /* set booster */ - U8X8_DLY(100), - U8X8_CA(0x033, 0x02f), /* Power Control */ - U8X8_DLY(200), - - U8X8_C(0x064), /* Display Ctrl: Bit3: SHL 2:ADC 1:EON, 0:REV */ - - U8X8_CAA(0x074, 0x000, 0x00f), /* AY Window */ - U8X8_CAA(0x075, 0x000, 0x07f), /* AX Window */ - - U8X8_CA(0x040, 64), /* Start line at 64 */ - - U8X8_CA(0x0b1, 100), /* electronic volume */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ist7920_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ist7920_128x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ist7920_128x128_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ist7920_128x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ist7920_128x128_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ist7920_128x128_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ist7920_128x128_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x0b1 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* st7920 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x0c0 ); - u8x8_cad_SendArg(u8x8, x ); - u8x8_cad_SendCmd(u8x8, 0x001 ); - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos) ); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ks0108.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ks0108.c deleted file mode 100644 index ece6816..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ks0108.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - - u8x8_d_ks0108.c - - The classic 5V LCD - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_ks0108_init_seq[] = { - U8X8_C(0x0c0), /* satart at the top */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ks0108_powersave0_seq[] = { - U8X8_C(0x03f), /* display on */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ks0108_powersave1_seq[] = { - U8X8_C(0x03e), /* display off */ - U8X8_END() /* end of sequence */ -}; - - -struct u8x8_ks0108_vars -{ - uint8_t *ptr; - uint8_t x; - uint8_t c; - uint8_t arg_int; -}; - -static void u8x8_ks0108_out(u8x8_t *u8x8, struct u8x8_ks0108_vars *v, void *arg_ptr) -{ - uint8_t cnt; - u8x8_cad_SendCmd(u8x8, 0x040 | ((v->x << 3) & 63) ); - u8x8_cad_SendCmd(u8x8, 0x0b8 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - while( v->arg_int > 0 ) - { - /* calculate tiles to next boundary (end or chip limit) */ - cnt = v->x; - cnt += 8; - cnt &= 0x0f8; - cnt -= v->x; - - if ( cnt > v->c ) - cnt = v->c; - - /* of cours we still could use cnt=1 here... */ - /* but setting cnt to 1 is not very efficient */ - //cnt = 1; - - v->x +=cnt; - v->c-=cnt; - cnt<<=3; - u8x8_cad_SendData(u8x8, cnt, v->ptr); /* note: SendData can not handle more than 255 bytes */ - v->ptr += cnt; - - if ( v->c == 0 ) - { - v->ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - v->c = ((u8x8_tile_t *)arg_ptr)->cnt; - v->arg_int--; - } - if ( ((v->x) & 7) == 0 ) - break; - } -} - - -static const u8x8_display_info_t u8x8_ks0108_128x64_display_info = -{ - /* chip_enable_level = */ 0, /* KS0108: Not used */ - /* chip_disable_level = */ 1, /* KS0108: Not used */ - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, /* could be faster for the KS0108 */ - /* sda_setup_time_ns = */ 12, - /* sck_pulse_width_ns = */ 75, /* KS0108: Not used */ - /* sck_clock_hz = */ 4000000UL, /* KS0108: Not used */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* KS0108: Not used */ - /* data_setup_time_ns = */ 200, - /* write_pulse_width_ns = */ 250, /* KS0108: actially 450 ns, but additional 200 ns are added by the byte transfer function */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_ks0108_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - struct u8x8_ks0108_vars v; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ks0108_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 2, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - - if ( arg_int == 0 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 2, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - } - else - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 2, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - } - break; -// The KS0108 can not mirror the cols and rows, use U8g2 for rotation -// case U8X8_MSG_DISPLAY_SET_FLIP_MODE: -// break; -// The KS0108 has no internal contrast command -// case U8X8_MSG_DISPLAY_SET_CONTRAST: -// break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - - v.ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - v.x = ((u8x8_tile_t *)arg_ptr)->x_pos; - v.c = ((u8x8_tile_t *)arg_ptr)->cnt; - v.arg_int = arg_int; - - - if ( v.x < 8 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_ks0108_out(u8x8, &v, arg_ptr); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - } - if ( v.x < 16 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 2, NULL); - u8x8_ks0108_out(u8x8, &v, arg_ptr); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - } - //if ( v.x < 24 ) - //{ - //u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 4, NULL); - //u8x8_ks0108_out(u8x8, &v, arg_ptr); - //u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - //} - break; - default: - return 0; - } - return 1; -} - -static const u8x8_display_info_t u8x8_ks0108_192x64_display_info = -{ - /* chip_enable_level = */ 0, /* KS0108: Not used */ - /* chip_disable_level = */ 1, /* KS0108: Not used */ - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, /* could be faster for the KS0108 */ - /* sda_setup_time_ns = */ 12, - /* sck_pulse_width_ns = */ 75, /* KS0108: Not used */ - /* sck_clock_hz = */ 4000000UL, /* KS0108: Not used */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* KS0108: Not used */ - /* data_setup_time_ns = */ 200, - /* write_pulse_width_ns = */ 250, /* KS0108: actially 450 ns, but additional 200 ns are added by the byte transfer function */ - /* tile_width = */ 24, /* width of 24*8=192 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 192, - /* pixel_height = */ 64 -}; - - -/* east rising (buydisplay.com) ERM19264 */ -/* left: 011, middle: 101, right: 110, no chip select: 111 */ -uint8_t u8x8_d_ks0108_erm19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - struct u8x8_ks0108_vars v; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ks0108_192x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - - if ( arg_int == 0 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - } - else - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - - } - break; -// The KS0108 can not mirror the cols and rows, use U8g2 for rotation -// case U8X8_MSG_DISPLAY_SET_FLIP_MODE: -// break; -// The KS0108 has no internal contrast command -// case U8X8_MSG_DISPLAY_SET_CONTRAST: -// break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - - v.ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - v.x = ((u8x8_tile_t *)arg_ptr)->x_pos; - v.c = ((u8x8_tile_t *)arg_ptr)->cnt; - v.arg_int = arg_int; - -/* - 3-bit CS value: - In u8x8_byte_set_ks0108_cs(u8x8_t *u8x8, uint8_t arg) the lowest - bit is assigned to CS and highest bit if the 3-bit value to CS2 - - CS: left part of the display --> 6 - CS1: middle part --> 5 - CS2: right part of the display --> 3 - - Reference: https://github.com/olikraus/u8g2/issues/631 -*/ - if ( v.x < 8 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); // 3-->6, issue 631 - u8x8_ks0108_out(u8x8, &v, arg_ptr); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - } - if ( v.x < 16 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); - u8x8_ks0108_out(u8x8, &v, arg_ptr); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - } - if ( v.x < 24 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); // 6-->3, // issue 631 - u8x8_ks0108_out(u8x8, &v, arg_ptr); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); - } - break; - default: - return 0; - } - return 1; -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_lc7981.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_lc7981.c deleted file mode 100644 index 2b174c4..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_lc7981.c +++ /dev/null @@ -1,470 +0,0 @@ -/* - - u8x8_d_lc7981.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -*/ -#include "u8x8.h" - - - - -/* no powersave mode for the LC7981 */ -// static const uint8_t u8x8_d_lc7981_powersave0_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - -// static const uint8_t u8x8_d_lc7981_powersave1_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - -/* no hardware flip for the LC7981 */ -// static const uint8_t u8x8_d_lc7981_flip0_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - -// static const uint8_t u8x8_d_lc7981_flip1_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - - -/* http://graphics.stanford.edu/~seander/bithacks.html */ -static uint8_t reverse_byte(uint8_t v) -{ - // if ( v != 0 && v != 255 ) does not help much - { - // swap odd and even bits - v = ((v >> 1) & 0x055) | ((v & 0x055) << 1); - // swap consecutive pairs - v = ((v >> 2) & 0x033) | ((v & 0x033) << 2); - // swap nibbles ... - v = ((v >> 4) & 0x00F) | ((v & 0x00F) << 4); - } - return v; -} - -static uint8_t u8x8_d_lc7981_common(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, void *arg_ptr) -{ - uint8_t c, i, j; - uint16_t y; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y*=8; - y*= u8x8->display_info->tile_width; - /* x = ((u8x8_tile_t *)arg_ptr)->x_pos; x is ignored... no u8x8 support */ - u8x8_cad_StartTransfer(u8x8); - /* - Tile structure is reused here for the t6963, however u8x8 is not supported - tile_ptr points to data which has cnt*8 bytes (same as SSD1306 tiles) - Buffer is expected to have 8 lines of code fitting to the t6963 internal memory - "cnt" includes the number of horizontal bytes. width is equal to cnt*8 - - x is assumed to be zero - - TODO: Consider arg_int, however arg_int is not used by u8g2 - */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ - for( i = 0; i < 8; i++ ) - { - u8x8_cad_SendCmd(u8x8, 0x0a ); /* display ram (cursor) address low byte */ - u8x8_cad_SendArg(u8x8, y&255); - u8x8_cad_SendCmd(u8x8, 0x0b ); /* display ram (cursor) address high byte */ - u8x8_cad_SendArg(u8x8, y>>8); - - u8x8_cad_SendCmd(u8x8, 0x0c ); /* write start */ - /* - The LC7981 has the MSB at the right position, which is exactly the opposite to the T6963. - Instead of writing a third hvline procedure for this device, we just revert the bytes before - transmit. This is slow because: - - the bit reverse itself - - the single byte transfer - The one byte is transmitted via SendArg, which is ok, because CAD = 100 - */ - for( j = 0; j < c; j++ ) - u8x8_cad_SendArg(u8x8, reverse_byte(*ptr++)); - - //u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */ - //ptr += u8x8->display_info->tile_width; - - y += u8x8->display_info->tile_width; - } - - u8x8_cad_EndTransfer(u8x8); - break; - /* handled in the calling procedure - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_lc7981_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - */ - /* power save is not there... - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_powersave1_seq); - break; - */ - /* hardware flip not is not available - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - */ -#ifdef U8X8_WITH_SET_CONTRAST - /* no contrast setting :-( - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); - u8x8_cad_EndTransfer(u8x8); - break; - */ -#endif - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* LC7981 160x80 LCD*/ - -static const u8x8_display_info_t u8x8_lc7981_160x80_display_info = -{ - /* chip_enable_level = */ 0, /* LC7981 has a low active CS*/ - /* chip_disable_level = */ 1, - - /* from here... */ - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* ... to here, values are ignored, because this is a parallel interface only */ - - /* data_setup_time_ns = */ 220, - /* write_pulse_width_ns = */ 20, - /* tile_width = */ 20, /* width of 20*8=160 pixel */ - /* tile_hight = */ 10, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 160, - /* pixel_height = */ 80 -}; - -static const uint8_t u8x8_d_lc7981_160x80_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(50), - - U8X8_CA(0x00, 0x32), /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1) */ - U8X8_CA(0x01, 0x07), /* character/bits per pixel pitch */ - U8X8_CA(0x02, 160/8-1), /* number of chars/byte width of the screen */ - U8X8_CA(0x03, 0x50), /* time division: 50 (1/80 duty cycle) */ - U8X8_CA(0x08, 0x00), /* display start low */ - U8X8_CA(0x09, 0x00), /* display start high */ - - U8X8_DLY(10), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_lc7981_160x80(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_lc7981_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_lc7981_160x80_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_160x80_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* LC7981 160x160 LCD*/ - -static const u8x8_display_info_t u8x8_lc7981_160x160_display_info = -{ - /* chip_enable_level = */ 0, /* LC7981 has a low active CS*/ - /* chip_disable_level = */ 1, - - /* from here... */ - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* ... to here, values are ignored, because this is a parallel interface only */ - - /* data_setup_time_ns = */ 220, - /* write_pulse_width_ns = */ 20, - /* tile_width = */ 20, /* width of 20*8=160 pixel */ - /* tile_hight = */ 20, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 160, - /* pixel_height = */ 160 -}; - -static const uint8_t u8x8_d_lc7981_160x160_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(50), - - U8X8_CA(0x00, 0x32), /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1) */ - U8X8_CA(0x01, 0x07), /* character/bits per pixel pitch */ - U8X8_CA(0x02, 160/8-1), /* number of chars/byte width of the screen */ - U8X8_CA(0x03, 159), /* time division */ - U8X8_CA(0x08, 0x00), /* display start low */ - U8X8_CA(0x09, 0x00), /* display start high */ - - U8X8_DLY(10), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_lc7981_160x160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_lc7981_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_lc7981_160x160_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_160x160_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* LC7981 240x128 LCD*/ - -static const u8x8_display_info_t u8x8_lc7981_240x128_display_info = -{ - /* chip_enable_level = */ 0, /* LC7981 has a low active CS*/ - /* chip_disable_level = */ 1, - - /* from here... */ - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* ... to here, values are ignored, because this is a parallel interface only */ - - /* data_setup_time_ns = */ 220, - /* write_pulse_width_ns = */ 20, - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 128 -}; - -static const uint8_t u8x8_d_lc7981_240x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(50), - - U8X8_CA(0x00, 0x32), /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1) */ - U8X8_CA(0x01, 0x07), /* character/bits per pixel pitch */ - U8X8_CA(0x02, 240/8-1), /* number of chars/byte width of the screen */ - U8X8_CA(0x03, 0x7f), /* time division */ - U8X8_CA(0x08, 0x00), /* display start low */ - U8X8_CA(0x09, 0x00), /* display start high */ - - U8X8_DLY(10), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_lc7981_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_lc7981_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_lc7981_240x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_240x128_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* LC7981 240x64 LCD*/ -/* https://github.com/olikraus/u8g2/issues/642 */ - -static const u8x8_display_info_t u8x8_lc7981_240x64_display_info = -{ - /* chip_enable_level = */ 0, /* LC7981 has a low active CS*/ - /* chip_disable_level = */ 1, - - /* from here... */ - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* ... to here, values are ignored, because this is a parallel interface only */ - - /* data_setup_time_ns = */ 220, - /* write_pulse_width_ns = */ 20, - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_d_lc7981_240x64_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(50), - - U8X8_CA(0x00, 0x32), /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1) */ - U8X8_CA(0x01, 0x07), /* character/bits per pixel pitch */ - U8X8_CA(0x02, 240/8-1), /* number of chars/byte width of the screen */ - U8X8_CA(0x03, 0x7f), /* time division */ - U8X8_CA(0x08, 0x00), /* display start low */ - U8X8_CA(0x09, 0x00), /* display start high */ - - U8X8_DLY(10), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_lc7981_240x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_lc7981_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_lc7981_240x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_lc7981_240x64_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ld7032_60x32.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ld7032_60x32.c deleted file mode 100644 index 8d307f8..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ld7032_60x32.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - - u8x8_d_ld7032_60x32.c - Note: Flip Mode is NOT supported - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - -/* testboard U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board) */ -/* http://www.seeedstudio.com/document/pdf/0.5OLED%20SPEC.pdf */ -#ifdef OBSOLETE -static const uint8_t u8x8_d_ld7032_60x32_init_seq_old[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - //U8X8_CA(0x002, 0x001), /* Dot Matrix Display ON */ - U8X8_CA(0x014, 0x000), /* Stand-by OFF */ - U8X8_CA(0x01a, 0x004), /* Dot Matrix Frame Rate, special value for this OLED from manual*/ - U8X8_CA(0x01d, 0x000), /* Graphics Memory Writing Direction: reset default (right down, horizontal) */ - U8X8_CA(0x009, 0x000), /* Display Direction: reset default (x,y: min --> max) */ - U8X8_CAA(0x030, 0x000, 0x03b), /* Display Size X, Column Start - End*/ - U8X8_CAA(0x032, 0x000, 0x01f), /* Display Size Y, Row Start - End*/ - U8X8_CA(0x010, 0x000), /* Peak Pulse Width Set: 0 SCLK */ - U8X8_CA(0x016, 0x000), /* Peak Pulse Delay Set: 0 SCLK */ - U8X8_CA(0x012, 0x040), /* Dot Matrix Current Level Set: 0x050 * 1 uA = 80 uA */ - U8X8_CA(0x018, 0x003), /* Pre-Charge Pulse Width: 3 SCLK */ - U8X8_CA(0x044, 0x002), /* Pre-Charge Mode: Every Time */ - U8X8_CA(0x048, 0x003), /* Row overlap timing: Pre-Charge + Peak Delay + Peak boot Timing */ - U8X8_CA(0x03f, 0x011), /* VCC_R_SEL: ??? */ - U8X8_CA(0x03d, 0x000), /* VSS selection: 2.8V */ - //U8X8_CA(0x002, 0x001), /* Dot Matrix Display ON */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; -#endif - -/* new sequence https://github.com/olikraus/u8g2/issues/865 */ -static const uint8_t u8x8_d_ld7032_60x32_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x02, 0x00), /* Dot Matrix Display OFF */ - U8X8_CA(0x14, 0x00), /* Stand-by OFF, OSCA Start */ - U8X8_CA(0x1a, 0x04), /* Dot Matrix Frame Rate, special value for this OLED from manual 4 => 120Hz*/ - U8X8_CA(0x1d, 0x00), /* Graphics Memory Writing Direction: reset default (right down, horizontal) */ - U8X8_CA(0x09, 0x00), /* Display Direction: reset default (x,y: min --> max) */ - U8X8_CAA(0x30, 0x00, 0x3B), /* Display Size X, Column Start - End 0-0x3b(59)*/ - U8X8_CAA(0x32, 0x00, 0x1F), /* Display Size Y, Row Start - End 0-0x1f(31)*/ - U8X8_CA(0x34, 0x00), /* Data Reading/Writing Box X start */ - U8X8_CA(0x35, 0x07), /* Data Reading/Writing Box X end */ - U8X8_CA(0x36, 0x00), /* Data Reading/Writing Box Y start */ - U8X8_CA(0x37, 0x1F), /* Data Reading/Writing Box Y end */ - U8X8_CA(0x38, 0x00), /* Display Start Address X */ - U8X8_CA(0x39, 0x00), /* Display Start Address Y */ - U8X8_CA(0x10, 0x00), /* Peak Pulse Width Set: 0 SCLK */ - U8X8_CA(0x16, 0x00), /* Peak Pulse Delay Set: 0 SCLK */ - U8X8_CA(0x12, 0x40), /* 0x32, 0x50 or 0x40 Dot Matrix Current Level Set: 0x050 * 1 uA = 80 uA */ - U8X8_CA(0x18, 0x03), /* Pre-Charge Pulse Width: 3 SCLK */ - U8X8_CA(0x44, 0x02), /* Pre-Charge Mode: Every Time */ - U8X8_CA(0x48, 0x03), /* Row overlap timing: Pre-Charge + Peak Delay + Peak boot Timing */ - U8X8_CA(0x17, 0x00), /* Row Scan */ - U8X8_CA(0x13, 0x00), /* Row Scan Sequence Setting */ - U8X8_CA(0x1C, 0x00), /* Data Reverse */ - U8X8_CA(0x3f, 0x11), /* VCC_R_SEL: Internal Regulator enabled(D4=1) and VCC_R=VCC_C*0.7(D0=1) */ - U8X8_CA(0x3d, 0x00), /* VSS selection: 2.8V */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ld7032_60x32_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x002, 0x001), /* Dot Matrix Display ON */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ld7032_60x32_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x002, 0x000), /* Dot Matrix Display ON */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ld7032_60x32_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x009, 0x000), /* Display Direction: reset default (x,y: min --> max) */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ld7032_60x32_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - //U8X8_CA(0x009, 0x002), /* Display Direction: reset default (x,y: min --> max) */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ld7032_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ld7032_60x32_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ld7032_60x32_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ld7032_60x32_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ld7032_60x32_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ld7032_60x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ld7032_60x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x012 ); - if ( arg_int > 0x07f ) /* default is 0x040, limit to 0x07f to be on the safe side (hopefully) */ - arg_int= 0x07f; - u8x8_cad_SendArg(u8x8, arg_int ); /* values from 0x00 to 0x0ff are allowed, bit will all values be safe??? */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x += u8x8->x_offset/8; - u8x8_cad_SendCmd(u8x8, 0x034 ); - u8x8_cad_SendArg(u8x8, x ); - u8x8_cad_SendCmd(u8x8, 0x035 ); - u8x8_cad_SendArg(u8x8, 0x007 ); - u8x8_cad_SendCmd(u8x8, 0x036 ); - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)*8 ); - u8x8_cad_SendCmd(u8x8, 0x037 ); - u8x8_cad_SendArg(u8x8, 0x01f ); - u8x8_cad_SendCmd(u8x8, 0x008 ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ld7032_60x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 15, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 30, /* 20ns, but cycle time is 60ns, so use 60/2 */ - /* sck_pulse_width_ns = */ 30, /* 20ns, but cycle time is 60ns, so use 60/2 */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 20, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 8, - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 60, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_ld7032_60x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ld7032_60x32_display_info); - return 1; - } - return u8x8_d_ld7032_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ls013b7dh03.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ls013b7dh03.c deleted file mode 100644 index 458570d..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ls013b7dh03.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - - u8x8_d_ls013b7dh03.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The LS013B7DH02 is a simple display and controller - --> no support for contrast adjustment, flip and power down. -*/ - -#include "u8x8.h" - -#define SWAP8(a) ((((a) & 0x80) >> 7) | (((a) & 0x40) >> 5) | (((a) & 0x20) >> 3) | (((a) & 0x10) >> 1) | (((a) & 0x08) << 1) | (((a) & 0x04) << 3) | (((a) & 0x02) << 5) | (((a) & 0x01) << 7)) - -#define LS013B7DH03_CMD_UPDATE (0x01) -#define LS013B7DH03_CMD_ALL_CLEAR (0x04) -#define LS013B7DH03_VAL_TRAILER (0x00) - -static const u8x8_display_info_t u8x8_ls013b7dh03_128x128_display_info = -{ - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, - /* post_chip_enable_wait_ns = */ 50, - /* pre_chip_disable_wait_ns = */ 50, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 227, /* 227 nsec according to the datasheet */ - /* sck_pulse_width_ns = */ 255, /* 450 nsec according to the datasheet */ - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 2, /* active low, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 100, - /* write_pulse_width_ns = */ 100, - /* tile_width = */ 16, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -uint8_t u8x8_d_ls013b7dh03_128x128(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, void *arg_ptr) -{ - uint8_t y, c, i; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ls013b7dh03_128x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - - /* clear screen */ - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, SWAP8(LS013B7DH03_CMD_ALL_CLEAR) ); - u8x8_cad_SendCmd(u8x8, LS013B7DH03_VAL_TRAILER); - u8x8_cad_EndTransfer(u8x8); - - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - /* not available for the ls013b7dh03 */ - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - /* each tile is 8 lines, with the data starting at the left edge */ - y = ((((u8x8_tile_t *)arg_ptr)->y_pos) * 8) + 1; - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - /* send data mode byte */ - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, SWAP8(LS013B7DH03_CMD_UPDATE) ); - - /* send 8 lines of 16 bytes (=128 pixels) */ - for( i = 0; i < 8; i++ ) - { - u8x8_cad_SendCmd(u8x8, SWAP8(y + i) ); - u8x8_cad_SendData(u8x8, c, ptr); - u8x8_cad_SendCmd(u8x8, LS013B7DH03_VAL_TRAILER); - - ptr += c; - } - - /* finish with a trailing byte */ - u8x8_cad_SendCmd(u8x8, LS013B7DH03_VAL_TRAILER); - u8x8_cad_EndTransfer(u8x8); - - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ls027b7dh01_400x240_display_info = -{ - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, - /* post_chip_enable_wait_ns = */ 50, - /* pre_chip_disable_wait_ns = */ 50, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 227, /* 227 nsec according to the datasheet */ - /* sck_pulse_width_ns = */ 255, /* 450 nsec according to the datasheet */ - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 2, /* active low, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 100, - /* write_pulse_width_ns = */ 100, - /* tile_width = */ 50, - /* tile_hight = */ 30, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 400, - /* pixel_height = */ 240 -}; - -uint8_t u8x8_d_ls027b7dh01_400x240(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ls027b7dh01_400x240_display_info); - break; - default: - return u8x8_d_ls013b7dh03_128x128(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - -static const u8x8_display_info_t u8x8_ls013b7dh05_144x168_display_info = -{ - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, - /* post_chip_enable_wait_ns = */ 50, - /* pre_chip_disable_wait_ns = */ 50, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 227, /* 227 nsec according to the datasheet */ - /* sck_pulse_width_ns = */ 255, /* 450 nsec according to the datasheet */ - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 2, /* active low, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 100, - /* write_pulse_width_ns = */ 100, - /* tile_width = */ 18, - /* tile_hight = */ 21, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 144, - /* pixel_height = */ 168 -}; - -uint8_t u8x8_d_ls013b7dh05_144x168(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ls013b7dh05_144x168_display_info); - break; - default: - return u8x8_d_ls013b7dh03_128x128(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_max7219.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_max7219.c deleted file mode 100644 index ad41f72..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_max7219.c +++ /dev/null @@ -1,459 +0,0 @@ -/* - - u8x8_d_max7219.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -static const uint8_t u8x8_d_max7219_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_END_TRANSFER(), /* disable chip */ - - - //U8X8_CA(12, 0), /* shutdown */ - - //U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_max7219_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_max7219_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_max7219_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t c, j, i; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_pcf8812_96x65_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave1_seq); - break; - */ -/* not supported by MAX7219 - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - break; -*/ -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - for( i = 0; i < u8x8->display_info->tile_width; i++ ) - { - u8x8_cad_SendCmd(u8x8, 10 ); /* brightness */ - u8x8_cad_SendArg(u8x8, (arg_int>>4) ); /* 0..15 for contrast */ - } - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - /* transfer always has to start at x pos 0 (u8x8 is not supported) */ - /* also y pos has to be 0 */ - /* arg_int is ignored */ - //x = ((u8x8_tile_t *)arg_ptr)->x_pos; - - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ - for( i = 0; i < 8; i++ ) - { - u8x8_cad_StartTransfer(u8x8); - for( j = 0; j < c; j++ ) - { - u8x8_cad_SendCmd(u8x8, i+1); /* commands 1..8 select the byte */ - u8x8_cad_SendArg(u8x8, *ptr ); - ptr++; - } - u8x8_cad_EndTransfer(u8x8); - } - - break; - default: - return 0; - } - return 1; -} - -/*==============================*/ - -static const u8x8_display_info_t u8x8_max7219_32x8_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 100, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 100, - /* sck_pulse_width_ns = */ 100, - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 4, - /* tile_hight = */ 1, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 32, - /* pixel_height = */ 8 -}; - -uint8_t u8x8_d_max7219_32x8(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY : - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_max7219_32x8_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave1_seq); - return 1; - } - return u8x8_d_max7219_generic(u8x8, msg, arg_int, arg_ptr); -} - -/*==============================*/ - -static const u8x8_display_info_t u8x8_max7219_16x16_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 100, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 100, - /* sck_pulse_width_ns = */ 100, - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 2, - /* tile_hight = */ 2, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 16, - /* pixel_height = */ 16 -}; - -/* - Multiple page rows are not supported, so 16x16 will not work. - Due to the hardware structure of such displays all tiles of the display - must be written at once. - This is not possible with the current u8g2 structure. - So u8x8_d_max7219_16x16 will not work. -*/ - -uint8_t u8x8_d_max7219_16x16(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY : - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_max7219_16x16_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave1_seq); - return 1; - } - return u8x8_d_max7219_generic(u8x8, msg, arg_int, arg_ptr); -} - -/*==============================*/ - -static const u8x8_display_info_t u8x8_max7219_8x8_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 100, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 100, - /* sck_pulse_width_ns = */ 100, - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 1, - /* tile_hight = */ 1, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 8, - /* pixel_height = */ 8 -}; - -uint8_t u8x8_d_max7219_8x8(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY : - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_max7219_8x8_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave1_seq); - return 1; - } - return u8x8_d_max7219_generic(u8x8, msg, arg_int, arg_ptr); -} - - -/*==============================*/ - -static const uint8_t u8x8_d_max7219_8_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_CA(15, 0), /* test mode off */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_CA(12, 0), /* */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_CA(9, 0), /* decode mode: graphics */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_CA(10, 10), /* medium high intensity */ - U8X8_END_TRANSFER(), /* disable chip */ - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_CA(11, 7), /* scan limit: display all digits (assuming a 8x8 matrix) */ - U8X8_END_TRANSFER(), /* disable chip */ - - - //U8X8_CA(12, 0), /* shutdown */ - - //U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_max7219_8_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_CA(12, 1), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_max7219_8_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_CA(12, 0), /* shutdown */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_max7219_64x8_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 100, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 100, - /* sck_pulse_width_ns = */ 100, - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 8, - /* tile_hight = */ 1, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 64, - /* pixel_height = */ 8 -}; - -uint8_t u8x8_d_max7219_64x8(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY : - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_max7219_64x8_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_8_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_8_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_8_powersave1_seq); - return 1; - } - return u8x8_d_max7219_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcd8544_84x48.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcd8544_84x48.c deleted file mode 100644 index 7a14dcd..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcd8544_84x48.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - - u8x8_d_pcd8544_84x48.c (so called "Nokia 5110" displays) - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_pcd8544_84x48_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x021), /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */ - U8X8_C(0x006), /* temp. control: b10 = 2 */ - U8X8_C(0x013), /* bias system 1:48 */ - U8X8_C(0x0c0), /* medium Vop */ - - U8X8_C(0x020), /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ - U8X8_C(0x008), /* blank */ - U8X8_C(0x024), /* power down (PD=1), horizontal increment (V=0), enter normal command set (H=0) */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_pcd8544_84x48_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x020), /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ - U8X8_C(0x00c), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_pcd8544_84x48_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x020), /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ - U8X8_C(0x008), /* blank */ - U8X8_C(0x024), /* power down (PD=1), horizontal increment (V=0), enter normal command set (H=0) */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -static const u8x8_display_info_t u8x8_pcd8544_84x48_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 2, - /* post_reset_wait_ms = */ 2, - /* sda_setup_time_ns = */ 12, - /* sck_pulse_width_ns = */ 75, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 11, /* width of 11*8=88 pixel */ - /* tile_hight = */ 6, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 84, - /* pixel_height = */ 48 -}; - -uint8_t u8x8_d_pcd8544_84x48(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_pcd8544_84x48_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_pcd8544_84x48_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_pcd8544_84x48_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_pcd8544_84x48_powersave1_seq); - break; - // case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - // break; NOT SUPPORTED - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x021 ); /* command mode, extended function set */ - u8x8_cad_SendCmd(u8x8, 0x080 | (arg_int >> 1) ); - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x020 ); /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ - u8x8_cad_SendCmd(u8x8, 0x080 | (x) ); /* set X address */ - u8x8_cad_SendCmd(u8x8, 0x040 | (((u8x8_tile_t *)arg_ptr)->y_pos) ); /* set Y address */ - - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - do - { - if ( c + x > 84u ) - { - if ( x >= 84u ) - break; - c = 84u; - c -= x; - } - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - x += c; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8812.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8812.c deleted file mode 100644 index b103a7b..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8812.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - - u8x8_d_pcf8812.c - - pcf8812: 65x102 - pcf8814: 65x96 - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -static const uint8_t u8x8_d_pcf8812_96x65_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x020), /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ - U8X8_C(0x008), /* blank display */ - - U8X8_C(0x021), /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */ - U8X8_C(0x006), /* temp. control: b10 = 2 */ - U8X8_C(0x013), /* bias system, 0x010..0x07 1:48 */ - U8X8_C(0x09f), /* contrast setting, 0..127 */ - //U8X8_CA(0x020 | 2, 0x080 | 0), /* contrast setting, pcf8814 */ - - U8X8_C(0x024), /* deactivate chip (PD=1), horizontal increment (V=0), enter normal command set (H=0) */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_pcf8812_96x65_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x020), /* power on */ - U8X8_C(0x00c), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_pcf8812_96x65_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x020), /* power on */ - U8X8_C(0x008), /* blank display */ - U8X8_C(0x024), /* power down */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_pcf8812_96x65_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_pcf8812_96x65_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_pcf8812_96x65_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_pcf8812_96x65_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_pcf8812_96x65_powersave1_seq); - break; -/* - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_pcf8812_96x65_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_pcf8812_96x65_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -*/ -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x021 ); /* command mode, extended function set */ - u8x8_cad_SendArg(u8x8, (arg_int>>1)|0x80 ); /* 0..127 for contrast */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x020 ); /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ - u8x8_cad_SendCmd(u8x8, 0x080 | x); - u8x8_cad_SendCmd(u8x8, 0x040 | ((u8x8_tile_t *)arg_ptr)->y_pos); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_pcf8812_96x65_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 100, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 100, - /* sck_pulse_width_ns = */ 100, - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 12, - /* tile_hight = */ 9, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 96, - /* pixel_height = */ 65 -}; - -uint8_t u8x8_d_pcf8812_96x65(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_pcf8812_96x65_display_info); - return 1; - } - return u8x8_d_pcf8812_96x65_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8814_hx1230.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8814_hx1230.c deleted file mode 100644 index c2ce3d2..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_pcf8814_hx1230.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - - u8x8_d_pcf8814_hc1230.c - - pcf8814: 65x96 - hx1230: 68x96 - - pcf8814 and hc1230 are almost identical. - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -static const uint8_t u8x8_d_hx1230_96x68_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x020), /* power off */ - U8X8_C(0x080), /* contrast setting, 0..31, set to 0 */ - U8X8_C(0x0a6), /* not inverted display */ - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_C(0x0a0), /* */ - U8X8_C(0x0c0), /* */ - - U8X8_C(0x040), /* start at scanline 0 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_hx1230_96x68_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x02f), /* power on */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_hx1230_96x68_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* All pixels on = powersave */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_hx1230_96x68_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* */ - U8X8_C(0x0c0), /* */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_hx1230_96x68_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* */ - U8X8_C(0x0c8), /* */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_hx1230_96x68_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_hx1230_96x68_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, (arg_int>>3)|0x80 ); /* 0..31 for contrast */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, x&15); - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4)); - u8x8_cad_SendCmd(u8x8, 0x0b0 | ((u8x8_tile_t *)arg_ptr)->y_pos); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -static const u8x8_display_info_t u8x8_hx1230_96x68_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 100, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 100, - /* sck_pulse_width_ns = */ 100, - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 12, - /* tile_hight = */ 9, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 96, - /* pixel_height = */ 68 -}; - -uint8_t u8x8_d_hx1230_96x68(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_hx1230_96x68_display_info); - return 1; - } - return u8x8_d_hx1230_96x68_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sbn1661.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sbn1661.c deleted file mode 100644 index 978ab0d..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sbn1661.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - - u8x8_d_sbn1661.c - - SED1520 / SBN1661 122x32 5V LCD - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_sbn1661_init_seq[] = { - U8X8_C(0x0c0), /* display start at line 0 */ - U8X8_C(0x0a0), /* a0: ADC forward, a1: ADC reverse */ - U8X8_C(0x0a4), /* a4: normal driving, a5: power save */ - U8X8_C(0x0a9), /* a8: 1/16, a9: 1/32 duty */ - - //U8X8_C(0x0af), /* display on */ - - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sbn1661_powersave0_seq[] = { - U8X8_C(0x0af), /* display on */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sbn1661_powersave1_seq[] = { - U8X8_C(0x0ae), /* display off */ - U8X8_END() /* end of sequence */ -}; - - -struct u8x8_sbn1661_vars -{ - uint8_t *ptr; - uint8_t x; - uint8_t c; - uint8_t arg_int; -}; - -#ifdef NOT_USED -static void u8x8_sbn1661_out(u8x8_t *u8x8, struct u8x8_sbn1661_vars *v, void *arg_ptr) -{ - uint8_t cnt; - u8x8_cad_SendCmd(u8x8, 0x000 | ((v->x << 3) & 63) ); - u8x8_cad_SendCmd(u8x8, 0x0b8 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - while( v->arg_int > 0 ) - { - /* calculate tiles to next boundary (end or chip limit) */ - cnt = v->x; - cnt += 8; - cnt &= 0x0f8; - cnt -= v->x; - - if ( cnt > v->c ) - cnt = v->c; - - /* of course we still could use cnt=1 here... */ - /* but setting cnt to 1 is not very efficient */ - //cnt = 1; - - v->x +=cnt; - v->c-=cnt; - cnt<<=3; - u8x8_cad_SendData(u8x8, cnt, v->ptr); /* note: SendData can not handle more than 255 bytes */ - v->ptr += cnt; - - if ( v->c == 0 ) - { - v->ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - v->c = ((u8x8_tile_t *)arg_ptr)->cnt; - v->arg_int--; - } - if ( ((v->x) & 7) == 0 ) - break; - } -} -#endif /* NOT_USED */ - - -static const u8x8_display_info_t u8x8_sbn1661_122x32_display_info = -{ - /* chip_enable_level = */ 0, /* sbn1661: Not used */ - /* chip_disable_level = */ 1, /* sbn1661: Not used */ - - /* post_chip_enable_wait_ns = */ 100, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, /* */ - /* sda_setup_time_ns = */ 12, - /* sck_pulse_width_ns = */ 75, /* sbn1661: Not used */ - /* sck_clock_hz = */ 4000000UL, /* sbn1661: Not used */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* sbn1661: Not used */ - /* data_setup_time_ns = */ 200, - /* write_pulse_width_ns = */ 200, /* */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 122, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_sbn1661_122x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t *ptr; - //uint8_t x; - //uint8_t c; - - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sbn1661_122x32_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 0, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_sbn1661_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_sbn1661_init_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 1, NULL); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - - if ( arg_int == 0 ) - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 0, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_sbn1661_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_sbn1661_powersave0_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 1, NULL); - } - else - { - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 0, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_sbn1661_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendSequence(u8x8, u8x8_d_sbn1661_powersave1_seq); - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 1, NULL); - - } - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - // x and c are ignored (u8g2 only) - //x = ((u8x8_tile_t *)arg_ptr)->x_pos; - //c = ((u8x8_tile_t *)arg_ptr)->cnt; - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 0, NULL); - u8x8_cad_SendCmd(u8x8, 0x000 | 0); // column 0 - u8x8_cad_SendCmd(u8x8, 0x0b8 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendData(u8x8, 61, ptr); /* note: SendData can not handle more than 255 bytes */ - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL); - - ptr += 61; - - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL); - u8x8_cad_SendCmd(u8x8, 0x000 | 0); // column 0 - u8x8_cad_SendCmd(u8x8, 0x0b8 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - u8x8_cad_SendData(u8x8, 61, ptr); /* note: SendData can not handle more than 255 bytes */ - u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 1, NULL); - - break; - default: - return 0; - } - return 1; -} - -uint8_t u8x8_d_sed1520_122x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - return u8x8_d_sbn1661_122x32(u8x8, msg, arg_int, arg_ptr); - -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sed1330.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sed1330.c deleted file mode 100644 index 1ebf88b..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sed1330.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - - u8x8_d_sed1330.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The device might also work with the RA8835, SED1335 and SED1336 controller. - The following devices might be compatible: - RA8835 - SED1330 - SED1335 - S1D13700 - - -*/ -#include "u8x8.h" - - - -static const uint8_t u8x8_d_sed1330_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */ - U8X8_CA(0x059, 0x004), /* send display on command (hex 0x059, see p37 ) */ - /* display cmd has one arg: 01010100 should enable all three blocks, but disable the cursor*/ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sed1330_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x058, 0x000), /* send display off command (hex 0x059, see p37) and turn of all banks */ - /* maybe send a sleep in cmd */ - //U8X8_C(0x053) /* sleep in: 0x053 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_sed1330_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t c, i; - uint16_t y; - uint8_t *ptr; - switch(msg) - { - /* U8X8_MSG_DISPLAY_SETUP_MEMORY is handled by the calling function */ - /* - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - break; - case U8X8_MSG_DISPLAY_INIT: - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y*=8; - y*= u8x8->display_info->tile_width; - - u8x8_cad_StartTransfer(u8x8); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ - for( i = 0; i < 8; i++ ) - { - u8x8_cad_SendCmd(u8x8, 0x046 ); /* CSRW command*/ - u8x8_cad_SendArg(u8x8, y&255); /* CSRW low adr byte */ - u8x8_cad_SendArg(u8x8, y>>8); /* CSRW high adr byte */ - u8x8_cad_SendCmd(u8x8, 0x042 ); /* MWRITE */ - - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */ - - ptr += u8x8->display_info->tile_width; - y += u8x8->display_info->tile_width; - } - - /* sometimes the display switches off... so just sent a display on command */ - u8x8_cad_SendCmd(u8x8, 0x059 ); /* display on */ - u8x8_cad_SendArg(u8x8, 0x004); /* arg for display on */ - - u8x8_cad_EndTransfer(u8x8); - //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ - - break; - default: - return 0; - } - return 1; -} - -/*=============================================*/ - - -static const u8x8_display_info_t u8x8_sed1330_240x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 30, /* G242CX Datasheet p5 */ - /* pre_chip_disable_wait_ns = */ 10, /* G242CX Datasheet p5 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 120, /* G242CX Datasheet p5 */ - /* write_pulse_width_ns = */ 220, /* G242CX Datasheet p5 */ - /* tile_width = */ 0x01e, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 128 -}; - -/* 240x128 Seiko G242C */ -static const uint8_t u8x8_d_sed1330_240x128_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - /* system init command, see also u8x8_d_sed1330_powersave0_seq */ - U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */ - /* system init has total 8 parameters, so 7 more are here */ - U8X8_A(0x087), /* no idea here... WF (topmost bit) is set to one because it is suggested in the datasheet, lowest 3 bits refer to text mode only */ - U8X8_A(0x007), /* FY: height of a char+1, does not matter here (hopefully), because we use graphics mode only */ - U8X8_A(0x01d), /* C/R: this could be the number of horizontal bytes - 1 (Value confirmed with app notes p41) */ - U8X8_A(0x050), /* TC/R: According to app notes fOSC=6Mhz fFF=70Hz --> TC/R = 74d*/ - U8X8_A(0x080), /* L/F: Lines per frame - 1, probably this is the height of the display - 1 (value confirmed with app notes p41)*/ - U8X8_A(0x01e), /* Low byte of the virtual screen size. (Value confirmed with app notes p41) */ - U8X8_A(0), /* High byte of the virtual screen size, see also section 9.1.2 */ - - U8X8_C(0x044), /* SCROLL */ - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x080), - U8X8_A(0x000), - U8X8_A(0x040), - U8X8_A(0x080), - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x000), - - U8X8_CA(0x05a, 0), /* HDOT SCR: Horizontal dotwise scroll... set to 0 */ - - U8X8_CA(0x05b, 0x0c), /* OVLAY: 2-layer, all graphics, OR between layer 1 and 2 */ - - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - -/* RA8835 NHD-240128BZ */ -static const uint8_t u8x8_d_rh8835_nhd_240128_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - /* system init command, see also u8x8_d_sed1330_powersave0_seq */ - U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */ - /* system init has total 8 parameters, so 7 more are here */ - U8X8_A(0x087), /* no idea here... WF (topmost bit) is set to one because it is suggested in the datasheet, lowest 3 bits refer to text mode only */ - U8X8_A(0x007), /* FY: height of a char+1, does not matter here (hopefully), because we use graphics mode only */ - U8X8_A(0x01d), /* C/R: this could be the number of horizontal bytes - 1 (Value confirmed with app notes p41) */ - U8X8_A(0x050), /* TC/R: According to app notes fOSC=6Mhz fFF=70Hz --> TC/R = 74d*/ - U8X8_A(0x080), /* L/F: Lines per frame - 1, probably this is the height of the display - 1 (value confirmed with app notes p41)*/ - U8X8_A(0x01e), /* Low byte of the virtual screen size. (Value confirmed with app notes p41) */ - U8X8_A(0), /* High byte of the virtual screen size, see also section 9.1.2 */ - - U8X8_C(0x044), /* SCROLL */ - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x080), - U8X8_A(0x000), - U8X8_A(0x040), - U8X8_A(0x080), - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x000), - - //U8X8_CA(0x05a, 0), /* HDOT SCR: Horizontal dotwise scroll... set to 0 */ - - U8X8_CA(0x05b, 0x0c), /* OVLAY: 2-layer, all graphics, OR between layer 1 and 2 */ - - //U8X8_CA(0x059, 0x04), /* send display on command (hex 0x059, see p37 ) */ - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), - -}; - - -uint8_t u8x8_d_sed1330_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sed1330_240x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_240x128_init_seq); - break; - default: - return u8x8_d_sed1330_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - -uint8_t u8x8_d_ra8835_nhd_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sed1330_240x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_rh8835_nhd_240128_init_seq); - break; - default: - return u8x8_d_sed1330_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - - -/*=============================================*/ - - -static const u8x8_display_info_t u8x8_sed1330_320x240_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 30, /* G242CX Datasheet p5 */ - /* pre_chip_disable_wait_ns = */ 10, /* G242CX Datasheet p5 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 120, /* G242CX Datasheet p5 */ - /* write_pulse_width_ns = */ 220, /* G242CX Datasheet p5 */ - /* tile_width = */ 40, - /* tile_hight = */ 30, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 320, - /* pixel_height = */ 240 -}; - -static const uint8_t u8x8_d_sed1330_320x240_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - /* system init command, see also u8x8_d_sed1330_powersave0_seq */ - U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */ - /* system init has total 8 parameters, so 7 more are here */ - U8X8_A(0x087), /* no idea here... WF (topmost bit) is set to one because it is suggested in the datasheet, lowest 3 bits refer to text mode only */ - U8X8_A(0x007), /* FY: height of a char+1, does not matter here (hopefully), because we use graphics mode only */ - U8X8_A(0x027), /* 40-1 */ /* C/R: this could be the number of horizontal bytes - 1 (Value confirmed with app notes p41) */ - U8X8_A(0x039), /* TC/R: According to app notes fOSC=6Mhz fFF=70Hz --> TC/R = 74d*/ - U8X8_A(0x0ef), /* L/F: Lines per frame - 1, probably this is the height of the display - 1 (value confirmed with app notes p41)*/ - U8X8_A(0x028), /* Low byte of the virtual screen size. (Value confirmed with app notes p41) */ - U8X8_A(0), /* High byte of the virtual screen size, see also section 9.1.2 */ - - U8X8_C(0x044), /* SCROLL */ - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x0ef), - U8X8_A(0x0b0), - U8X8_A(0x004), - U8X8_A(0x0ef), - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x000), - - U8X8_CA(0x05a, 0), /* HDOT SCR: Horizontal dotwise scroll... set to 0 */ - - U8X8_CA(0x05b, 0x0c), /* OVLAY: 2-layer, all graphics, OR between layer 1 and 2 */ - - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - - - -uint8_t u8x8_d_ra8835_320x240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sed1330_320x240_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_320x240_init_seq); - break; - default: - return u8x8_d_sed1330_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_64x32.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_64x32.c deleted file mode 100644 index eec3d98..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_64x32.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - - u8x8_d_sh1106_64x32.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2018, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* issue 568 */ -static const uint8_t u8x8_d_sh1106_64x32_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x01f), /* multiplex ratio, 0.42 OLED */ - U8X8_CA(0x0d3, 0x000), /* display offset, 0.42 OLED */ - U8X8_C(0x040), /* set display start line to 0, 0.42 OLED */ - U8X8_CA(0xad, 0x8b), /* DC-DC ON/OFF Mode Set: Built-in DC-DC is used, Normal Display (POR = 0x8b) */ - U8X8_C(0x33), /* set charge pump voltage 0x30 (POR) .. 0x33 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.66 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.66 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.66 OLED */ - U8X8_CA(0x081, 0x080), /* [2] set contrast control, 0.42 OLED datasheet: 0xcf */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, 0.42 OLED datasheet: 0x22 */ - U8X8_CA(0x0db, 0x028), /* vcomh deselect level, 0.42 OLED datasheet: 0x00 */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_64x32_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_64x32_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_64x32_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_CA(0x0d3, 0), /* display offset, 0.42 OLED */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_64x32_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_CA(0x0d3, 0), /* What is the correct offset in flip 1 mode? --> Issue 547 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_sh1106_64x32_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_64x32_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_64x32_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_64x32_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_64x32_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_64x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_64x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/* copied from SSD1306 */ -static const u8x8_display_info_t u8x8_sh1106_64x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 8, - /* tile_hight = */ 4, - /* default_x_offset = */ 32, - /* flipmode_x_offset = */ 36, - /* pixel_width = */ 64, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_sh1106_64x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_64x32_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_64x32_init_seq); - return 1; - } - return u8x8_d_sh1106_64x32_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_72x40.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_72x40.c deleted file mode 100644 index e2884b0..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1106_72x40.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - - u8x8_d_sh1106_72x40.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2018, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* WiseChip 0.42 OLED, issue 547 */ -static const uint8_t u8x8_d_sh1106_72x40_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x027), /* multiplex ratio, 0.42 OLED */ - U8X8_CA(0x0d3, 0x00c), /* display offset, 0.42 OLED */ - U8X8_C(0x040), /* set display start line to 0, 0.42 OLED */ - U8X8_CA(0xad, 0x8b), /* DC-DC ON/OFF Mode Set: Built-in DC-DC is used, Normal Display (POR = 0x8b) */ - U8X8_C(0x33), /* set charge pump voltage 0x30 (POR) .. 0x33 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.66 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.66 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.66 OLED */ - U8X8_CA(0x081, 0x080), /* [2] set contrast control, 0.42 OLED datasheet: 0xcf */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, 0.42 OLED datasheet: 0x22 */ - U8X8_CA(0x0db, 0x028), /* vcomh deselect level, 0.42 OLED datasheet: 0x00 */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_72x40_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_72x40_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_72x40_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_CA(0x0d3, 12), /* display offset, 0.42 OLED */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1106_72x40_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_CA(0x0d3, 52), /* What is the correct offset in flip 1 mode? --> Issue 547 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_sh1106_72x40_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_72x40_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/* copied from SSD1306 */ -static const u8x8_display_info_t u8x8_sh1106_72x40_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 9, - /* tile_hight = */ 5, - /* default_x_offset = */ 30, - /* flipmode_x_offset = */ 30, - /* pixel_width = */ 72, - /* pixel_height = */ 40 -}; - -/* WiseChip 0.42" OLED */ -uint8_t u8x8_d_sh1106_72x40_wise(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_72x40_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_init_seq); - return 1; - } - return u8x8_d_sh1106_72x40_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1107.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1107.c deleted file mode 100644 index 5e28831..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1107.c +++ /dev/null @@ -1,501 +0,0 @@ -/* - - u8x8_d_sh1107.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - -/* code copyied from SSD1306 */ - - - -static const uint8_t u8x8_d_sh1107_64x128_noname_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1107_64x128_noname_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1107_64x128_noname_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1107_64x128_noname_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_sh1107_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1107_64x128_noname_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_64x128_noname_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_64x128_noname_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_64x128_noname_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_64x128_noname_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_64x128_noname_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* sh1107 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - //u8x8_cad_SendCmd(u8x8, 0x040 ); /* set line offset to 0 */ - - // set column address - u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4)); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15))); /* probably wrong, should be SendCmd */ - - // set page address - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); /* probably wrong, should be SendCmd */ - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*==================================================*/ - -/* QG-6428TSWKG01 */ -static const uint8_t u8x8_d_sh1107_64x128_noname_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0dc, 0x000), /* start line */ - U8X8_CA(0x081, 0x02f), /* [2] set contrast control */ - U8X8_C(0x020), /* use page addressing mode */ - - // U8X8_C(0x0a1), /* segment remap a0/a1*/ - // U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0a8, 0x7f), /* 0x03f) multiplex ratio */ - U8X8_CA(0x0d3, 0x060), /* display offset */ - U8X8_CA(0x0d5, 0x051), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x035), /* vcomh deselect level */ - - U8X8_C(0x0b0), /* set page address */ - U8X8_CA(0x0da, 0x012), /* set com pins */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_sh1107_64x128_noname_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* sh1107: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* sh1107: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* sh1107: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 8, - /* tile_height = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 64, - /* pixel_height = */ 128 -}; - -uint8_t u8x8_d_sh1107_64x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_sh1107_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_64x128_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1107_64x128_noname_display_info); - break; - default: - return 0; - } - return 1; -} - -/*==================================================*/ - -/* init sequence from Grove OLED 96x96 */ -static const uint8_t u8x8_d_sh1107_seeed_96x96_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x050), /* clock divide ratio (0x00=1) and oscillator frequency (0x5) */ - U8X8_C(0x020), /* use page addressing mode */ - //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_CA(0x0dc, 0x000), /* start line */ - //U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - //U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x080), /* [2] set contrast control */ - U8X8_CA(0x0ad, 0x080), /* */ - U8X8_CA(0x0d9, 0x01f), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x027), /* vcomh deselect level */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - //U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_sh1107_seeed_96x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 100, /* cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 100, /* cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 12, - /* tile_hight = */ 12, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 96, - /* pixel_height = */ 96 -}; - -uint8_t u8x8_d_sh1107_seeed_96x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_sh1107_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_seeed_96x96_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1107_seeed_96x96_display_info); - break; - default: - return 0; - } - return 1; -} - - -/*==================================================*/ -/* 128x128 OLED: this display has a very strange x offset */ - -/* sequence taken over from 64x128 sequence, because it seems to work mostly */ -static const uint8_t u8x8_d_sh1107_128x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0dc, 0x000), /* start line */ - U8X8_CA(0x081, 0x02f), /* [2] set contrast control */ - U8X8_C(0x020), /* use page addressing mode */ - - // U8X8_C(0x0a1), /* segment remap a0/a1*/ - // U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0a8, 0x7f), /* 0x03f multiplex ratio */ - //U8X8_CA(0x0d3, 0x060), /* display offset (removed, not in datasheet ) */ - U8X8_CA(0x0d5, 0x050), /* clock divide ratio (0x00=1) and oscillator frequency (0x8), changed to 0x051, issue 501 */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x035), /* vcomh deselect level */ - - U8X8_C(0x0b0), /* set page address */ - U8X8_CA(0x0da, 0x012), /* set com pins */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_sh1107_128x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 100, /* cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 100, /* cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 16, - /* default_x_offset = */ 96, - /* flipmode_x_offset = */ 96, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -uint8_t u8x8_d_sh1107_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_sh1107_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_128x128_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1107_128x128_display_info); - break; - default: - return 0; - } - return 1; -} - -/*==================================================*/ -/* pimoroni_128x128_display */ - -static const u8x8_display_info_t u8x8_sh1107_pimoroni_128x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 100, /* cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 100, /* cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -uint8_t u8x8_d_sh1107_pimoroni_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_sh1107_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_128x128_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1107_pimoroni_128x128_display_info); - break; - default: - return 0; - } - return 1; -} - -/*==================================================*/ -/* -Name: SH1107_seeed_128x128 -URL: https://www.seeedstudio.com/Grove-OLED-Display-1-12-V2.html -Display is there in my lab. Backside PCB label: "OLED Display 1.12 inch v1.0" -Tookover code from SSD1327_SEEED_96X96 because none of the other displays did work -and at least the 96x96 driver did show something. -*/ - -static const u8x8_display_info_t u8x8_seeed_128x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 100, /* cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 100, /* cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 2, // 400kHz does not work, but 200kHz seems to be ok - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -uint8_t u8x8_d_sh1107_seeed_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_sh1107_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_128x128_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_seeed_128x128_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1108.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1108.c deleted file mode 100644 index fbe2cf4..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1108.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - - u8x8_d_sh1108.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2018, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - -/* - code copyied from sh1107 - SH1108: 160x160 controller from Sino Wealth -*/ - - - -static const uint8_t u8x8_d_sh1108_noname_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1108_noname_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1108_160x160_noname_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1108_160x160_noname_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_sh1108_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1108_64x128_noname_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1108_64x128_noname_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1108_noname_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1108_noname_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1108_160x160_noname_powersave0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1108_160x160_noname_powersave1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* sh1108 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - //u8x8_cad_SendCmd(u8x8, 0x040 ); /* set line offset to 0 */ - - // set column address - u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4)); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15))); - - // set page address - u8x8_cad_SendCmd(u8x8, 0x0b0 ); // page cmd is a two byte command - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*==================================================*/ - -/* issue #619, 160x160 OLED */ -static const uint8_t u8x8_d_sh1108_160x160_noname_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x060), /* clock divide ratio and oscillator frequency */ - U8X8_CA(0x0a9, 0x003), /* set display resolution, 0=64x160, 1=96x160, 2=128x160, 3=160x160 */ - U8X8_C(0x020), /* use page addressing mode */ - U8X8_CA(0x081, 0x01f), /* set contrast control */ - U8X8_CA(0x0ad, 0x80), /* DC/DC control 80=Use external Vpp, 89=Use internal DC/DC*/ - U8X8_C(0x030), /* set discharge VSL level, 0x030..0x03f */ - U8X8_CA(0x0d9, 0x028), /* pre-charge period */ - U8X8_CA(0x0db, 0x035), /* vcomh deselect level */ - U8X8_CA(0x0dc, 0x035), /* VSEGM Deselect Level */ - - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_sh1108_160x160_noname_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 60, - /* pre_chip_disable_wait_ns = */ 120, - /* reset_pulse_width_ms = */ 100, /* sh1108: 3 us */ - /* post_reset_wait_ms = */ 100, /* sometimes OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 100, /* sh1108: 100ns */ - /* sck_pulse_width_ns = */ 100, /* sh1108: 100ns */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* sh1108: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 20, - /* tile_height = */ 20, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 160, - /* pixel_height = */ 160 -}; - -uint8_t u8x8_d_sh1108_160x160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_sh1108_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1108_160x160_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1108_160x160_noname_display_info); - break; - default: - return 0; - } - return 1; -} - -/*==================================================*/ diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1122.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1122.c deleted file mode 100644 index 52db4f2..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_sh1122.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - - u8x8_d_sh1122.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - Copied from sh1122 mostly because of the similar RAM architecture. - However: Commands are very different! - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_sh1122_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* sh1122: display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1122_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* sh1122: display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -/* - input: - one tile (8 Bytes) - output: - Tile for SH1122 (32 Bytes) -*/ - -/* -static uint8_t u8x8_sh1122_to32_dest_buf[32]; - -static uint8_t *u8x8_sh1122_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr) -{ - uint8_t v; - uint8_t a,b; - uint8_t i, j; - uint8_t *dest; - - for( j = 0; j < 4; j++ ) - { - dest = u8x8_sh1122_to32_dest_buf; - dest += j; - a =*ptr; - ptr++; - b = *ptr; - ptr++; - for( i = 0; i < 8; i++ ) - { - v = 0; - if ( a&1 ) v |= 0xf0; - if ( b&1 ) v |= 0x0f; - *dest = v; - dest+=4; - a >>= 1; - b >>= 1; - } - } - - return u8x8_sh1122_to32_dest_buf; -} -*/ - - -static uint8_t u8x8_write_byte_to_16gr_device(u8x8_t *u8x8, uint8_t b) -{ - static uint8_t buf[4]; - static uint8_t map[4] = { 0, 0x00f, 0x0f0, 0x0ff }; - buf [3] = map[b & 3]; - b>>=2; - buf [2] = map[b & 3]; - b>>=2; - buf [1] = map[b & 3]; - b>>=2; - buf [0] = map[b & 3]; - return u8x8_cad_SendData(u8x8, 4, buf); -} - -uint8_t u8x8_d_sh1122_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x; - uint8_t y, c, i; - uint8_t *ptr; - switch(msg) - { - /* U8X8_MSG_DISPLAY_SETUP_MEMORY is handled by the calling function */ - /* - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1122_256x64_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1122_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1122_powersave1_seq); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* sh1122 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 2; // only every 4th col can be addressed - x += u8x8->x_offset; - - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y *= 8; - - - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ - for( i = 0; i < 8; i++ ) - { - u8x8_cad_SendCmd(u8x8, 0x0b0 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendCmd(u8x8, x & 15 ); /* lower 4 bit*/ - u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4) ); /* higher 3 bit */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - - while ( c > 0 ) - { - u8x8_write_byte_to_16gr_device(u8x8, *ptr); - c--; - ptr++; - } - y++; - } - - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*=========================================================*/ - -static const uint8_t u8x8_d_sh1122_256x64_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* remap */ - U8X8_C(0x0c8), /* remap */ - U8X8_C(0x060), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_sh1122_256x64_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* remap */ - U8X8_C(0x0c0), /* remap */ - U8X8_C(0x040), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_sh1122_256x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 10, /* sh1122: 10 us */ - /* post_reset_wait_ms = */ 20, /* */ - /* sda_setup_time_ns = */ 125, /* sh1122: cycle time is 250ns, so use 250/2 */ - /* sck_pulse_width_ns = */ 125, /* sh1122: cycle time is 250ns, so use 250/2 */ - /* sck_clock_hz = */ 40000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 10, - /* write_pulse_width_ns = */ 150, /* sh1122: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 32, /* 256 pixel, so we require 32 bytes for this */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* this is the byte offset (there are two pixel per byte with 4 bit per pixel) */ - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 256, - /* pixel_height = */ 64 -}; - - -static const uint8_t u8x8_d_sh1122_256x64_init_seq[] = { - - U8X8_DLY(1), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(1), - - U8X8_C(0xae), /* display off */ - U8X8_C(0x40), /* display start line */ - U8X8_C(0x0a0), /* remap */ - U8X8_C(0x0c0), /* remap */ - U8X8_CA(0x81, 0x80), /* set display contrast */ - U8X8_CA(0xa8, 0x3f), /* multiplex ratio 1/64 Duty (0x0F~0x3F) */ - U8X8_CA(0xad, 0x81), /* use buildin DC-DC with 0.6 * 500 kHz */ - - U8X8_CA(0xd5, 0x50), /* set display clock divide ratio (lower 4 bit)/oscillator frequency (upper 4 bit) */ - U8X8_CA(0xd3, 0x00), /* display offset, shift mapping ram counter */ - U8X8_CA(0xd9, 0x22), /* pre charge (lower 4 bit) and discharge(higher 4 bit) period */ - U8X8_CA(0xdb, 0x35), /* VCOM deselect level */ - U8X8_CA(0xdc, 0x35), /* Pre Charge output voltage */ - U8X8_C(0x030), /* discharge level */ - - U8X8_DLY(1), /* delay */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_sh1122_256x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1122_256x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1122_256x64_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1122_256x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1122_256x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - - default: - return u8x8_d_sh1122_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1305.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1305.c deleted file mode 100644 index ef3c8d5..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1305.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - - u8x8_d_ssd1305.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_ssd1305_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1305_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1305_128x32_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0d3, 32), /* display offset to 32 */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1305_128x32_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0d3, 0), /* display offset to */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -static uint8_t u8x8_d_ssd1305_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x040 ); /* set line offset to 0 */ - - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendArg(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendArg(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos) ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_powersave1_seq); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1305 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -/* timing from SSD1306 */ -static const u8x8_display_info_t u8x8_ssd1305_128x32_noname_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 4, - /* default_x_offset = */ 2, - /* flipmode_x_offset = */ 2, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - - -static const uint8_t u8x8_d_ssd1305_128x32_noname_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_CA(0x0d3, 32), /* display offset to 32 */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x0cf), /* [2] set contrast control */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1305_128x32_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1305_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1305_128x32_noname_display_info); - break; - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* adafruit 128x32 SSD1305 OLED, https://www.adafruit.com/product/2675 */ -/* issue 724 */ - -/* timing from SSD1306 */ -static const u8x8_display_info_t u8x8_ssd1305_128x32_adafruit_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 4, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - - -uint8_t u8x8_d_ssd1305_128x32_adafruit(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1305_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1305_128x32_adafruit_display_info); - break; - default: - return 0; - } - return 1; -} - - - - -/*================================================*/ -/* adafruit SSD1305 OLED */ - -/* timing from SSD1306 */ -static const u8x8_display_info_t u8x8_ssd1305_128x64_adafruit_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 2, - /* flipmode_x_offset = */ 2, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - - -static const uint8_t u8x8_d_ssd1305_128x64_adafruit_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x0f0), /* clock divide ratio (0x00=1) and oscillator frequency */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x040), /* display offset to 32 */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x032), /* [2] set contrast control */ - U8X8_CA(0x082, 0x080), /* set area brightness (reset=0x080) */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1305_128x64_adafruit(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1305_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1305_128x64_adafruit_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1305_128x64_adafruit_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x32.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x32.c deleted file mode 100644 index 70c9b4f..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x32.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - - u8x8_d_ssd1306_128x32.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* UG-2832HSWEG02 Datasheet, Section 4.4 */ -static const uint8_t u8x8_d_ssd1306_128x32_univision_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x01f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x002), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - U8X8_CA(0x081, 0x08f), /* [2] set contrast control */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x32_univision_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x32_univision_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x32_univision_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x32_univision_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1306_128x32_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x32_univision_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1306_128x32_univision_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_ssd1306_128x32_univision(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x32_univision_display_info); - return 1; - } - return u8x8_d_ssd1306_128x32_generic(u8x8, msg, arg_int, arg_ptr); -} - -/*=============================================*/ -/* issue 756 */ - -#define ADDR_MODE 0 //0:horizontal, 1:vertical, 2:page - - -static const u8x8_display_info_t u8x8_ssd1306_128x32_winstar_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 4, - /* default_x_offset = */ 125, - /* flipmode_x_offset = */ 125, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_ssd1306_128x32_winstar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x32_winstar_display_info); - return 1; - } - return u8x8_d_ssd1306_128x32_generic(u8x8, msg, arg_int, arg_ptr); -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x64_noname.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x64_noname.c deleted file mode 100644 index 684dfc3..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_128x64_noname.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - - u8x8_d_ssd1306_128x64_noname.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* more or less generic setup of all these small OLEDs */ -static const uint8_t u8x8_d_ssd1306_128x64_noname_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, SSD1306 only, should be removed for SH1106 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x0cf), /* [2] set contrast control */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* this setup maximizes the brightness range, that can be set with setContrast() */ -/* Drawback: VCOMH deselect level is set to 0, which das not work so good with all OLEDs, issue #116 */ -static const uint8_t u8x8_d_ssd1306_128x64_vcomh0_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - U8X8_CA(0x081, 0x0ef), /* [2] set contrast control, */ - U8X8_CA(0x0d9, 0x0a1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x000), /* vcomh deselect level 0x000 .. 0x070, low nibble always 0 */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* same as u8x8_d_ssd1306_128x64_noname_init_seq, but 0x0da bit 4 is set to 0 */ -/* this will disable the alternative COM configuration */ -static const uint8_t u8x8_d_ssd1306_128x64_alt0_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, SSD1306 only, should be removed for SH1106 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x002), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x0cf), /* [2] set contrast control */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -/* issue 316: a special sh1106 setup, https://www.mikrocontroller.net/topic/431371?goto=5087807#5087807 */ -static const uint8_t u8x8_d_sh1106_128x64_winstar_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0xae), // Display OFF/ON: off (POR = 0xae) - U8X8_C(0xa4), // Set Entire Display OFF/ON: off (POR = 0xa4) - U8X8_CA(0xd5, 0x50), // Divide Ratio/Oscillator FrequencyData Set: divide ratio = 1 (POR = 1), Oscillator Frequency = +/- 0% (POR = +/- 0%) - U8X8_CA(0xa8, 0x3f), // Multiplex Ratio Data Set: 64 (POR = 0x3f, 64) - U8X8_CA(0xd3, 0x00), // Display OffsetData Set: 0 (POR = 0x00) - U8X8_C(0x40), // Set Display Start Line: 0 - U8X8_CA(0xad, 0x8b), // DC-DC ON/OFF Mode Set: Built-in DC-DC is used, Normal Display (POR = 0x8b) - U8X8_CA(0xd9, 0x22), // Dis-charge/Pre-charge PeriodData Set: pre-charge 2 DCLKs, dis-charge 2 DCLKs (POR = 0x22, pre-charge 2 DCLKs, dis-charge 2 DCLKs) - U8X8_CA(0xdb, 0x35), // VCOM Deselect LevelData Set: 0,770V (POR = 0x35, 0,770 V) - U8X8_C(0x32), // Set Pump voltage value: 8,0 V (POR = 0x32, 8,0 V) - U8X8_CA(0x81, 0xff), // Contrast Data Register Set: 255 (large) (POR = 0x80) - U8X8_C(0x0a6), // Set Normal/Reverse Display: normal (POR = 0xa6) - U8X8_CA(0x0da, 0x012), // com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1306_128x64_noname_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x64_noname_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x64_noname_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_128x64_noname_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1306_sh1106_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x64_noname_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x040 ); /* set line offset to 0 */ - - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendArg(u8x8, 0x000 | ((x&15))); /* probably wrong, should be SendCmd */ - u8x8_cad_SendArg(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); /* probably wrong, should be SendCmd */ - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1306_128x64_noname_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_ssd1306_128x64_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x64_noname_display_info); - break; - default: - return 0; - } - return 1; -} - -uint8_t u8x8_d_ssd1306_128x64_vcomh0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_vcomh0_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x64_noname_display_info); - break; - default: - return 0; - } - return 1; -} - -uint8_t u8x8_d_ssd1306_128x64_alt0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_alt0_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x64_noname_display_info); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_sh1106_128x64_noname_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 3, /* active low (clock is high by default), rising edge, this seems to be a difference to the ssd1306 */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 2, - /* flipmode_x_offset = */ 2, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_sh1106_128x64_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - /* maybe use a better init sequence */ - /* https://www.mikrocontroller.net/topic/431371 */ - /* the new sequence is added in the winstar constructor (see below), this is kept untouched */ - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_128x64_noname_display_info); - break; - default: - return 0; - } - return 1; - -} - -uint8_t u8x8_d_sh1106_128x64_vcomh0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_vcomh0_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_128x64_noname_display_info); - break; - default: - return 0; - } - return 1; - -} - -uint8_t u8x8_d_sh1106_128x64_winstar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_128x64_winstar_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_128x64_noname_display_info); - break; - default: - return 0; - } - return 1; - -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_2040x16.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_2040x16.c deleted file mode 100644 index afdd95b..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_2040x16.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - - u8x8_d_ssd1306_2040x16.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - */ -#include "u8x8.h" - -/* virtual device, issue 1291 */ -static const uint8_t u8x8_d_ssd1306_2040x16_init_seq[] = -{ - -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio, 0.71 OLED: changed from 0x2f to 0x3f */ - U8X8_CA(0x0d3, 0x000), /* display offset, 0.71 OLED */ - U8X8_C(0x040), /* set display start line to 0, 0.71 OLED */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, 0.71 OLED 0x14*/ - - /// according to the datasheet, 0x00 is NOT page addressing mode, but horizontal addressing mode; - /// so it looks like u8g2 expects horizontal addressing (and the inline comment is wrong) while the Winstar example - /// actually uses page addressing (which is the reset default) - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.71 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.71 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.71 OLED */ - U8X8_CA(0x081, 0x07f), /* [2] set contrast control, 0.71 OLED datasheet: 0x7f */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, 0.71 OLED datasheet: 0x22 */ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level, 0.71 OLED datasheet: 0x40 */ - - // U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_2040x16_powersave0_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0af), /* display on */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_2040x16_powersave1_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0ae), /* display off */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_2040x16_flip0_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0a1), /* segment remap a0/a1*/ -U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_2040x16_flip1_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0a0), /* segment remap a0/a1*/ -U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static uint8_t u8x8_d_ssd1306_2040x16_generic(u8x8_t *u8x8, uint8_t msg, - uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch (msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_2040x16_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_2040x16_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if (arg_int == 0) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_2040x16_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_2040x16_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if (arg_int == 0) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_2040x16_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_2040x16_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081); - u8x8_cad_SendArg(u8x8, arg_int); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *) arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4)); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *) arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *) arg_ptr)->cnt; - ptr = ((u8x8_tile_t *) arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c * 8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while (arg_int > 0); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -static const u8x8_display_info_t u8x8_ssd1306_2040x16_display_info = -{ -/* chip_enable_level = */0, -/* chip_disable_level = */1, - -/* post_chip_enable_wait_ns = */20, -/* pre_chip_disable_wait_ns = */10, -/* reset_pulse_width_ms = */100, /* SSD1306: 3 us */ -/* post_reset_wait_ms = */100, /* far east OLEDs need much longer setup time */ -/* sda_setup_time_ns = */50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ -/* sck_pulse_width_ns = */50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ -/* sck_clock_hz = */8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ -/* spi_mode = */0, /* active high, rising edge */ -/* i2c_bus_clock_100kHz = */4, -/* data_setup_time_ns = */40, -/* write_pulse_width_ns = */150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ -/* tile_width = */255, -/* tile_height = */2, -/* default_x_offset = */0, -/* flipmode_x_offset = */0, -/* pixel_width = */2040, -/* pixel_height = */16 }; - -uint8_t u8x8_d_ssd1306_2040x16(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if (msg == U8X8_MSG_DISPLAY_SETUP_MEMORY) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_2040x16_display_info); - return 1; - } - else if (msg == U8X8_MSG_DISPLAY_INIT) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_2040x16_init_seq); - return 1; - } - return u8x8_d_ssd1306_2040x16_generic(u8x8, msg, arg_int, arg_ptr); -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_48x64.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_48x64.c deleted file mode 100644 index e2b1f79..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_48x64.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - - u8x8_d_ssd1306_48x64_winstar.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - */ -#include "u8x8.h" - -/* Winstar 0.71 OLED */ -static const uint8_t u8x8_d_ssd1306_48x64_winstar_init_seq[] = -{ - -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio, 0.71 OLED: changed from 0x2f to 0x3f */ - U8X8_CA(0x0d3, 0x000), /* display offset, 0.71 OLED */ - U8X8_C(0x040), /* set display start line to 0, 0.71 OLED */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, 0.71 OLED 0x14*/ - - /// according to the datasheet, 0x00 is NOT page addressing mode, but horizontal addressing mode; - /// so it looks like u8g2 expects horizontal addressing (and the inline comment is wrong) while the Winstar example - /// actually uses page addressing (which is the reset default) - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.71 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.71 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.71 OLED */ - U8X8_CA(0x081, 0x07f), /* [2] set contrast control, 0.71 OLED datasheet: 0x7f */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, 0.71 OLED datasheet: 0x22 */ - U8X8_CA(0x0db, 0x040), /* vcomh deselect level, 0.71 OLED datasheet: 0x40 */ - - // U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_48x64_powersave0_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0af), /* display on */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_48x64_powersave1_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0ae), /* display off */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_48x64_flip0_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0a1), /* segment remap a0/a1*/ -U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_48x64_flip1_seq[] = -{ -U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -U8X8_C(0x0a0), /* segment remap a0/a1*/ -U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ -U8X8_END_TRANSFER(), /* disable chip */ -U8X8_END() /* end of sequence */ -}; - -static uint8_t u8x8_d_ssd1306_48x64_generic(u8x8_t *u8x8, uint8_t msg, - uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch (msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_48x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_winstar_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if (arg_int == 0) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if (arg_int == 0) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081); - u8x8_cad_SendArg(u8x8, arg_int); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *) arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4)); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *) arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *) arg_ptr)->cnt; - ptr = ((u8x8_tile_t *) arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c * 8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while (arg_int > 0); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -static const u8x8_display_info_t u8x8_ssd1306_48x64_display_info = -{ -/* chip_enable_level = */0, -/* chip_disable_level = */1, - -/* post_chip_enable_wait_ns = */20, -/* pre_chip_disable_wait_ns = */10, -/* reset_pulse_width_ms = */100, /* SSD1306: 3 us */ -/* post_reset_wait_ms = */100, /* far east OLEDs need much longer setup time */ -/* sda_setup_time_ns = */50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ -/* sck_pulse_width_ns = */50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ -/* sck_clock_hz = */8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ -/* spi_mode = */0, /* active high, rising edge */ -/* i2c_bus_clock_100kHz = */4, -/* data_setup_time_ns = */40, -/* write_pulse_width_ns = */150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ -/* tile_width = */6, -/* tile_height = */8, -/* default_x_offset = */40, -/* flipmode_x_offset = */40, -/* pixel_width = */48, -/* pixel_height = */64 }; - -/* Winstar 0.71" OLED */ -uint8_t u8x8_d_ssd1306_48x64_winstar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, - void *arg_ptr) -{ - if (msg == U8X8_MSG_DISPLAY_SETUP_MEMORY) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_48x64_display_info); - return 1; - } - else if (msg == U8X8_MSG_DISPLAY_INIT) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_winstar_init_seq); - return 1; - } - return u8x8_d_ssd1306_48x64_generic(u8x8, msg, arg_int, arg_ptr); -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x32.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x32.c deleted file mode 100644 index 2b7b313..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x32.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - - u8x8_d_ssd1306_64x32.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_ssd1306_64x32_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x32_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x32_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x32_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1306_64x32_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_64x32_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_noname_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*======================================================*/ - -static const u8x8_display_info_t u8x8_ssd1306_64x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 8, - /* tile_hight = */ 4, - /* default_x_offset = */ 32, - /* flipmode_x_offset = */ 32, - /* pixel_width = */ 64, - /* pixel_height = */ 32 -}; - - -/*======================================================*/ - -static const uint8_t u8x8_d_ssd1306_64x32_noname_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x02f), /* multiplex ratio: changed from 0x1f to 0x2f */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1 */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - U8X8_CA(0x081, 0x0cf), /* [2] set contrast control datasheet: 0xcf */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1 */ - U8X8_CA(0x0db, 0x000), /* vcomh deselect level */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ssd1306_64x32_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_64x32_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_noname_init_seq); - return 1; - } - return u8x8_d_ssd1306_64x32_generic(u8x8, msg, arg_int, arg_ptr); -} - - -/*======================================================*/ - -static const uint8_t u8x8_d_ssd1306_64x32_1f_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x01f), /* multiplex ratio: changed from 0x1f to 0x2f, 23 Sep 17: changed back to 1f */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1 */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - U8X8_CA(0x081, 0x0cf), /* [2] set contrast control datasheet: 0xcf */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1 */ - U8X8_CA(0x0db, 0x000), /* vcomh deselect level */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ssd1306_64x32_1f(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_64x32_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x32_1f_init_seq); - return 1; - } - return u8x8_d_ssd1306_64x32_generic(u8x8, msg, arg_int, arg_ptr); -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x48.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x48.c deleted file mode 100644 index fea6cbe..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_64x48.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - - u8x8_d_ssd1306_64x48.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* EastRising 0.66 OLED */ -static const uint8_t u8x8_d_ssd1306_64x48_er_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x02f), /* multiplex ratio, 0.66 OLED: changed from 0x1f to 0x2f */ - U8X8_CA(0x0d3, 0x000), /* display offset, 0.66 OLED */ - U8X8_C(0x040), /* set display start line to 0, 0.66 OLED */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, 0.66 OLED 0x14*/ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.66 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.66 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.66 OLED */ - U8X8_CA(0x081, 0x0cf), /* [2] set contrast control, 0.66 OLED datasheet: 0xcf */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, 0.66 OLED datasheet: 0x22 */ - U8X8_CA(0x0db, 0x000), /* vcomh deselect level, 0.66 OLED datasheet: 0x00 */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x48_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x48_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x48_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_64x48_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1306_64x48_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_64x48_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_er_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1306_64x48_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 8, - /* tile_hight = */ 6, - /* default_x_offset = */ 32, - /* flipmode_x_offset = */ 32, - /* pixel_width = */ 64, - /* pixel_height = */ 48 -}; - -/* East Rising 0.66" OLED */ -uint8_t u8x8_d_ssd1306_64x48_er(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_64x48_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_er_init_seq); - return 1; - } - return u8x8_d_ssd1306_64x48_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_72x40.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_72x40.c deleted file mode 100644 index 2c8aa7a..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_72x40.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - - u8x8_d_ssd1306_72x40.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* -EastRising 0.41 OLED -https://www.buydisplay.com/default/white-0-42-inch-oled-display-panel-72x40-iic-i2c-serial-spi-ssd1306 - - - command(0xae);//--turn off oled panel - - command(0xd5);//--set display clock divide ratio/oscillator frequency - command(0x80);//--set divide ratio - - command(0xa8);//--set multiplex ratio - command(0x27);//--1/40 duty - - command(0xd3);//-set display offset - command(0x00);//-not offset - - command(0xad);//--Internal IREF Setting - command(0x30);//-- - - command(0x8d);//--set Charge Pump enable/disable - command(0x14);//--set(0x10) disable - - command(0x40);//--set start line address - - command(0xa6);//--set normal display - - command(0xa4);//Disable Entire Display On - - command(0xa1);//--set segment re-map 128 to 0 - - command(0xC8);//--Set COM Output Scan Direction 64 to 0 - - command(0xda);//--set com pins hardware configuration - command(0x12); - - command(0x81);//--set contrast control register - command(0xaf); - - command(0xd9);//--set pre-charge period - command(0x22); - - command(0xdb);//--set vcomh - command(0x20); - - command(0xaf);//--turn on oled panel - - -*/ -static const uint8_t u8x8_d_ssd1306_72x40_er_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x027), /* multiplex ratio, 0.42 OLED: 0x27*/ - U8X8_CA(0x0d3, 0x000), /* display offset, 0.42 OLED */ - U8X8_CA(0x0ad, 0x030), /* Internal IREF Setting for the 0.42 OLED, see also issue https://github.com/olikraus/u8g2/issues/1047 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, 0.66 OLED 0x14*/ - - U8X8_C(0x040), /* set display start line to 0, 0.66 OLED */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - U8X8_C(0x0a4), /* output ram to display */ - - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.66 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.66 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.66 OLED */ - U8X8_CA(0x081, 0x0af), /* [2] set contrast control, 0.42 OLED */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, 0.42 OLED datasheet: 0x22 */ - U8X8_CA(0x0db, 0x020), /* vcomh deselect level, 0.42 OLED datasheet: 0x20 */ - - U8X8_C(0x02e), /* Deactivate scroll */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_72x40_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_72x40_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_72x40_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_72x40_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1306_72x40_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_72x40_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_72x40_er_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_72x40_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_72x40_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_72x40_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_72x40_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1306_72x40_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 9, - /* tile_hight = */ 5, - /* default_x_offset = */ 28, - /* flipmode_x_offset = */ 28, - /* pixel_width = */ 72, - /* pixel_height = */ 40 -}; - -/* -EastRising 0.41 OLED -https://www.buydisplay.com/default/white-0-42-inch-oled-display-panel-72x40-iic-i2c-serial-spi-ssd1306 -*/ -uint8_t u8x8_d_ssd1306_72x40_er(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_72x40_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_72x40_er_init_seq); - return 1; - } - return u8x8_d_ssd1306_72x40_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_96x16.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_96x16.c deleted file mode 100644 index f36db05..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1306_96x16.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - - u8x8_d_ssd1306_96x16.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -/* EastRising 0.69 OLED */ -static const uint8_t u8x8_d_ssd1306_96x16_er_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x00f), /* multiplex ratio, 0.69 OLED: 0x0f */ - U8X8_CA(0x0d3, 0x000), /* display offset, 0.69 OLED */ - U8X8_C(0x040), /* set display start line to 0, 0.69 OLED */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, 0.66 OLED 0x14*/ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1, 0.66 OLED */ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse, 0.66 OLED */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x002), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), 0.66 OLED */ - U8X8_CA(0x081, 0x0af), /* [2] set contrast control, 0.69 OLED datasheet: 0xaf */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x0f1, 0.69 OLED datasheet: 0xf1 */ - U8X8_CA(0x0db, 0x020), /* vcomh deselect level, 0.69 OLED datasheet: 0x20 */ - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_96x16_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_96x16_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_96x16_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1306_96x16_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1306_96x16_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_96x16_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_er_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1306_96x16_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns, increased to 8MHz (issue 215) */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 12, - /* tile_hight = */ 2, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 32, - /* pixel_width = */ 96, - /* pixel_height = */ 16 -}; - -/* East Rising 0.69" OLED */ -uint8_t u8x8_d_ssd1306_96x16_er(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_96x16_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_er_init_seq); - return 1; - } - return u8x8_d_ssd1306_96x16_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1309.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1309.c deleted file mode 100644 index 5813e78..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1309.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - - u8x8_d_ssd1309.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_ssd1309_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1309_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1309_128x64_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1309_128x64_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -static uint8_t u8x8_d_ssd1309_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos) ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_powersave1_seq); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1309 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - - -/*=================================================*/ -/* offset 2 version */ - -/* timing from SSD1306 */ -static const u8x8_display_info_t u8x8_ssd1309_128x64_noname2_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 2, - /* flipmode_x_offset = */ 2, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - - -static const uint8_t u8x8_d_ssd1309_128x64_noname_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x0a0), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_CA(0x020, 0x002), /* page addressing mode */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x06f), /* [2] set contrast control */ - U8X8_CA(0x0d9, 0x0d3), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x020), /* vcomh deselect level */ - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - //U8X8_C(0x0af), /* display on */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1309_128x64_noname2(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1309_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_128x64_noname2_display_info); - break; - default: - return 0; - } - return 1; -} - - -/*=================================================*/ -/* offset 0 version */ - -/* timing from SSD1306 */ -static const u8x8_display_info_t u8x8_ssd1309_128x64_noname0_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_ssd1309_128x64_noname0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1309_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_128x64_noname0_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1316.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1316.c deleted file mode 100644 index f903d93..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1316.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - - u8x8_d_ssd1316.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - SSD1316: 128x39 OLED - - https://github.com/olikraus/u8g2/issues/919 - -*/ - - -#include "u8x8.h" - -static const uint8_t u8x8_d_ssd1316_128x32_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1316_128x32_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1316_128x32_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1316_128x32_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -/*===================================================*/ - -static uint8_t u8x8_d_ssd1316_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1316_128x32_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1316_128x32_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1316_128x32_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1316_128x32_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1316_128x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1316_128x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); /* probably wrong, should be SendCmd */ - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); /* probably wrong, should be SendCmd */ - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*===================================================*/ - - -/* QT-2832TSWUG02/ZJY-2832TSWZG02 */ -static const uint8_t u8x8_d_ssd1316_128x32_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* start line */ - U8X8_CA(0x081, 0x045), /* QG-2832TSWZG02 datasheet */ - - U8X8_C(0x0a6), /* none inverted normal display mode */ - U8X8_CA(0x0a8, 0x01f), /* multiplex ratio, duty = 1/32 */ - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - U8X8_CA(0x0db, 0x020), /* vcomh deselect level */ - U8X8_CA(0x08d, 0x015), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, */ - - //U8X8_CA(0x0a2, 0x000), /* set display start line to 0 */ - //U8X8_CA(0x020, 0x000), /* page addressing mode */ - - - // Flipmode - //U8X8_C(0x0a1), /* segment remap a0/a1*/ - //U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_C(0x02e), /* Deactivate scroll */ - //U8X8_C(0x0a4), /* output ram to display */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -static const u8x8_display_info_t u8x8_ssd1316_128x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* reset time */ - /* post_reset_wait_ms = */ 100, /* reset delay */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_ssd1316_128x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1316_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1316_128x32_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1316_128x32_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1317.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1317.c deleted file mode 100644 index 22eb1ef..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1317.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - - u8x8_d_ssd1317.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2018, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - SSD1317: 128x96 OLED - - https://github.com/olikraus/u8g2/issues/663 - -*/ - - -#include "u8x8.h" - - - -/* more or less generic setup of all these small OLEDs */ -static const uint8_t u8x8_d_ssd1317_96x96_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0d5, 0x0d1), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_CA(0x0a2, 0x000), /* set display start line to 0 */ - U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, SSD1306 only, should be removed for SH1106 */ - U8X8_CA(0x020, 0x000), /* page addressing mode */ - - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - - // Flipmode - //U8X8_C(0x0a1), /* segment remap a0/a1*/ - //U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x09f), /* [2] set contrast control */ - U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/ - U8X8_CA(0x0db, 0x0ff), /* vcomh deselect level */ - - // if vcomh is 0, then this will give the biggest range for contrast control issue #98 - // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116 - - U8X8_C(0x02e), /* Deactivate scroll */ - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -static const uint8_t u8x8_d_ssd1317_96x96_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1317_96x96_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1317_96x96_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1317_96x96_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1317_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1317_96x96_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1317_96x96_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1317_96x96_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1317_96x96_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1317_96x96_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1317_96x96_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x040 ); /* set line offset to 0 */ - - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendArg(u8x8, 0x000 | ((x&15))); /* probably wrong, should be SendCmd */ - u8x8_cad_SendArg(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); /* probably wrong, should be SendCmd */ - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1317_96x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 12, - /* tile_hight = */ 12, - /* default_x_offset = */ 16, - /* flipmode_x_offset = */ 16, - /* pixel_width = */ 96, - /* pixel_height = */ 96 -}; - -uint8_t u8x8_d_ssd1317_96x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1317_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1317_96x96_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1317_96x96_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1318.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1318.c deleted file mode 100644 index e0004d0..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1318.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - - u8x8_d_ssd1318.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - SSD1318: 128x96 OLED - - https://github.com/olikraus/u8g2/issues/784 - -*/ - - -#include "u8x8.h" - - - -/* with internal charge pump (icp) */ -static const uint8_t u8x8_d_ssd1318_128x96_icp_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_CA(0x0fd, 0x012), /* unlock */ - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0ad, 0x0d0), /* external or internal IREF selection */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio, 96 duty */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_CA(0x0a2, 0x000), /* start line */ - - - // four possible charge pump setting from as per sec 6.8.2 of the ssd1318 datasheet - // uncomment only one of the below for lines - // default: - // U8X8_CA(0x08d, 0x004, 0x0ac, 0x001), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */ - // U8X8_CA(0x08d, 0x044, 0x0ac, 0x001), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */ - // U8X8_CA(0x08d, 0x084, 0x0ac, 0x001), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */ - U8X8_CAAA(0x08d, 0x0c4, 0x0ac, 0x001), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */ - - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x00f), /* value from issue 784, seems to be a little bit low... */ - - - U8X8_CA(0x0d5, 0x0d1), /* clock divide ratio (0x00=1) and oscillator frequency (0x8), value from issue 784 example code */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, value from issue 784 example code */ - U8X8_CA(0x0db, 0x030), /* vcomh deselect level, value from issue 784 example code */ - - - //U8X8_CA(0x020, 0x000), /* page addressing mode */ - //U8X8_C(0x02e), /* Deactivate scroll */ - - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* with external charge pump */ -static const uint8_t u8x8_d_ssd1318_128x96_xcp_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_CA(0x0fd, 0x012), /* unlock */ - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0ad, 0x0d0), /* external or internal IREF selection */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio, 96 duty */ - U8X8_CA(0x0d3, 0x000), /* display offset */ - U8X8_CA(0x0a2, 0x000), /* start line */ - - - // not sure if we have to set something for external charge pump - // ... - - - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - // Flipmode - // U8X8_C(0x0a0), /* segment remap a0/a1*/ - // U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - - U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */ - - U8X8_CA(0x081, 0x00f), /* value from issue 784, seems to be a little bit low... */ - - - U8X8_CA(0x0d5, 0x0d1), /* clock divide ratio (0x00=1) and oscillator frequency (0x8), value from issue 784 example code */ - U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, value from issue 784 example code */ - U8X8_CA(0x0db, 0x030), /* vcomh deselect level, value from issue 784 example code */ - - - //U8X8_CA(0x020, 0x000), /* page addressing mode */ - //U8X8_C(0x02e), /* Deactivate scroll */ - - U8X8_C(0x0a4), /* output ram to display */ - U8X8_C(0x0a6), /* none inverted normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1318_128x96_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1318_128x96_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1318_128x96_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1318_128x96_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_ssd1318_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1318_128x96_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1318 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x040 ); /* set line offset to 0 */ - - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendArg(u8x8, 0x000 | ((x&15))); /* probably wrong, should be SendCmd */ - u8x8_cad_SendArg(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); /* probably wrong, should be SendCmd */ - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - /* - do - { - u8x8_cad_SendData(u8x8, 8, ptr); - ptr += 8; - c--; - } while( c > 0 ); - */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1318_128x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */ - /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */ - /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */ - /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */ - /* tile_width = */ 16, - /* tile_hight = */ 12, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 96 -}; - -uint8_t u8x8_d_ssd1318_128x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1318_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_icp_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1318_128x96_display_info); - break; - default: - return 0; - } - return 1; -} - -uint8_t u8x8_d_ssd1318_128x96_xcp(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_ssd1318_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_xcp_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1318_128x96_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1325.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1325.c deleted file mode 100644 index 7d9970b..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1325.c +++ /dev/null @@ -1,435 +0,0 @@ -/* - - u8x8_d_ssd1325.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - SSD1325: - 128 x 80, 16 Gray Scale Dot Matrix - - SSD0323: Identical to SSD1325, issue 720 - - -*/ - - -#include "u8x8.h" - - - -static const uint8_t u8x8_d_ssd1325_128x64_nhd_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1325_128x64_nhd_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1325_128x64_nhd_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x052), /* remap */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1325_128x64_nhd_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x041), /* remap */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* - input: - one tile (8 Bytes) - output: - Tile for SSD1325 (32 Bytes) -*/ - -static uint8_t u8x8_ssd1325_8to32_dest_buf[32]; - -static uint8_t *u8x8_ssd1325_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr) -{ - uint8_t v; - uint8_t a,b; - uint8_t i, j; - uint8_t *dest; - - for( j = 0; j < 4; j++ ) - { - dest = u8x8_ssd1325_8to32_dest_buf; - dest += j; - a =*ptr; - ptr++; - b = *ptr; - ptr++; - for( i = 0; i < 8; i++ ) - { - v = 0; - if ( a&1 ) v |= 0xf0; - if ( b&1 ) v |= 0x0f; - *dest = v; - dest+=4; - a >>= 1; - b >>= 1; - } - } - - return u8x8_ssd1325_8to32_dest_buf; -} - - -/*===================================================================*/ - -static uint8_t u8x8_d_ssd1325_128x64_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1325_128x64_nhd_display_info); - break; - */ - - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_powersave1_seq); - break; - - /* handled by the calling function - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - */ -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1325 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 4; - - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y *= 8; - y += u8x8->x_offset; /* x_offset is used as y offset for the SSD1325 */ - - - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - do - { - if ( ptr[0] | ptr[1] | ptr[2] | ptr[3] | ptr[4] | ptr[5] | ptr[6] | ptr[7] ) - { - /* draw the tile if pattern is not zero for all bytes */ - u8x8_cad_SendCmd(u8x8, 0x015 ); /* set column address */ - u8x8_cad_SendArg(u8x8, x ); /* start */ - u8x8_cad_SendArg(u8x8, x+3 ); /* end */ - - - - u8x8_cad_SendData(u8x8, 32, u8x8_ssd1325_8to32(u8x8, ptr)); - } - else - { - /* tile is empty, use the graphics acceleration command */ - u8x8_cad_SendCmd(u8x8, 0x024 ); // draw rectangle - u8x8_cad_SendArg(u8x8, x ); - u8x8_cad_SendArg(u8x8, y ); - u8x8_cad_SendArg(u8x8, x+3 ); - u8x8_cad_SendArg(u8x8, y+7 ); - u8x8_cad_SendArg(u8x8, 0 ); // clear - } - ptr += 8; - x += 4; - c--; - } while( c > 0 ); - - //x += 4; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_SendCmd(u8x8, 0xe3); // no-op needs to be sent after last byte before cs is toggled. - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*===================================================================*/ - -/* http://www.newhavendisplay.com/app_notes/OLED_2_7_12864.txt */ -static const uint8_t u8x8_d_ssd1325_128x64_nhd_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */ - U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - U8X8_CA(0x0a0, 0x052), /* remap configuration, horizontal address increment (bit 2 = 0), enable nibble remap (upper nibble is left, bit 1 = 1) */ - U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - U8X8_C(0x0b8), /* set gray scale table */ - U8X8_A(0x001), /* */ - U8X8_A(0x011), /* */ - U8X8_A(0x022), /* */ - U8X8_A(0x032), /* */ - U8X8_A(0x043), /* */ - U8X8_A(0x054), /* */ - U8X8_A(0x065), /* */ - U8X8_A(0x076), /* */ - - U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128, Newhaven: 0x040 */ - U8X8_CA(0x0b2, 0x051), /* frame frequency (row period) */ - U8X8_CA(0x0b1, 0x055), /* phase length */ - U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0b4, 0x002), /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CA(0x0b0, 0x028), /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */ - U8X8_CA(0x0bf, 0x002|0x00d), /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_CA(0x023, 0x003), /* graphics accelleration: fill pixel */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_nhd_ssd1325_128x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* SSD1325 */ - /* sck_pulse_width_ns = */ 100, /* SSD1325 */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, /* SSD1325 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* x_offset is used as y offset for the SSD1325 */ - /* flipmode_x_offset = */ 8, /* x_offset is used as y offset for the SSD1325 */ - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_ssd1325_nhd_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_nhd_ssd1325_128x64_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1325_128x64_nhd_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return u8x8_d_ssd1325_128x64_generic(u8x8, msg, arg_int, arg_ptr); -} - -/*===================================================================*/ -/* OSRAM Pictiva 128x64 OLED */ -/* https://github.com/olikraus/u8g2/issues/720 */ - -static const uint8_t u8x8_d_ssd0323_os128064_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */ - U8X8_CA(0x0a2, 0x040), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - U8X8_CA(0x0a0, 0x052), /* remap configuration, horizontal address increment (bit 2 = 0), enable nibble remap (upper nibble is left, bit 1 = 1) */ - U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - U8X8_C(0x0b8), /* set gray scale table */ - U8X8_A(0x001), /* */ - U8X8_A(0x011), /* */ - U8X8_A(0x022), /* */ - U8X8_A(0x032), /* */ - U8X8_A(0x043), /* */ - U8X8_A(0x054), /* */ - U8X8_A(0x065), /* */ - U8X8_A(0x076), /* */ - - U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128, Newhaven: 0x040 */ - U8X8_CA(0x0b2, 0x051), /* frame frequency (row period) */ - U8X8_CA(0x0b1, 0x055), /* phase length */ - U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0b4, 0x002), /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CA(0x0b0, 0x028), /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */ - U8X8_CA(0x0bf, 0x002|0x00d), /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_CA(0x023, 0x003), /* graphics accelleration: fill pixel */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd0323_os128064_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x052), /* remap */ - U8X8_CA(0x0a2, 0x040), /* display offset, shift mapping ram counter */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd0323_os128064_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x041), /* remap */ - U8X8_CA(0x0a2, 0x050), /* display offset, shift mapping ram counter */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_ssd0323_os128064_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* SSD1325 */ - /* sck_pulse_width_ns = */ 100, /* SSD1325 */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, /* SSD1325 */ - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* x_offset is used as y offset for the SSD1325 */ - /* flipmode_x_offset = */ 0, /* x_offset is used as y offset for the SSD1325 */ - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_ssd0323_os128064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd0323_os128064_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd0323_os128064_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd0323_os128064_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd0323_os128064_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return u8x8_d_ssd1325_128x64_generic(u8x8, msg, arg_int, arg_ptr); -} - - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1326.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1326.c deleted file mode 100644 index 89a4a86..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1326.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - - u8x8_d_ssd1326.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - -/* ER OLED */ -static const uint8_t u8x8_d_ssd1326_er_256x32_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x0fd, 0x012), /* unlock (not required, this is default by reset) */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0a8, 0x01f), /* multiplex ratio: 0x03f * 1/64 duty - changed by CREESOO, acc. to datasheet, 100317*/ - U8X8_CA(0x0a1, 0x000), /* display start line */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - /* - a0 command: 0x0a0 ***abcde - a: 1: mono mode - b: 0: horizontal (1: vertical) address increment - c: 1: enable bit remap - d: 1: COM remap - e: 1: Column remap - */ - U8X8_CA(0x0a0, 0x006), /* remap configuration, see above */ - U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - - U8X8_C(0x0b7), /* set default gray scale table */ - - U8X8_CA(0x081, 0x027), /* contrast, brightness, 0..128 */ - U8X8_CA(0x0b1, 0x071), /* phase length */ - //U8X8_CA(0x0b2, 0x051), /* frame frequency (row period) */ - U8X8_CA(0x0b3, 0x0f0), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - //U8X8_CA(0x0b4, 0x002), /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - //U8X8_CA(0x0b0, 0x028), /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CAA(0x0bb, 0x035, 0x0ff), /* set precharge */ - U8X8_CA(0x0bc, 0x01f), /* pre-charge voltage level */ - U8X8_CA(0x0be, 0x00f), /* VCOMH voltage */ - U8X8_CA(0x0bf, 0x002|0x00d), /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_C(0x0a4), /* normal display mode */ - - //U8X8_CA(0x023, 0x003), /* graphics accelleration: fill pixel */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1326_256x32_nhd_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1326_256x32_nhd_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1326_256x32_nhd_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x006), /* remap 00110 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1326_256x32_nhd_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - //U8X8_CA(0x0a0, 0x005), /* remap 00101 */ - U8X8_CA(0x0a0, 0x001), /* remap 00001 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* - input: - one tile (8 Bytes) - output: - Tile for ssd1326 (32 Bytes) -*/ - -static uint8_t u8x8_ssd1326_8to32_dest_buf[32]; - -static uint8_t *u8x8_ssd1326_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr) -{ - uint8_t v; - uint8_t a,b; - uint8_t i, j; - uint8_t *dest; - - for( j = 0; j < 4; j++ ) - { - dest = u8x8_ssd1326_8to32_dest_buf; - dest += j; - a =*ptr; - ptr++; - b = *ptr; - ptr++; - for( i = 0; i < 8; i++ ) - { - v = 0; - if ( a&1 ) v |= 0xf0; - if ( b&1 ) v |= 0x0f; - *dest = v; - dest+=4; - a >>= 1; - b >>= 1; - } - } - - return u8x8_ssd1326_8to32_dest_buf; -} - - - - -static uint8_t u8x8_d_ssd1326_256x32_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1326_256x32_nhd_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_er_256x32_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1326 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 4; - - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - - y *= 8; - y += u8x8->x_offset; /* x_offset is used as y offset for the ssd1326 */ - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - do - { - u8x8_cad_SendCmd(u8x8, 0x015 ); /* set column address */ - u8x8_cad_SendArg(u8x8, x ); /* start */ - u8x8_cad_SendArg(u8x8, x+3 ); /* end */ - - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); - - u8x8_cad_SendData(u8x8, 32, u8x8_ssd1326_8to32(u8x8, ptr)); - - ptr += 8; - x += 4; - c--; - } while( c > 0 ); - - //x += 4; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1326_256x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 15, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* ssd1326 */ - /* sck_pulse_width_ns = */ 100, /* ssd1326 */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, /* ssd1326 */ - /* tile_width = */ 32, - /* tile_hight = */ 4, - /* default_x_offset = */ 0, /* x_offset is used as y offset for the ssd1326 */ - /* flipmode_x_offset = */ 0, /* x_offset is used as y offset for the ssd1326 */ - /* pixel_width = */ 256, - /* pixel_height = */ 32 -}; - -uint8_t u8x8_d_ssd1326_er_256x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1326_256x32_display_info); - return 1; - } - return u8x8_d_ssd1326_256x32_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1327.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1327.c deleted file mode 100644 index 504ea77..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1327.c +++ /dev/null @@ -1,952 +0,0 @@ -/* - - u8x8_d_ssd1327.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - -static const uint8_t u8x8_d_ssd1327_96x96_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1327_96x96_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1327_seeed_96x96_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1327_seeed_96x96_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x060), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x042), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1327_winstar_96x64_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x042), /* remap configuration */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1327_winstar_96x64_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - U8X8_CA(0x0a2, 0x040), /* display offset, shift mapping ram counter */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* - input: - one tile (8 Bytes) - output: - Tile for ssd1327 (32 Bytes) -*/ - -static uint8_t u8x8_ssd1327_8to32_dest_buf[32]; - -static uint8_t *u8x8_ssd1327_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr) -{ - uint8_t v; - uint8_t a,b; - uint8_t i, j; - uint8_t *dest; - - for( j = 0; j < 4; j++ ) - { - dest = u8x8_ssd1327_8to32_dest_buf; - dest += j; - a =*ptr; - ptr++; - b = *ptr; - ptr++; - for( i = 0; i < 8; i++ ) - { - v = 0; - if ( a&1 ) v |= 0xf0; - if ( b&1 ) v |= 0x0f; - *dest = v; - dest+=4; - a >>= 1; - b >>= 1; - } - } - - return u8x8_ssd1327_8to32_dest_buf; -} - - - - -static uint8_t u8x8_d_ssd1327_96x96_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_96x96_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_powersave1_seq); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1327 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 4; - x+=u8x8->x_offset/2; - - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y *= 8; - - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address, moved out of the loop (issue 302) */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - do - { - u8x8_cad_SendCmd(u8x8, 0x015 ); /* set column address */ - u8x8_cad_SendArg(u8x8, x ); /* start */ - u8x8_cad_SendArg(u8x8, x+3 ); /* end */ - - - u8x8_cad_SendData(u8x8, 32, u8x8_ssd1327_8to32(u8x8, ptr)); - ptr += 8; - x += 4; - c--; - } while( c > 0 ); - - //x += 4; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*=============================================*/ -/* - Winstar WEA009664B 96x64 OLED Display, 1.1 inch OLED - https://www.winstar.com.tw/products/oled-module/graphic-oled-display/96x64-oled.html - - https://github.com/olikraus/u8g2/issues/1050 -*/ - -static const u8x8_display_info_t u8x8_ssd1327_winstar_96x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* */ - /* sck_pulse_width_ns = */ 100, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow */ - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, - /* tile_width = */ 12, - /* tile_hight = */ 8, - /* default_x_offset = */ 16, /* changed to 16, issue 1050 */ - /* flipmode_x_offset = */ 16, /* changed to 16, issue 1050 */ - /* pixel_width = */ 96, - /* pixel_height = */ 64 -}; - -/* - Write_Cmd(0xAE); //Set Display Off OK - Write_Cmd(0x81); //Contrast Level OK - Write_Cmd(0xdF); // VALUE WRONG???? - Write_Cmd(0xD9); //Pre-charge Period - Write_Cmd(0x00); - Write_Cmd(0xA0); //Set Re-map OK - Write_Cmd(0x42); //Default Setting OK - Write_Cmd(0xA1); //Set Display Start Line OK - Write_Cmd(0x00); OK - Write_Cmd(0xA2); //Set Display Offset OK - Write_Cmd(0x00); OK - Write_Cmd(0xA4); //Set Display Mode OK - Write_Cmd(0xA8); //Set Multiplex Ratio OK - Write_Cmd(0x63); //Multiplex OK - Write_Cmd(0xAB); //Set Function SelectionA OK - Write_Cmd(0x01); OK - Write_Cmd(0xB1); //Set Phase Length OK - Write_Cmd(0x47); OK - Write_Cmd(0xB3); //Set Display Clock Divide Ratio/Oscillator Frequency OK - Write_Cmd(0x00); OK - Write_Cmd(0xBC); //Set Prechange Voltage OK - Write_Cmd(0x07); OK - Write_Cmd(0xBE); //Set VCOMH Voltage OK - Write_Cmd(0x07); OK - Write_Cmd(0xB6); //Set Second Pre-charge period OK - Write_Cmd(0x04); OK - Write_Cmd(0xD5); //Set Function selection B OK - Write_Cmd(0x62); OK - Write_Cmd(0xAF); //Set Display On - -*/ - -static const uint8_t u8x8_d_ssd1327_winstar_96x64_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */ - U8X8_C(0x0ae), /* display off */ - - U8X8_CA(0x0d9, 0x000), /* Pre-charge Period ??? */ - - U8X8_CA(0x0a0, 0x042), /* remap configuration */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - - U8X8_CA(0x0a8, 0x063), /* multiplex ratio: 63* 1/64 duty */ /* changed to hex, issue 1050 */ - - U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */ - U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */ - - U8X8_CA(0x0b1, 0x047), /* phase length */ - //U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */ - U8X8_CA(0x0b3, 0x000), /* set display clock divide ratio/oscillator frequency */ - - U8X8_C(0x0b9), /* use linear lookup table */ - - U8X8_CA(0x0bc, 0x007), /* pre-charge voltage level */ - U8X8_CA(0x0be, 0x007), /* VCOMH voltage */ - U8X8_CA(0x0b6, 0x004), /* second precharge */ - U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */ - - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ssd1327_ws_96x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_winstar_96x64_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_winstar_96x64_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_winstar_96x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_winstar_96x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - -/*=============================================*/ -/* Seeedstudio Grove OLED 96x96 */ - -static const u8x8_display_info_t u8x8_ssd1327_96x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* */ - /* sck_pulse_width_ns = */ 100, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow */ - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, - /* tile_width = */ 12, - /* tile_hight = */ 12, - /* default_x_offset = */ 16, - /* flipmode_x_offset = */ 16, - /* pixel_width = */ 96, - /* pixel_height = */ 96 -}; - -/* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */ -/* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */ -/* values from u8glib */ -/* - Re-map setting in Graphic Display Data RAM, command 0x0a0 - Bit 0: Column Address Re-map - Bit 1: Nibble Re-map - Bit 2: Horizontal/Vertical Address Increment - Bit 3: Not used, must be 0 - - Bit 4: COM Re-map - Bit 5: Not used, must be 0 - Bit 6: COM Split Odd Even - Bit 7: Not used, must be 0 -*/ - - -static const uint8_t u8x8_d_ssd1327_96x96_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */ - U8X8_C(0x0ae), /* display off */ - //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */ - - U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - - - U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */ - //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */ - U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */ - //U8X8_CA(0x0b1, 0x055), /* phase length */ - U8X8_CA(0x0b1, 0x051), /* phase length */ - //U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */ - - //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - - U8X8_C(0x0b9), /* use linear lookup table */ - - //U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0bc, 0x008), /* pre-charge voltage level */ - //U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */ - U8X8_CA(0x0be, 0x007), /* VCOMH voltage */ - U8X8_CA(0x0b6, 0x001), /* second precharge */ - U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */ - - - - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -uint8_t u8x8_d_ssd1327_seeed_96x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_96x96_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_seeed_96x96_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_seeed_96x96_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - -/*=============================================*/ -/* EA W128128 round OLED 128x128 */ -/* issue #641 */ -/* https://www.lcd-module.de/fileadmin/eng/pdf/grafik/W128128-XR.pdf */ - -static const u8x8_display_info_t u8x8_ssd1327_ea_w128128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* */ - /* sck_pulse_width_ns = */ 100, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow */ - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, - /* tile_width = */ 16, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -/* this is a copy of the init sequence for the seeed 96x96 oled */ -static const uint8_t u8x8_d_ssd1327_ea_w128128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */ - U8X8_C(0x0ae), /* display off */ - //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */ - - U8X8_CA(0x0a2, 0x010), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - - - U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */ - //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */ - U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */ - //U8X8_CA(0x0b1, 0x055), /* phase length */ - U8X8_CA(0x0b1, 0x051), /* phase length */ - //U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */ - - //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - - U8X8_C(0x0b9), /* use linear lookup table */ - - //U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0bc, 0x008), /* pre-charge voltage level */ - //U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */ - U8X8_CA(0x0be, 0x007), /* VCOMH voltage */ - U8X8_CA(0x0b6, 0x001), /* second precharge */ - U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */ - - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -static const uint8_t u8x8_d_ssd1327_ea_w128128_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1327_ea_w128128_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x042), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ssd1327_ea_w128128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_ea_w128128_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - -/*=============================================*/ -/* MIDAS MCOT128128C1V-YM 128x128 Module */ - - -static const u8x8_display_info_t u8x8_ssd1327_128x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* */ - /* sck_pulse_width_ns = */ 100, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow, Update 9 Aug 2019: The OLED from aliexpress supports 400kHz */ - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, - /* tile_width = */ 16, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -/* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */ -/* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */ -/* values from u8glib */ -/* - Re-map setting in Graphic Display Data RAM, command 0x0a0 - Bit 0: Column Address Re-map - Bit 1: Nibble Re-map - Bit 2: Horizontal/Vertical Address Increment - Bit 3: Not used, must be 0 - - Bit 4: COM Re-map - Bit 5: Not used, must be 0 - Bit 6: COM Split Odd Even - Bit 7: Not used, must be 0 -*/ - - -static const uint8_t u8x8_d_ssd1327_128x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */ - U8X8_C(0x0ae), /* display off */ - //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */ - //U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */ - U8X8_CA(0x0a8, 0x07f), /* multiplex ratio: 0x05f * 1/128duty */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */ - - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - - - U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */ - //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */ - U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */ - //U8X8_CA(0x0b1, 0x055), /* phase length */ - U8X8_CA(0x0b1, 0x051), /* phase length */ - //U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */ - - //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - - U8X8_C(0x0b9), /* use linear lookup table */ - - //U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0bc, 0x008), /* pre-charge voltage level */ - //U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */ - U8X8_CA(0x0be, 0x007), /* VCOMH voltage */ - U8X8_CA(0x0b6, 0x001), /* second precharge */ - U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */ - - - - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1327_128x128_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1327_128x128_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x042), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1327_midas_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call the 96x96 procedure at the moment */ - if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_128x128_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x128_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x128_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x128_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - -/*=============================================*/ -/* - Waveshare 128x128 Module - https://www.waveshare.com/w/upload/8/80/1.5inch_OLED_Module_User_Manual_EN.pdf - https://github.com/olikraus/u8g2/issues/880 - - This is mostly a takeover of the EA display. -*/ - -/* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */ -/* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */ -/* values from u8glib */ -/* - Re-map setting in Graphic Display Data RAM, command 0x0a0 - Bit 0: Column Address Re-map - Bit 1: Nibble Re-map - Bit 2: Horizontal/Vertical Address Increment - Bit 3: Not used, must be 0 - - Bit 4: COM Re-map - Bit 5: Not used, must be 0 - Bit 6: COM Split Odd Even - Bit 7: Not used, must be 0 -*/ - -/* takeover from https://github.com/olikraus/u8g2/issues/880 */ -static const uint8_t u8x8_d_ssd1327_ws_128x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0ae), //--turn off oled panel - U8X8_CAA(0x015, 0x000, 0x07f), //set column address, start column 0, end column 127 - U8X8_CAA(0x075, 0x000, 0x07f), //set row address, start row 0, end row 127 - U8X8_CA(0x081, 0x080), //set contrast control - U8X8_CA(0x0a0, 0x051), //gment remap, 51 - U8X8_CA(0x0a1, 0x000), //start line - U8X8_CA(0x0a2, 0x000), //display offset - U8X8_CAA(0x0a4, 0x0a8, 0x07f), //rmal display, set multiplex ratio - U8X8_CA(0x0b1, 0x0f1), //set phase leghth - U8X8_CA(0x0b3, 0x000), //set dclk, 80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30 120Hz:0x50 130Hz:0x70 01 - U8X8_CA(0x0ab, 0x001), // - U8X8_CA(0x0b6, 0x00f), //set phase leghth - U8X8_CA(0x0be, 0x00f), - U8X8_CA(0x0bc, 0x008), - U8X8_CA(0x0d5, 0x062), - U8X8_CA(0x0fd, 0x012), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ - }; - - -uint8_t u8x8_d_ssd1327_ws_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call the 96x96 procedure at the moment */ - if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_ea_w128128_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ws_128x128_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - - - -/*=============================================*/ -/* -Visonox VGM128096A4W10 128x96 COB -https://github.com/olikraus/u8g2/files/4052919/M02289_VGM128096A4W10_Y02.pdf -https://github.com/olikraus/u8g2/issues/1090 -*/ - - -static const u8x8_display_info_t u8x8_ssd1327_128x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 10, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* */ - /* sck_pulse_width_ns = */ 100, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow, Update 9 Aug 2019: The OLED from aliexpress supports 400kHz */ - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, - /* tile_width = */ 16, - /* tile_hight = */ 12, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 96 -}; - -/* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */ -/* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */ -/* values from u8glib */ -/* - Re-map setting in Graphic Display Data RAM, command 0x0a0 - Bit 0: Column Address Re-map - Bit 1: Nibble Re-map - Bit 2: Horizontal/Vertical Address Increment - Bit 3: Not used, must be 0 - - Bit 4: COM Re-map - Bit 5: Not used, must be 0 - Bit 6: COM Split Odd Even - Bit 7: Not used, must be 0 -*/ - -/* init values from the Visionox datasheeet section 10.4 */ - -static const uint8_t u8x8_d_ssd1327_128x96_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */ - U8X8_C(0x0ae), /* display off */ - //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */ - //U8X8_CA(0x0a8, 0x07f), /* multiplex ratio: 0x05f * 1/128duty */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */ - - U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - - - U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */ - //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */ - U8X8_CA(0x081, 0x0df), /* contrast, brightness, 0..128 (0xdf as per datasheet) */ - U8X8_CA(0x0b1, 0x022), /* phase length */ - U8X8_CA(0x0b3, 0x050), /* set display clock divide ratio/oscillator frequency */ - - //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ - - U8X8_C(0x0b9), /* use linear lookup table */ - - U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0be, 0x005), /* VCOMH voltage */ - U8X8_CA(0x0b6, 0x00a), /* second precharge */ - U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */ - - - - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1327_128x96_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x051), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1327_128x96_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a2, 0x060), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a0, 0x042), /* remap configuration */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1327_visionox_128x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call the 96x96 procedure at the moment */ - if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_128x96_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x96_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x96_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x96_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1329.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1329.c deleted file mode 100644 index 6add978..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1329.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - - u8x8_d_ssd1329.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - -#include "u8x8.h" - - - -static const uint8_t u8x8_d_ssd1329_128x96_noname_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x0ae), /* display off */ - U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */ - U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x03f * 1/64 duty - changed by CREESOO, acc. to datasheet, 100317*/ - U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */ - U8X8_CA(0x0a1, 0x000), /* display start line */ - U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */ - U8X8_CA(0x0a0, 0x052), /* remap configuration, horizontal address increment (bit 2 = 0), enable nibble remap (upper nibble is left, bit 1 = 1) */ - U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */ -#ifdef removed - U8X8_C(0x0b8), /* set gray scale table */ - U8X8_A(1), /* */ - U8X8_A(5), /* */ - U8X8_A(10), /* */ - U8X8_A(14), /* */ - U8X8_A(19), /* */ - U8X8_A(23), /* */ - U8X8_A(28), /* */ - U8X8_A(32), /* */ - U8X8_A(37), /* */ - U8X8_A(41), /* */ - U8X8_A(46), /* */ - U8X8_A(50), /* */ - U8X8_A(55), /* */ - U8X8_A(59), /* */ - U8X8_A(63), /* */ -#endif - - U8X8_C(0x0b7), /* set default gray scale table */ - - U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */ - U8X8_CA(0x0b2, 0x051), /* frame frequency (row period) */ - U8X8_CA(0x0b1, 0x055), /* phase length */ - U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */ - U8X8_CA(0x0b4, 0x002), /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CA(0x0b0, 0x028), /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */ - U8X8_CA(0x0bf, 0x002|0x00d), /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */ - U8X8_C(0x0a4), /* normal display mode */ - - U8X8_CA(0x023, 0x003), /* graphics accelleration: fill pixel */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1329_128x96_nhd_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1329_128x96_nhd_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1329_128x96_nhd_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x052), /* remap */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1329_128x96_nhd_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0a0, 0x041), /* remap */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* - input: - one tile (8 Bytes) - output: - Tile for ssd1329 (32 Bytes) -*/ - -static uint8_t u8x8_ssd1329_8to32_dest_buf[32]; - -static uint8_t *u8x8_ssd1329_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr) -{ - uint8_t v; - uint8_t a,b; - uint8_t i, j; - uint8_t *dest; - - for( j = 0; j < 4; j++ ) - { - dest = u8x8_ssd1329_8to32_dest_buf; - dest += j; - a =*ptr; - ptr++; - b = *ptr; - ptr++; - for( i = 0; i < 8; i++ ) - { - v = 0; - if ( a&1 ) v |= 0xf0; - if ( b&1 ) v |= 0x0f; - *dest = v; - dest+=4; - a >>= 1; - b >>= 1; - } - } - - return u8x8_ssd1329_8to32_dest_buf; -} - - - - -static uint8_t u8x8_d_ssd1329_128x96_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1329_128x96_nhd_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1329_128x96_noname_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1329_128x96_nhd_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1329_128x96_nhd_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1329_128x96_nhd_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1329_128x96_nhd_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1329 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 4; - - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - - y *= 8; - y += u8x8->x_offset; /* x_offset is used as y offset for the ssd1329 */ - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - do - { - if ( ptr[0] | ptr[1] | ptr[2] | ptr[3] | ptr[4] | ptr[5] | ptr[6] | ptr[7] ) - { - /* draw the tile if pattern is not zero for all bytes */ - u8x8_cad_SendCmd(u8x8, 0x015 ); /* set column address */ - u8x8_cad_SendArg(u8x8, x ); /* start */ - u8x8_cad_SendArg(u8x8, x+3 ); /* end */ - - u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address */ - u8x8_cad_SendArg(u8x8, y); - u8x8_cad_SendArg(u8x8, y+7); - - - u8x8_cad_SendData(u8x8, 32, u8x8_ssd1329_8to32(u8x8, ptr)); - } - else - { - /* tile is empty, use the graphics acceleration command */ - /* are this really available on the SSD1329??? */ - u8x8_cad_SendCmd(u8x8, 0x024 ); // draw rectangle - u8x8_cad_SendArg(u8x8, x ); - u8x8_cad_SendArg(u8x8, y ); - u8x8_cad_SendArg(u8x8, x+3 ); - u8x8_cad_SendArg(u8x8, y+7 ); - u8x8_cad_SendArg(u8x8, 0 ); // clear - } - ptr += 8; - x += 4; - c--; - } while( c > 0 ); - - //x += 4; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1329_128x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 15, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, /**/ - /* sda_setup_time_ns = */ 100, /* ssd1329 */ - /* sck_pulse_width_ns = */ 100, /* ssd1329 */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 60, /* ssd1329 */ - /* tile_width = */ 16, - /* tile_hight = */ 12, - /* default_x_offset = */ 0, /* x_offset is used as y offset for the ssd1329 */ - /* flipmode_x_offset = */ 0, /* x_offset is used as y offset for the ssd1329 */ - /* pixel_width = */ 128, - /* pixel_height = */ 96 -}; - -uint8_t u8x8_d_ssd1329_128x96_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1329_128x96_display_info); - return 1; - } - return u8x8_d_ssd1329_128x96_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1606_172x72.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1606_172x72.c deleted file mode 100644 index d66b403..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1606_172x72.c +++ /dev/null @@ -1,394 +0,0 @@ -/* - - u8x8_d_ssd1606_172x72.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - SSD1606: 128x180x2 - two-bit, four graylevels - command - 0x22: assign actions - 0x20: execute actions - - action for command 0x022 are (more or less guessed) - bit 7: Enable Clock - bit 6: Enable Charge Pump - bit 5: Load Temparture Value (???) - bit 4: Load LUT (???) - bit 3: Initial Display (???) - bit 2: Pattern Display --> Requires about 945ms with the LUT from below - bit 1: Disable Charge Pump - bit 0: Disable Clock - - Disable Charge Pump and Clock require about 267ms - Enable Charge Pump and Clock require about 10ms - - Notes: - - Introduced a refresh display message, which copies RAM to display - - Charge pump and clock are only enabled for the transfer RAM to display - - U8x8 will not really work because of the two buffers in the SSD1606, however U8g2 should be ok. - -*/ - - -#include "u8x8.h" - - -#define L(a,b,c,d) (((a)<<6)|((b)<<4)|((c)<<2)|(d)) - - -/* GDE021A1, 2.1" EPD */ -static const uint8_t u8x8_d_ssd1606_172x72_gde021a1_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x10, 0x00), /* Deep Sleep mode Control: Disable */ - U8X8_CA(0x11, 0x03), /* Define data entry mode, x&y inc, x first */ - U8X8_CAA(0x44, 0, 31), /* RAM x start & end, each byte has 4 pixel, 32*4=128 */ - U8X8_CAA(0x45, 0, 179), /* RAM y start & end, 179 MAX */ - - U8X8_CA(0x4e, 0), /* set x pos, 0..31 */ - U8X8_CA(0x4f, 0), /* set y pos, 0...179 */ - - U8X8_CA(0xf0, 0x1f), /* set booster feedback to internal */ - U8X8_CA(0x22, 0xc0), /* display update seq. option: enable clk, enable CP, .... todo: this is never activated */ - - U8X8_C(0x32), /* write LUT register*/ - -#ifdef ORIGINAL_LUT - - /* wavefrom part of the LUT: absolute LUT... this will always force the destination color */ - U8X8_A4(0x00,0x00,0x00,0x55), /* step 0 */ - U8X8_A4(0x00,0x00,0x55,0x55), /* step 1 */ - U8X8_A4(0x00,0x55,0x55,0x55), - U8X8_A4(0xAA,0xAA,0xAA,0xAA), - U8X8_A4(0x15,0x15,0x15,0x15), - U8X8_A4(0x05,0x05,0x05,0x05), - U8X8_A4(0x01,0x01,0x01,0x01), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), /* step 19 */ - - /* timing part of the LUT */ - U8X8_A8(0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00), - U8X8_A(0x00),U8X8_A(0x00), - -#else - - /* the following LUT will not change anything if the old and the new values are the same */ - /* 03 02 01 00 13 12 11 10 23 22 21 20 33 32 31 30 original */ - U8X8_A4(L(0, 0, 0, 0), L(0, 0, 0, 0), L(0, 0, 0, 0), L(0, 1, 1, 1)), // 0x00,0x00,0x00,0x55, step 0 - U8X8_A4(L(0, 0, 0, 0), L(0, 0, 0, 0), L(1, 0, 1, 1), L(0, 1, 1, 1)), // 0x00,0x00,0x55,0x55, step 1 - U8X8_A4(L(0, 0, 0, 0), L(1, 1, 0, 1), L(1, 0, 1, 1), L(0, 1, 1, 1)), // 0x00,0x55,0x55,0x55, step 2 - U8X8_A4(L(2, 2, 2, 0), L(2, 2, 0, 2), L(2, 0, 2, 2), L(0, 2, 2, 2)), // 0xAA,0xAA,0xAA,0xAA, step 3 - U8X8_A4(L(0, 1, 1, 0), L(0, 1, 0, 1), L(0, 0, 1, 1), L(0, 1, 1, 1)), // 0x15,0x15,0x15,0x15, step 4 - U8X8_A4(L(0, 0, 1, 0), L(0, 0, 0, 1), L(0, 0, 1, 1), L(0, 0, 1, 1)), // 0x05,0x05,0x05,0x05, step 5 - U8X8_A4(L(0, 0, 0, 0), L(0, 0, 0, 1), L(0, 0, 0, 1), L(0, 0, 0, 1)), // 0x01,0x01,0x01,0x01, step 6 - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), - U8X8_A4(0x00,0x00,0x00,0x00), /* step 19 */ - - /* timing part of the LUT */ - U8X8_A8(0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00), - U8X8_A(0x00),U8X8_A(0x00), - -#endif - - U8X8_CA(0x2c, 0xa0), /* write vcom value*/ - U8X8_CA(0x3c, 0x63), /* select boarder waveform */ - U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - /* 0x0c4 is mentioned in chapter 9.2 of the GDE021A1 data sheet */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1606_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - //U8X8_CA(0x22, 0xc0), /* display update seq. option: Enable clock and charge pump */ - //U8X8_C(0x20), /* execute sequence */ - //U8X8_DLY(10), - /* strange, splitting 0x0c0 does not work reliable */ - - U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(250), /* the sequence above requires about 970ms */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(230), - - U8X8_CA(0x22, 0x03), /* disable clock and charge pump */ - U8X8_DLY(200), /* this requres about 270ms */ - U8X8_DLY(90), - - //U8X8_CA(0x10, 0x01), /* deep sleep mode */ - //U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(50), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -// static const uint8_t u8x8_d_ssd1606_172x72_powersave0_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - - -// static const uint8_t u8x8_d_ssd1606_172x72_powersave1_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - -// static const uint8_t u8x8_d_ssd1606_172x72_flip0_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - -// static const uint8_t u8x8_d_ssd1606_172x72_flip1_seq[] = { -// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ -// U8X8_END_TRANSFER(), /* disable chip */ -// U8X8_END() /* end of sequence */ -// }; - - -static uint8_t *u8x8_convert_tile_for_ssd1606(uint8_t *t) -{ - uint8_t i; - uint16_t r; - static uint8_t buf[16]; - uint8_t *pbuf = buf; - - for( i = 0; i < 8; i++ ) - { - r = u8x8_upscale_byte(~(*t++)); - *pbuf++ = (r>>8) & 255; - *pbuf++ = r & 255; - } - return buf; -} - -static void u8x8_d_ssd1606_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) U8X8_NOINLINE; -static void u8x8_d_ssd1606_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c, page; - uint8_t *ptr; - u8x8_cad_StartTransfer(u8x8); - - page = u8x8->display_info->tile_height; - page --; - page -= (((u8x8_tile_t *)arg_ptr)->y_pos); - page *= 2; - - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x00f ); /* scan start */ - u8x8_cad_SendArg(u8x8, 0); - - u8x8_cad_SendCmd(u8x8, 0x011 ); /* cursor increment mode */ - u8x8_cad_SendArg(u8x8, 3); - - u8x8_cad_SendCmd(u8x8, 0x045 ); /* window start column */ - u8x8_cad_SendArg(u8x8, 0); - u8x8_cad_SendArg(u8x8, 179); /* end of display */ - - u8x8_cad_SendCmd(u8x8, 0x044 ); /* window end page */ - u8x8_cad_SendArg(u8x8, page); - u8x8_cad_SendArg(u8x8, page+1); - - u8x8_cad_SendCmd(u8x8, 0x04f ); /* window column */ - u8x8_cad_SendArg(u8x8, x); - - u8x8_cad_SendCmd(u8x8, 0x04e ); /* window row */ - u8x8_cad_SendArg(u8x8, page); - - u8x8_cad_SendCmd(u8x8, 0x024 ); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, 16, u8x8_convert_tile_for_ssd1606(ptr)); - ptr += 8; - x += 8; - c--; - } while( c > 0 ); - - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); -} - - -static uint8_t u8x8_d_ssd1606_172x72_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1606_172x72_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_gde021a1_init_seq); - - /* special code for the SSD1606... */ - /* ensure that the initial buffer is clear and all eInk is set to white */ - /* this is done here, because the LUT will be of that kind, that it uses the previous color */ - /* make everything black */ - u8x8_FillDisplay(u8x8); - /* write content to the display */ - u8x8_RefreshDisplay(u8x8); - /* now make everything clear */ - u8x8_FillDisplay(u8x8); - /* write content to the display */ - u8x8_RefreshDisplay(u8x8); - /* now make everything clear */ - u8x8_ClearDisplay(u8x8); - /* write content to the display */ - u8x8_RefreshDisplay(u8x8); - - u8x8_ClearDisplay(u8x8); - /* write content to the display */ - u8x8_RefreshDisplay(u8x8); - - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: -/* - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_powersave1_seq); -*/ - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: -/* - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } -*/ - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: -/* - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_EndTransfer(u8x8); -*/ - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_ssd1606_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_to_display_seq); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_ssd1606_172x72_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 120, - /* pre_chip_disable_wait_ns = */ 60, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 50, /* SSD1606: */ - /* sck_pulse_width_ns = */ 100, /* SSD1606: 100ns */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 22, /* 22*8 = 176 */ - /* tile_hight = */ 9, /* 9*8 = 72 */ - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 172, - /* pixel_height = */ 72 -}; - -uint8_t u8x8_d_ssd1606_172x72(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1606_172x72_display_info); - return 1; - } - return u8x8_d_ssd1606_172x72_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1607_200x200.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1607_200x200.c deleted file mode 100644 index 8ab398e..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_ssd1607_200x200.c +++ /dev/null @@ -1,718 +0,0 @@ -/* - - u8x8_d_ssd1607_200x200.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - SSD1607: 200x300x1 - - command - 0x22: assign actions - 0x20: execute actions - - action for command 0x022 are (more or less guessed) - bit 7: Enable Clock - bit 6: Enable Charge Pump - bit 5: Load Temparture Value (???) - bit 4: Load LUT (???) - bit 3: Initial Display (???) - bit 2: Pattern Display --> Requires about 945ms with the LUT from below - bit 1: Disable Charge Pump - bit 0: Disable Clock - - Disable Charge Pump and Clock require about 267ms - Enable Charge Pump and Clock require about 10ms - - Notes: - - Introduced a refresh display message, which copies RAM to display - - Charge pump and clock are only enabled for the transfer RAM to display - - U8x8 will not really work because of the two buffers in the SSD1606, however U8g2 should be ok. - -*/ - - -#include "u8x8.h" - -/*=================================================*/ - -static const u8x8_display_info_t u8x8_ssd1607_200x200_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* values from SSD1606 */ - /* post_chip_enable_wait_ns = */ 120, - /* pre_chip_disable_wait_ns = */ 60, - /* reset_pulse_width_ms = */ 100, - /* post_reset_wait_ms = */ 100, - /* sda_setup_time_ns = */ 50, /* SSD1606: */ - /* sck_pulse_width_ns = */ 100, /* SSD1606: 100ns */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 150, - /* tile_width = */ 25, /* 25*8 = 200 */ - /* tile_hight = */ 25, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 200, - /* pixel_height = */ 200 -}; - - -static const uint8_t u8x8_d_ssd1607_200x200_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x22, 0xc0), /* enable clock and charge pump */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(200), /* according to my measures it may take up to 150ms */ - U8X8_DLY(100), /* but it might take longer */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1607_200x200_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - /* disable clock and charge pump only, deep sleep is not entered, because we will loose RAM content */ - U8X8_CA(0x22, 0x02), /* only disable charge pump, HW reset seems to be required if the clock is disabled */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(20), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1607_200x200_exec_1000dly_seq[] = { - // assumes, that the start transfer has happend - U8X8_CA(0x22, 0x04), /* display update seq. option: pattern display */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static void u8x8_d_ssd1607_200x200_first_init(u8x8_t *u8x8) -{ - u8x8_ClearDisplay(u8x8); - - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x032); // program update sequence - u8x8_cad_SendMultipleArg(u8x8, 8, 0x055); // all black - u8x8_cad_SendMultipleArg(u8x8, 12, 0x0aa); // all white - u8x8_cad_SendMultipleArg(u8x8, 10, 0x022); // 830ms - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_exec_1000dly_seq); - -} - -static uint8_t *u8x8_convert_tile_for_ssd1607(uint8_t *t) -{ - uint8_t i; - static uint8_t buf[8]; - uint8_t *pbuf = buf; - - for( i = 0; i < 8; i++ ) - { - *pbuf++ = ~(*t++); - } - return buf; -} - -static void u8x8_d_ssd1607_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) U8X8_NOINLINE; -static void u8x8_d_ssd1607_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) -{ - uint16_t x; - uint8_t c, page; - uint8_t *ptr; - u8x8_cad_StartTransfer(u8x8); - - page = u8x8->display_info->tile_height; - page --; - page -= (((u8x8_tile_t *)arg_ptr)->y_pos); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - - - u8x8_cad_SendCmd(u8x8, 0x045 ); /* window start column */ - u8x8_cad_SendArg(u8x8, x&255); - u8x8_cad_SendArg(u8x8, x>>8); - u8x8_cad_SendArg(u8x8, 199); /* end of display */ - u8x8_cad_SendArg(u8x8, 0); - - u8x8_cad_SendCmd(u8x8, 0x044 ); /* window end page */ - u8x8_cad_SendArg(u8x8, page); - u8x8_cad_SendArg(u8x8, page); - - u8x8_cad_SendCmd(u8x8, 0x04f ); /* window column */ - u8x8_cad_SendArg(u8x8, x&255); - u8x8_cad_SendArg(u8x8, x>>8); - - u8x8_cad_SendCmd(u8x8, 0x04e ); /* window row */ - u8x8_cad_SendArg(u8x8, page); - - u8x8_cad_SendCmd(u8x8, 0x024 ); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, 8, u8x8_convert_tile_for_ssd1607(ptr)); - ptr += 8; - x += 8; - c--; - } while( c > 0 ); - - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); -} - - - -/*=================================================*/ - - -#define L(a,b,c,d) (((a)<<6)|((b)<<4)|((c)<<2)|(d)) - - -/* https://github.com/embeddedadventures/SSD1607/blob/master/SSD1607.cpp */ -static const uint8_t u8x8_d_ssd1607_200x200_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - //U8X8_CA(0x10, 0x00), /* Deep Sleep mode Control: Disable */ - U8X8_C(0x01), - U8X8_A(199),U8X8_A(0),U8X8_A(0), - - - U8X8_CA(0x03, 0x00), /* Gate Driving voltage: 15V (lowest value)*/ - U8X8_CA(0x04, 0x0a), /* Source Driving voltage: 15V (mid value and POR)*/ - - U8X8_CA(0x0f, 0x00), /* scan start ? */ - - U8X8_CA(0xf0, 0x1f), /* set booster feedback to internal */ - - U8X8_CA(0x2c, 0xa8), /* write vcom value*/ - U8X8_CA(0x3a, 0x1a), /* dummy lines */ - U8X8_CA(0x3b, 0x08), /* gate time */ - U8X8_CA(0x3c, 0x33), /* select boarder waveform */ - - U8X8_CA(0x11, 0x03), /* cursor increment mode */ - U8X8_CAA(0x44, 0, 24), /* RAM x start & end, each byte has 8 pixel, 25*4=200 */ - U8X8_CAAAA(0x45, 0, 0, 299&255, 299>>8), /* RAM y start & end, 0..299 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_ssd1607_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x32), /* write LUT register*/ - - - /* according to the command table, the lut has 240 bits (=30 bytes * 8 bits) */ - - /* Waveform part of the LUT (20 bytes) */ - /* bit 7/6: 1 - 1 transition */ - /* bit 5/4: 1 - 0 transition */ - /* bit 3/2: 0 - 1 transition */ - /* bit 1/0: 0 - 0 transition */ - /* 00 – VSS */ - /* 01 – VSH */ - /* 10 – VSL */ - /* 11 – NA */ - - /* original values */ - /* - U8X8_A(0x02), - U8X8_A(0x02), - U8X8_A(0x01), - U8X8_A(0x11), - U8X8_A(0x12), - U8X8_A(0x12), - U8X8_A(0x22), - U8X8_A(0x22), - U8X8_A(0x66), - U8X8_A(0x69), - U8X8_A(0x69), - U8X8_A(0x59), - U8X8_A(0x58), - U8X8_A(0x99), - U8X8_A(0x99), - U8X8_A(0x88), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - */ - - /* original values, L-macro */ - U8X8_A(L(0,0,0,2)), // 0x02 - U8X8_A(L(0,0,0,2)), // 0x02 - U8X8_A(L(0,0,0,1)), // 0x01 - U8X8_A(L(0,1,0,1)), // 0x11 - U8X8_A(L(0,1,0,2)), // 0x12 - U8X8_A(L(0,1,0,2)), // 0x12 - U8X8_A(L(0,2,0,2)), // 0x22 - U8X8_A(L(0,2,0,2)), // 0x22 - U8X8_A(L(1,2,1,2)), // 0x66 - U8X8_A(L(1,2,2,1)), // 0x69 - U8X8_A(L(1,2,2,1)), // 0x69 - U8X8_A(L(1,1,2,1)), // 0x59 - U8X8_A(L(1,1,2,0)), // 0x58 - U8X8_A(L(2,1,2,1)), // 0x99 - U8X8_A(L(2,1,2,1)), // 0x99 - U8X8_A(L(2,0,2,0)), // 0x88 - U8X8_A(L(0,0,0,0)), // 0x00 - U8X8_A(L(0,0,0,0)), // 0x00 - U8X8_A(L(0,0,0,0)), // 0x00 - U8X8_A(L(0,0,0,0)), // 0x00 - - - /* orginal values without 0-0 and 1-1 transition */ - /* - U8X8_A(L(3,0,0,3)), // 0x02 - U8X8_A(L(3,0,0,3)), // 0x02 - U8X8_A(L(3,0,0,3)), // 0x01 - U8X8_A(L(3,1,0,3)), // 0x11 - U8X8_A(L(3,1,0,3)), // 0x12 - U8X8_A(L(3,1,0,3)), // 0x12 - U8X8_A(L(3,2,0,3)), // 0x22 - U8X8_A(L(3,2,0,3)), // 0x22 - U8X8_A(L(3,2,1,3)), // 0x66 - U8X8_A(L(3,2,2,3)), // 0x69 - U8X8_A(L(3,2,2,3)), // 0x69 - U8X8_A(L(3,1,2,3)), // 0x59 - U8X8_A(L(3,1,2,3)), // 0x58 - U8X8_A(L(3,1,2,3)), // 0x99 - U8X8_A(L(3,1,2,3)), // 0x99 - U8X8_A(L(3,0,2,3)), // 0x88 - U8X8_A(L(3,0,0,3)), // 0x00 - U8X8_A(L(3,0,0,3)), // 0x00 - U8X8_A(L(3,0,0,3)), // 0x00 - U8X8_A(L(3,0,0,3)), // 0x00 - */ - - - /* Timing part of the LUT, 20 Phases with 4 bit each: 10 bytes */ - U8X8_A(0xF8), - U8X8_A(0xB4), - U8X8_A(0x13), - U8X8_A(0x51), - U8X8_A(0x35), - U8X8_A(0x51), - U8X8_A(0x51), - U8X8_A(0x19), - U8X8_A(0x01), - U8X8_A(0x00), - - - U8X8_CA(0x22, 0x04), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - U8X8_C(0x20), /* execute sequence */ - U8X8_DLY(250), /* the sequence above requires about 1200ms for the 200x200 display*/ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1607_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1607_200x200_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_init_seq); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - u8x8_d_ssd1607_200x200_first_init(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_ssd1607_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_to_display_seq); - break; - default: - return 0; - } - return 1; -} - - -/*=================================================*/ -/* there is no improvement possible... so i consider the v2 version as obsolete */ - - -static const uint8_t u8x8_d_ssd1607_v2_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - /* -0xaa, 0x09, 0x09, 0x19, 0x19, -0x11, 0x11, 0x11, 0x11, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, - -0x75, 0x77, 0x77, 0x77, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00 -measured 1240 ms with IL3830 196x128 - - -0x02, 0x02, 0x01, 0x11, 0x12, -0x12, 0x12, 0x22, 0x22, 0x66, -0x69, 0x59, 0x58, 0x99, 0x99, -0x88, 0x00, 0x00, 0x00, 0x00, - -0xf8, 0xb4, 0x13, 0x51, 0x35, -0x51, 0x51, 0xe9, 0x04, 0x00 - -*/ - - U8X8_C(0x32), /* write LUT register*/ - - /* https://github.com/olikraus/u8g2/issues/347 */ - U8X8_A(0x02), - U8X8_A(0x02), - U8X8_A(0x01), - U8X8_A(0x11), - U8X8_A(0x12), - U8X8_A(0x12), - U8X8_A(0x22), - U8X8_A(0x22), - U8X8_A(0x66), - U8X8_A(0x69), - U8X8_A(0x69), - U8X8_A(0x59), - U8X8_A(0x58), - U8X8_A(0x99), - U8X8_A(0x99), - - U8X8_A(0x88), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - U8X8_A(0x00), - - /* Timing part of the LUT, 20 Phases with 4 bit each: 10 bytes */ - U8X8_A(0xF8), - U8X8_A(0xB4), - U8X8_A(0x13), - U8X8_A(0x51), - U8X8_A(0x35), - - U8X8_A(0x51), - U8X8_A(0x51), - U8X8_A(0xe9), - U8X8_A(0x04), - U8X8_A(0x00), - - U8X8_CA(0x22, 0x04), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - U8X8_C(0x20), /* execute sequence */ - - U8X8_DLY(250), /* delay for 1500ms. The current sequence takes 1300ms */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - - U8X8_DLY(250), - U8X8_DLY(250), - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_ssd1607_v2_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1607_200x200_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_init_seq); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - u8x8_d_ssd1607_200x200_first_init(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_ssd1607_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_v2_to_display_seq); - break; - default: - return 0; - } - return 1; -} - - -/*=================================================*/ -/* GDEP015OC1 */ -/* https://github.com/olikraus/u8g2/issues/454 */ - - -static const uint8_t u8x8_d_ssd1607_gd_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - /* -0xaa, 0x09, 0x09, 0x19, 0x19, -0x11, 0x11, 0x11, 0x11, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, - -0x75, 0x77, 0x77, 0x77, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00 -measured 1240 ms with IL3830 196x128 - - -0x02, 0x02, 0x01, 0x11, 0x12, -0x12, 0x12, 0x22, 0x22, 0x66, -0x69, 0x59, 0x58, 0x99, 0x99, -0x88, 0x00, 0x00, 0x00, 0x00, - -0xf8, 0xb4, 0x13, 0x51, 0x35, -0x51, 0x51, 0xe9, 0x04, 0x00 - -*/ - - U8X8_C(0x32), /* write LUT register*/ - -/* - U8X8_A(0x50), U8X8_A(0xAA), U8X8_A(0x55), U8X8_A(0xAA), U8X8_A(0x11), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - - U8X8_A(0xFF), U8X8_A(0xFF), U8X8_A(0x1F), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), -*/ - U8X8_A(0x10), U8X8_A(0x18), U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x18), // numbers based on Waveshare demo code - U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - - U8X8_A(0x13), U8X8_A(0x14), U8X8_A(0x44), U8X8_A(0x12), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - - U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - U8X8_C(0x20), /* execute sequence */ - - U8X8_DLY(250), /* delay for 1500ms. The current sequence takes 1300ms */ - U8X8_DLY(250), - U8X8_DLY(250), -// U8X8_DLY(250), - -// U8X8_DLY(250), -// U8X8_DLY(250), - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_ssd1607_gd_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1607_200x200_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_init_seq); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - u8x8_d_ssd1607_200x200_first_init(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_ssd1607_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_gd_to_display_seq); - break; - default: - return 0; - } - return 1; -} - - - -/*=================================================*/ - -static const uint8_t u8x8_d_ssd1607_ws_to_display_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_C(0x32), /* write LUT register*/ - - U8X8_A(0x10), U8X8_A(0x18), U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x18), // numbers based on Waveshare demo code - U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - - U8X8_A(0x13), U8X8_A(0x14), U8X8_A(0x44), U8X8_A(0x12), U8X8_A(0x00), - U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), - - U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - U8X8_C(0x20), /* execute sequence */ - - U8X8_DLY(250), /* delay for 1250ms. */ - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - U8X8_DLY(250), - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_ssd1607_ws_to_refresh_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - - U8X8_CA(0x22, 0x04), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ - U8X8_C(0x20), /* execute sequence */ - -// U8X8_DLY(250), -// U8X8_DLY(250), - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* waveshare 200x200 */ -static const uint8_t u8x8_d_ssd1607_ws_200x200_init_seq[] = { - // suggested code from https://github.com/olikraus/u8g2/issues/637 - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x01), /* DRIVER_OUTPUT_CONTROL: LO(EPD_HEIGHT-1), HI(EPD_HEIGHT-1). GD = 0; SM = 0; TB = 0; */ - U8X8_A(199),U8X8_A(0),U8X8_A(0), - - U8X8_C(0x0C), /* BOOSTER_SOFT_START_CONTROL */ - U8X8_A(0xd7),U8X8_A(0xd6),U8X8_A(0x9d), - - U8X8_CA(0x2c, 0xa8), /* WRITE_VCOM_REGISTER: VCOM 7C */ - U8X8_CA(0x3a, 0x1a), /* SET_DUMMY_LINE_PERIOD: 4 dummy lines per gate */ - U8X8_CA(0x3b, 0x08), /* SET_GATE_TIME: 2us per line */ - U8X8_CA(0x11, 0x03), /* DATA_ENTRY_MODE_SETTING: X increment; Y increment */ - U8X8_CAA(0x44, 0, 24), /* SET_RAM_X_ADDRESS_START_END_POSITION: LO(x >> 3), LO((w-1) >> 3) */ - U8X8_CAAAA(0x45, 0, 0, 199&255, 199>>8), /* SET_RAM_Y_ADDRESS_START_END_POSITION: LO(y), HI(y), LO(h - 1), HI(h - 1) */ - U8X8_CA(0x4e, 0), /* LO(x >> 3) */ - U8X8_CAA(0x4f, 0, 0), /* LO(y), HI(y >> 8) */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ - -}; - - -uint8_t u8x8_d_ssd1607_ws_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1607_200x200_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_ws_200x200_init_seq); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - u8x8_d_ssd1607_200x200_first_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_ws_to_display_seq);; // to setup LUT - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_d_ssd1607_draw_tile(u8x8, arg_int, arg_ptr); - break; - case U8X8_MSG_DISPLAY_REFRESH: - u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_ws_to_refresh_seq); - break; - default: - return 0; - } - return 1; -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7511.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7511.c deleted file mode 100644 index 56fa680..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7511.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - - u8x8_d_st7511.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - 20 May 2019: - https://github.com/olikraus/u8g2/issues/876 - Probably HW Flip does not work - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_st7511_320x240_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x015, 0x0a5), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7511_320x240_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x014, 0x0a5), /* display off */ - // maybe use sleep mode here, but it not clear whether sleep mode will reset all the settings - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7511_320x240_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CAAAA(0x24, 0x01, 0xa5, 0xa5, 0xa5), /* memory control directions */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7511_320x240_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CAAAA(0x24, 0x02, 0xa5, 0xa5, 0xa5), /* memory control directions */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -/*=====================================================*/ -/* AV-Display: AVD-TM57QV-NW-001-B, issue 876 */ - -static const u8x8_display_info_t u8x8_st7511_320x240_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* ST7511 Datasheet */ - /* pre_chip_disable_wait_ns = */ 150, /* ST7511 Datasheet */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 120, /* ST7511 Datasheet */ - /* sck_pulse_width_ns = */ 150, /* ST7511 Datasheet */ - /* sck_clock_hz = */ 3300000UL, /* ST7511 Datasheet: 300ns cycle */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 200, /* */ - /* write_pulse_width_ns = */ 250, /* ST7511 Datasheet: 500ns */ - /* tile_width = */ 40, /* width of 17*8=136 pixel */ - /* tile_hight = */ 30, - /* default_x_offset = */ 160, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 320, - /* pixel_height = */ 240 -}; - -static const uint8_t u8x8_d_st7511_320x240_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0xae, 0xa5), /* SW Reset */ - U8X8_CAAAA(0x61, 0x0f, 0x04, 0x02, 0xa5), /* all power on */ - U8X8_CAAAA(0x62, 0x0a, 0x06, 0x0f, 0xa5), /* electronic volumne set 1 */ - U8X8_CAAAA(0x63, 0x0f, 0x0f, 0xa5, 0xa5), /* electronic volumne set 2 */ - U8X8_CAAAA(0x66, 0x00, 0xa5, 0xa5, 0xa5), /* electronic volumne set 2 */ - U8X8_CA(0x12, 0xa5), /* SLeeP OUT */ - U8X8_DLY(50), - // skiping display on here, deviation from https://github.com/olikraus/u8g2/issues/876 - // will be called later in u8x8_d_st7511_320x240_powersave0_seq - U8X8_CAAAA(0x22, 0x00, 0xa5, 0xa5, 0xa5), /* monochrome display */ - U8X8_CAAAA(0x24, 0x01, 0xa5, 0xa5, 0xa5), /* memory control directions */ - - U8X8_DLY(50), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7511_avd_320x240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint16_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7511_320x240_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7511_320x240_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7511_320x240_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7511_320x240_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7511_320x240_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7511_320x240_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - // not sure how to implement this.... - // u8x8_cad_StartTransfer(u8x8); - // u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - // set page - u8x8_cad_SendCmd(u8x8, 0x025); - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x09f); // end page - u8x8_cad_SendArg(u8x8, 0x000); // frame 0 - u8x8_cad_SendArg(u8x8, 0x0a5); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - // set column - u8x8_cad_SendCmd(u8x8, 0x026); - u8x8_cad_SendArg(u8x8, (x>>8) ); - u8x8_cad_SendArg(u8x8, (x&255) ); - u8x8_cad_SendArg(u8x8, 0x002); - u8x8_cad_SendArg(u8x8, 0x07f); - - // start data transfer - u8x8_cad_SendCmd(u8x8, 0x02c); - u8x8_cad_SendArg(u8x8, 0x0a5 ); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - while ( c > 128 ) - { - u8x8_cad_SendData(u8x8, 128, ptr); /* note: SendData can not handle more than 255 bytes */ - c -= 128; - ptr += 128; - } - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75256.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75256.c deleted file mode 100644 index b20156e..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75256.c +++ /dev/null @@ -1,1776 +0,0 @@ -/* - - u8x8_d_st75256.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - 0x030 ext 00 - 0x031 ext 01 - 0x038 ext 10 - 0x039 ext 11 - - cad 011 - - - code examples: - http://www.it610.com/article/2601023.htm - - normal mode: - 0x00c bit format - U8X8_CA( 0xbc, 0x00 ), data scan dir - U8X8_A( 0xa6 ), - y: 0 offset - - flip mode: - 0x008 bit format - U8X8_CA( 0xbc, 0x03 ), data scan dir - U8X8_A( 0xa6 ), - y: 5 offset - - -*/ - - -#include "u8x8.h" - - -/* not a real power down for the st75256... just a display off */ -static const uint8_t u8x8_d_st75256_256x128_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x94 ), /* sleep out */ - U8X8_DLY(10), - U8X8_C( 0xaf ), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_256x128_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xae ), /* display off */ - U8X8_C( 0x95 ), /* sleep in */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_jlx256128_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x00 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_jlx256128_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x03 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x008 ), /* data format MSB top */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_jlx172104_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x02 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_jlx172104_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x01 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x008 ), /* data format MSB top */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_jlx256160_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x00 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75256_jlx256160_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x03 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x008 ), /* data format MSB top */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static uint8_t u8x8_d_st75256_256x128_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_256x128_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - u8x8_cad_SendArg(u8x8, u8x8->x_offset + (((u8x8_tile_t *)arg_ptr)->y_pos)); /* x offset is used as y offset */ - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* SendData can not handle more than 255 bytes, treat c > 31 correctly */ - if ( c > 31 ) - { - u8x8_cad_SendData(u8x8, 248, ptr); /* 31*8=248 */ - ptr+=248; - c -= 31; - } - - u8x8_cad_SendData(u8x8, c*8, ptr); - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*=============================================*/ -/* JLX256128 */ - -static const u8x8_display_info_t u8x8_st75256_256x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 32, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, /* must be 0, because this is checked also for normal mode */ - /* flipmode_x_offset = */ 5, /* used as y offset */ - /* pixel_width = */ 256, - /* pixel_height = */ 128 -}; - - -static const uint8_t u8x8_d_st75256_256x128_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x000 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x4f), /* row range */ - U8X8_CAA(0x15, 0, 255), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x00 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 0x7f ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x36, 0x05 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx256128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_st75256_256x128_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_256x128_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256128_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256128_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - - -/*=============================================*/ -/* WO256X128, https://github.com/olikraus/u8g2/issues/891 */ - -static const u8x8_display_info_t u8x8_st75256_wo256x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 32, - /* tile_hight = */ 16, - /* default_x_offset = */ 5, /* must be 0, because this is checked also for normal mode */ - /* flipmode_x_offset = */ 0, /* used as y offset */ - /* pixel_width = */ 256, - /* pixel_height = */ 128 -}; - - -static const uint8_t u8x8_d_st75256_wo256x128_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x000 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x4f), /* row range */ - U8X8_CAA(0x15, 0, 255), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x01 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x008 ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 0x7f ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x36, 0x05 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_wo256x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_st75256_256x128_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_wo256x128_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_wo256x128_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip1_seq); // this matches the init sequence - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - -/*=============================================*/ -/* JLX25664 */ - -static const u8x8_display_info_t u8x8_st75256_256x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 32, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* must be 0, because this is checked also for normal mode */ - /* flipmode_x_offset = */ 13, /* used as y offset */ - /* pixel_width = */ 256, - /* pixel_height = */ 64 -}; - - -static const uint8_t u8x8_d_st75256_256x64_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x005 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x1f), /* row range */ - U8X8_CAA(0x15, 0, 255), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x00 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 0x3f ), /* 64 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 012, 0x02 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx25664(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_st75256_256x128_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_256x64_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x64_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256128_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256128_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - -/*=============================================*/ -/* JLX172104 LCD */ - -static const u8x8_display_info_t u8x8_st75256_172x104_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 22, /* 22=176 */ - /* tile_hight = */ 13, - /* default_x_offset = */ 84, /* */ - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 172, - /* pixel_height = */ 104 -}; - -static const uint8_t u8x8_d_st75256_jlx172104_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x003 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x4f), /* row range */ - U8X8_CAA(0x15, 0, 255), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x02 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 0x9f ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x08, 0x04 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx172104(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - if ( u8x8->x_offset == 0 ) /* 0 means flip mode 1, then adjust y value */ - u8x8_cad_SendArg(u8x8, 8+(((u8x8_tile_t *)arg_ptr)->y_pos)); - else - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x+u8x8->x_offset); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - - /* this procedure assumes, that the overall width is 172 */ - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - c *= 8; - - if ( c + x > 172u ) - { - c = 172u; - c -= x; - } - - u8x8_cad_SendData(u8x8, c, ptr); - x += c; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - return 1; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_172x104_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - return 1; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - return 1; -#endif - } - return 0; -} - -/*=============================================*/ -/* JLX240160 */ - -static const u8x8_display_info_t u8x8_st75256_240x160_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 30, - /* tile_hight = */ 20, - /* default_x_offset = */ 16, /* x offset in flipmode 0 */ - /* flipmode_x_offset = */ 0, /* */ - /* pixel_width = */ 240, - /* pixel_height = */ 160 -}; - - -static const uint8_t u8x8_d_st75256_240x160_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x000 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x4f), /* row range */ - U8X8_CAA(0x15, 0, 239), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x02 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 159 ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x18, 0x04 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx240160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - if ( u8x8->x_offset == 0 ) /* 0 means flip mode 1 */ - u8x8_cad_SendArg(u8x8, 1+(((u8x8_tile_t *)arg_ptr)->y_pos)); - else - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x+u8x8->x_offset); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - c *= 8; - - if ( c + x > 240u ) - { - c = 240u; - c -= x; - } - - u8x8_cad_SendData(u8x8, c, ptr); - x += c; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - return 1; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_240x160_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_240x160_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - return 1; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - return 1; -#endif - } - return 0; - - - -} - - -/*=============================================*/ -/* JLX256160 */ - -static const u8x8_display_info_t u8x8_st75256_256x160_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 32, - /* tile_hight = */ 20, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 1, /* x offset is used as y offset in flipmode */ - /* pixel_width = */ 256, - /* pixel_height = */ 160 -}; - - -static const uint8_t u8x8_d_st75256_256x160_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x000 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x28), /* row range */ - U8X8_CAA(0x15, 0, 0xFF), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x00 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 159 ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x18, 0x05 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx256160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - if ( u8x8->x_offset == 1 ) /* 1 means flip mode 1 */ - u8x8_cad_SendArg(u8x8, 1+(((u8x8_tile_t *)arg_ptr)->y_pos)); - else - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x+u8x8->display_info->default_x_offset); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* SendData can not handle more than 255 bytes, treat c > 31 correctly */ - if ( c > 31 ) - { - u8x8_cad_SendData(u8x8, 248, ptr); /* 31*8=248 */ - ptr+=248; - c -= 31; - } - - u8x8_cad_SendData(u8x8, c*8, ptr); - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - return 1; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_256x160_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x160_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - return 1; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256160_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256160_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - return 1; -#endif - } - return 0; -} - - -/*=============================================*/ -/* JLX256160 mirror version #930 */ - - -static const uint8_t u8x8_d_st75256_256x160m_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x000 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x28), /* row range */ - U8X8_CAA(0x15, 0, 0xFF), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x02 ), /* data scan dir ( CHANGED FOR MIRROR VERSION ) */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 159 ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x18, 0x05 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st75256_jlx256160m(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - if ( u8x8->x_offset == 1 ) /* 1 means flip mode 1 */ - u8x8_cad_SendArg(u8x8, 1+(((u8x8_tile_t *)arg_ptr)->y_pos)); - else - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x+u8x8->display_info->default_x_offset); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* SendData can not handle more than 255 bytes, treat c > 31 correctly */ - if ( c > 31 ) - { - u8x8_cad_SendData(u8x8, 248, ptr); /* 31*8=248 */ - ptr+=248; - c -= 31; - } - - u8x8_cad_SendData(u8x8, c*8, ptr); - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - return 1; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_256x160_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x160m_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - return 1; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - return 1; -#endif - } - return 0; -} - - - - -/*=============================================*/ -/* JLX256160 alternative version from issue #561 */ - -static const u8x8_display_info_t u8x8_st75256_256x160_alt_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 32, - /* tile_hight = */ 20, - /* default_x_offset = */ 0, /* x offset in flipmode 0 */ - /* flipmode_x_offset = */ 0, /* */ - /* pixel_width = */ 256, - /* pixel_height = */ 160 -}; - - -static const uint8_t u8x8_d_st75256_256x160_alt_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x000 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x4f), /* row range */ - U8X8_CAA(0x15, 0, 255), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x02 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 159 ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x18, 0x05 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx256160_alt(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - if ( u8x8->x_offset == 0 ) /* 0 means flip mode 1 */ - u8x8_cad_SendArg(u8x8, 1+(((u8x8_tile_t *)arg_ptr)->y_pos)); - else - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x+u8x8->x_offset); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* SendData can not handle more than 255 bytes, treat c > 31 correctly */ - if ( c > 31 ) - { - u8x8_cad_SendData(u8x8, 248, ptr); /* 31*8=248 */ - ptr+=248; - c -= 31; - } - - u8x8_cad_SendData(u8x8, c*8, ptr); - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - return 1; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_256x160_alt_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x160_alt_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - return 1; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - return 1; -#endif - } - return 0; - -} - - -/*=============================================*/ -/* JLX19296 LCD */ - -static const u8x8_display_info_t u8x8_st75256_192x96_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 24, - /* tile_hight = */ 12, - /* default_x_offset = */ 0, /* */ - /* flipmode_x_offset = */ 64, - /* pixel_width = */ 192, - /* pixel_height = */ 96 -}; - -static const uint8_t u8x8_d_st75256_jlx19296_init_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_DLY(20), - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x094 ), /* sleep out */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x0ae ), /* display off */ - - U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_CA( 0x0d7, 0x09f ), /* disable auto read */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x032 ), /* analog circuit set */ - U8X8_A( 0x000 ), /* code example: OSC Frequency adjustment */ - U8X8_A( 0x001 ), /* Frequency on booster capacitors 1 = 6KHz? */ - U8X8_A( 0x003 ), /* Bias: 1: 1/13, 2: 1/12, 3: 1/11, 4:1/10, 5:1/9 */ - - //U8X8_C( 0x031 ), /* select 01 commands */ - U8X8_C( 0x020 ), /* gray levels */ - U8X8_A( 0x01 ), - U8X8_A( 0x03 ), - U8X8_A( 0x05 ), - U8X8_A( 0x07 ), - U8X8_A( 0x09), - U8X8_A( 0x0b ), - U8X8_A( 0x0d ), - U8X8_A( 0x10 ), - U8X8_A( 0x11 ), - U8X8_A( 0x13 ), - U8X8_A( 0x15 ), - U8X8_A( 0x17 ), - U8X8_A( 0x19 ), - U8X8_A( 0x1b ), - U8X8_A( 0x1d ), - U8X8_A( 0x1f ), - - - U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA(0x75, 0, 0x4f), /* row range */ - U8X8_CAA(0x15, 0, 255), /* col range */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0xbc, 0x00 ), /* data scan dir */ - U8X8_A( 0xa6 ), /* ??? */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0x00c ), /* data format LSB top */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_C( 0xca ), /* display control, 3 args follow */ - U8X8_A( 0x00 ), /* 0x00: no clock division, 0x04: devide clock */ - U8X8_A( 0x9f ), /* 1/160 duty value from the DS example code */ - U8X8_A( 0x20 ), /* nline off */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x0f0, 0x010 ), /* monochrome mode = 0x010*/ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CAA( 0x81, 0x2e, 0x03 ), /* Volume control */ - - //U8X8_C( 0x030 ), /* select 00 commands */ - U8X8_CA( 0x020, 0x00b ), /* Power control: Regulator, follower & booster on */ - U8X8_DLY(100), - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st75256_jlx19296(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x030 ); /* select command set */ - u8x8_cad_SendCmd(u8x8, 0x075 ); /* row */ - if ( u8x8->x_offset == 0 ) /* 0 means flip mode 1, then adjust y value */ - u8x8_cad_SendArg(u8x8, 8+(((u8x8_tile_t *)arg_ptr)->y_pos)); - else - u8x8_cad_SendArg(u8x8, 1+(((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendArg(u8x8, 0x04f); - //u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x015 ); /* col */ - u8x8_cad_SendArg(u8x8, x+u8x8->x_offset); - u8x8_cad_SendArg(u8x8, 255); - u8x8_cad_SendCmd(u8x8, 0x05c ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - c *= 8; - - if ( c + x > 192u ) - { - c = 192u; - c -= x; - } - - u8x8_cad_SendData(u8x8, c, ptr); - x += c; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - return 1; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - //u8x8_SetI2CAddress(u8x8, 0x078); /* lowest I2C adr of the ST75256 */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75256_192x96_display_info); - return 1; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx19296_init_seq); - return 1; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_256x128_powersave1_seq); - - return 1; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256160_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx256160_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - /* - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75256_jlx172104_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - */ - -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x030 ); - u8x8_cad_SendCmd(u8x8, 0x081 ); /* there are 9 bit for the volume control */ - u8x8_cad_SendArg(u8x8, (arg_int & 0x1f)<<1 ); /* lower 6 bit */ - u8x8_cad_SendArg(u8x8, (arg_int>>5)); /* upper 3 bit */ - - u8x8_cad_EndTransfer(u8x8); - return 1; -#endif - } - return 0; -} - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7528.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7528.c deleted file mode 100644 index e9f7ac3..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7528.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - - u8x8_d_st7528.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ST7528: 16 Graylevel Controller - https://github.com/olikraus/u8g2/issues/986 - I2C Address: 0x03f (0x7e) - -*/ - - -#include "u8x8.h" - - -/* NHD C160100 */ -static const uint8_t u8x8_d_st7528_nhd_c160100_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - -/* - I2C_out(0x48);//partial display duty ratio - I2C_out(0x64);// 1/100 duty - I2C_out(0xA0);//ADC select - I2C_out(0xC8);//SHL select - I2C_out(0x44);//initial Com0 register - I2C_out(0x00);//scan from Com0 - I2C_out(0xAB);//OSC on - I2C_out(0x26);// - I2C_out(0x81); //set electronic volume - I2C_out(0x15);//vopcode=0x1C - I2C_out(0x56);//set 1/11 bias - I2C_out(0x64);//3x - delay(2); - I2C_out(0x2C);// - I2C_out(0x66);//5x - delay(2); - I2C_out(0x2E);// - delay(2); - I2C_out(0x2F);//power control - I2C_out(0xF3);//bias save circuit - I2C_out(0x00);// - I2C_out(0x96);//frc and pwm - I2C_out(0x38);//external mode - I2C_out(0x75);// - I2C_out(0x97);//3frc, 45 pwm THIS IS A MODE0 CMD, IT IS USELESS HERE - I2C_out(0x80);//start 16-level grayscale settings -*/ - U8X8_CA(0x048, 0x064), /* partial display duty ratio, 1/100 duty*/ - U8X8_C(0x0a0), /* ADC */ - U8X8_C(0x0c8), /* SHL */ - U8X8_CA(0x044, 0x000), /* initial Com0 */ - U8X8_C(0x0ab), /* start oscillator */ - U8X8_C(0x026), /* Select the internal resistance ratio of the regulator resistor */ - U8X8_CA(0x081, 0x015), /* volumn */ - U8X8_C(0x056), /* LCD Bias */ - U8X8_C(0x064), /* DC DC step up */ - U8X8_DLY(2), - U8X8_C(0x02c), /* Power Control */ - U8X8_C(0x066), /* DC DC step up */ - U8X8_DLY(2), - U8X8_C(0x02e), /* Power Control */ - U8X8_DLY(2), - U8X8_C(0x02f), /* Power Control */ - U8X8_CA(0x0f3, 0x000), /* bias power save */ - U8X8_C(0x096), /* frc and pwm */ - - U8X8_CA(0x038, 0x075), /* ext mode 1*/ - - /* graylevel setup */ - U8X8_CA(0x80, 0x00), U8X8_CA(0x81, 0x00), U8X8_CA(0x82, 0x00), U8X8_CA(0x83, 0x00), - U8X8_CA(0x84, 0x06), U8X8_CA(0x85, 0x06), U8X8_CA(0x86, 0x06), U8X8_CA(0x87, 0x06), - U8X8_CA(0x88, 0x0b), U8X8_CA(0x89, 0x0b), U8X8_CA(0x8a, 0x0b), U8X8_CA(0x8b, 0x0b), - U8X8_CA(0x8c, 0x10), U8X8_CA(0x8d, 0x10), U8X8_CA(0x8e, 0x10), U8X8_CA(0x8f, 0x10), - - U8X8_CA(0x90, 0x15), U8X8_CA(0x91, 0x15), U8X8_CA(0x92, 0x15), U8X8_CA(0x93, 0x15), - U8X8_CA(0x94, 0x1a), U8X8_CA(0x95, 0x1a), U8X8_CA(0x96, 0x1a), U8X8_CA(0x97, 0x1a), - U8X8_CA(0x98, 0x1e), U8X8_CA(0x99, 0x1e), U8X8_CA(0x9a, 0x1e), U8X8_CA(0x9b, 0x1e), - U8X8_CA(0x9c, 0x23), U8X8_CA(0x9d, 0x23), U8X8_CA(0x9e, 0x23), U8X8_CA(0x9f, 0x23), - - U8X8_CA(0xa0, 0x27), U8X8_CA(0xa1, 0x27), U8X8_CA(0xa2, 0x27), U8X8_CA(0xa3, 0x27), - U8X8_CA(0xa4, 0x2b), U8X8_CA(0xa5, 0x2b), U8X8_CA(0xa6, 0x2b), U8X8_CA(0xa7, 0x2b), - U8X8_CA(0xa8, 0x2f), U8X8_CA(0xa9, 0x2f), U8X8_CA(0xaa, 0x2f), U8X8_CA(0xab, 0x2f), - U8X8_CA(0xac, 0x32), U8X8_CA(0xad, 0x32), U8X8_CA(0xae, 0x32), U8X8_CA(0xaf, 0x32), - - U8X8_CA(0xb0, 0x35), U8X8_CA(0xb1, 0x35), U8X8_CA(0xb2, 0x35), U8X8_CA(0xb3, 0x35), - U8X8_CA(0xb4, 0x38), U8X8_CA(0xb5, 0x38), U8X8_CA(0xb6, 0x38), U8X8_CA(0xb7, 0x38), - U8X8_CA(0xb8, 0x3a), U8X8_CA(0xb9, 0x3a), U8X8_CA(0xba, 0x3a), U8X8_CA(0xbb, 0x3a), - U8X8_CA(0xbc, 0x3c), U8X8_CA(0xbd, 0x3c), U8X8_CA(0xbe, 0x3c), U8X8_CA(0xbf, 0x3c), - - U8X8_CA(0x038, 0x074), /* ext mode 0*/ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7528_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x038, 0x074), /* ext mode 0*/ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7528_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x038, 0x074), /* ext mode 0*/ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7528_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7528_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* - input: - one tile (8 Bytes) - output: - Tile for st7528 (32 Bytes) -*/ - -static uint8_t u8x8_st7528_8to32_dest_buf[32]; - -static uint8_t *u8x8_st7528_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr) -{ - uint8_t v; - uint8_t a,b; - uint8_t i, j; - uint8_t *dest; - - for( j = 0; j < 4; j++ ) - { - dest = u8x8_st7528_8to32_dest_buf; - dest += j; - a =*ptr; - ptr++; - b = *ptr; - ptr++; - for( i = 0; i < 8; i++ ) - { - v = 0; - if ( a&1 ) v |= 0xf0; - if ( b&1 ) v |= 0x0f; - *dest = v; - dest+=4; - a >>= 1; - b >>= 1; - } - } - - return u8x8_st7528_8to32_dest_buf; -} - - - - -static uint8_t u8x8_d_st7528_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7528_display_info); - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7528_nhd_c160100_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7528_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7528_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7528_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7528_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1326 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 4; // not clear - - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - - do - { - u8x8_cad_SendCmd(u8x8, 0xb0 | y ); /* set page address */ - u8x8_cad_SendCmd(u8x8, 0x10| (x>>4) ); /* set col msb*/ - u8x8_cad_SendCmd(u8x8, 0x00| (x&15) ); /* set col lsb*/ - - u8x8_cad_SendData(u8x8, 32, u8x8_st7528_8to32(u8x8, ptr)); - - ptr += 8; - x += 4; - c--; - } while( c > 0 ); - - //x += 4; - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -static const u8x8_display_info_t u8x8_st7528_160x100_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* st7528 */ - /* sck_pulse_width_ns = */ 25, /* st7528 */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* st7528 actually allows 20MHz according to the datasheet */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, - /* write_pulse_width_ns = */ 80, /* st7528 */ - /* tile_width = */ 20, - /* tile_hight = */ 13, - /* default_x_offset = */ 0, /* x_offset is used as y offset for the ssd1326 */ - /* flipmode_x_offset = */ 0, /* x_offset is used as y offset for the ssd1326 */ - /* pixel_width = */ 160, - /* pixel_height = */ 100 -}; - -uint8_t u8x8_d_st7528_nhd_c160100(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7528_160x100_display_info); - return 1; - } - return u8x8_d_st7528_generic(u8x8, msg, arg_int, arg_ptr); -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75320.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75320.c deleted file mode 100644 index 4b928a7..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st75320.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - - u8x8_d_st75320.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2019, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - ST75320: 320x240 monochrome LCD - - https://github.com/olikraus/u8g2/issues/921 - -*/ - - -#include "u8x8.h" - -static const uint8_t u8x8_d_st75320_jlx320240_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75320_jlx320240_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75320_jlx320240_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0xC4, 0x02), /* COM Output Status, Bits 0 & 1 */ - U8X8_C(0xA1), /* Column Address Direction: Bit 0 */ - //U8X8_C(0x0a1), /* segment remap a0/a1*/ - //U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st75320_jlx320240_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - //U8X8_C(0x0a0), /* segment remap a0/a1*/ - //U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_CA(0xC4, 0x03), /* COM Output Status, Bits 0 & 1 */ - U8X8_C(0xA0), /* Column Address Direction: Bit 0 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -/*===================================================*/ - -static uint8_t u8x8_d_st75320_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint16_t x; - uint8_t c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75320_jlx320240_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75320_jlx320240_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st75320_jlx320240_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st75320_jlx320240_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75320_jlx320240_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st75320_jlx320240_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int<<2 ); - u8x8_cad_SendArg(u8x8, arg_int>>6 ); - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, 0x013); - u8x8_cad_SendArg(u8x8, (x>>8) ); - u8x8_cad_SendArg(u8x8, (x&255) ); - u8x8_cad_SendCmd(u8x8, 0x0b1 ); - u8x8_cad_SendArg(u8x8, (((u8x8_tile_t *)arg_ptr)->y_pos)); - - - u8x8_cad_SendCmd(u8x8, 0x01d ); // write data - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* SendData can not handle more than 255 bytes */ - if ( c > 31 ) - { - u8x8_cad_SendData(u8x8, 248, ptr); /* 31*8=248 */ - ptr+=248; - c -= 31; - } - - u8x8_cad_SendData(u8x8, c*8, ptr); - arg_int--; - } while( arg_int > 0 ); - - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*===================================================*/ - - -/* QT-2832TSWUG02/ZJY-2832TSWZG02 */ -static const uint8_t u8x8_d_st75320_jlx320240_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0xAE), // Display OFF - U8X8_CA(0xEA, 0x00), // Power Discharge Control, Discharge OFF - U8X8_C(0xA8), // sleep out - U8X8_C(0xAB), // OSC ON - U8X8_C(0x69), // Temperature Detection ON - U8X8_C(0x4E), // TC Setting - U8X8_A8(0xff, 0x44, 0x12, 0x11, 0x11, 0x11, 0x22, 0x23), - U8X8_CAA(0x39, 0x00, 0x00), //TC Flag - - - U8X8_CA(0x2B, 0x00), // Frame Rate Level - U8X8_CAA(0x5F, 0x66, 0x66), // Set Frame Frequency, fFR=80Hz in all temperature range - U8X8_CAAA(0xEC, 0x19, 0x64, 0x6e), // FR Compensation Temp. Range, TA = -15 degree, TB = 60 degree, TC = 70 degree - U8X8_CAA(0xED, 0x04, 0x04), // Temp. Hysteresis Value (thermal sensitivity) - U8X8_C(0xA6), // Display Inverse OFF - U8X8_C(0xA4), // Disable Display All Pixel ON - - U8X8_CA(0xC4, 0x02), // COM Output Status - U8X8_C(0xA1), // Column Address Direction: MX=0 - - U8X8_CAA(0x6D, 0x07, 0x00), // Display Area, Duty = 1/240 duty, Start Group = 1 - U8X8_C(0x84), // Display Data Input Direction: Column - U8X8_CA(0x36, 0x1e), // Set N-Line - U8X8_C(0xE4), // N-Line On - U8X8_CA(0xE7, 0x19), // LCD Drive Method //NLFR=1// - - U8X8_CAA(0x81, 0x4f, 0x01), // OX81: Set EV=64h, 0..255, 0..3 - U8X8_CA(0xA2, 0x0a), // BIAS //1/16 BIAS - U8X8_CA(0x25, 0x020), // Power Control //AVDD ON - U8X8_DLY(10), - U8X8_CA(0x25, 0x60), // Power Control//AVDD, MV3 & NAVDD ON - U8X8_DLY(10), - U8X8_CA(0x25, 0x70), // Power Control //AVDD, MV3, NAVDD & V3 ON - U8X8_DLY(10), - U8X8_CA(0x25, 0x78), // Power Control//AVDD, MV3, NAVDD, V3 & VPF ON - U8X8_DLY(10), - U8X8_CA(0x25, 0x7c), // Power Control//AVDD, MV3, NAVDD, V3, VPF & VNF ON - U8X8_DLY(10), - U8X8_CA(0x25, 0x7e), // Power Control//VOUT, AVDD, MV3, NAVDD, V3, VPF & VNF ON - U8X8_DLY(10), - U8X8_CA(0x25, 0x7f), // Power Control/VOUT, AVDD, MV3, NAVDD, V3, VPF & VNF ON - U8X8_DLY(10), - //U8X8_C(0xaf); //Display ON - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -static const u8x8_display_info_t u8x8_st75320_jlx320240_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 20, /* */ - /* sck_pulse_width_ns = */ 40, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 15, - /* write_pulse_width_ns = */ 70, - /* tile_width = */ 40, - /* tile_hight = */ 30, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 320, - /* pixel_height = */ 240 -}; - -uint8_t u8x8_d_st75320_jlx320240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - if ( u8x8_d_st75320_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - - switch(msg) - { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st75320_jlx320240_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st75320_jlx320240_display_info); - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7565.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7565.c deleted file mode 100644 index 799025d..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7565.c +++ /dev/null @@ -1,1281 +0,0 @@ -/* - - u8x8_d_st7565.c - also includes support for nt7534 - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - - -static const uint8_t u8x8_d_st7565_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a4), /* all pixel off, issue 142 */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7565_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7565_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7565_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7565_zflip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7565_zflip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7565_128x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 4, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_st7565_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7565 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - /* handled in the calling procedure - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_powersave1_seq); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7565 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* DOGM128 */ - -static const uint8_t u8x8_d_st7565_dogm128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x018), /* set contrast, contrast value, EA default: 0x016 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_ea_dogm128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_dogm128_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - - -/*================================================*/ -/* LM6063 https://github.com/olikraus/u8g2/issues/893 */ - -static const uint8_t u8x8_d_st7565_lm6063_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 50/4), /* set contrast, contrast value, 40..60 seems to be good */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_lm6063(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_lm6063_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* Displaytech 64128n */ - -static const uint8_t u8x8_d_st7565_64128n_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - #ifdef NOT_WORKING - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on */ - //U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - //U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - - U8X8_C(0x010), /* Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N */ - - - U8X8_CA(0x081, 0x01e), /* set contrast, contrast value */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ -#else - - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0A2), /* 0x0a2: LCD bias 1/9 (according to Displaytech 64128N datasheet) */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - //U8X8_C(0x0A0), /* Normal ADC Select (according to Displaytech 64128N datasheet) */ - //U8X8_C(0x0c8), /* common output mode: set scan direction normal operation/SHL Select, 0x0c0 --> SHL = 0, normal, 0x0c8 --> SHL = 1 */ - - U8X8_C(0x040), /* Display start line for Displaytech 64128N */ - U8X8_C(0x028 | 0x04), /* power control: turn on voltage converter */ - U8X8_C(0x028 | 0x06), /* power control: turn on voltage regulator */ - U8X8_C(0x028 | 0x07), /* power control: turn on voltage follower */ - U8X8_C(0x010), /* Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N */ - /* 19 Jul 17: Not sure if this is true, cmd 0x1? is used to set the column */ - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x081), /* set contrast */ - U8X8_C(0x01e), /* Contrast value. Setting for controlling brightness of Displaytech 64128N */ - //U8X8_C(0x0af), /* display on */ - //U8X8_C(0x0a5), /* display all points, ST7565 */ - //U8X8_C(0x0a4), /* normal display */ - - U8X8_C(0x0ae), /* display off */ - - -#endif - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7565_64128n_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_st7565_64128n(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_64128n_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_64128n_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* ZOLEN 128x64 */ - -static const uint8_t u8x8_d_st7565_zolen_128x64_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c0), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x007), /* set contrast, contrast value, EA default: 0x016 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_zolen_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_zolen_128x64_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_zflip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_zflip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - - -/*================================================*/ -/* NHD-C12832 */ - -static const u8x8_display_info_t u8x8_st7565_128x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 4, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - - -static const uint8_t u8x8_d_st7565_nhd_c12832_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - U8X8_C(0x023), /* set V0 voltage resistor ratio to large*/ - U8X8_CA(0x081, 0x00a), /* set contrast, contrast value NHD C12832 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_nhd_c12832(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_128x32_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_nhd_c12832_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* NHD-C12864 */ - -static const u8x8_display_info_t u8x8_st7565_nhd_c12864_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - - -static const uint8_t u8x8_d_st7565_nhd_c12864_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - U8X8_C(0x023), /* set V0 voltage resistor ratio to large*/ - U8X8_CA(0x081, 180), /* set contrast, contrast value NHD C12864, see issue 186, increased contrast to 180 (issue 219) */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_nhd_c12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_nhd_c12864_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_nhd_c12864_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} -/*================================================*/ -/* JLX12864 */ - -uint8_t u8x8_d_st7565_jlx12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - return u8x8_d_st7565_nhd_c12864(u8x8, msg, arg_int, arg_ptr); -} - - -/*================================================*/ -/* LM6059 (Adafruit)... probably this is a ST7567 display */ - -static const uint8_t u8x8_d_st7565_lm6059_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x060), /* set display start line to ... */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - //U8X8_C(0x0a1), /* ADC set to reverse */ - //U8X8_C(0x0c0), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x (ST7567 feature) */ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x018), /* set contrast, contrast value, EA default: 0x016 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7565_lm6059_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 1, /* not sure... */ - /* flipmode_x_offset = */ 3, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_st7565_lm6059(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_lm6059_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_lm6059_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* https://github.com/olikraus/u8g2/issues/1314 */ -/* KS0713 controller, takeover from LM6059 */ - -static const uint8_t u8x8_d_st7565_ks0713_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0a3), /* LCD bias 1/9 */ - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_C(0x026), /* set V0 voltage resistor ratio to max */ - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_CA(0x081, 0x010), /* set contrast, contrast value, EA default: 0x016 */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_ks0713(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_lm6059_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_ks0713_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* LX12864 issue 576 */ - -static const uint8_t u8x8_d_st7565_lx12864_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x060), /* set display start line to ... */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - //U8X8_C(0x0a1), /* ADC set to reverse */ - //U8X8_C(0x0c0), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x (ST7567 feature) */ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x008), /* set contrast, contrast value */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7565_lx12864_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 1, /* not sure... */ - /* flipmode_x_offset = */ 3, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_st7565_lx12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_lx12864_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_lx12864_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* ERC12864-1 (buydisplay.com) */ - -static const uint8_t u8x8_d_st7565_erc12864_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to ... */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - //U8X8_C(0x0a1), /* ADC set to reverse */ - //U8X8_C(0x0c0), /* common output mode */ - // Flipmode - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x (ST7567 feature)*/ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x018), /* set contrast, contrast value, EA default: 0x016 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7565_erc12864_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 4, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_st7565_erc12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_erc12864_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_erc12864_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - - - -/*================================================*/ -/* ERC12864-1 alternative version, suggested in issue 790 */ - -static const uint8_t u8x8_d_st7565_erc12864_alt_init_seq[] = { - - - // original sequence - - // U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - // U8X8_C(0x0e2), /* soft reset */ - // U8X8_C(0x0ae), /* display off */ - // U8X8_C(0x040), /* set display start line to ... */ - - // U8X8_C(0x0a0), /* ADC set to reverse */ - // U8X8_C(0x0c8), /* common output mode */ - - // U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - // U8X8_C(0x0a3), /* LCD bias 1/9 */ - // U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - // U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x (ST7567 feature)*/ - // U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - // U8X8_CA(0x081, 0x018), /* set contrast, contrast value, EA default: 0x016 */ - - // U8X8_C(0x0ae), /* display off */ - // U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - // U8X8_END_TRANSFER(), /* disable chip */ - // U8X8_END() /* end of sequence */ - - - - // suggested in https://github.com/olikraus/u8g2/issues/790 - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to ... */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 - *** Changed by Ismail - was 0xa3 - 1/7 bias we were getting dark pixel off */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x (ST7567 feature)*/ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x05), /* set contrast, contrast value, EA default: 0x016 - *** Changed by Ismail to 0x05 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ - -}; - - -uint8_t u8x8_d_st7565_erc12864_alt(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_erc12864_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_erc12864_alt_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - - - -/*================================================*/ -/* NT7534, TG12864R */ -/* The NT7534 has an extended command set for the ST7565, however this is not used. */ -/* The TG12864R display is also shifted in lines, like the LM6059/Adafruit display */ -/* However contrast seems to be different */ - -static const uint8_t u8x8_d_nt7534_tg12864r_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x060), /* set display start line to ... */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - // Flipmode - //U8X8_C(0x0a1), /* ADC set to reverse */ - //U8X8_C(0x0c0), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on (regulator, booster and follower) */ - //U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x (ST7567 feature)*/ - U8X8_C(0x027), /* set V0 voltage resistor ratio to max */ - U8X8_CA(0x081, 0x009), /* set contrast, contrast value, EA default: 0x016 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_nt7534_tg12864r(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - /* reuse the LM6059 data structure... this display seems to have similar shifts and offsets */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_lm6059_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - - //u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_lm6059_init_seq); - u8x8_cad_SendSequence(u8x8, u8x8_d_nt7534_tg12864r_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* EA DOGM132 */ - -static const u8x8_display_info_t u8x8_st7565_dogm132_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* st7565 datasheet, table 26, tcsh */ - /* pre_chip_disable_wait_ns = */ 50, /* st7565 datasheet, table 26, tcss */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* st7565 datasheet, table 26, tsds */ - /* sck_pulse_width_ns = */ 120, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* st7565 datasheet, table 24, tds8 */ - /* write_pulse_width_ns = */ 80, /* st7565 datasheet, table 24, tcclw */ - /* tile_width = */ 17, /* width of 16*8=136 pixel */ - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 132, - /* pixel_height = */ 32 -}; - - -static const uint8_t u8x8_d_st7565_dogm132_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on */ - U8X8_CA(0x0f8, 0x000), /* set booster ratio to 4x */ - U8X8_C(0x023), /* set V0 voltage resistor ratio to large*/ - U8X8_CA(0x081, 0x01f), /* set contrast, contrast value EA DOGM132 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_st7565_ea_dogm132(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_st7565_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7565_dogm132_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_dogm132_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7565_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7567.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7567.c deleted file mode 100644 index 04509d9..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7567.c +++ /dev/null @@ -1,1000 +0,0 @@ -/* - - u8x8_d_st7567.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_st7567_132x64_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a4), /* all pixel off, issue 142 */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7567_132x64_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7567_132x64_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7567_132x64_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7567_n_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7567_n_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - -/*=====================================================*/ - - -static const u8x8_display_info_t u8x8_st7567_132x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 17, /* width of 17*8=136 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 132, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_d_st7567_132x64_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* LCD bias 1/7 */ - /* power on sequence from paxinstruments */ - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x026), /* v0 voltage resistor ratio */ - U8X8_CA(0x081, 0x027), /* set contrast, contrast value*/ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* pax instruments 132x64 display */ -uint8_t u8x8_d_st7567_pi_132x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_132x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7567 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - - - -/*=====================================================*/ - - - - - -static const u8x8_display_info_t u8x8_st7567_jlx12864_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_st7567_jlx12864_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* LCD bias 1/7 */ - /* power on sequence from paxinstruments */ - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x023), /* v0 voltage resistor ratio */ - U8X8_CA(0x081, 42>>2), /* set contrast, contrast value*/ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* JLX12864 display */ -uint8_t u8x8_d_st7567_jlx12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_jlx12864_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_st7567_jlx12864_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7567 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -/*=====================================================*/ - - - -static const u8x8_display_info_t u8x8_st7567_enh_dg128064_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 4, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -static const u8x8_display_info_t u8x8_st7567_enh_dg128064i_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_st7567_enh_dg128064_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - /* power on sequence from paxinstruments */ - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x023), /* v0 voltage resistor ratio */ - U8X8_CA(0x081, 200>>2), /* set contrast, contrast value*/ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* ENH-DG128064 transparent display */ -static uint8_t u8x8_d_st7567_enh_dg128064_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_enh_dg128064_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_st7567_enh_dg128064_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave1_seq); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7567 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -uint8_t u8x8_d_st7567_enh_dg128064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_enh_dg128064_display_info); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_n_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_n_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return u8x8_d_st7567_enh_dg128064_generic(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - -uint8_t u8x8_d_st7567_enh_dg128064i(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_enh_dg128064i_display_info); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return u8x8_d_st7567_enh_dg128064_generic(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - -/*=====================================================*/ -/* issue 657 */ - -static const u8x8_display_info_t u8x8_st7567_64x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 8, - /* tile_hight = */ 4, - /* default_x_offset = */ 32, - /* flipmode_x_offset = */ 32, - /* pixel_width = */ 64, - /* pixel_height = */ 32 -}; - -static const uint8_t u8x8_st7567_64x32_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x024), /* v0 voltage resistor ratio, taken from issue 657 */ - U8X8_CA(0x081, 0x020), /* set contrast, contrast value*/ - /* 18 Apr 2020: the value 0x080 does not make sense, only 6 bit are supported - for contrast, changed to 0x040 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st7567_64x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_64x32_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_st7567_64x32_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7567 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*=====================================================*/ -/* issue 1159, Lummax HEM6432-03 */ - - -static const u8x8_display_info_t u8x8_st7567_hem6432_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 8, - /* tile_hight = */ 4, - /* default_x_offset = */ 36, /* issue 1159 */ - /* flipmode_x_offset = */ 32, /* issue 1159 */ - /* pixel_width = */ 64, - /* pixel_height = */ 32 -}; - -static const uint8_t u8x8_st7567_hem6432_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x024), /* v0 voltage resistor ratio, taken from issue 657 */ - U8X8_CA(0x081, 225/4), /* set contrast, contrast value as suggested inissue 1159 */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st7567_hem6432(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_hem6432_display_info); - u8x8->i2c_address = 0x07e; /* issue 1159, use different i2c address */ - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_st7567_hem6432_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7567 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - -/*=====================================================*/ -/* - https://github.com/olikraus/u8g2/issues/1088 - https://www.dx.com/p/opensmart-33v-26-inch-128x64-serial-spi-monochrome-lcd-breakout-board-module-with-backlight-for-arduino-nano-pro-mini-2710499.html -*/ - - - - - -static const u8x8_display_info_t u8x8_st7567_os12864_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, /* */ - /* pre_chip_disable_wait_ns = */ 50, /* */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 1, - /* sda_setup_time_ns = */ 50, /* */ - /* sck_pulse_width_ns = */ 120, /* */ - /* sck_clock_hz = */ 4000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 40, /* */ - /* write_pulse_width_ns = */ 80, /* */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 4, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_st7567_os12864_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a3), /* LCD bias 1/7 */ - /* power on sequence from paxinstruments */ - U8X8_C(0x028|4), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|6), /* all power control circuits on */ - U8X8_DLY(50), - U8X8_C(0x028|7), /* all power control circuits on */ - U8X8_DLY(50), - - U8X8_C(0x026), /* v0 voltage resistor ratio */ - U8X8_CA(0x081, 50>>2), /* set contrast, contrast value*/ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* open-smart 12864 display */ -uint8_t u8x8_d_st7567_os12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7567_os12864_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_st7567_os12864_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7567_132x64_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* st7567 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the st7567 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_erc240160.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_erc240160.c deleted file mode 100644 index 8854eb1..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_erc240160.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - u8x8_d_st7586s_erc240160.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2018, olikraus@gmail.com - - All rights reserved. - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "u8g2.h" - - -static const uint8_t u8x8_d_st7586s_sleep_on[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x010), /* set power save mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_sleep_off[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x011), //Sleep out - U8X8_DLY(50), /* delay 50 ms */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_erc240160_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x036), /* Scan Direction Setting */ - U8X8_A(0x0C8), /* COM159 -> COM0 SEG383 -> SEG0 */ - U8X8_C(0x037), /* Start line 0 */ - U8X8_A(0x000), - U8X8_C(0x02A), /* Column Address Setting */ - U8X8_A(0x000), /* COL8 -> COL127 */ - U8X8_A(0x008), - U8X8_A(0x000), - U8X8_A(0x07F), /* 120*3=240 pixels + 120 unused */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_erc240160_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x036), /* Scan Direction Setting */ - U8X8_A(0x000), /* COM0 -> COM159 SEG0 -> SEG383 */ - U8X8_C(0x037), /* Start line 0 */ - U8X8_A(0x000), - U8X8_C(0x02A), /* Column Address Setting */ - U8X8_A(0x000), /* COL0 -> COL119 */ - U8X8_A(0x000), - U8X8_A(0x000), - U8X8_A(0x077), /* 120*3=240 pixels + 120 unused */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_erc240160_init_seq[] = { - U8X8_END_TRANSFER(),/* disable chip */ - // U8G_ESC_RST(1), /* hardware reset */ - U8X8_DLY(60), /* Delay 60 ms */ - U8X8_START_TRANSFER(),/* enable chip */ - - U8X8_C(0x001), // Soft reset - U8X8_DLY(60), // Delay 120 ms - - U8X8_C(0x011), // Sleep Out - U8X8_C(0x028), // Display OFF - U8X8_DLY(25), // Delay 50 ms - - U8X8_CAA(0x0C0,0x036,0x01),// Vop = 136h data sheet suggested 0x0145 but this caused streaks - - U8X8_CA(0x0C3,0x000), // BIAS = 1/14 - - U8X8_CA(0x0C4,0x007), // Booster = x8 - - U8X8_CA(0x0D0,0x01D), // Enable Analog Circuit - - U8X8_CA(0x0B3,0x000), // Set FOSC divider - - U8X8_CA(0x0B5,0x000), // N-Line = 0 - - U8X8_C(0x039), // 0x39 Monochrome mode. 0x38 - gray Mode - - U8X8_C(0x03A), // Enable DDRAM Interface - U8X8_A(0x002), // monochrome and 4-level - - U8X8_C(0x036), // Scan Direction Setting - U8X8_A(0x0C8), // COM:C159->C0 SEG: SEG383->SEG0 - - U8X8_C(0x0B1), // First output COM - U8X8_A(0x000), // - - U8X8_C(0x0B0), // Duty Setting (num rows - 1) - U8X8_A(0x09F), - - U8X8_C(0x020), // Display inversion off - - U8X8_C(0x02A), // Column Address Setting - U8X8_A(0x000), // COL0 -> COL127 - U8X8_A(0x008), // - U8X8_A(0x000), // - U8X8_A(0x07F), // 80*3=240 pixels - - U8X8_C(0x02B), // Row Address Setting - U8X8_A(0x000), // ROW0 -> ROW159 - U8X8_A(0x000), // - U8X8_A(0x000), // - U8X8_A(0x09F), // 160 pixels - - U8X8_C(0x029), // Display ON - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7586s_erc240160_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 100, /* datasheet ST7586S */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* ST7586+Atmega128RFA1 works with 8MHz */ - /* spi_mode = */ 3, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 20, /* datasheet suggests min 20 */ - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 30, - /* tile_height = */ 20, - /* default_x_offset = */ 0, /* abused as flag to know if we are flipped */ - /* flipmode_x_offset = */ 1, /* as pixel order different for normal/flipped */ - /* pixel_width = */ 240, - /* pixel_height = */ 160 -}; - -/******************************************************************************* - * st7586s_erc240160 driver. ST7586 based display from buydisplay.com - ******************************************************************************/ -uint8_t u8x8_d_st7586s_erc240160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { - - uint8_t c; - uint8_t *ptr; - uint8_t i, byte; - uint32_t input; - uint8_t output[4]; - switch (msg) { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); // OK Start transfer - u8x8_cad_SendCmd(u8x8, 0x02B); /* Row Address Setting */ - u8x8_cad_SendArg(u8x8, 0x000); - u8x8_cad_SendArg(u8x8, 0x008 * ((u8x8_tile_t *)arg_ptr)->y_pos); - u8x8_cad_SendArg(u8x8, 0x000); - u8x8_cad_SendArg(u8x8, 0x09F); // should set end row based on display dimensions - u8x8_cad_SendCmd(u8x8, 0x02C); /* cmd write display data to ram */ - c = ((u8x8_tile_t *) arg_ptr)->cnt; // - c *= 8; - ptr = ((u8x8_tile_t *) arg_ptr)->tile_ptr; // - -// The ST7586S has an unusual 3 pixels per byte format the ERC240160 is even more annoying -// as it has every 3rd COM line disconnected for extra oddness so here we read in a byte -// (8 pixels) and pack that into 4 bytes of 2 pixels + 1 unused each. This has to be done -// in a different order for flipped, normal UUx11x22 flipped 11x22xUU - while (c > 0) { - input = ((uint8_t)ptr[0]); - - for (i=0; i<4; i++) - { - byte = 0; - if (u8x8->x_offset ==0){ - if (input & 0x80) // if bit 7 - byte = byte | 0x18; //set pixel 1 - if (input & 0x40) // if bit 6 - byte = byte | 0x3; //set pixel 2 - } - if (u8x8->x_offset ==1){ - if (input & 0x80) // if bit 7 - byte = byte | 0xC0; //set pixel 1 - if (input & 0x40) // if bit 6 - byte = byte | 0x18; //set pixel 2 - } - output[i] = byte; - input <<= 2; - } - - u8x8_cad_SendData(u8x8, 4, output); - ptr += 1; - c -= 1; - } - u8x8_cad_EndTransfer(u8x8); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_erc240160_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7586s_erc240160_display_info); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_erc240160_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_erc240160_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if (arg_int == 0) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_sleep_off); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_sleep_on); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x0C0); - u8x8_cad_SendArg(u8x8, arg_int); - u8x8_cad_SendArg(u8x8, 1); - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_s028hn118a.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_s028hn118a.c deleted file mode 100644 index e2a2a81..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7586s_s028hn118a.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - u8x8_d_st7586s_s028hn118a.c - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - Copyright (c) 2018, olikraus@gmail.com - All rights reserved. - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "u8g2.h" - - -static const uint8_t u8x8_d_st7586s_sleep_on[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x010), /* set power save mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_sleep_off[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x011), //Sleep out - U8X8_DLY(50), /* delay 50 ms */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_s028hn118a_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x036), /* Scan Direction Setting */ - U8X8_A(0x000), /* COM0 -> COM159 SEG0 -> SEG384 */ - U8X8_C(0x037), /* Start line 0 */ - U8X8_A(0x000), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7586s_s028hn118a_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x036), /* Scan Direction Setting */ - U8X8_A(0x0C8), /* COM159 -> COM0 SEG384 -> SEG0 */ - U8X8_C(0x037), /* Start line 24 */ - U8X8_A(0x018), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static uint8_t u8x8_d_st7586s_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { - uint8_t c; - uint8_t *ptr; - uint8_t i, byte; - uint32_t input; - uint8_t output[8]; - switch (msg) { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); // OK Start transfer - u8x8_cad_SendCmd(u8x8, 0x02B); /* Row Address Setting */ - u8x8_cad_SendArg(u8x8, 0x000); - u8x8_cad_SendArg(u8x8, 0x008 * ((u8x8_tile_t *)arg_ptr)->y_pos); - u8x8_cad_SendArg(u8x8, 0x000); - u8x8_cad_SendArg(u8x8, u8x8->display_info->pixel_height - 1); /* should this be u8x8->display_info->pixel_height - 1 */ - u8x8_cad_SendCmd(u8x8, 0x02C); /* cmd write display data to ram */ - c = ((u8x8_tile_t *) arg_ptr)->cnt; // - c *= 8; - ptr = ((u8x8_tile_t *) arg_ptr)->tile_ptr; // - -// The ST7586S has an unusual 3 pixels per byte format so here we read in 3 bytes (24 pixels) and -// pack that into 8 bytes of 3 pixels each - while (c > 0) { - input = (((uint32_t)ptr[0] << 16) | ((uint32_t)ptr[1] << 8) | (uint32_t)ptr[2]); - for (i=0; i<8; i++) - { - byte = 0; - if (input & 0x800000) // if bit 23 - byte = byte | 0xC0; //set pixel 1 - if (input & 0x400000) // if bit 22 - byte = byte | 0x18; //set pixel 2 - if (input & 0x200000) // if bit 22 - byte = byte | 0x3; //set pixel 3 - output[i] = byte; - input <<= 3; - } - u8x8_cad_SendData(u8x8, 8, output); - ptr += 3; - c -= 3; - } - u8x8_cad_EndTransfer(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if (arg_int == 0) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_sleep_off); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_sleep_on); - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x0C0); - u8x8_cad_SendArg(u8x8, arg_int); - u8x8_cad_SendArg(u8x8, 0); - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -static const uint8_t u8x8_d_st7586s_s028hn118a_init_seq[] = { - U8X8_END_TRANSFER(),/* disable chip */ -// U8G_ESC_RST(15), /* hardware reset */ - U8X8_DLY(60), /* Delay 60 ms */ - U8X8_START_TRANSFER(),/* enable chip */ - - U8X8_C(0x001), // Soft reset - U8X8_DLY(60), // Delay 120 ms - - U8X8_C(0x011), // Sleep Out - U8X8_C(0x028), // Display OFF - U8X8_DLY(25), // Delay 50 ms - - U8X8_CAA(0x0C0,0x0E5,0x00),// Vop = F0h in trace a bit too dark - - U8X8_CA(0x0C3,0x004), // BIAS = 1/10 0x04 in trace - - U8X8_CA(0x0C4,0x005), // Booster = x6 0x05 in trace - - U8X8_CA(0x0D0,0x01D), // Enable Analog Circuit - - U8X8_CA(0x0B3,0x000), // Set FOSC divider - - U8X8_CA(0x0B5,0x08B), // N-Line = 0 - - U8X8_C(0x039), // 0x39 Monochrome mode. 0x38 - gray Mode - - U8X8_C(0x03A), // Enable DDRAM Interface - U8X8_A(0x002), // monochrome and 4-level - - U8X8_C(0x036), // Scan Direction Setting - U8X8_A(0x000), // COM0 -> COM159 SEG0 -> SEG384 - - U8X8_C(0x0B0), // Duty Setting (num rows - 1) - U8X8_A(0x087), // should be 0x87 but caused flicker 0x9F - - U8X8_C(0x020), // Display inversion off - - U8X8_C(0x02A), // Column Address Setting - U8X8_A(0x000), // COL0 -> COL127 - U8X8_A(0x000), // - U8X8_A(0x000), // - U8X8_A(0x07f), // 128*3=384 pixels - - U8X8_C(0x02B), // Row Address Setting - U8X8_A(0x000), // ROW0 -> ROW135 - U8X8_A(0x000), // - U8X8_A(0x000), // - U8X8_A(0x087), // 136 pixels - - U8X8_C(0x0F1), // Frame rate monochrome - U8X8_A(0x00C), // The factory firmware set this to 49.0 Hz 0x07 - U8X8_A(0x00C), // This caused a shimmer under 50Hz LED lights - U8X8_A(0x00C), // 69.0 Hz (0x0C) fixes this and should avoid the - U8X8_A(0x00C), // issue in the US too - - U8X8_C(0x029), // Display ON - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_st7586s_s028hn118a_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 100, /* datasheet ST7586S */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* ST7586+Atmega128RFA1 works with 8MHz */ - /* spi_mode = */ 3, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 20, /* datasheet suggests min 20 */ - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 48, - /* tile_height = */ 17, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 384, - /* pixel_height = */ 136 -}; - -/******************************************************************************* - * st7586s_s028hn118a driver. This is the display in the SMART Response XE. This requires 16 bit mode. - ******************************************************************************/ -uint8_t u8x8_d_st7586s_s028hn118a(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { - if (u8x8_d_st7586s_common(u8x8, msg, arg_int, arg_ptr) != 0) - return 1; - - switch (msg) { - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_s028hn118a_init_seq); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7586s_s028hn118a_display_info); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_s028hn118a_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7586s_s028hn118a_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7588.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7588.c deleted file mode 100644 index dd1d4df..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7588.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - - u8x8_d_st7588.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ST7588 - - has 4 different I2C addresses - - I2C protocol is identical to SSD13xx - -*/ - - -#include "u8x8.h" - -/* function set, bit 2: power down, bit 3: MY, bit 4: MX, bit 5: must be 1 */ -#define FS (0x020) - -/* not a real power down for the ST7588... just a display off */ -static const uint8_t u8x8_d_st7588_128x64_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( FS | 0x00 ), /* select 00 commands */ - //U8X8_C( 0x08 ), /* display off */ - U8X8_C( 0x0c ), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7588_128x64_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( FS | 0x00 ), /* select 00 commands */ - U8X8_C( 0x08 ), /* display off */ - //U8X8_C( 0x0c ), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - - - -static uint8_t u8x8_d_st7588_128x64_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - /* handled by the calling function - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7588_128x64_display_info); - break; - */ - /* handled by the calling function - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7588_128x64_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7588_128x64_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7588_128x64_powersave1_seq); - - /* restore orientation */ - if ( u8x8->x_offset == 0 ) - u8x8_cad_SendCmd(u8x8, FS ); /* select 00 commands */ - else - u8x8_cad_SendCmd(u8x8, FS ^ 0x018 ); /* select 00 commands */ - - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - - u8x8_cad_StartTransfer(u8x8); - - u8x8_cad_SendCmd(u8x8, FS ); - u8x8_cad_SendArg(u8x8, 4 | (arg_int>>7) ); - u8x8_cad_SendCmd(u8x8, FS | 1); - u8x8_cad_SendArg(u8x8, 0x080 | arg_int ); - - /* restore orientation */ - if ( u8x8->x_offset == 0 ) - u8x8_cad_SendCmd(u8x8, FS ); /* select 00 commands */ - else - u8x8_cad_SendCmd(u8x8, FS ^ 0x018 ); /* select 00 commands */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - - u8x8_cad_StartTransfer(u8x8); - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - x += u8x8->x_offset; - - if ( u8x8->x_offset == 0 ) - u8x8_cad_SendCmd(u8x8, FS ); /* select 00 commands */ - else - u8x8_cad_SendCmd(u8x8, FS ^ 0x018 ); /* select 00 commands */ - - u8x8_cad_SendCmd(u8x8, 0x040 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - u8x8_cad_SendCmd(u8x8, 0x0e0 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0f0 | (x>>4) ); - - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - -/*=============================================*/ - -static const u8x8_display_info_t u8x8_st7588_128x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 150, - /* pre_chip_disable_wait_ns = */ 30, - /* reset_pulse_width_ms = */ 5, - /* post_reset_wait_ms = */ 5, /**/ - /* sda_setup_time_ns = */ 60, /* */ - /* sck_pulse_width_ns = */ 60, /* */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, /* 400KHz */ - /* data_setup_time_ns = */ 80, - /* write_pulse_width_ns = */ 50, - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* must be 0, because this is checked also for normal mode */ - /* flipmode_x_offset = */ 4, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - - - -static const uint8_t u8x8_d_st7588_128x64_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C( FS | 0x03 ), /* select 11 commands */ - U8X8_C( 0x03 ), /* software reset */ - - U8X8_C( FS | 0x00 ), /* select 00 commands */ - U8X8_C( 0x08 ), /* display off */ - //U8X8_C( 0x0c ), /* display on */ - - U8X8_C( FS | 0x01 ), /* select 01 commands */ - U8X8_C( 0x08 ), /* display confguration */ - U8X8_C( 0x12 ), /* bias 1/9 */ - U8X8_C( 0x8f ), /* Vop, lower 7 bits */ - - U8X8_C( FS | 0x00 ), /* select 00 commands */ - U8X8_C( 0x05), /* Bit 0 contains high/low range for Vop */ - - - U8X8_C( FS | 0x03 ), /* select 11 commands */ - U8X8_C( 0x0b), /* Frame Rate: 73 Hz */ - - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const uint8_t u8x8_d_st7588_jlx12864_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( FS ), /* normal mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7588_jlx12864_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C( FS ^ 0x018 ), /* normal mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st7588_jlx12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - if ( u8x8_d_st7588_128x64_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) - return 1; - if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) - { - u8x8_SetI2CAddress(u8x8, 0x07e); /* the JLX12864 has 0x07e as a default address for I2C */ - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7588_128x64_display_info); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_INIT ) - { - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7588_128x64_init_seq); - return 1; - } - else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7588_jlx12864_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_st7588_jlx12864_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - return 0; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7920.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7920.c deleted file mode 100644 index a9eae77..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_st7920.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - - u8x8_d_st7920.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The ST7920 controller does not support hardware graphics flip. - Contrast adjustment is done by an external resistor --> no support for contrast adjustment - - -*/ -#include "u8x8.h" - - - -static const uint8_t u8x8_d_st7920_init_seq[] = { - - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(10), - - U8X8_C(0x038), /* 8 Bit interface (DL=1), basic instruction set (RE=0) */ - U8X8_C(0x008), /* display on, cursor & blink off; 0x08: all off */ - U8X8_C(0x006), /* Entry mode: Cursor move to right ,DDRAM address counter (AC) plus 1, no shift */ - U8X8_C(0x002), /* disable scroll, enable CGRAM adress */ - U8X8_C(0x001), /* clear RAM, needs 1.6 ms */ - U8X8_DLY(4), /* delay 2ms */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7920_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x038), /* 8 Bit interface (DL=1), basic instruction set (RE=0) */ - U8X8_C(0x00c), /* display on, cursor & blink off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_st7920_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x038), /* 8 Bit interface (DL=1), basic instruction set (RE=0) */ - U8X8_C(0x008), /* display off */ - U8X8_C(0x034), /* 8 Bit interface (DL=1), extended instruction set (RE=1) */ - U8X8_C(0x001), /* Standby mode */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_st7920_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c, i; - uint8_t *ptr; - switch(msg) - { - /* U8X8_MSG_DISPLAY_SETUP_MEMORY is handled by the calling function */ - /* - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - break; - */ - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_st7920_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_st7920_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_st7920_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y*=8; - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x /= 2; /* not sure whether this is a clever idea, problem is, the ST7920 can address only every second tile */ - - if ( y >= 32 ) /* this is the adjustment for 128x64 displays */ - { - y-=32; - x+=8; - } - - u8x8_cad_StartTransfer(u8x8); - - - /* - Tile structure is reused here for the ST7920, however u8x8 is not supported - tile_ptr points to data which has cnt*8 bytes (same as SSD1306 tiles) - Buffer is expected to have 8 lines of code fitting to the ST7920 internal memory - "cnt" includes the number of horizontal bytes. width is equal to cnt*8 - Also important: Width must be a multiple of 16 (ST7920 requirement), so cnt must be even. - - TODO: Consider arg_int, however arg_int is not used by u8g2 - */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ - /* The following byte is sent to allow the ST7920 to sync up with the data */ - /* it solves some issues with garbage data */ - u8x8_cad_SendCmd(u8x8, 0x03e ); /* enable extended mode */ - u8x8_cad_SendCmd(u8x8, 0x03e ); /* enable extended mode, issue 487 */ - for( i = 0; i < 8; i++ ) - { - //u8x8_cad_SendCmd(u8x8, 0x03e ); /* enable extended mode */ - u8x8_cad_SendCmd(u8x8, 0x080 | (y+i) ); /* y pos */ - u8x8_cad_SendCmd(u8x8, 0x080 | x ); /* set x pos */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - - //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */ - ptr += c; - //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ - } - - u8x8_cad_EndTransfer(u8x8); - - break; - default: - return 0; - } - return 1; -} - -static const u8x8_display_info_t u8x8_st7920_192x32_display_info = -{ - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, /* datasheet ST7920 */ - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 3, /* old: sck_takeover_edge, new: active high (bit 1), rising edge (bit 0), 18 Aug 16: changed from 1 to 3 which works for 101 */ - /* Arduino mode 3: aktive low clock, but use rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 24, - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 192, - /* pixel_height = */ 32 -}; - -static const u8x8_display_info_t u8x8_st7920_128x64_display_info = -{ - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, /* datasheet ST7920 */ - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* ST7920+Due work with 1MHz but not with 2MHz, ST7920+Uno works with 2MHz */ - /* spi_mode = */ 3, /* active high, rising edge, 18 Aug 16: changed from 1 to 3 which works for 101 */ - /* in theory mode 3 should be correct */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_st7920_192x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7920_192x32_display_info); - break; - default: - return u8x8_d_st7920_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - -uint8_t u8x8_d_st7920_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7920_128x64_display_info); - break; - default: - return u8x8_d_st7920_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - - - - - \ No newline at end of file diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_t6963.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_t6963.c deleted file mode 100644 index 6a45f64..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_t6963.c +++ /dev/null @@ -1,564 +0,0 @@ -/* - - u8x8_d_t6963.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The t6963 controller does not support hardware graphics flip. - Contrast adjustment is done by an external resistor --> no support for contrast adjustment - - -*/ -#include "u8x8.h" - - - -static const uint8_t u8x8_d_t6963_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x098), /* mode register: Display Mode, Graphics on, Text off, Cursor off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_t6963_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x090), /* All Off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_t6963_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t c, i; - uint16_t y; - uint8_t *ptr; - switch(msg) - { - /* U8X8_MSG_DISPLAY_SETUP_MEMORY is handled by the calling function */ - /* - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - break; - case U8X8_MSG_DISPLAY_INIT: - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_DRAW_TILE: - y = (((u8x8_tile_t *)arg_ptr)->y_pos); - y*=8; - y*= u8x8->display_info->tile_width; - /* x = ((u8x8_tile_t *)arg_ptr)->x_pos; x is ignored... no u8x8 support */ - //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ - u8x8_cad_StartTransfer(u8x8); - //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ - /* - Tile structure is reused here for the t6963, however u8x8 is not supported - tile_ptr points to data which has cnt*8 bytes (same as SSD1306 tiles) - Buffer is expected to have 8 lines of code fitting to the t6963 internal memory - "cnt" includes the number of horizontal bytes. width is equal to cnt*8 - - TODO: Consider arg_int, however arg_int is not used by u8g2 - */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ - for( i = 0; i < 8; i++ ) - { - u8x8_cad_SendArg(u8x8, y&255); - u8x8_cad_SendArg(u8x8, y>>8); - u8x8_cad_SendCmd(u8x8, 0x024 ); /* set adr */ - u8x8_cad_SendCmd(u8x8, 0x0b0 ); /* auto write start */ - - - //c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */ - - u8x8_cad_SendCmd(u8x8, 0x0b2 ); /* auto write reset */ - ptr += u8x8->display_info->tile_width; - y += u8x8->display_info->tile_width; - } - - u8x8_cad_EndTransfer(u8x8); - //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */ - - break; - default: - return 0; - } - return 1; -} - -/*=============================================*/ - - -static const u8x8_display_info_t u8x8_t6963_240x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 110, /* T6963 Datasheet p30 */ - /* pre_chip_disable_wait_ns = */ 100, /* T6963 Datasheet p30 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 80, - /* write_pulse_width_ns = */ 80, - /* tile_width = */ 30, - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 128 -}; - -/* 240x128 */ -static const uint8_t u8x8_d_t6963_240x128_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - U8X8_AAC(0x00,0x00,0x021), /* low, high, set cursor pos */ - U8X8_AAC(0x00,0x00,0x022), /* low, high, set offset */ - U8X8_AAC(0x00,0x00,0x040), /* low, high, set text home */ - U8X8_AAC(240/8,0x00,0x041), /* low, high, set text columns */ - U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ - U8X8_AAC(240/8,0x00,0x043), /* low, high, graphics columns */ - U8X8_DLY(2), /* delay 2ms */ - // mode set - // 0x080: Internal CG, OR Mode - // 0x081: Internal CG, EXOR Mode - // 0x083: Internal CG, AND Mode - // 0x088: External CG, OR Mode - // 0x089: External CG, EXOR Mode - // 0x08B: External CG, AND Mode - U8X8_C(0x080), /* mode register: OR Mode, Internal Character Mode */ - // display mode - // 0x090: Display off - // 0x094: Graphic off, text on, cursor off, blink off - // 0x096: Graphic off, text on, cursor on, blink off - // 0x097: Graphic off, text on, cursor on, blink on - // 0x098: Graphic on, text off, cursor off, blink off - // 0x09a: Graphic on, text off, cursor on, blink off - // ... - // 0x09c: Graphic on, text on, cursor off, blink off - // 0x09f: Graphic on, text on, cursor on, blink on - U8X8_C(0x090), /* All Off */ - U8X8_AAC(0x00,0x00,0x024), /* low, high, set adr pointer */ - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - -uint8_t u8x8_d_t6963_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_240x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_240x128_init_seq); - break; - default: - return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - - -/*=============================================*/ - -static const u8x8_display_info_t u8x8_t6963_240x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 110, /* T6963 Datasheet p30 */ - /* pre_chip_disable_wait_ns = */ 100, /* T6963 Datasheet p30 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 80, - /* write_pulse_width_ns = */ 80, - /* tile_width = */ 30, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 64 -}; - - -/* 240x64 */ -static const uint8_t u8x8_d_t6963_240x64_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - U8X8_AAC(0x00,0x00,0x021), /* low, high, set cursor pos */ - U8X8_AAC(0x00,0x00,0x022), /* low, high, set offset */ - U8X8_AAC(0x00,0x00,0x040), /* low, high, set text home */ - U8X8_AAC(240/8,0x00,0x041), /* low, high, set text columns */ - U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ - U8X8_AAC(240/8,0x00,0x043), /* low, high, graphics columns */ - U8X8_DLY(2), /* delay 2ms */ - // mode set - // 0x080: Internal CG, OR Mode - // 0x081: Internal CG, EXOR Mode - // 0x083: Internal CG, AND Mode - // 0x088: External CG, OR Mode - // 0x089: External CG, EXOR Mode - // 0x08B: External CG, AND Mode - U8X8_C(0x080), /* mode register: OR Mode, Internal Character Mode */ - // display mode - // 0x090: Display off - // 0x094: Graphic off, text on, cursor off, blink off - // 0x096: Graphic off, text on, cursor on, blink off - // 0x097: Graphic off, text on, cursor on, blink on - // 0x098: Graphic on, text off, cursor off, blink off - // 0x09a: Graphic on, text off, cursor on, blink off - // ... - // 0x09c: Graphic on, text on, cursor off, blink off - // 0x09f: Graphic on, text on, cursor on, blink on - U8X8_C(0x090), /* All Off */ - U8X8_AAC(0x00,0x00,0x024), /* low, high, set adr pointer */ - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - -uint8_t u8x8_d_t6963_240x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_240x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_240x64_init_seq); - break; - default: - return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - - -/*=============================================*/ - - - -static const u8x8_display_info_t u8x8_t6963_256x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 110, /* T6963 Datasheet p30 */ - /* pre_chip_disable_wait_ns = */ 100, /* T6963 Datasheet p30 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 80, - /* write_pulse_width_ns = */ 80, - /* tile_width = */ 32, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 256, - /* pixel_height = */ 64 -}; - -/* 256x64 */ -static const uint8_t u8x8_d_t6963_256x64_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - U8X8_AAC(0x00,0x00,0x021), /* low, high, set cursor pos */ - U8X8_AAC(0x00,0x00,0x022), /* low, high, set offset */ - U8X8_AAC(0x00,0x00,0x040), /* low, high, set text home */ - U8X8_AAC(256/8,0x00,0x041), /* low, high, set text columns */ - U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ - U8X8_AAC(256/8,0x00,0x043), /* low, high, graphics columns */ - U8X8_DLY(2), /* delay 2ms */ - // mode set - // 0x080: Internal CG, OR Mode - // 0x081: Internal CG, EXOR Mode - // 0x083: Internal CG, AND Mode - // 0x088: External CG, OR Mode - // 0x089: External CG, EXOR Mode - // 0x08B: External CG, AND Mode - U8X8_C(0x080), /* mode register: OR Mode, Internal Character Mode */ - // display mode - // 0x090: Display off - // 0x094: Graphic off, text on, cursor off, blink off - // 0x096: Graphic off, text on, cursor on, blink off - // 0x097: Graphic off, text on, cursor on, blink on - // 0x098: Graphic on, text off, cursor off, blink off - // 0x09a: Graphic on, text off, cursor on, blink off - // ... - // 0x09c: Graphic on, text on, cursor off, blink off - // 0x09f: Graphic on, text on, cursor on, blink on - U8X8_C(0x090), /* All Off */ - U8X8_AAC(0x00,0x00,0x024), /* low, high, set adr pointer */ - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - -uint8_t u8x8_d_t6963_256x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_256x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_256x64_init_seq); - break; - default: - return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - -/*=============================================*/ - -static const u8x8_display_info_t u8x8_t6963_128x64_display_info = -{ - /* chip_enable_level = */ 1, - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* T6963 Datasheet p30 */ - /* pre_chip_disable_wait_ns = */ 100, /* T6963 Datasheet p30 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 80, - /* write_pulse_width_ns = */ 80, - /* tile_width = */ 16, - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -/* 128x64 */ -static const uint8_t u8x8_d_t6963_128x64_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - U8X8_AAC(0x00,0x00,0x021), /* low, high, set cursor pos */ - U8X8_AAC(0x00,0x00,0x022), /* low, high, set offset */ - U8X8_AAC(0x00,0x00,0x040), /* low, high, set text home */ - U8X8_AAC(128/8,0x00,0x041), /* low, high, set text columns */ - U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ - U8X8_AAC(128/8,0x00,0x043), /* low, high, graphics columns */ - U8X8_DLY(2), /* delay 2ms */ - // mode set - // 0x080: Internal CG, OR Mode - // 0x081: Internal CG, EXOR Mode - // 0x083: Internal CG, AND Mode - // 0x088: External CG, OR Mode - // 0x089: External CG, EXOR Mode - // 0x08B: External CG, AND Mode - U8X8_C(0x080), /* mode register: OR Mode, Internal Character Mode */ - // display mode - // 0x090: Display off - // 0x094: Graphic off, text on, cursor off, blink off - // 0x096: Graphic off, text on, cursor on, blink off - // 0x097: Graphic off, text on, cursor on, blink on - // 0x098: Graphic on, text off, cursor off, blink off - // 0x09a: Graphic on, text off, cursor on, blink off - // ... - // 0x09c: Graphic on, text on, cursor off, blink off - // 0x09f: Graphic on, text on, cursor on, blink on - U8X8_C(0x090), /* All Off */ - U8X8_AAC(0x00,0x00,0x024), /* low, high, set adr pointer */ - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - -uint8_t u8x8_d_t6963_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_128x64_init_seq); - break; - default: - return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - -/*=============================================*/ - -static const u8x8_display_info_t u8x8_t6963_160x80_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 10, /* T6963 Datasheet p30 */ - /* pre_chip_disable_wait_ns = */ 100, /* T6963 Datasheet p30 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 20, - /* sck_pulse_width_ns = */ 140, - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 80, - /* write_pulse_width_ns = */ 80, - /* tile_width = */ 20, - /* tile_hight = */ 10, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 160, - /* pixel_height = */ 80 -}; - -/* 128x64 */ -static const uint8_t u8x8_d_t6963_160x80_init_seq[] = { - U8X8_DLY(100), - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(100), - - U8X8_AAC(0x00,0x00,0x021), /* low, high, set cursor pos */ - U8X8_AAC(0x00,0x00,0x022), /* low, high, set offset */ - U8X8_AAC(0x00,0x00,0x040), /* low, high, set text home */ - U8X8_AAC(160/8,0x00,0x041), /* low, high, set text columns */ - U8X8_AAC(0x00,0x00,0x042), /* low, high, graphics home */ - U8X8_AAC(160/8,0x00,0x043), /* low, high, graphics columns */ - U8X8_DLY(2), /* delay 2ms */ - // mode set - // 0x080: Internal CG, OR Mode - // 0x081: Internal CG, EXOR Mode - // 0x083: Internal CG, AND Mode - // 0x088: External CG, OR Mode - // 0x089: External CG, EXOR Mode - // 0x08B: External CG, AND Mode - U8X8_C(0x080), /* mode register: OR Mode, Internal Character Mode */ - // display mode - // 0x090: Display off - // 0x094: Graphic off, text on, cursor off, blink off - // 0x096: Graphic off, text on, cursor on, blink off - // 0x097: Graphic off, text on, cursor on, blink on - // 0x098: Graphic on, text off, cursor off, blink off - // 0x09a: Graphic on, text off, cursor on, blink off - // ... - // 0x09c: Graphic on, text on, cursor off, blink off - // 0x09f: Graphic on, text on, cursor on, blink on - U8X8_C(0x090), /* All Off */ - U8X8_AAC(0x00,0x00,0x024), /* low, high, set adr pointer */ - - U8X8_DLY(100), - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_DLY(100), -}; - -uint8_t u8x8_d_t6963_160x80(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_160x80_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_160x80_init_seq); - break; - default: - return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - -/* alternative version for the 128x64 t6963 display: use the 160x80 init sequence */ -uint8_t u8x8_d_t6963_128x64_alt(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_160x80_init_seq); - break; - default: - return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); - } - return 1; -} - - - - - \ No newline at end of file diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1601.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1601.c deleted file mode 100644 index 23ee5dd..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1601.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - - u8x8_d_uc1601.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This is for the uc1601s controller - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_uc1601_128x32_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1601_128x32_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1601_128x32_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c4), /* bit 1: MX, bit 2: MY */ - U8X8_C(0x060), /* set display start line to 32 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1601_128x32_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c2), /* bit 1: MX, bit 2: MY */ - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_uc1601_128x32_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 1, /* uc1601 datasheet, page 46 */ - /* pre_chip_disable_wait_ns = */ 5, /* uc1601 datasheet, page 46 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 12, /* uc1601 datasheet, page 44 */ - /* sck_pulse_width_ns = */ 15, /* uc1601 datasheet, page 44 */ - /* sck_clock_hz = */ 2000000UL, /* */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 1, - /* data_setup_time_ns = */ 60, /* uc1601 datasheet, page 43 */ - /* write_pulse_width_ns = */ 80, /* uc1601 datasheet, page 43 */ - /* tile_width = */ 16, - /* tile_hight = */ 4, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 4, - /* pixel_width = */ 128, - /* pixel_height = */ 32 -}; - -static const uint8_t u8x8_d_uc1601_128x32_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0eb), /* LCD Bias: 0xe8: 6, 0xe9: 7, 0xea: 8, 0xeb: 9 */ - //U8X8_C(0x023), /* 0x020...0x023 only for UC1601, not for UC1601s */ - - - //U8X8_C(0x02e), /* LCD Load + Internal Charge Pump (default: 0x2e) */ - U8X8_C(0x024), /* Temperature Compenstation, default: 0x24 */ - U8X8_C(0x089), /* RAM address ctrl, default: 0x89 */ - U8X8_C(0x0c4), /* RAM mapping ctrl */ - U8X8_C(0x0a0), /* Frame Rate, 0x0a0 or 0x0a1 */ - U8X8_CA(0x081, 0x0df), /* set contrast */ - U8X8_C(0x02e), /* LCD Load + Internal Charge Pump (default: 0x2e) */ - U8X8_C(0x060), /* set display start line to 32 */ - - U8X8_C(0x0a6), /* normal display */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1601_128x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1601_128x32_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1601 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1604.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1604.c deleted file mode 100644 index e7df8f9..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1604.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - - u8x8_d_uc1604.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -*/ -#include "u8x8.h" - - - - - -static const uint8_t u8x8_d_uc1604_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_DLY(20), - U8X8_C(0x0af), /* display on */ - U8X8_DLY(20), /* during setup, it seems that the startup is more reliable when sending this cmd twice */ - U8X8_C(0x0af), /* display on */ - U8X8_DLY(50), /* startup takes some time */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1604_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off, enter sleep mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1604_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c4), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1604_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c2), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_uc1604_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - - y = ((u8x8_tile_t *)arg_ptr)->y_pos; - y += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x0b0 | (y&15)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - /* handled in the calling procedure - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1604_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1604 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* JLX19264 */ - -/* - timings from uc1608 - - UC1604 has two chip select inputs (CS0 and CS1). - CS0 is low active, CS1 is high active. It will depend on the display - module whether the display has a is low or high active chip select. - -*/ -static const u8x8_display_info_t u8x8_uc1604_192x64_display_info = -{ - /* chip_enable_level = */ 0, /* JLX19264G uses CS0, which is low active CS*/ - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 20, - /* pre_chip_disable_wait_ns = */ 20, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 35, - /* tile_width = */ 24, /* width of 24*8=192 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* reused as y page offset */ - /* flipmode_x_offset = */ 0, /* reused as y page offset */ - /* pixel_width = */ 192, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_d_uc1604_jlx19264_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_DLY(200), - U8X8_DLY(200), - - U8X8_C(0x02f), /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */ - U8X8_DLY(200), - U8X8_DLY(200), - - U8X8_CA(0x081, 0x052), /* set contrast, JLX19264G suggestion: 0x045 */ - U8X8_C(0x0eb), /* LCD bias Bits 0/1: 00=6 01=7, 10=8, 11=9 */ - - - //U8X8_C(0x023), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - //U8X8_C(0x027), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - - U8X8_C(0x0c4), /* Map control, Bit 2: MY=1, Bit 1: MX=0 */ - U8X8_C(0x0a0), /* 0xa0: 76Hz FPS, controller default: 0x0a1: 95Hz FPS */ - - - U8X8_C(0x040), /* set scroll line to 0 */ - U8X8_C(0x089), /* RAM access control (controller default: 0x089)*/ - - - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x0b0), /* page adr */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1604_jlx19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1604_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1604_192x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_jlx19264_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1608.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1608.c deleted file mode 100644 index 7482062..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1608.c +++ /dev/null @@ -1,512 +0,0 @@ -/* - - u8x8_d_uc1608.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -*/ -#include "u8x8.h" - - - - - -static const uint8_t u8x8_d_uc1608_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1608_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off, enter sleep mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1608_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c8), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1608_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c4), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_uc1608_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - - y = ((u8x8_tile_t *)arg_ptr)->y_pos; - y += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x0b0 | (y&15)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - /* handled in the calling procedure - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1608_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1608 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* ERC24064-1 */ - -/* - The UC1608 has only one high active chip select input. - UC1604, UC1610 and UC1611 have two chip select inputs. -*/ - -static const u8x8_display_info_t u8x8_uc1608_240x64_display_info = -{ - /* chip_enable_level = */ 1, /* uc1608 has high active CS */ - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* uc1608 datasheet, page 39, actually 0 */ - /* pre_chip_disable_wait_ns = */ 20, /* uc1608 datasheet, page 39 */ - /* reset_pulse_width_ms = */ 1, /* uc1608 datasheet, page 42 */ - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, /* uc1608 datasheet, page 41 */ - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1608 datasheet, page 39 */ - /* write_pulse_width_ns = */ 35, /* uc1608 datasheet, page 39 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, /* reused as y page offset */ - /* flipmode_x_offset = */ 4, /* reused as y page offset */ - /* pixel_width = */ 240, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_d_uc1608_erc24064_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_DLY(200), - - U8X8_C(0x023), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - //U8X8_C(0x027), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - - U8X8_C(0x0c8), /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */ - U8X8_C(0x0e8), /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7 */ - - U8X8_C(0x02f), /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */ - U8X8_DLY(50), - - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_C(0x090), /* no fixed lines */ - U8X8_C(0x089), /* RAM access control */ - - U8X8_CA(0x081, 0x014), /* set contrast, ERC24064-1 default: 0x040 */ - - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x0b0), /* page adr */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1608_erc24064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1608_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1608_240x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_erc24064_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ -/* experimental implementation for the uc1608 240x128, not referenced in codebuild */ - -static const u8x8_display_info_t u8x8_uc1608_240x128_display_info = -{ - /* chip_enable_level = */ 1, /* uc1608 has high active CS */ - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* uc1608 datasheet, page 39, actually 0 */ - /* pre_chip_disable_wait_ns = */ 20, /* uc1608 datasheet, page 39 */ - /* reset_pulse_width_ms = */ 1, /* uc1608 datasheet, page 42 */ - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, /* uc1608 datasheet, page 41 */ - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1608 datasheet, page 39 */ - /* write_pulse_width_ns = */ 35, /* uc1608 datasheet, page 39 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 16, - /* default_x_offset = */ 0, /* reused as y page offset */ - /* flipmode_x_offset = */ 0, /* reused as y page offset */ - /* pixel_width = */ 240, - /* pixel_height = */ 128 -}; - -static const uint8_t u8x8_d_uc1608_240x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_DLY(200), - - //U8X8_C(0x023), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - U8X8_C(0x026), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - - U8X8_C(0x0c8), /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */ - U8X8_C(0x0ea), /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7 */ - /* maybe 0x0eb??? */ - - U8X8_C(0x02f), /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */ - U8X8_DLY(50), - - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_C(0x090), /* no fixed lines */ - U8X8_C(0x089), /* RAM access control */ - - U8X8_CA(0x081, 0x072), /* set contrast */ - - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x0b0), /* page adr */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1608_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1608_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1608_240x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_240x128_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* experimental implementation for the uc1608 erc240x120 */ - -static const u8x8_display_info_t u8x8_uc1608_erc240120_display_info = -{ - /* chip_enable_level = */ 1, /* uc1608 has high active CS */ - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* uc1608 datasheet, page 39, actually 0 */ - /* pre_chip_disable_wait_ns = */ 20, /* uc1608 datasheet, page 39 */ - /* reset_pulse_width_ms = */ 1, /* uc1608 datasheet, page 42 */ - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, /* uc1608 datasheet, page 41 */ - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1608 datasheet, page 39 */ - /* write_pulse_width_ns = */ 35, /* uc1608 datasheet, page 39 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 15, - /* default_x_offset = */ 1, /* reused as y page offset */ - /* flipmode_x_offset = */ 0, /* reused as y page offset */ - /* pixel_width = */ 240, - /* pixel_height = */ 120 -}; - -/* http://www.buydisplay.com/download/democode/ERC240120-1_DemoCode.txt */ -static const uint8_t u8x8_d_uc1608_erc240120_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_DLY(200), - - //U8X8_C(0x023), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - U8X8_C(0x026), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - - U8X8_C(0x0c8), /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */ - U8X8_C(0x0ea), /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7 */ - /* according to DemoCode.txt */ - - U8X8_C(0x02f), /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */ - U8X8_DLY(50), - - U8X8_C(0x040), /* set display start line to 0 */ - U8X8_C(0x090), /* no fixed lines */ - U8X8_C(0x089), /* RAM access control */ - - //U8X8_CA(0x081, 46), /* set contrast, 46 according to DemoCode.txt */ - U8X8_CA(0x081, 80), /* */ - - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x0b0), /* page adr */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1608_erc240120(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1608_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1608_erc240120_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_erc240120_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* DEM 240064, issue 1164 */ - - -static const u8x8_display_info_t u8x8_uc1608_dem240064_display_info = -{ - /* chip_enable_level = */ 1, /* uc1608 has high active CS */ - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* uc1608 datasheet, page 39, actually 0 */ - /* pre_chip_disable_wait_ns = */ 20, /* uc1608 datasheet, page 39 */ - /* reset_pulse_width_ms = */ 1, /* uc1608 datasheet, page 42 */ - /* post_reset_wait_ms = */ 10, - /* sda_setup_time_ns = */ 30, /* uc1608 datasheet, page 41 */ - /* sck_pulse_width_ns = */ 65, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1608 datasheet, page 39 */ - /* write_pulse_width_ns = */ 35, /* uc1608 datasheet, page 39 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 1, /* reused as y page offset */ - /* flipmode_x_offset = */ 0, /* reused as y page offset */ - /* pixel_width = */ 240, - /* pixel_height = */ 64 -}; - -/* http://www.buydisplay.com/download/democode/ERC240120-1_DemoCode.txt */ -static const uint8_t u8x8_d_uc1608_dem240064_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_DLY(200), - - //U8X8_C(0x023), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - U8X8_C(0x026), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */ - - U8X8_C(0x0c8), /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */ - U8X8_C(0x0ea), /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7 */ - /* according to DemoCode.txt */ - - U8X8_C(0x02f), /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */ - U8X8_DLY(50), - - U8X8_C(0x07f), /* set display start line*/ - U8X8_C(0x094), /* fixed lines */ - U8X8_C(0x089), /* RAM access control */ - - U8X8_CA(0x081, 160), /* issue 1164 */ - - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x0b0), /* page adr */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1608_dem240064_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c8), /* LCD Mapping */ - U8X8_C(0x07f), /* set display start line*/ - U8X8_C(0x094), /* fixed lines */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1608_dem240064_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c4), /* LCD Mapping */ - U8X8_C(0x040), /* set display start line*/ - U8X8_C(0x090), /* fixed lines */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_uc1608_dem240064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - - /* checking for the flip mode cmd first */ - if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE ) - { - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_dem240064_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_dem240064_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - return 1; - } - /* call the common procedure, this now leads to the effect, that the flip code is executed again */ - /* maybe we should paste the common code here to avoid this */ - - - if ( u8x8_d_uc1608_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1608_dem240064_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1608_dem240064_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1610.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1610.c deleted file mode 100644 index 1ae472e..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1610.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - - u8x8_d_uc1610.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - cad001 - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_uc1610_dogxl160_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x0f1, 0x067), /* set COM end (display height-1) */ - U8X8_C(0x0c0), /* SEG & COM normal */ - U8X8_C(0x040), /* set scroll line lsb to zero */ - U8X8_C(0x050), /* set scroll line msb to zero */ - U8X8_C(0x02b), /* set panelloading */ - U8X8_C(0x0eb), /* set bias 1/2 */ - U8X8_CA(0x081, 0x05f), /* set contrast */ - - /* - AC0: 0: stop at boundary, 1: increment by one - AC1: 0: first column then page, 1: first page, then column increment - AC2: 0: increment page adr, 1: decrement page adr. - */ - U8X8_C(0x08b), /* set auto increment, low bits are AC2 AC1 AC0 */ - - /* - LC0: 0 - MX: Mirror X - MY: Mirror Y - */ - U8X8_C(0x0c0), /* low bits are MY, MX, LC0 */ - - U8X8_C(0x0f8), // window mode off - U8X8_C(0x010), // col high - U8X8_C(0x000), // col low - U8X8_C(0x0b0), // page - - U8X8_C(0x0a6), /* set normal pixel mode (not inverse) */ - U8X8_C(0x0a4), /* set normal pixel mode (not all on) */ - - /* test code - U8X8_C(0x0af), // display on - U8X8_C(0x0f8), // window mode off - U8X8_CA(0x0f4, 0), // set window - U8X8_CA(0x0f5, 0), - U8X8_CA(0x0f6, 4), - U8X8_CA(0x0f7, 1), - U8X8_C(0x0f9), // window mode on - U8X8_D1(0x03), - U8X8_D1(0x0c0), - U8X8_D1(0x0ff), - U8X8_D1(0x0ff), - U8X8_D1(0x0ff), - U8X8_D1(0x0ff), - U8X8_D1(0x0ff), - U8X8_D1(0x0ff), - */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1610_dogxl160_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on, UC1610 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1610_dogxl160_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off, UC1610 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1610_dogxl160_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - /* - LC0: 0 - MX: Mirror X - MY: Mirror Y - */ - U8X8_C(0x0c0), /* low bits are MY, MX, LC0 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1610_dogxl160_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - /* - LC0: 0 - MX: Mirror X - MY: Mirror Y - */ - U8X8_C(0x0c6), /* low bits are MY, MX, LC0 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* - UC1610 has two chip select inputs (CS0 and CS1). - CS0 is low active, CS1 is high active. It will depend on the display - module whether the display has a is low or high active chip select. -*/ - -static const u8x8_display_info_t u8x8_uc1610_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 15, - /* pre_chip_disable_wait_ns = */ 15, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 30, - /* sck_pulse_width_ns = */ 63, /* half of cycle time (125ns cycle time according to datasheet) --> 8MHz clock */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 20, - /* tile_hight = */ 13, /* height of 13*8=104 pixel */ - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 160, - /* pixel_height = */ 104 -}; - - -/* - RAM Organization: - D0 Pix0 - D1 - D2 Pix1 - D3 - D4 Pix2 - D5 - D6 Pix3 - D7 - D0 Pix4 - D1 - D2 Pix5 - D3 - D4 Pix6 - D5 - D6 Pix7 - D7 - - -*/ -static uint8_t *u8x8_convert_tile_for_uc1610(uint8_t *t) -{ - uint8_t i; - uint16_t r; - static uint8_t buf[16]; - uint8_t *pbuf = buf; - - for( i = 0; i < 8; i++ ) - { - r = u8x8_upscale_byte(*t++); - *pbuf++ = r & 255; - r >>= 8; - *pbuf++ = r; - } - return buf; -} - -uint8_t u8x8_d_uc1610_ea_dogxl160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c, page; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1610_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1610_dogxl160_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1610_dogxl160_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1610_dogxl160_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1610_dogxl160_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1610_dogxl160_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1610 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - page = (((u8x8_tile_t *)arg_ptr)->y_pos); - page *= 2; - - u8x8_cad_SendCmd(u8x8, 0x0f8 ); /* window disable */ - - //u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - //u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - //u8x8_cad_SendCmd(u8x8, 0x0b0 | page); - - u8x8_cad_SendCmd(u8x8, 0x0f4 ); /* window start column */ - u8x8_cad_SendArg(u8x8, x); - u8x8_cad_SendCmd(u8x8, 0x0f5 ); /* window start page */ - u8x8_cad_SendArg(u8x8, page); - u8x8_cad_SendCmd(u8x8, 0x0f6 ); /* window end column */ - u8x8_cad_SendArg(u8x8, 159); /* end of display */ - u8x8_cad_SendCmd(u8x8, 0x0f7 ); /* window end page */ - u8x8_cad_SendArg(u8x8, page+1); - u8x8_cad_SendCmd(u8x8, 0x0f9 ); /* window enable */ - - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, 16, u8x8_convert_tile_for_uc1610(ptr)); - ptr += 8; - x += 8; - c--; - } while( c > 0 ); - - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - - - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1611.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1611.c deleted file mode 100644 index b5bbec3..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1611.c +++ /dev/null @@ -1,633 +0,0 @@ -/* - - u8x8_d_uc1611.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - 6 Nov 2016: Not yet finished - - There are two controller: - UC1611s 160x256 - UC1611 160x240 - - Differences: - UC1611 0xa8 cmd: enables 80 display rows - UC1611s 0xa8 cmd: controlls graylevels - - UC1611 0xc0 cmd: single byte command for LCD mapping control - UC1611s 0xc0 cmd: double byte command for LCD mapping control - - -*/ -#include "u8x8.h" - - - - - -static const uint8_t u8x8_d_uc1611s_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a9), /* display on, UC1611s */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1611s_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a8), /* display off, enter sleep mode, UC1611s */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1611s_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0c0, 0x004), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1611s_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0c0, 0x002), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1611_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - - y = ((u8x8_tile_t *)arg_ptr)->y_pos; - u8x8_cad_SendCmd(u8x8, 0x060 | (y&15)); - u8x8_cad_SendCmd(u8x8, 0x070 | (y>>4)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - /* handled in the calling procedure - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1611_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - */ -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1611 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* EA DOGM240 */ - - -/* - UC1611 has two chip select inputs (CS0 and CS1). - CS0 is low active, CS1 is high active. It will depend on the display - module whether the display has a is low or high active chip select. -*/ - -static const u8x8_display_info_t u8x8_uc1611_240x64_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* pre_chip_disable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, /* uc1611 datasheet, page 67 */ - /* sda_setup_time_ns = */ 10, /* uc1611 datasheet, page 64, actually 0 */ - /* sck_pulse_width_ns = */ 60, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1611 datasheet, page 60 */ - /* write_pulse_width_ns = */ 80, /* uc1611 datasheet, page 60 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 64 -}; - -static const uint8_t u8x8_d_uc1611_ea_dogm240_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x02f), /* internal pump control */ - U8X8_CA(0x0f1, 63), /* set COM end */ - U8X8_CA(0x0f2, 0x000), /* display line start */ - U8X8_CA(0x0f3, 63), /* display line end */ - U8X8_C(0x0a3), /* line rate */ - U8X8_CA(0x081, 0x0a4), /* set contrast, EA default: 0x0b7 */ - - //U8X8_C(0x0a9), /* display enable */ - - U8X8_C(0x0d1), /* display pattern */ - U8X8_C(0x089), /* auto increment */ - U8X8_CA(0x0c0, 0x004), /* LCD Mapping */ - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x060), /* page adr low */ - U8X8_C(0x070), /* page adr high */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* UC1611s 240x64 display */ -uint8_t u8x8_d_uc1611_ea_dogm240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1611_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1611_240x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_ea_dogm240_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* EA DOGXL240 */ - -static const uint8_t u8x8_d_uc1611_ea_dogxl240_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x02f), /* internal pump control */ - U8X8_CA(0x0f1, 0x07f), /* set COM end */ - U8X8_CA(0x0f2, 0x000), /* display line start */ - U8X8_CA(0x0f3, 127), /* display line end */ - U8X8_C(0x0a3), /* line rate */ - U8X8_CA(0x081, 0x08f), /* set contrast */ - - //U8X8_C(0x0a9), /* display enable */ - - U8X8_C(0x0d1), /* display pattern */ - U8X8_C(0x089), /* auto increment */ - U8X8_CA(0x0c0, 0x004), /* LCD Mapping */ - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x060), /* page adr low */ - U8X8_C(0x070), /* page adr high */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_uc1611_240x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* pre_chip_disable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, /* uc1611 datasheet, page 67 */ - /* sda_setup_time_ns = */ 10, /* uc1611 datasheet, page 64, actually 0 */ - /* sck_pulse_width_ns = */ 60, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1611 datasheet, page 60 */ - /* write_pulse_width_ns = */ 80, /* uc1611 datasheet, page 60 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 128 -}; - -/* UC1611s 240x128 display */ -uint8_t u8x8_d_uc1611_ea_dogxl240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1611_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1611_240x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_ea_dogxl240_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - -/*================================================*/ -/* EMERGING DISPLAY, EW50850FLWP 240x160 */ -/* active high CS (CS1), UC1611 display */ - -static const uint8_t u8x8_d_uc1611_ew50850_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x02f), /* internal pump control */ - U8X8_CA(0x0f1, 159), /* set COM end */ - U8X8_CA(0x0f2, 0), /* display line start */ - U8X8_CA(0x0f3, 159), /* display line end */ - U8X8_C(0x0a3), /* line rate */ - U8X8_CA(0x081, 75), /* set contrast */ - - //U8X8_C(0x0a9), /* display enable */ - - U8X8_C(0x0d2), /* gray level mode: 16 gray shades */ - U8X8_C(0x089), /* auto increment */ - U8X8_C(0x0c0), /* LCD Mapping Bit 0: MSF, Bit 1: MX, Bit 2: MY */ - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x060), /* page adr low */ - U8X8_C(0x070), /* page adr high */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_uc1611_ew50850_display_info = -{ - /* chip_enable_level = */ 1, /* active high */ - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* pre_chip_disable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, /* uc1611 datasheet, page 67 */ - /* sda_setup_time_ns = */ 10, /* uc1611 datasheet, page 64, actually 0 */ - /* sck_pulse_width_ns = */ 60, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1611 datasheet, page 60 */ - /* write_pulse_width_ns = */ 80, /* uc1611 datasheet, page 60 */ - /* tile_width = */ 30, /* width of 30*8=240 pixel */ - /* tile_hight = */ 20, /* height: 160 pixel */ - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 240, - /* pixel_height = */ 160 -}; - -static const uint8_t u8x8_d_uc1611_alt_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c0), /* LCD Mapping Bit 0: MSF, Bit 1: MX, Bit 2: MY */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1611_alt_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c6), /* LCD Mapping Bit 0: MSF, Bit 1: MX, Bit 2: MY */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1611_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0af), /* display on, UC1611 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1611_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a8), /* display off, enter sleep mode, UC1611 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -/* EW50850, 240x160 */ -uint8_t u8x8_d_uc1611_ew50850(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c, i, v, m0, m1, ai; - uint8_t *ptr; - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - - y = ((u8x8_tile_t *)arg_ptr)->y_pos; - y*=4; - m0 = 1; - m1 = 2; - for( i = 0; i < 4; i++ ) - { - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - - u8x8_cad_SendCmd(u8x8, 0x060 | (y&15)); - u8x8_cad_SendCmd(u8x8, 0x070 | (y>>4)); - - ai = arg_int; - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - while( c > 0 ) - { - v = 0; - if ( *ptr & m0 ) - v|= 0x0f; - if ( *ptr & m1 ) - v|= 0xf0; - u8x8_cad_SendData(u8x8, 1, &v); /* note: SendData can not handle more than 255 bytes */ - c--; - ptr++; - } - ai--; - } while( ai > 0 ); - - m0 <<= 2; - m1 <<= 2; - y++; - } - u8x8_cad_EndTransfer(u8x8); - break; - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1611_ew50850_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_ew50850_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_alt_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_alt_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1611 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; /* msg unknown */ - } - return 1; -} - - -/*================================================*/ -/* CG160160D, http://www.cloverdisplay.com/pdf/CG160160D.pdf */ - -/* - UC1611 has two chip select inputs (CS0 and CS1). - CS0 is low active, CS1 is high active. It will depend on the display - module whether the display has a is low or high active chip select. - - Connect CS1 to 3.3V and CS0 to GPIO -*/ - -static const u8x8_display_info_t u8x8_uc1611_cg160160_display_info = -{ - /* chip_enable_level = */ 0, /* use CS0 of the UC1611 */ - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* pre_chip_disable_wait_ns = */ 10, /* uc1611 datasheet, page 60, actually 0 */ - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 10, /* uc1611 datasheet, page 67 */ - /* sda_setup_time_ns = */ 10, /* uc1611 datasheet, page 64, actually 0 */ - /* sck_pulse_width_ns = */ 60, /* half of cycle time */ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1611 datasheet, page 60 */ - /* write_pulse_width_ns = */ 80, /* uc1611 datasheet, page 60 */ - /* tile_width = */ 20, /* width of 20*8=160 pixel */ - /* tile_hight = */ 20, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 160, - /* pixel_height = */ 160 -}; - -/* -System Reset: E2H --> DONE -Set Temp. Compensation: 24H --> DONE -Set up LCD format specific parameters MX,MY,etc(double-byte command): C0H,04H --> FLIP0 -Set line rate: A3H --> DONE -Set Pump Control (internal Vlcd): 2FH --> DONE -Set Isolation Clock Front (3 bytes command): 82H, 13H, 01H --> DONE -Set Isolation Clock Back (3 bytes command): 82H, 14H, 00H --> DONE -Set LCD Bias Ratio: EAH -LCD Specific Operation Voltage Setting (double-byte command): 81H, 90H --> DONE -Set RAM Address Control: 80H --> DOES NOT MAKE SENSE -Set Page Addr. MSB: 72H --> DONE -Set Page Addr. LSB : 60H --> DONE -Set Column Addr. LSB: 00H --> DONE -Set Column Addr.MSB: 10H --> DONE -Window Program Enable : F8H --> NOT REQURED -Window Starting Column (double-byte command): F4H , 00H --> NOT REQURED -Window Ending Column (double-byte command): F6H, 9FH --> NOT REQURED -Set one bit for one pixel: D1H --> DONE -Set Display Enable: A9H -*/ - -static const uint8_t u8x8_d_uc1611_cg160160_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0e2), /* system reset */ - U8X8_DLY(2), - U8X8_C(0x024), /* Temp. Compensation to 0 = -0.05%/ Grad C */ - U8X8_C(0x0a3), /* line rate */ - U8X8_C(0x02f), /* internal pump control */ - U8X8_CAA(0x082, 0x013, 0x001), /* Isolation front clock, "1" is the default value */ - U8X8_CAA(0x082, 0x014, 0x000), /* Isolation back clock, "0" is the default value */ - U8X8_C(0x0ea), /* bias ratio, default: 0x0ea */ - U8X8_CA(0x081, 0x090), /* set contrast, CG160160: 0x090 */ - - //U8X8_CA(0x0f1, 159), /* set COM end */ - //U8X8_CA(0x0f2, 0), /* display line start */ - //U8X8_CA(0x0f3, 159), /* display line end */ - - //U8X8_C(0x0a9), /* display enable */ - - U8X8_C(0x089), /* RAM Address Control: auto increment */ - U8X8_C(0x0d1), /* display pattern */ - U8X8_CA(0x0c0, 0x004), /* LCD Mapping */ - U8X8_C(0x000), /* column low nibble */ - U8X8_C(0x010), /* column high nibble */ - U8X8_C(0x060), /* page adr low */ - U8X8_C(0x070), /* page adr high */ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -/* cg160160 display */ -uint8_t u8x8_d_uc1611_cg160160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1611_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1611_cg160160_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611_cg160160_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1611s_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1617.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1617.c deleted file mode 100644 index 7db4f9b..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1617.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - - u8x8_d_uc1617.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2017, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - - -static const uint8_t u8x8_d_uc1617_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - //U8X8_C(0x0ad), /* display enable BW Mode*/ - U8X8_C(0x0af), /* display enable GS Mode*/ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1617_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ac), /* display off, enter sleep mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1617_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c0), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1617_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c6), /* LCD Mapping */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -//static uint8_t u8x8_upscale_4bit(uint8_t x) U8X8_NOINLINE; -static uint8_t u8x8_upscale_4bit(uint8_t x) -{ - uint8_t y = x; - y |= (y << 4); // x = (x | (x << S[2])) & B[2]; - y &= 0x0f; - y |= (y << 2); // x = (x | (x << S[1])) & B[1]; - y &= 0x33; - y |= (y << 1); // x = (x | (x << S[0])) & B[0]; - y &= 0x55; - - y |= (y << 1); // z = x | (y << 1); - return y; -} - -static uint8_t u8x8_uc1617_tile_half_buffer[8]; - -static uint8_t *u8x8_convert_tile_for_uc1617_lower4bit(uint8_t *t) -{ - uint8_t i; - uint8_t *pbuf = u8x8_uc1617_tile_half_buffer; - - for( i = 0; i < 8; i++ ) - { - *pbuf++ = u8x8_upscale_4bit(*t++); - } - return u8x8_uc1617_tile_half_buffer; -} - -static uint8_t *u8x8_convert_tile_for_uc1617_upper4bit(uint8_t *t) -{ - uint8_t i; - uint8_t *pbuf = u8x8_uc1617_tile_half_buffer; - - for( i = 0; i < 8; i++ ) - { - *pbuf++ = u8x8_upscale_4bit((*t++)>>4); - } - return u8x8_uc1617_tile_half_buffer; -} - -#ifdef NOT_USED -static uint8_t *u8x8_convert_tile_for_uc1617(uint8_t *t) -{ - uint8_t i; - uint16_t r; - static uint8_t buf[16]; - uint8_t *pbuf = buf; - - for( i = 0; i < 8; i++ ) - { - r = u8x8_upscale_byte(*t++); - *pbuf = r & 255; - r >>= 8; - pbuf+=8; - *pbuf = r; - pbuf-=7; - } - return buf; -} -#endif - - -uint8_t u8x8_d_uc1617_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c, a; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - - - y = ((u8x8_tile_t *)arg_ptr)->y_pos; - y*=2; - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x060 | (x&15)); - u8x8_cad_SendCmd(u8x8, 0x070 | (x>>4)); - u8x8_cad_SendCmd(u8x8, 0x00 | (y)); - -#ifdef NOT_REQUIRED - u8x8_cad_SendCmd(u8x8, 0xf8 ); /* disable window */ - u8x8_cad_SendCmd(u8x8, 0xf4 ); /* page start */ - u8x8_cad_SendCmd(u8x8, y ); - u8x8_cad_SendCmd(u8x8, 0xf5 ); /* x start */ - u8x8_cad_SendCmd(u8x8, x ); - u8x8_cad_SendCmd(u8x8, 0xf6 ); /* page end */ - u8x8_cad_SendCmd(u8x8, y ); - u8x8_cad_SendCmd(u8x8, 0xf7 ); /* x end */ - u8x8_cad_SendCmd(u8x8, 127 ); - u8x8_cad_SendCmd(u8x8, 0xf9 ); /* enable window */ -#endif - - a = arg_int; - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, 8, u8x8_convert_tile_for_uc1617_lower4bit(ptr)); - ptr += 8; - x += 8; - c--; - } while( c > 0 ); - a--; - } while( a > 0 ); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x060 | (x&15)); - u8x8_cad_SendCmd(u8x8, 0x070 | (x>>4)); - u8x8_cad_SendCmd(u8x8, 0x00 | (y+1)); - a = arg_int; - do - { - c = ((u8x8_tile_t *)arg_ptr)->cnt; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, 8, u8x8_convert_tile_for_uc1617_upper4bit(ptr)); - ptr += 8; - x += 8; - c--; - } while( c > 0 ); - a--; - } while( a > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1617_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1617_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1617_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1617_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1617 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - -/*================================================*/ -/* JLX128128 */ - -static const uint8_t u8x8_d_uc1617_jlx128128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* reset */ - U8X8_DLY(10), - - //U8X8_D1(0x0ff), - U8X8_C(0x027), /* temperature compensation */ - U8X8_C(0x02b), /* panel loading: 13-18nF */ - - U8X8_C(0x02f), /* internal pump control */ - U8X8_C(0x0eb), /* bias=1/11 */ - U8X8_CA(0x081, 0x028), /* set contrast */ - //U8X8_C(0x0a9), /* used in display datasheet, but cmd not described in controller datasheet */ - - U8X8_CA(0x0f1, 0x07f), /* set COM end */ - U8X8_CA(0x0f2, 0x000), /* display line start */ - U8X8_CA(0x0f3, 127), /* display line end */ - U8X8_C(0x0a3), /* line rate */ - - U8X8_C(0x0d3), /* */ - U8X8_C(0x0d7), /* */ - - - //U8X8_C(0x0a5), /* all pixel on */ - - //U8X8_C(0x0d1), /* display pattern */ - U8X8_C(0x08b), /* auto increment */ - U8X8_C(0x0c0), /* LCD Mapping */ - - //U8X8_C(0x0ad), /* display enable BW Mode*/ - //U8X8_C(0x0af), /* display enable GS Mode*/ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const u8x8_display_info_t u8x8_uc1617_128x128_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 10, /* uc1617 datasheet, page 54, actually 5 */ - /* pre_chip_disable_wait_ns = */ 10, /* uc1617 datasheet, page 54, actually 5 */ - /* reset_pulse_width_ms = */ 10, - /* post_reset_wait_ms = */ 20, /* uc1617 datasheet, page 56 */ - /* sda_setup_time_ns = */ 24, /* uc1617 datasheet, page 54 */ - /* sck_pulse_width_ns = */ 45, /* half of cycle time uc1617 datasheet, page 54*/ - /* sck_clock_hz = */ 8000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* uc1617 datasheet, page 52 */ - /* write_pulse_width_ns = */ 65, /* uc1617 datasheet, page 52 */ - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 16, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 0, - /* pixel_width = */ 128, - /* pixel_height = */ 128 -}; - -uint8_t u8x8_d_uc1617_jlx128128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1617_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1617_128x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1617_jlx128128_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1638.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1638.c deleted file mode 100644 index 252ebda..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1638.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - - u8x8_d_uc1638.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -*/ -#include "u8x8.h" - - - - - -static const uint8_t u8x8_d_uc1638_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0c9, 0x0ad), /* display on */ /* UC1638 B/W mode */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1638_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_CA(0x0c9, 0x0ac), /* display off */ /* UC1638 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1638_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c4), /* LCD Mapping */ /* UC1638*/ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1638_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0c2), /* LCD Mapping */ /* UC1638*/ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -uint8_t u8x8_d_uc1638_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, y, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - - u8x8_cad_SendCmd(u8x8, 0x004); /* UC1638 */ - u8x8_cad_SendArg(u8x8, x); - - y = ((u8x8_tile_t *)arg_ptr)->y_pos; - y += u8x8->x_offset; - y *= 2; /* for B/W mode, use only every second page */ - - u8x8_cad_SendCmd(u8x8, 0x060 | (y&15)); /* UC1638 */ - u8x8_cad_SendCmd(u8x8, 0x070 | (y>>4)); /* UC1638 */ - - - u8x8_cad_SendCmd(u8x8, 0x001); /* UC1638 */ - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - /* handled in the calling procedure - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1638_128x64_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - */ - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1638_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1638_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1638_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1638_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int ); /* uc1638 has range from 0 to 255 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - default: - return 0; - } - return 1; -} - - -/*================================================*/ -/* uc1638 160x128 */ - -/* values taken from uc1608 */ -static const u8x8_display_info_t u8x8_uc1638_160x128_display_info = -{ - /* chip_enable_level = */ 1, /* uc1638 has high active CS */ - /* chip_disable_level = */ 0, - - /* post_chip_enable_wait_ns = */ 10, /* */ - /* pre_chip_disable_wait_ns = */ 20, /* */ - /* reset_pulse_width_ms = */ 5, /* */ - /* post_reset_wait_ms = */ 150, - /* sda_setup_time_ns = */ 30, /* */ - /* sck_pulse_width_ns = */ 65, /* */ - /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 3, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, /* */ - /* write_pulse_width_ns = */ 35, /* */ - /* tile_width = */ 20, /* width of 20*8=160 pixel */ - /* tile_hight = */ 16, - /* default_x_offset = */ 0, /* */ - /* flipmode_x_offset = */ 0, /* */ - /* pixel_width = */ 160, - /* pixel_height = */ 128 -}; - -static const uint8_t u8x8_d_uc1638_160x128_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_CA(0x0e1, 0x0e2), /* software reset */ /* UC1638*/ - U8X8_DLY(5), /* 5 ms */ - - U8X8_C(0x024), /* set temp comp*/ - U8X8_C(0x0c0), /* mirror y and mirror x */ /* WAS: c2 */ - U8X8_C(0x0a2), /* line rate */ - U8X8_C(0x0d6), /* gray scale 2 */ - U8X8_C(0x0eb), /* set bias*/ - U8X8_C(0x095), /* set 1 bit per pixel, pattern 0*/ - U8X8_C(0x089), /* set auto increment, low bits are AC2 AC1 AC0 */ /* WAS 89 */ - - - U8X8_CA(0x081, 0x0a0), /* set contrast */ /* UC1638*/ - - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -uint8_t u8x8_d_uc1638_160x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - /* call common procedure first and handle messages there */ - if ( u8x8_d_uc1638_common(u8x8, msg, arg_int, arg_ptr) == 0 ) - { - /* msg not handled, then try here */ - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1638_160x128_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1638_160x128_init_seq); - break; - default: - return 0; /* msg unknown */ - } - } - return 1; -} - - -/*================================================*/ diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_dogs102.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_dogs102.c deleted file mode 100644 index 7d0fc3e..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_dogs102.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - - u8x8_d_uc1701_dogs102.c - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_uc1701_dogs102_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a1), /* ADC set to reverse */ - U8X8_C(0x0c0), /* common output mode */ - // Flipmode - //U8X8_C(0x0a0), /* ADC set to reverse */ - //U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on */ - U8X8_C(0x027), /* regulator, booster and follower */ - U8X8_CA(0x081, 0x00e), /* set contrast, contrast value, EA default: 0x010, previous value for S102: 0x0e */ - U8X8_C(0x0fa), /* Set Temp compensation */ - U8X8_C(0x090), /* 0.11 deg/c WP Off WC Off*/ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_dogs102_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a4), /* all pixel off, issue 142 */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_dogs102_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_dogs102_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_dogs102_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_uc1701_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 12, - /* sck_pulse_width_ns = */ 75, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 13, /* width of 13*8=104 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 30, - /* pixel_width = */ 102, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_uc1701_ea_dogs102(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1701_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_dogs102_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* uc1701 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the uc1701 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_mini12864.c b/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_mini12864.c deleted file mode 100644 index 2fd53d4..0000000 --- a/MilliOhmMeter_FW/lib/U8g2/src/clib/u8x8_d_uc1701_mini12864.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - - u8x8_d_uc1701_mini12864.c (dealextreme, displays from ebay MP3 players) - - Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) - - Copyright (c) 2016, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -#include "u8x8.h" - - - - -static const uint8_t u8x8_d_uc1701_mini12864_init_seq[] = { - - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - - U8X8_C(0x0e2), /* soft reset */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x040), /* set display start line to 0 */ - - U8X8_C(0x0a0), /* ADC set to reverse */ - U8X8_C(0x0c8), /* common output mode */ - - U8X8_C(0x0a6), /* display normal, bit val 0: LCD pixel off. */ - U8X8_C(0x0a2), /* LCD bias 1/9 */ - U8X8_C(0x02f), /* all power control circuits on */ - U8X8_C(0x0f8), /* set booster ratio to */ - U8X8_C(0x000), /* 4x */ - U8X8_C(0x023), /* set V0 voltage resistor ratio to large */ - U8X8_C(0x081), /* set contrast */ - U8X8_C(0x027), /* contrast value */ - U8X8_C(0x0ac), /* indicator */ - // 0x000, /* disable */ - - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_mini12864_powersave0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a4), /* all pixel off, issue 142 */ - U8X8_C(0x0af), /* display on */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_mini12864_powersave1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0ae), /* display off */ - U8X8_C(0x0a5), /* enter powersafe: all pixel on, issue 142 */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_mini12864_flip0_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a0), /* segment remap a0/a1*/ - U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - -static const uint8_t u8x8_d_uc1701_mini12864_flip1_seq[] = { - U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ - U8X8_C(0x0a1), /* segment remap a0/a1*/ - U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */ - U8X8_END_TRANSFER(), /* disable chip */ - U8X8_END() /* end of sequence */ -}; - - -static const u8x8_display_info_t u8x8_uc1701_display_info = -{ - /* chip_enable_level = */ 0, - /* chip_disable_level = */ 1, - - /* post_chip_enable_wait_ns = */ 5, - /* pre_chip_disable_wait_ns = */ 5, - /* reset_pulse_width_ms = */ 1, - /* post_reset_wait_ms = */ 6, - /* sda_setup_time_ns = */ 12, - /* sck_pulse_width_ns = */ 75, /* half of cycle time (100ns according to datasheet), AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */ - /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ - /* spi_mode = */ 0, /* active high, rising edge */ - /* i2c_bus_clock_100kHz = */ 4, - /* data_setup_time_ns = */ 30, - /* write_pulse_width_ns = */ 40, - /* tile_width = */ 16, /* width of 16*8=128 pixel */ - /* tile_hight = */ 8, - /* default_x_offset = */ 0, - /* flipmode_x_offset = */ 4, - /* pixel_width = */ 128, - /* pixel_height = */ 64 -}; - -uint8_t u8x8_d_uc1701_mini12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) -{ - uint8_t x, c; - uint8_t *ptr; - switch(msg) - { - case U8X8_MSG_DISPLAY_SETUP_MEMORY: - u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1701_display_info); - break; - case U8X8_MSG_DISPLAY_INIT: - u8x8_d_helper_display_init(u8x8); - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_init_seq); - break; - case U8X8_MSG_DISPLAY_SET_POWER_SAVE: - if ( arg_int == 0 ) - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_powersave0_seq); - else - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_powersave1_seq); - break; - case U8X8_MSG_DISPLAY_SET_FLIP_MODE: - if ( arg_int == 0 ) - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_flip0_seq); - u8x8->x_offset = u8x8->display_info->default_x_offset; - } - else - { - u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_flip1_seq); - u8x8->x_offset = u8x8->display_info->flipmode_x_offset; - } - break; -#ifdef U8X8_WITH_SET_CONTRAST - case U8X8_MSG_DISPLAY_SET_CONTRAST: - u8x8_cad_StartTransfer(u8x8); - u8x8_cad_SendCmd(u8x8, 0x081 ); - u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* uc1701 has range from 0 to 63 */ - u8x8_cad_EndTransfer(u8x8); - break; -#endif - case U8X8_MSG_DISPLAY_DRAW_TILE: - u8x8_cad_StartTransfer(u8x8); - - x = ((u8x8_tile_t *)arg_ptr)->x_pos; - x *= 8; - x += u8x8->x_offset; - u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); - u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); - - c = ((u8x8_tile_t *)arg_ptr)->cnt; - c *= 8; - ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; - /* - The following if condition checks the hardware limits of the uc1701 - controller: It is not allowed to write beyond the display limits. - This is in fact an issue within flip mode. - - bug: this check should be inside the while loop, see u8x8_d_pcd8544_84x48.c - */ - if ( c + x > 132u ) - { - c = 132u; - c -= x; - } - do - { - u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ - arg_int--; - } while( arg_int > 0 ); - - u8x8_cad_EndTransfer(u8x8); - break; - default: - return 0; - } - return 1; -} - - diff --git a/MilliOhmMeter_FW/src/board.h b/MilliOhmMeter_FW/src/board.h index 56be262..5c01ea0 100644 --- a/MilliOhmMeter_FW/src/board.h +++ b/MilliOhmMeter_FW/src/board.h @@ -17,7 +17,8 @@ void scanI2C(void); #define DAC1_OUT 26 -#define BUTTON1 21 -#define BUTTON2 12 -#define BUTTON3 13 -#define BUTTON4 16 \ No newline at end of file +#define BUTTON1 18 +#define BUTTON2 15 +#define BUTTON3 32 +#define BUTTON4 33 +#define BUTTON5 13 \ No newline at end of file diff --git a/MilliOhmMeter_FW/src/display.cpp b/MilliOhmMeter_FW/src/display.cpp index 43af5bf..c6f8822 100644 --- a/MilliOhmMeter_FW/src/display.cpp +++ b/MilliOhmMeter_FW/src/display.cpp @@ -1,66 +1,12 @@ #include "display.h" -c_onScreenButton ma20("20m", (uint8_t)mA20, LocBottom); -c_onScreenButton ma200("200m", (uint8_t)mA200, LocBottom); -c_onScreenButton ma1000("1A", (uint8_t)mA1000, LocBottom); -c_onScreenButton mauto("Auto", (uint8_t)mAuto, LocBottom); -c_onScreenButton bsetup("Conf", 5, LocBottom); -c_onScreenButton errorState("ER", 6, LocRight, &getErrorState); -c_onScreenButton okState("OK", 7, LocRight, &getOkState); -c_onScreenButton openState("Open", 8, LocRight, &getOpenState); -c_onScreenButton wifiState("Wifi", 9, LocRight, &getWifiState); -std::vector MainScreen; - -#define FONT8 u8g2_font_helvR08_tf -#define FONT16 u8g2_font_7x14_tf -#define FONT24 u8g2_font_freedoomr25_tn //u8g2_font_logisoso24_tf U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI display(U8G2_R0, OLED_CS, OLED_DC, OLED_RST); -void initMainScreenButtons(void) +U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI* getDisplay(void) { - Serial.print("Init GUI: "); - display.setFont(FONT8); - uint16_t screenwidth = display.getWidth() - 1; - uint16_t buttonwidth = ((screenwidth / mLast) - CONTROLLOFFSET * 2) - 1; - uint16_t currentWidth = 0; - uint16_t ypos = display.getHeight() - 1 - CONTROLSLINE_H + 2; - - //setup bottom buttons - ma20.begin(currentWidth, ypos, buttonwidth, CONTROLSLINE_H + 6, CONTROLRADIUS); - ma200.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS); - ma1000.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS); - mauto.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS); - bsetup.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS); - - //setup right side indicators - uint16_t currentYpos = 0; - uint16_t IndicatorXpos = screenwidth - INDICATORWIDTH - (INDICATORWIDTH / 2); - - errorState.begin(IndicatorXpos, currentYpos, INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS); - okState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS); - openState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS); - wifiState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS); - - //fill vector - Serial.print("Store"); - MainScreen.push_back(ma20); - MainScreen.push_back(ma200); - MainScreen.push_back(ma1000); - MainScreen.push_back(mauto); - MainScreen.push_back(bsetup); - - MainScreen.push_back(errorState); - MainScreen.push_back(okState); - MainScreen.push_back(openState); - MainScreen.push_back(wifiState); - - for (auto &&button : MainScreen) - { - button.setVisible(true); - } - Serial.println("OK"); + return &display; } void c_onScreenButton::begin(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, uint16_t radius) @@ -90,21 +36,6 @@ void c_onScreenButton::begin(uint16_t xpos, uint16_t ypos, uint16_t width, uint1 Serial.print(":OK | "); } -void drawDashedHLine(uint16_t x, uint16_t y, uint16_t len) -{ - for(int i = 0; i < len; i+=2) - { - display.drawPixel(x+i, y); - } -} - -void drawDashedVLine(uint16_t x, uint16_t y, uint16_t len) -{ - for(int i = 0; i < len; i+=2) - { - display.drawPixel(x, y+i); - } -} void c_onScreenButton::drawButton() { @@ -162,46 +93,39 @@ void drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, ui display.drawRBox(x + 1, y + 2, maxProgressWidth, height - 3, radius); } -void drawMeasurementValues() + +void drawDashedHLine(uint16_t x, uint16_t y, uint16_t len) { - drawDashedHLine(0,12,220); - drawDashedVLine(40,12,33); - display.setFont(FONT8); - display.drawStr(5,8,"Fs:100Hz LP"); - - - display.setFont(FONT24); - - //display.drawStr(60, 45, String(getValue()).c_str()); - display.setCursor(60,45); - display.printf("%4.2f",getValue()); - uint16_t stringwidth = display.getStrWidth(showValue("", getValue(), "").c_str()); - display.setFont(u8g2_font_8x13_t_symbols); - display.drawUTF8(60+stringwidth+3 , 43, "mΩ"); - //drawProgressBar(0, 40, 127, 5, getBar()); -} - -void drawMainSceenButtons() -{ - //draw controlstrip indicators - for (auto &&thismode : MainScreen) + for(int i = 0; i < len; i+=2) { - thismode.setState((thismode.getIndex() == (uint8_t)getMeasureMode())); - thismode.drawButton(); + display.drawPixel(x+i, y); } } -void drawMainScreen() +void drawDashedVLine(uint16_t x, uint16_t y, uint16_t len) { - drawMainSceenButtons(); - drawMeasurementValues(); + for(int i = 0; i < len; i+=2) + { + display.drawPixel(x, y+i); + } +} + + +uint16_t getDisplayWidth(void) +{ + return display.getWidth(); +} + +uint16_t getDisplayHeight(void) +{ + return display.getHeight(); } uint64_t lastDisplayTime = 0; void initDisplay() { - initMainScreenButtons(); + display.setFont(FONT8); display.begin(); display.clearBuffer(); lastDisplayTime = millis(); @@ -212,13 +136,15 @@ void handleDisplay() uint64_t currentmillis = millis(); if (currentmillis - lastDisplayTime > SCREENREFRESH) { - display.clearBuffer(); - - // do - // { - drawMainScreen(); - // } while (display.nextPage()); display.sendBuffer(); + + lastDisplayTime = millis(); } + +} + +void clearDisplay(void) +{ + display.clearBuffer(); } \ No newline at end of file diff --git a/MilliOhmMeter_FW/src/display.h b/MilliOhmMeter_FW/src/display.h index b33fb66..27f3dae 100644 --- a/MilliOhmMeter_FW/src/display.h +++ b/MilliOhmMeter_FW/src/display.h @@ -22,13 +22,13 @@ #define SCREENREFRESH 20 -enum displayState -{ - mainscreen, - setupscreen -}; +#define FONT8 u8g2_font_helvR08_tf +#define FONT16 u8g2_font_7x14_tf +#define FONT24 u8g2_font_freedoomr25_tn //u8g2_font_logisoso24_tf -typedef enum + + +typedef enum { LocTop, LocRight, @@ -57,24 +57,21 @@ class c_onScreenButton bool (*const _stateFn)() = NULL; public: - c_onScreenButton(String name, uint8_t index, e_buttonLoc location) : - _xpos(1), - _width(1), - _name(name), - _index(index), - _location(location), - _stateFn(NULL) + c_onScreenButton(String name, uint8_t index, e_buttonLoc location) : _xpos(1), + _width(1), + _name(name), + _index(index), + _location(location), + _stateFn(NULL) { _visible = false; - } - c_onScreenButton(String name, uint8_t index, e_buttonLoc location, bool (*stateFn)()) : - _xpos(1), - _width(1), - _name(name), - _index(index), - _location(location), - _stateFn(stateFn) + c_onScreenButton(String name, uint8_t index, e_buttonLoc location, bool (*stateFn)()) : _xpos(1), + _width(1), + _name(name), + _index(index), + _location(location), + _stateFn(stateFn) { _visible = false; } @@ -95,9 +92,19 @@ public: void setVisible(bool state) { _visible = state; } bool getVisible(void) { return _visible; } uint8_t getIndex(void) { return _index; } - e_buttonLoc getLocation( void ) {return _location; } + e_buttonLoc getLocation(void) { return _location; } }; -//#endif void initDisplay(void); -void handleDisplay(void); \ No newline at end of file +void handleDisplay(void); + +void clearDisplay(void); + +String showValue(String designator, float value, String unit); + +uint16_t getDisplayWidth(void); +uint16_t getDisplayHeight(void); + +U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI *getDisplay(void); +void drawDashedVLine(uint16_t x, uint16_t y, uint16_t len); +void drawDashedHLine(uint16_t x, uint16_t y, uint16_t len); \ No newline at end of file diff --git a/MilliOhmMeter_FW/src/main.cpp b/MilliOhmMeter_FW/src/main.cpp index 6929bf2..938cef3 100644 --- a/MilliOhmMeter_FW/src/main.cpp +++ b/MilliOhmMeter_FW/src/main.cpp @@ -3,6 +3,8 @@ #include "display.h" #include "leds.h" #include "measure.h" +#include "buttons.h" +#include "gui.h" uint64_t looptime = 0; @@ -10,9 +12,12 @@ void setup() { // put your setup code here, to run once: initBoard(); + initButtons(); initDisplay(); initLeds(); initMeasure(); + initGui(); + looptime = millis(); } @@ -20,10 +25,10 @@ void loop() { // put your main code here, to run repeatedly: looptime = micros(); - - handleDisplay(); handleLeds(); handleMeasure(); - + handleButtons(); + handleGui(); + handleDisplay(); //make sure to update the display last (writes buffer to the screen) Serial.printf("T=%4.2fms\n", (double)(micros() - looptime)/1000); } \ No newline at end of file diff --git a/MilliOhmMeter_FW/src/measure.cpp b/MilliOhmMeter_FW/src/measure.cpp index 59cb32d..ada6612 100644 --- a/MilliOhmMeter_FW/src/measure.cpp +++ b/MilliOhmMeter_FW/src/measure.cpp @@ -52,29 +52,6 @@ void handleDAC(void) } } -void initMeasure(void) -{ - Serial.print("init measurements:ADC="); - if (!ads.begin()) - { - Serial.println("Failed to initialize ADS."); - } - else - { - Serial.println("OK"); - } - lastMeasurement = millis(); - lastDacWrite = millis(); - - pinMode(BUTTON3, INPUT_PULLUP); -} - -void handleMeasure(void) -{ - handleADC(); - handleDAC(); -} - measureMode getMeasureMode(void) { return measureMode::mA200; @@ -120,3 +97,26 @@ bool getOpenState(void) { return false; } + +void initMeasure(void) +{ + Serial.print("init measurements:ADC="); + if (!ads.begin()) + { + Serial.println("Failed to initialize ADS."); + } + else + { + Serial.println("OK"); + } + lastMeasurement = millis(); + lastDacWrite = millis(); + + pinMode(BUTTON3, INPUT_PULLUP); +} + +void handleMeasure(void) +{ + handleADC(); + handleDAC(); +}