Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
fc19725f
Commit
fc19725f
authored
Apr 21, 2015
by
devsaurus
Browse files
make variables local to save heap
parent
ef7ed47a
Changes
3
Show whitespace changes
Inline
Side-by-side
lua_examples/u8glib/u8g_bitmaps.lua
View file @
fc19725f
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
-- setup I2c and connect display
-- setup I2c and connect display
function
init_i2c_display
()
function
init_i2c_display
()
-- SDA and SCL can be assigned freely to available GPIOs
-- SDA and SCL can be assigned freely to available GPIOs
sda
=
5
-- GPIO14
local
sda
=
5
-- GPIO14
scl
=
6
-- GPIO12
local
scl
=
6
-- GPIO12
sla
=
0x3c
local
sla
=
0x3c
i2c
.
setup
(
0
,
sda
,
scl
,
i2c
.
SLOW
)
i2c
.
setup
(
0
,
sda
,
scl
,
i2c
.
SLOW
)
disp
=
u8g
.
ssd1306_128x64_i2c
(
sla
)
disp
=
u8g
.
ssd1306_128x64_i2c
(
sla
)
end
end
...
@@ -15,9 +15,9 @@ function init_spi_display()
...
@@ -15,9 +15,9 @@ function init_spi_display()
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
-- Hardware SPI MISO = GPIO12 (not used)
-- CS, D/C, and RES can be assigned freely to available GPIOs
-- CS, D/C, and RES can be assigned freely to available GPIOs
cs
=
8
-- GPIO15, pull-down 10k to GND
local
cs
=
8
-- GPIO15, pull-down 10k to GND
dc
=
4
-- GPIO2
local
dc
=
4
-- GPIO2
res
=
0
-- GPIO16
local
res
=
0
-- GPIO16
spi
.
setup
(
1
,
spi
.
MASTER
,
spi
.
CPOL_LOW
,
spi
.
CPHA_LOW
,
spi
.
DATABITS_8
,
0
)
spi
.
setup
(
1
,
spi
.
MASTER
,
spi
.
CPOL_LOW
,
spi
.
CPHA_LOW
,
spi
.
DATABITS_8
,
0
)
disp
=
u8g
.
ssd1306_128x64_spi
(
cs
,
dc
,
res
)
disp
=
u8g
.
ssd1306_128x64_spi
(
cs
,
dc
,
res
)
...
...
lua_examples/u8glib/u8g_graphics_test.lua
View file @
fc19725f
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
-- setup I2c and connect display
-- setup I2c and connect display
function
init_i2c_display
()
function
init_i2c_display
()
-- SDA and SCL can be assigned freely to available GPIOs
-- SDA and SCL can be assigned freely to available GPIOs
sda
=
5
-- GPIO14
local
sda
=
5
-- GPIO14
scl
=
6
-- GPIO12
local
scl
=
6
-- GPIO12
sla
=
0x3c
local
sla
=
0x3c
i2c
.
setup
(
0
,
sda
,
scl
,
i2c
.
SLOW
)
i2c
.
setup
(
0
,
sda
,
scl
,
i2c
.
SLOW
)
disp
=
u8g
.
ssd1306_128x64_i2c
(
sla
)
disp
=
u8g
.
ssd1306_128x64_i2c
(
sla
)
end
end
...
@@ -15,9 +15,9 @@ function init_spi_display()
...
@@ -15,9 +15,9 @@ function init_spi_display()
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
-- Hardware SPI MISO = GPIO12 (not used)
-- CS, D/C, and RES can be assigned freely to available GPIOs
-- CS, D/C, and RES can be assigned freely to available GPIOs
cs
=
8
-- GPIO15, pull-down 10k to GND
local
cs
=
8
-- GPIO15, pull-down 10k to GND
dc
=
4
-- GPIO2
local
dc
=
4
-- GPIO2
res
=
0
-- GPIO16
local
res
=
0
-- GPIO16
spi
.
setup
(
1
,
spi
.
MASTER
,
spi
.
CPOL_LOW
,
spi
.
CPHA_LOW
,
spi
.
DATABITS_8
,
0
)
spi
.
setup
(
1
,
spi
.
MASTER
,
spi
.
CPOL_LOW
,
spi
.
CPHA_LOW
,
spi
.
DATABITS_8
,
0
)
disp
=
u8g
.
ssd1306_128x64_spi
(
cs
,
dc
,
res
)
disp
=
u8g
.
ssd1306_128x64_spi
(
cs
,
dc
,
res
)
...
...
lua_examples/u8glib/u8g_rotation.lua
View file @
fc19725f
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
-- setup I2c and connect display
-- setup I2c and connect display
function
init_i2c_display
()
function
init_i2c_display
()
-- SDA and SCL can be assigned freely to available GPIOs
-- SDA and SCL can be assigned freely to available GPIOs
sda
=
5
-- GPIO14
local
sda
=
5
-- GPIO14
scl
=
6
-- GPIO12
local
scl
=
6
-- GPIO12
sla
=
0x3c
local
sla
=
0x3c
i2c
.
setup
(
0
,
sda
,
scl
,
i2c
.
SLOW
)
i2c
.
setup
(
0
,
sda
,
scl
,
i2c
.
SLOW
)
disp
=
u8g
.
ssd1306_128x64_i2c
(
sla
)
disp
=
u8g
.
ssd1306_128x64_i2c
(
sla
)
end
end
...
@@ -15,9 +15,9 @@ function init_spi_display()
...
@@ -15,9 +15,9 @@ function init_spi_display()
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
-- Hardware SPI MISO = GPIO12 (not used)
-- CS, D/C, and RES can be assigned freely to available GPIOs
-- CS, D/C, and RES can be assigned freely to available GPIOs
cs
=
8
-- GPIO15, pull-down 10k to GND
local
cs
=
8
-- GPIO15, pull-down 10k to GND
dc
=
4
-- GPIO2
local
dc
=
4
-- GPIO2
res
=
0
-- GPIO16
local
res
=
0
-- GPIO16
spi
.
setup
(
1
,
spi
.
MASTER
,
spi
.
CPOL_LOW
,
spi
.
CPHA_LOW
,
spi
.
DATABITS_8
,
0
)
spi
.
setup
(
1
,
spi
.
MASTER
,
spi
.
CPOL_LOW
,
spi
.
CPHA_LOW
,
spi
.
DATABITS_8
,
0
)
disp
=
u8g
.
ssd1306_128x64_spi
(
cs
,
dc
,
res
)
disp
=
u8g
.
ssd1306_128x64_spi
(
cs
,
dc
,
res
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment