Skip to content

Commit

Permalink
Add compilation instuctions and update to used arduino-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob toft pedersen committed Sep 24, 2022
1 parent 8fe1793 commit 13dc6af
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 2 deletions.
28 changes: 26 additions & 2 deletions flipmos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
cmake_minimum_required(VERSION 3.16)
project("Flipmos")

set(SSID "osaa-5" CACHE STRING "The access point ssid to us")
set(PASSWORD "deadbeef" CACHE STRING "The wifi password ")
set(MDNS_NAME "flipmos" CACHE STRING "The multicast name")
set(WEMOS_PORT "/dev/usb0" CACHE STRING "The port where the wemos is attached")
set(FQBN "esp8266:esp8266:d1" CACHE STRING "The Fully Qualified Board Name")

configure_file(
Config.h.in
${CMAKE_CURRENT_SOURCE_DIR}/Config.h
@ONLY
)

add_custom_target(
flipmos_init
#works on ubuntu something
# COMMAND sudo snap install arduino-cli
COMMAND arduino-cli --config-file arduino-cli.yaml core update-index
COMMAND arduino-cli --config-file arduino-cli.yaml core install esp8266:esp8266
COMMAND arduino-cli --config-file arduino-cli.yaml lib install "Adafruit GFX Library"
COMMAND arduino-cli --config-file arduino-cli.yaml lib install "Adafruit SSD1306 Wemos Mini OLED"
)

set_target_properties(
flipmos_init
PROPERTIES
EXCLUDE_FROM_ALL 1
)


add_custom_target(
flipmos
COMMAND arduino --verify ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino
COMMAND arduino-cli --config-file arduino-cli.yaml compile --fqbn ${FQBN} ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino
)

add_custom_target(
flipmos_upload
COMMAND arduino --upload ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino
COMMAND arduino-cli --config-file arduino-cli.yaml upload -p ${WEMOS_PORT} --fqbn ${FQBN} ${CMAKE_CURRENT_SOURCE_DIR}/flipmos.ino

)

# Do not upload when building all
Expand All @@ -24,3 +47,4 @@ set_target_properties(
PROPERTIES
EXCLUDE_FROM_ALL 1
)

44 changes: 44 additions & 0 deletions flipmos/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Getting started #

Get prerequisites: CMake, Make etc

and arduino-cli
on ubuntu this can be installed with:

sudo snap install arduino-cli

## Configure the build ##
The SSID / Password is set as variables in CMakeLists.txt

The WEMOS_PORT is where the wemos is connected

You can change them by editing your local copy, giving them as parameters for cmake.


## Setup a build ##
We need to create the Makefiles and insert values into the `Config.h` header
```
cd ~/flipdot/flimos
cmake -B build -DSSID=osaa-iot -DPASSWORD=hunter2 -DWEMOS_PORT="/dev/usb0"
```

## Prepare the wemos environment ##
Install all the wemos libraries we need

```
make -C build flipmos_init
```

## Build the flipmos binary ##
This steps compiles
```
make -C build flipmos
```
## deploy the flipmos binary ##
This will upload to `WEMOS_PORT`

```
make -C build flipmos_upload
```


24 changes: 24 additions & 0 deletions flipmos/arduino-cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
board_manager:
additional_urls:
- https://arduino.esp8266.com/stable/package_esp8266com_index.json
daemon:
port: "50051"
directories:
data: /home/jacob/snap/arduino-cli/31/.arduino15
downloads: /home/jacob/snap/arduino-cli/31/.arduino15/staging
user: /home/jacob/snap/arduino-cli/31/Arduino
library:
enable_unsafe_install: false
logging:
file: ""
format: text
level: info
metrics:
addr: :9090
enabled: true
output:
no_color: false
sketch:
always_export_binaries: false
updater:
enable_notification: true

0 comments on commit 13dc6af

Please sign in to comment.