This commit is contained in:
Alexander Popov 2024-06-08 01:13:04 +03:00
commit e662f4d9d6
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
7 changed files with 217 additions and 0 deletions

20
.editorconfig Normal file
View File

@ -0,0 +1,20 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.sh]
indent_style = space
indent_size = 2
[humans.txt]
indent_style = tab
indent_size = 2
[*.md]
trim_trailing_whitespace = false

0
.gitignore vendored Normal file
View File

0
HISTORY.md Normal file
View File

24
LICENSE Normal file
View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# 🔌 Arduino Deploy Utility
## Usage
### 1. Installing
# 🔌 Программа для работы с Arduino
## Использование
### 1. Установка

145
deploy.sh Executable file
View File

@ -0,0 +1,145 @@
#!/bin/bash
# О программе
AUTHOR='Alexander Popov <iiiypuk {at} fastmail.fm>'
VERSION='1.0.0 beta'
LICENSE='Public Domain'
# Настройки
MAIN_FOLDER=$HOME/.local/share/arduino-deploy # Рабочая директория
ARGV=("$@") # Аргументы программы
ARDUINO_PORT=/dev/ttyACM0
ARDUINO_BOARD=arduino:avr:uno
PROJECT=./RFIDAuth/
# Основная функция
main() {
# Выполняет проверку наличия библиотек
[ ! -d "$MAIN_FOLDER" ] && mkdir -p ${MAIN_FOLDER}
check_colors
check_ini_parser
# Выполняет импорт библиотек
source $HOME/Temp/.arduino-deploy/colors.sh
source $HOME/Temp/.arduino-deploy/ini-file-parser.sh
# Выводит приветствие
clear
echo -e "${BRIGHT_YELLOW_B}Программа для сборки прошивки${NC}"
printf '\u2500%0.s' $(seq 29)
echo ''
echo -e "${GREEN_B}Автор: ${YELLOW}${AUTHOR}${NC}"
echo -e "${GREEN_B}Версия: ${YELLOW}${VERSION}${NC}"
printf '\u2500%0.s' $(seq 29)
echo ''
# Выводит список команд при вызове без параметров
if [ "${ARGV[0]}" = "" ]; then
echo -e "${BLUE_B}Доступные параметры:${NC}"
echo -e " ${RED_B}b${NC} - сборка прошивки"
echo -e " ${RED_B}u${NC} - загрузка прошивки"
echo -e " ${RED_B}m${NC} - запуск монитора порта"
echo -e " ${RED_B}f${NC} - форматирование кода с помощью ${YELLOW}clang-format${NC}"
echo -e " ${RED_B}d${NC} - создать архив с исходниками"
echo ''
exit 0
fi
# b | Сборка прошивки
if [ "${ARGV[0]}" = "b" ]; then
build; exit 0
fi
# u | Загрузка прошивки
if [ "${ARGV[0]}" = "u" ]; then
upload; exit 0
fi
# m | Запуск монитора порта
if [ "${ARGV[0]}" = "m" ]; then
monitor; exit 0
fi
# f | Форматирование кода
if [ "${ARGV[0]}" = "f" ]; then
echo -e "${BRIGHT_RED_B}Форматирование кода прошивки...${NC}"
cd ${PROJECT}
clang-format -i *.hpp *.h *.ino
cd ..
echo -e "${BRIGHT_GREEN_B}Готово ✅${NC}\n"; exit 0
fi
# d | Создание дистрибутива с исходниками
if [ "${ARGV[0]}" = "d" ]; then
dist; exit 0
fi
}
# Запуск монитора порта
monitor() {
echo -e "${BRIGHT_CYAN_B}Запуск монитора порта...${NC}"
printf '\u2500%0.s' $(seq 24)
echo ''
arduino-cli monitor -p $ARDUINO_PORT
}
# Сборка прошивки
build() {
echo -e "${BRIGHT_RED_B}Сборка прошивки...${NC}"
printf '\u2500%0.s' $(seq 18)
echo ''
arduino-cli compile -b $ARDUINO_BOARD $PROJECT
echo -e "\n${BRIGHT_GREEN_B}Готово ✅${NC}\n"
}
# Загрузка прошивки
upload() {
echo -e "${BRIGHT_RED_B}Загрузка прошивки...${NC}"
printf '\u2500%0.s' $(seq 20)
echo ''
arduino-cli upload -b $ARDUINO_BOARD -p $ARDUINO_PORT $PROJECT
echo -e "\n${BRIGHT_GREEN_B}Готово ✅${NC}\n"
}
# Проверяет наличие библиотеки colors.sh
# https://git.a2s.su/iiiypuk/colors.sh
check_colors() {
FILE=${MAIN_FOLDER}/colors.sh
URL="https://git.a2s.su/iiiypuk/colors.sh/raw/branch/main/colors.sh"
SHA256SUM="a598398f8944e247b121d22994dabe5110a4ef2960571db77eab487c4f5e29d9"
# todo: check file sum & change url to release
if [ ! -f "$FILE" ]; then
wget $URL -O $FILE
fi
}
# Проверяет наличие библиотеки ini-file-parser.sh
# https://github.com/DevelopersToolbox/ini-file-parser
check_ini_parser() {
FILE=${MAIN_FOLDER}/ini-file-parser.sh
URL="https://raw.githubusercontent.com/DevelopersToolbox/ini-file-parser/master/src/ini-file-parser.sh"
SHA256SUM="a3c71e07654628b4db0a61328944e5d79e91fd3b9e7307a81f79244ccbbbbf52"
# todo: check file sum & change url to release
if [ ! -f "$FILE" ]; then
wget $URL -O $FILE
fi
}
# Запуск программы
main

16
humans.txt Normal file
View File

@ -0,0 +1,16 @@
/* PROJECT */
Last update: Thu June 05 2024
Language: Russian
IDE: Sublime Text 4
Tools:
Bash
EditorConfig
Components:
...
/* TEAM */
Author: Alexander Popov
Contacts: iiiypuk [at] fastmail.fm
From: Russia
Ko-Fi: iiiypuk
Boosty: iiiypuk