summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-06-09 12:55:53 +0100
committerdakkar <dakkar@thenautilus.net>2018-06-09 12:55:53 +0100
commit065835767dd877d8b0e2ccdbe5b915c5e22bd62a (patch)
treea326a82a749f47ccfc8006f806b3b0074cc3609a
parentworking sender for the CHIP (diff)
downloadthermostat-065835767dd877d8b0e2ccdbe5b915c5e22bd62a.tar.gz
thermostat-065835767dd877d8b0e2ccdbe5b915c5e22bd62a.tar.bz2
thermostat-065835767dd877d8b0e2ccdbe5b915c5e22bd62a.zip
working CHIP sender
-rw-r--r--trasmitter/.gitignore4
-rw-r--r--trasmitter/Makefile21
-rw-r--r--trasmitter/README.rst.txt11
-rw-r--r--trasmitter/arduino/Makefile19
-rw-r--r--trasmitter/arduino/sender.ino (renamed from trasmitter/sender.ino)0
-rw-r--r--trasmitter/sender-chip.c (renamed from trasmitter/clock.c)0
6 files changed, 30 insertions, 25 deletions
diff --git a/trasmitter/.gitignore b/trasmitter/.gitignore
index cebbcdf..bd6f3a9 100644
--- a/trasmitter/.gitignore
+++ b/trasmitter/.gitignore
@@ -1 +1,3 @@
-/build-*/
+/arduino/build-*/
+/sender-chip
+
diff --git a/trasmitter/Makefile b/trasmitter/Makefile
index 9815090..b31025b 100644
--- a/trasmitter/Makefile
+++ b/trasmitter/Makefile
@@ -1,19 +1,10 @@
-ARDMK_DIR = /home/dakkar/src/Arduino-Makefile
-ARDUINO_DIR = /usr/share/arduino
-MONITOR_PORT = /dev/ttyACM*
-CURRENT_DIR = $(basename $(CURDIR))
-AVR_TOOLS_DIR = /usr
-AVRDUDE_CONF = /etc/avrdude.conf
+CFLAGS = -Wall
-PROJECT_DIR = $(CURDIR)
-BOARD_TAG = uno
-MONITOR_BAUDRATE = 115200
+all: sender-chip setcap
-CFLAGS_STD = -std=gnu11
-CXXFLAGS_STD = -std=gnu++11
-CXXFLAGS += -pedantic -Wall -Wextra
+sender-chip: sender-chip.c
-include $(ARDMK_DIR)/Arduino.mk
+setcap: sender-chip
+ sudo setcap CAP_SYS_NICE=eip $<
-check-syntax:
- $(CXX) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES)
+.PHONY: setcap
diff --git a/trasmitter/README.rst.txt b/trasmitter/README.rst.txt
index d2fd957..78200a4 100644
--- a/trasmitter/README.rst.txt
+++ b/trasmitter/README.rst.txt
@@ -38,12 +38,5 @@ sysfs interface`_, seem to be fast enough for our purposes.
See the ``sender-chip.pl`` test program.
-The timing via the sysfs interface is awful.
-
-It looks like we can drive the pins (not the XIO ones) via
-memory-mapped registers: the sunxi-tools ``pio.c`` has most of the
-code needed.
-
-We could write a C program to just send the signal train. Look at
-``clock.c`` for a way to handle fast / real-time scheduling and
-delays.
+If we keep the ``*/value`` file open, we get good enough timing. The
+``sender-chip.c`` program works.
diff --git a/trasmitter/arduino/Makefile b/trasmitter/arduino/Makefile
new file mode 100644
index 0000000..9815090
--- /dev/null
+++ b/trasmitter/arduino/Makefile
@@ -0,0 +1,19 @@
+ARDMK_DIR = /home/dakkar/src/Arduino-Makefile
+ARDUINO_DIR = /usr/share/arduino
+MONITOR_PORT = /dev/ttyACM*
+CURRENT_DIR = $(basename $(CURDIR))
+AVR_TOOLS_DIR = /usr
+AVRDUDE_CONF = /etc/avrdude.conf
+
+PROJECT_DIR = $(CURDIR)
+BOARD_TAG = uno
+MONITOR_BAUDRATE = 115200
+
+CFLAGS_STD = -std=gnu11
+CXXFLAGS_STD = -std=gnu++11
+CXXFLAGS += -pedantic -Wall -Wextra
+
+include $(ARDMK_DIR)/Arduino.mk
+
+check-syntax:
+ $(CXX) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/trasmitter/sender.ino b/trasmitter/arduino/sender.ino
index 9373875..9373875 100644
--- a/trasmitter/sender.ino
+++ b/trasmitter/arduino/sender.ino
diff --git a/trasmitter/clock.c b/trasmitter/sender-chip.c
index 7ada0cf..7ada0cf 100644
--- a/trasmitter/clock.c
+++ b/trasmitter/sender-chip.c