From a3a17440dc193ca918ee52bf78447bfd1c7a62cd Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Thu, 22 Apr 2021 13:26:49 +0300 Subject: [PATCH] reset spi before uploading the firmware --- PKGBUILD | 1 + hid/Makefile | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index f55fcd71..51d9e420 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -63,6 +63,7 @@ depends=( openssl platformio avrdude-svn + wiringpi make patch sudo diff --git a/hid/Makefile b/hid/Makefile index a46a66d0..6987ef52 100644 --- a/hid/Makefile +++ b/hid/Makefile @@ -12,7 +12,15 @@ _build: install: upload upload: - platformio run --environment $(shell cat .current) --target upload + $(eval $@_CURRENT := $(shell cat .current)) + bash -ex -c " \ + current=`cat .current`; \ + if [ '$($@_CURRENT)' == 'spi' ] || [ '$($@_CURRENT)' == 'aum' ]; then \ + gpio -g write 25 1; \ + gpio -g write 25 0; \ + fi \ + " + platformio run --environment '$($@_CURRENT)' --target upload bootloader-spi: install-bootloader-spi