From e76caae1660779c7b25869251f2145c7f170a8af Mon Sep 17 00:00:00 2001 From: Macoy Madson Date: Wed, 16 Nov 2022 14:15:45 -0500 Subject: [PATCH] Got compiling and building from the CLI working --- Build.sh | 18 ++++++++++++++---- COPYING | 8 ++++---- Dependencies/cakelisp | 1 + ReadMe.org | 9 +++++++-- src/DrinkCounter.cake | 23 +++++++++++++++++++++++ src/Main.cake | 7 ------- 6 files changed, 49 insertions(+), 17 deletions(-) create mode 160000 Dependencies/cakelisp create mode 100644 src/DrinkCounter.cake delete mode 100644 src/Main.cake diff --git a/Build.sh b/Build.sh index b79487d..d1c8e86 100755 --- a/Build.sh +++ b/Build.sh @@ -4,15 +4,25 @@ CAKELISP_DIR=Dependencies/cakelisp # Build Cakelisp itself echo "\n\nCakelisp\n\n" -cd $CAKELISP_DIR +cd $CAKELISP_DIR || exit $? ./Build.sh || exit $? cd ../.. -echo "\n\nGameLib Project\n\n" +echo "\n\nDrink Counter\n\n" CAKELISP=./Dependencies/cakelisp/bin/cakelisp -$CAKELISP --verbose-processes --execute \ +# Arduino will build our file +$CAKELISP --verbose-processes --skip-build \ src/Config_Linux.cake \ - src/Main.cake || exit $? + src/DrinkCounter.cake || exit $? + +# Arduino build expects things to have specific names and extensions +mv cakelisp_cache/DrinkCounter/DrinkCounter.cake.c cakelisp_cache/DrinkCounter/DrinkCounter.ino || exit $? + +/media/macoy/Preserve/Programs/arduino-cli_0.29.0-rc.1_Linux_64bit/arduino-cli --no-color \ + compile -b arduino:avr:uno ./cakelisp_cache/DrinkCounter/DrinkCounter.ino || exit $? + +/media/macoy/Preserve/Programs/arduino-cli_0.29.0-rc.1_Linux_64bit/arduino-cli --no-color \ + upload -b arduino:avr:uno --port /dev/ttyACM0 ./cakelisp_cache/DrinkCounter || exit $? diff --git a/COPYING b/COPYING index ec692e2..19908d8 100644 --- a/COPYING +++ b/COPYING @@ -1,16 +1,16 @@ Copyright (c) 2021 Macoy Madson -This file is part of GameLib Project. +This file is part of Drink Counter. -GameLib Project is free software: you can redistribute it and/or modify +Drink Counter is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -GameLib Project is distributed in the hope that it will be useful, +Drink Counter is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GameLib Project. If not, see . \ No newline at end of file +along with Drink Counter. If not, see . \ No newline at end of file diff --git a/Dependencies/cakelisp b/Dependencies/cakelisp new file mode 160000 index 0000000..37e5637 --- /dev/null +++ b/Dependencies/cakelisp @@ -0,0 +1 @@ +Subproject commit 37e56378c017ae8f895ecf66c0f7891eeb2651ff diff --git a/ReadMe.org b/ReadMe.org index 87ecb8b..e134263 100644 --- a/ReadMe.org +++ b/ReadMe.org @@ -1,3 +1,8 @@ -#+title: GameLib Project +#+title: Drink Counter -This is a template repository for gamelib-based projects. +Currently an Arduino project for helping me count my drinks. + +* Setup + +- Download the [[https://github.com/arduino/arduino-cli/releases][Arduino CLI]]. There may be more steps because I had installed the IDE first before I found the CLI. +- Update ~Build.sh~ to point to the Arduino CLI install. diff --git a/src/DrinkCounter.cake b/src/DrinkCounter.cake new file mode 100644 index 0000000..dc7d09f --- /dev/null +++ b/src/DrinkCounter.cake @@ -0,0 +1,23 @@ +;; Arduino build expects things to have specific names and extensions. We'll create a build label +;; just to make our build directory match, which appears to be necessary. +(add-build-config-label "DrinkCounter") + +(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src") +;; (add-cakelisp-search-directory "Dependencies/gamelib/src") +(add-cakelisp-search-directory "Dependencies/cakelisp/runtime") +(add-cakelisp-search-directory "src") + +(import "CHelpers.cake") + +(defun setup () + (pinMode LED_BUILTIN OUTPUT)) + +(defun loop () + ;; turn the LED on (HIGH is the voltage level) + (digitalWrite LED_BUILTIN HIGH) + ;; wait for a second + (delay 10000) + ;; turn the LED off by making the voltage LOW + (digitalWrite LED_BUILTIN LOW) + ;; wait for a second + (delay 1000)) diff --git a/src/Main.cake b/src/Main.cake deleted file mode 100644 index 18d4a27..0000000 --- a/src/Main.cake +++ /dev/null @@ -1,7 +0,0 @@ -(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src") -(add-cakelisp-search-directory "Dependencies/gamelib/src") -(add-cakelisp-search-directory "Dependencies/cakelisp/runtime") -(add-cakelisp-search-directory "src") - -(defun main (&return int) - (return 0))