summaryrefslogtreecommitdiff
path: root/src/arch/arduino-nano
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-08-28 15:25:37 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-08-28 15:25:37 +0200
commit3a66ae51c3f34108428e582ef693866d71496d16 (patch)
tree6a8ab3774af1b1077720671a92f40a92d5425bcf /src/arch/arduino-nano
parente12d6d528705344628568000dc2fddb919457411 (diff)
Expose configuration via Kconfig
Diffstat (limited to 'src/arch/arduino-nano')
-rw-r--r--src/arch/arduino-nano/Kconfig37
-rw-r--r--src/arch/arduino-nano/Makefile.inc54
-rw-r--r--src/arch/arduino-nano/arch.cc5
-rw-r--r--src/arch/arduino-nano/prompt1
4 files changed, 85 insertions, 12 deletions
diff --git a/src/arch/arduino-nano/Kconfig b/src/arch/arduino-nano/Kconfig
new file mode 100644
index 0000000..7054d44
--- /dev/null
+++ b/src/arch/arduino-nano/Kconfig
@@ -0,0 +1,37 @@
+config arch_arduino_nano_driver_adc
+bool "ADC (Analog-Digital-Converter)"
+select meta_driver_adc
+
+config arch_arduino_nano_driver_i2c
+bool "I2C"
+select meta_driver_i2c
+
+config arch_arduino_nano_driver_neopixel
+bool "WS2812b (NeoPixel)"
+select meta_driver_neopixel
+
+config arch_arduino_nano_driver_spi
+bool "SPI"
+select meta_driver_spi
+
+config arch_arduino_nano_driver_stdin
+bool "UART Input"
+select meta_driver_stdin
+
+config arch_arduino_nano_driver_timer
+bool "Timer with Interrupts"
+select meta_driver_timer
+
+choice arch_arduino_nano_timer1
+bool "Timer 1"
+optional
+
+config arch_arduino_nano_driver_uptime
+bool "Uptime Counter"
+select meta_driver_uptime
+
+config arch_arduino_nano_driver_counter
+bool "Cycle Counter"
+select meta_driver_counter
+
+endchoice
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc
index 5445bc1..a3412fb 100644
--- a/src/arch/arduino-nano/Makefile.inc
+++ b/src/arch/arduino-nano/Makefile.inc
@@ -30,37 +30,77 @@ endif
CXX_TARGETS += src/arch/arduino-nano/arch.cc
CXX_TARGETS += src/arch/arduino-nano/driver/gpio.cc
CXX_TARGETS += src/arch/arduino-nano/driver/stdout.cc
-CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc
+
+# Command-line driver selection
ifneq ($(findstring softi2c,${drivers}), )
else ifneq ($(findstring i2c,${arch_drivers}), )
- CXX_TARGETS += src/arch/arduino-nano/driver/i2c.cc
+ CONFIG_arch_arduino_nano_driver_i2c = y
endif
ifneq ($(findstring adc,${arch_drivers}), )
- CXX_TARGETS += src/arch/arduino-nano/driver/adc.cc
+ CONFIG_arch_arduino_nano_driver_adc = y
endif
ifneq ($(findstring spi,${arch_drivers}), )
- CXX_TARGETS += src/arch/arduino-nano/driver/spi.cc
+ CONFIG_arch_arduino_nano_driver_spi = y
endif
ifneq ($(findstring stdin,${arch_drivers}), )
- CXX_TARGETS += src/arch/arduino-nano/driver/stdin.cc
+ CONFIG_arch_arduino_nano_driver_stdin = y
endif
ifneq ($(findstring timer,${arch_drivers}), )
- CXX_TARGETS += src/arch/arduino-nano/driver/timer.cc
+ CONFIG_arch_arduino_nano_driver_timer = y
endif
ifneq ($(findstring counter,${arch_drivers}), )
- CXX_TARGETS += src/arch/arduino-nano/driver/counter.cc
+ CONFIG_arch_arduino_nano_driver_counter = y
endif
ifneq ($(findstring neopixel,${arch_drivers}), )
+ CONFIG_arch_arduino_nano_driver_neopixel = y
+endif
+
+ifeq (${timer_s}, 1)
+ CONFIG_arch_arduino_nano_driver_uptime = y
+endif
+
+# Kconfig driver selection
+
+ifdef CONFIG_arch_arduino_nano_driver_i2c
+ CXX_TARGETS += src/arch/arduino-nano/driver/i2c.cc
+endif
+
+ifdef CONFIG_arch_arduino_nano_driver_adc
+ CXX_TARGETS += src/arch/arduino-nano/driver/adc.cc
+endif
+
+ifdef CONFIG_arch_arduino_nano_driver_spi
+ CXX_TARGETS += src/arch/arduino-nano/driver/spi.cc
+endif
+
+ifdef CONFIG_arch_arduino_nano_driver_stdin
+ CXX_TARGETS += src/arch/arduino-nano/driver/stdin.cc
+endif
+
+ifdef CONFIG_arch_arduino_nano_driver_timer
+ CXX_TARGETS += src/arch/arduino-nano/driver/timer.cc
+endif
+
+ifdef CONFIG_arch_arduino_nano_driver_counter
+ CXX_TARGETS += src/arch/arduino-nano/driver/counter.cc
+endif
+
+ifdef CONFIG_arch_arduino_nano_driver_neopixel
CXX_TARGETS += src/arch/arduino-nano/driver/neopixel.cc
endif
+ifdef CONFIG_arch_arduino_nano_driver_uptime
+ COMMON_FLAGS += -DTIMER_S
+ CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc
+endif
+
ifeq (${cpu_freq}, 16000000)
uart_baud = 57600
else ifeq (${cpu_freq}, 8000000)
diff --git a/src/arch/arduino-nano/arch.cc b/src/arch/arduino-nano/arch.cc
index 1023927..48b50f8 100644
--- a/src/arch/arduino-nano/arch.cc
+++ b/src/arch/arduino-nano/arch.cc
@@ -38,11 +38,6 @@ void Arch::setup(void)
#error Unsupported F_CPU
#endif
-#ifdef TIMER_CYCLES
- TCCR0A = 0;
- TCCR0B = _BV(CS00);
-#endif
-
#if defined(WITH_LOOP) || defined(TIMER_S)
TCCR1A = 0;
TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); // /1024
diff --git a/src/arch/arduino-nano/prompt b/src/arch/arduino-nano/prompt
new file mode 100644
index 0000000..1994e4c
--- /dev/null
+++ b/src/arch/arduino-nano/prompt
@@ -0,0 +1 @@
+Arduino Nano (Mega328)