aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-12-22 23:47:46 -0500
committerKevin O'Connor <kevin@koconnor.net>2016-12-23 17:06:10 -0500
commitfe95ea221b2b88e9cb52a6378ff2018ee752094b (patch)
tree2223d604cc7d5bdf2c771b05e15834dd418b3823 /src/avr
parent4e8674d5df46841e68b72b83911b28ec71079bf1 (diff)
downloadkutter-fe95ea221b2b88e9cb52a6378ff2018ee752094b.tar.gz
kutter-fe95ea221b2b88e9cb52a6378ff2018ee752094b.tar.xz
kutter-fe95ea221b2b88e9cb52a6378ff2018ee752094b.zip
build: Define DECL_CONSTANT mechanism for defining exported constants
Add a DECL_CONSTANT macro to allow the firmware to define constants that are to be exported to the host during the "identify" phase. This replaces the existing hardcoded mechanism of scanning the Kconfig header file for certain constants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/avr')
-rw-r--r--src/avr/serial.c3
-rw-r--r--src/avr/timer.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/avr/serial.c b/src/avr/serial.c
index bd92f048..6bd88598 100644
--- a/src/avr/serial.c
+++ b/src/avr/serial.c
@@ -9,6 +9,7 @@
#include "autoconf.h" // CONFIG_SERIAL_BAUD
#include "board/io.h" // readb
#include "board/misc.h" // console_get_input
+#include "command.h" // DECL_CONSTANT
#include "sched.h" // DECL_INIT
#include "irq.h" // irq_save
@@ -22,6 +23,8 @@ static uint8_t transmit_pos, transmit_max;
* Serial hardware
****************************************************************/
+DECL_CONSTANT(SERIAL_BAUD, CONFIG_SERIAL_BAUD);
+
static void
serial_init(void)
{
diff --git a/src/avr/timer.c b/src/avr/timer.c
index a7e832bc..3744351d 100644
--- a/src/avr/timer.c
+++ b/src/avr/timer.c
@@ -16,6 +16,9 @@
* Low level timer code
****************************************************************/
+DECL_CONSTANT(CLOCK_FREQ, F_CPU);
+DECL_CONSTANT(MCU, CONFIG_MCU);
+
// Return the number of clock ticks for a given number of microseconds
uint32_t
timer_from_us(uint32_t us)