Skip to content

Commit c6e34ff

Browse files
committed
esp01: Use arduino-cli in Makefile
1 parent 2ed3036 commit c6e34ff

File tree

7 files changed

+54
-7
lines changed

7 files changed

+54
-7
lines changed

src/arduino-cli.mk

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Variables
2+
3+
ARDUINO_CLI ?= arduino-cli
4+
BUILD_PATH ?= $(PWD)/.build
5+
6+
## Local options
7+
8+
ifneq ($(V),)
9+
VERBOSE = -v
10+
else
11+
VERBOSE =
12+
endif
13+
14+
## Makefile options
15+
16+
ifeq ($(BOARD_FQDN),)
17+
$(error missing BOARD_FQDN)
18+
endif
19+
20+
ifeq ($(SERIAL_PORT),)
21+
$(error missing SERIAL_PORT)
22+
endif
23+
24+
## Build rules
25+
26+
.PHONY: all
27+
all: compile
28+
29+
.PHONY: compile
30+
compile:
31+
$(ARDUINO_CLI) compile $(VERBOSE) -b $(BOARD_FQDN) --build-path $(BUILD_PATH)
32+
33+
.PHONY: upload
34+
upload:
35+
$(ARDUINO_CLI) upload $(VERBOSE) -b $(BOARD_FQDN) -p $(SERIAL_PORT) --input-dir $(BUILD_PATH)
36+
37+
.PHONY: clean
38+
clean:
39+
rm -rf $(BUILD_PATH)
40+
41+
## Aliases
42+
43+
.PHONY: serial
44+
serial: monitor
45+
46+
.PHONY: flash
47+
flash: upload

src/esp01-blinky/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ../arduino-config-esp.mk
1+
include ../esp01.mk

src/esp01-deepsleep/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
ARDUINO_LIBS =
2-
MONITOR_BAUDRATE = 74880
3-
include ../arduino-config-esp.mk
1+
include ../esp01.mk
File renamed without changes.

src/esp01-dht22/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
ARDUINO_LIBS = ESP8266WiFi Ticker DHT
2-
MONITOR_BAUDRATE = 115200
3-
include ../arduino-config-esp.mk
1+
include ../esp01.mk
File renamed without changes.

src/esp01.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BOARD_FQDN = esp8266:esp8266:generic:baud=921600
2+
SERIAL_PORT ?= /dev/ttyUSB1
3+
4+
include ../arduino-cli.mk

0 commit comments

Comments
 (0)