Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
derf
multipass
Commits
bfcfa4cf
Commit
bfcfa4cf
authored
7 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Add support for ESP8266 secondary LED
parent
62bb7da1
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+5
-1
5 additions, 1 deletion
Makefile
src/app/ledblink/main.cc
+2
-3
2 additions, 3 deletions
src/app/ledblink/main.cc
src/arch/esp8266/Makefile.inc
+4
-0
4 additions, 0 deletions
src/arch/esp8266/Makefile.inc
src/arch/esp8266/driver/gpio.cc
+35
-3
35 additions, 3 deletions
src/arch/esp8266/driver/gpio.cc
with
46 additions
and
7 deletions
Makefile
+
5
−
1
View file @
bfcfa4cf
...
...
@@ -6,7 +6,11 @@ CFLAGS = -std=c99
CXXFLAGS
=
-std
=
c++14
TARGETS
=
src/app/
${
app
}
/main.cc src/os/object/cpp_helpers.cc src/os/object/outputstream.cc
TARGETS
+=
src/driver/lm75.cc
ifneq
($(findstring lm75,${drivers}), )
TARGETS
+=
src/driver/lm75.cc
COMMON_FLAGS
+=
-DDRIVER_LM75
endif
ifeq
(${timer_cycles}, 1)
COMMON_FLAGS
+=
-DTIMER_CYCLES
...
...
This diff is collapsed.
Click to expand it.
src/app/ledblink/main.cc
+
2
−
3
View file @
bfcfa4cf
...
...
@@ -6,9 +6,6 @@
#ifndef TIMER_CYCLES
#error makeflag timer_cycles=1 required
#endif
#ifndef TIMER_S
#error makeflag timer_s=1 required
#endif
/*
void check_command(unsigned char argc, char** argv)
...
...
@@ -96,7 +93,9 @@ void check_command(unsigned char argc, char** argv)
void
loop
(
void
)
{
gpio
.
led_toggle
(
1
);
#ifdef TIMER_S
kout
<<
dec
<<
uptime
.
get_s
()
<<
endl
;
#endif
}
int
main
(
void
)
...
...
This diff is collapsed.
Click to expand it.
src/arch/esp8266/Makefile.inc
+
4
−
0
View file @
bfcfa4cf
...
...
@@ -21,6 +21,10 @@ TARGETS += src/arch/esp8266/driver/stdout.cc src/arch/esp8266/driver/uptime.cc
OBJECTS
=
${
TARGETS:.cc
=
.o
}
ifeq
(${esp8266_led2}, 1)
COMMON_FLAGS
+=
-DLED_ON_GPIO16
endif
.cc.o
:
${
CXX
}
${
INCLUDES
}
${
COMMON_FLAGS
}
${
CXXFLAGS
}
-c
-o
$@
${
@:.o
=
.cc
}
${
OBJCOPY
}
--rename-section
.text
=
.irom0.text
--rename-section
.literal
=
.irom0.literal
$@
...
...
This diff is collapsed.
Click to expand it.
src/arch/esp8266/driver/gpio.cc
+
35
−
3
View file @
bfcfa4cf
...
...
@@ -12,29 +12,61 @@ void ICACHE_FLASH_ATTR GPIO::setup()
// Enable GPIO2 (ESP8266 on-board LED) as output
PIN_FUNC_SELECT
(
PERIPHS_IO_MUX_GPIO2_U
,
FUNC_GPIO2
);
#ifdef LED_ON_GPIO16
// Enable GPIO16 (RTC out / NodeMCU on-board LED) as output
//WRITE_PERI_REG(PAD_XPD_DCDC_CONF, (READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1);
//WRITE_PERI_REG(RTC_GPIO_CONF, (READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0);
//WRITE_PERI_REG(RTC_GPIO_ENABLE, (READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe) | (uint32)0x1);
WRITE_PERI_REG
(
PAD_XPD_DCDC_CONF
,
(
READ_PERI_REG
(
PAD_XPD_DCDC_CONF
)
&
0xffffffbc
)
|
(
uint32
)
0x1
);
WRITE_PERI_REG
(
RTC_GPIO_CONF
,
(
READ_PERI_REG
(
RTC_GPIO_CONF
)
&
(
uint32
)
0xfffffffe
)
|
(
uint32
)
0x0
);
WRITE_PERI_REG
(
RTC_GPIO_ENABLE
,
(
READ_PERI_REG
(
RTC_GPIO_ENABLE
)
&
(
uint32
)
0xfffffffe
)
|
(
uint32
)
0x1
);
// Turn the GPIO on to make sure the LED is off by default
WRITE_PERI_REG
(
RTC_GPIO_OUT
,
(
READ_PERI_REG
(
RTC_GPIO_OUT
)
&
(
uint32
)
0xfffffffe
)
|
(
uint32
)(
1
));
#endif
}
void
ICACHE_FLASH_ATTR
GPIO
::
led_on
(
unsigned
char
id
)
{
#ifdef LED_ON_GPIO16
if
(
id
==
0
)
{
gpio_output_set
(
0
,
BIT2
,
BIT2
,
0
);
}
else
{
WRITE_PERI_REG
(
RTC_GPIO_OUT
,
(
READ_PERI_REG
(
RTC_GPIO_OUT
)
&
(
uint32
)
0xfffffffe
)
|
(
uint32
)(
0
));
}
#else
gpio_output_set
(
0
,
BIT2
,
BIT2
,
0
);
#endif
}
void
ICACHE_FLASH_ATTR
GPIO
::
led_off
(
unsigned
char
id
)
{
#ifdef LED_ON_GPIO16
if
(
id
==
0
)
{
gpio_output_set
(
BIT2
,
0
,
BIT2
,
0
);
}
else
{
WRITE_PERI_REG
(
RTC_GPIO_OUT
,
(
READ_PERI_REG
(
RTC_GPIO_OUT
)
&
(
uint32
)
0xfffffffe
)
|
(
uint32
)(
0
));
}
#else
gpio_output_set
(
BIT2
,
0
,
BIT2
,
0
);
#endif
}
void
ICACHE_FLASH_ATTR
GPIO
::
led_toggle
(
unsigned
char
id
)
{
#ifdef LED_ON_GPIO16
if
(
id
==
0
)
{
if
(
gpio_input_get
()
&
BIT2
)
{
led_on
(
0
);
}
else
{
led_off
(
0
);
}
}
else
{
WRITE_PERI_REG
(
RTC_GPIO_OUT
,
(
READ_PERI_REG
(
RTC_GPIO_OUT
)
^
BIT0
));
}
#else
if
(
gpio_input_get
()
&
BIT2
)
{
led_on
(
0
);
}
else
{
led_off
(
0
);
}
#endif
}
GPIO
gpio
;
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