Commit graph

18 commits

Author SHA1 Message Date
Scott Lahteine
a7684eef7a Squish code in ST7920 2016-06-25 18:35:15 -07:00
AnHardt
b4076883cc Set testet delays for K8200, RAMBO, MINIRAMBO and ST7920 2016-06-25 18:35:15 -07:00
AnHardt
4454d80276 Decrease the needed nops to 1
by shitfing the left shift into the high phase.

```
2	cbi 0x2,1 ;set CLK                      //
1	in r18,__SREG__                         //1
1-3	sbrc r24,7                              //2-4
2	rjmp .L19                               //4
1	cli                  .L19:              //5
2	lds r25,258          lds r25,258        //7
1	andi r25,lo8(-2)     ori r25,lo8(1)     //8
2	sts 258,r25          sts 258,r25        //10
1	out __SREG__,r18     out __SREG__,r18   //11
2	.L3:                 rjmp .L3           //13     //2
2	sbi 0x2,1 ;reset CLK //                 //13-15  //2-4
1	lsl r24	 ;  val      //1
1	nop                  //2
2	cbi 0x2,1 ;set CLK   //4
...
```
2016-06-25 18:35:15 -07:00
AnHardt
56c42b572c 3 ms speedup for ST7920 and delay for BOARD_3DRAG
and saving ~1k memory
by limiting the `#pragma GCC optimize (3)` optimisation to `ultralcd_st7920_u8glib_rrd.h`. These optimisation was and is not done for all the other displays, is the reason for the big additionally use of memory, because the complete 'ultralcd.cpp' and 'dogm_lcd_implementation.h' was optimised (sadly i did not observe a change in speed).

Unrolling the loop in `ST7920_SWSPI_SND_8BIT()`, what i expected the optimiser to do, by hand, saved some speed by eliminating the loop variable (i) compares and increases. Every CPU cycle in this loop costs at least 0.5ms per display update because it's executed more than 1k times/s.

The delays are now pre-filled with the calculated values for 4.5V driven ST7920.
A way to simply add __your__ timing into the configuration was made.

At 4.5V
1.) The CLK signal needs to be at least 200ns high and 200ns low.
2.) The DAT pin needs to be set at least 40ns before CLK goes high and must stay at this value until 40ns after CLK went high.

A nop takes one processor cycle.
For 16MHz one nop lasts 62.5ns.
For 20MHz one not lasts 50ns.

To fulfill condition 1.) we need 200/62.5 = 3.2 => 4 cycles (200/50 = 4 => 4). For the low phase, setting the pin takes much longer. For the high phase we (theoretically) have to throw in 2 nops, because changing the CLK takes only 2 cycles.

Condition 2.) is always fulfilled because the processor needs two cycles (100 - 125ns) for switching the CLK pin.


Needs tests and feedback.
Especially i cant test 20MHz, 3DRAG and displays supplied wit less than 5V.
Are the delays right? Please experiment with longer or shorter delays. And give feedback.

Already tested are 5 displays with 4.9V - 5.1V at 16MHz where no delays are needed.
2016-06-25 18:35:15 -07:00
João Brázio
664232140d
Fixes somes compiler warnings 2016-06-23 03:12:55 +01:00
Scott Lahteine
0da744b7b0 Further cleanup of comments, partial Doxygen-style
Following up on #3231
2016-03-25 00:45:56 -07:00
jbrazio
5e5d250832 Added gplv3 header to all Marlin files 2016-03-24 18:01:20 +00:00
Scott Lahteine
6e1bc03d3b Additional wrapping for #3140 2016-03-15 01:18:58 -07:00
Scott Lahteine
f9ded2a7c4 Wrap macros to prevent bad expansions 2016-03-12 22:38:55 -08:00
Scott Lahteine
0c7f7ebcfb Styling adjustments (PR#2668 & PR#2670)
Keep "astyled" reformatting
2015-10-03 22:02:45 -05:00
Scott Lahteine
58cfcd4239 Overridable Options - Part 5
Apply `ENABLED` / `DISABLED` macros to files needing only a small
number of changes.
2015-07-31 01:24:20 -05:00
AnHardt
6b1b71837c Intit. commit for Chinese
Edited the European part of 'ISO10646_CN.fon' to match the existing fonts.
Added Chinese font to make_fonts.bat
Created 'dogm_font_data_ISO10646_CN.h'
Added Chinese to 'language.h'
Added 'language_cn.h' with some minor edits.
Added Chinese font in 'language_en.h' to not fall back to European font.
Added cn to 'Configuration.h'
Changed WIDTH to LCD_PIXEL_WIDTH and HEIGHT to LCD_PIXEL_HEIGHT to have more descriptive names.

In 'dogm_lcd_implementation.h'
Added Chinese Font
Made 1 pixel more room for the larger Chinese font on the status line.
Changed geometry of the 'select bar' by one pixel.
Changed the way the position for values and postcars are set.
2015-04-27 12:15:36 +02:00
AnHardt
0f1bd6e4a7 In ST7920_SWSPI_SND_8BIT(uint8_t val) parameter is unsigned
therefor in macro ST7920_WRITE_BYTE(a) cast a to uint8_t
to make the compiler happy.
2015-03-30 01:40:58 +02:00
chris-bo
b73ba26b23 Update ultralcd_st7920_u8glib_rrd.h 2015-03-14 14:31:00 +01:00
Scott Lahteine
dfb38874f8 Some suggested changes for #1555 2015-03-03 00:48:20 -08:00
Souko
e7ecf14d0c Update ultralcd_st7920_u8glib_rrd.h
Fixed delay-times during Init. REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER won't get initialized on some Boards because delay was to short.
2015-02-09 21:46:06 +01:00
Cylindric
8f0cee2a14 Various typo fixes - only in comments, no code changes. 2014-02-17 10:58:36 +00:00
Scott Lahteine
5dabc95409 Apply all changes from latest Marlin_V1
Diffed and merged, preserving my updates
2013-06-06 15:49:25 -07:00