Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
50917ccd
Commit
50917ccd
authored
6 years ago
by
Scott Lahteine
Browse files
Options
Downloads
Patches
Plain Diff
Tweak some u8g interface code
parent
ba391863
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp
+5
-13
5 additions, 13 deletions
...HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
+17
-17
17 additions, 17 deletions
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
with
22 additions
and
30 deletions
Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp
+
5
−
13
View file @
50917ccd
...
...
@@ -68,23 +68,15 @@
static
pin_t
SCK_pin_ST7920_HAL
,
MOSI_pin_ST7920_HAL_HAL
;
static
uint8_t
SPI_speed
=
0
;
static
uint8_t
rs_last_state
=
255
;
static
void
u8g_com_LPC1768_st7920_write_byte_sw_spi
(
uint8_t
rs
,
uint8_t
val
)
{
if
(
rs
!=
rs_last_state
)
{
// time to send a command/data byte
static
uint8_t
rs_last_state
=
255
;
if
(
rs
!=
rs_last_state
)
{
// Transfer Data (FA) or Command (F8)
swSpiTransfer
(
rs
?
0x0FA
:
0x0F8
,
SPI_speed
,
SCK_pin_ST7920_HAL
,
-
1
,
MOSI_pin_ST7920_HAL_HAL
);
rs_last_state
=
rs
;
if
(
rs
==
0
)
/* command */
swSpiTransfer
(
0x0F8
,
SPI_speed
,
SCK_pin_ST7920_HAL
,
-
1
,
MOSI_pin_ST7920_HAL_HAL
);
else
/* data */
swSpiTransfer
(
0x0FA
,
SPI_speed
,
SCK_pin_ST7920_HAL
,
-
1
,
MOSI_pin_ST7920_HAL_HAL
);
DELAY_US
(
40
);
// give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
DELAY_US
(
40
);
// Give the controller time to process the data: 20 is bad, 30 is OK, 40 is safe
}
swSpiTransfer
(
val
&
0x0F0
,
SPI_speed
,
SCK_pin_ST7920_HAL
,
-
1
,
MOSI_pin_ST7920_HAL_HAL
);
swSpiTransfer
(
val
<<
4
,
SPI_speed
,
SCK_pin_ST7920_HAL
,
-
1
,
MOSI_pin_ST7920_HAL_HAL
);
}
...
...
This diff is collapsed.
Click to expand it.
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp
+
17
−
17
View file @
50917ccd
...
...
@@ -71,23 +71,23 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
OUT_WRITE
(
ST7920_CLK_PIN
,
HIGH
);
ST7920_CS
();
u8g_Delay
(
120
);
//
i
nitial delay for boot up
u8g_Delay
(
120
);
//
I
nitial delay for boot up
ST7920_SET_CMD
();
ST7920_WRITE_BYTE
(
0x20
);
//
n
on-extended mode
ST7920_WRITE_BYTE
(
0x08
);
//
d
isplay off, cursor+blink off
ST7920_WRITE_BYTE
(
0x01
);
//
c
lear DDRAM ram
u8g_Delay
(
15
);
//d
elay for DDRAM clear
ST7920_WRITE_BYTE
(
0x24
);
//
e
xtended mode
ST7920_WRITE_BYTE
(
0x26
);
//
e
xtended mode + GDRAM active
for
(
y
=
0
;
y
<
(
LCD_PIXEL_HEIGHT
)
/
2
;
y
++
)
{
//
c
lear GDRAM
ST7920_WRITE_BYTE
(
0x80
|
y
);
//
s
et y
ST7920_WRITE_BYTE
(
0x80
);
//
s
et x = 0
ST7920_WRITE_BYTE
(
0x20
);
//
N
on-extended mode
ST7920_WRITE_BYTE
(
0x08
);
//
D
isplay off, cursor+blink off
ST7920_WRITE_BYTE
(
0x01
);
//
C
lear DDRAM ram
u8g_Delay
(
15
);
// D
elay for DDRAM clear
ST7920_WRITE_BYTE
(
0x24
);
//
E
xtended mode
ST7920_WRITE_BYTE
(
0x26
);
//
E
xtended mode + GDRAM active
for
(
y
=
0
;
y
<
(
LCD_PIXEL_HEIGHT
)
/
2
;
y
++
)
{
//
C
lear GDRAM
ST7920_WRITE_BYTE
(
0x80
|
y
);
//
S
et y
ST7920_WRITE_BYTE
(
0x80
);
//
S
et x = 0
ST7920_SET_DAT
();
for
(
i
=
0
;
i
<
2
*
(
LCD_PIXEL_WIDTH
)
/
8
;
i
++
)
//2x width clears both segments
for
(
i
=
0
;
i
<
2
*
(
LCD_PIXEL_WIDTH
)
/
8
;
i
++
)
//
2x width clears both segments
ST7920_WRITE_BYTE
(
0
);
ST7920_SET_CMD
();
}
ST7920_WRITE_BYTE
(
0x0C
);
//d
isplay on, cursor+blink off
ST7920_WRITE_BYTE
(
0x0C
);
// D
isplay on, cursor+blink off
ST7920_NCS
();
}
break
;
...
...
@@ -104,15 +104,15 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
for
(
i
=
0
;
i
<
PAGE_HEIGHT
;
i
++
)
{
ST7920_SET_CMD
();
if
(
y
<
32
)
{
ST7920_WRITE_BYTE
(
0x80
|
y
);
//y
ST7920_WRITE_BYTE
(
0x80
);
//
x=
0
ST7920_WRITE_BYTE
(
0x80
|
y
);
//
y
ST7920_WRITE_BYTE
(
0x80
);
//
x =
0
}
else
{
ST7920_WRITE_BYTE
(
0x80
|
(
y
-
32
));
//y
ST7920_WRITE_BYTE
(
0x80
|
8
);
//
x=
64
ST7920_WRITE_BYTE
(
0x80
|
(
y
-
32
));
//
y
ST7920_WRITE_BYTE
(
0x80
|
8
);
//
x =
64
}
ST7920_SET_DAT
();
ST7920_WRITE_BYTES
(
ptr
,
(
LCD_PIXEL_WIDTH
)
/
8
);
//ptr
is
incremented inside of macro
ST7920_WRITE_BYTES
(
ptr
,
(
LCD_PIXEL_WIDTH
)
/
8
);
//
ptr incremented inside of macro
!
y
++
;
}
ST7920_NCS
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment