From b28e95ca1aa2860c0869041c29a3ba27054e5967 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 4 Mar 2019 23:35:11 -0500 Subject: [PATCH] command: Always pass a string to the DECL_CONSTANT() macro Make it clear that the name of the constant being defined is a string. When the value being defined is also a string, use a new DECL_CONSTANT_STR() macro. Signed-off-by: Kevin O'Connor --- docs/Protocol.md | 2 +- src/atsam/adc.c | 2 +- src/atsam/hard_pwm.c | 2 +- src/atsam/main.c | 2 +- src/atsam/sam4e_afec.c | 2 +- src/atsamd/adc.c | 2 +- src/atsamd/hard_pwm.c | 2 +- src/atsamd/main.c | 2 +- src/avr/adc.c | 2 +- src/avr/hard_pwm.c | 2 +- src/avr/main.c | 2 +- src/avr/timer.c | 2 +- src/basecmd.c | 2 +- src/command.h | 8 ++++---- src/generic/armcm_timer.c | 2 +- src/generic/serial_irq.c | 4 ++-- src/generic/timer_irq.c | 2 +- src/gpiocmds.c | 2 +- src/linux/analog.c | 2 +- src/linux/main.c | 2 +- src/linux/pca9685.c | 2 +- src/linux/timer.c | 2 +- src/lpc176x/adc.c | 2 +- src/lpc176x/main.c | 2 +- src/pru/adc.c | 2 +- src/pru/main.c | 2 +- src/stepper.c | 2 +- src/stm32f1/adc.c | 2 +- src/stm32f1/main.c | 2 +- 29 files changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/Protocol.md b/docs/Protocol.md index c6fce029..f73a195a 100644 --- a/docs/Protocol.md +++ b/docs/Protocol.md @@ -115,7 +115,7 @@ Declaring constants Constants can also be exported. For example, the following: ``` -DECL_CONSTANT(SERIAL_BAUD, 250000); +DECL_CONSTANT("SERIAL_BAUD", 250000); ``` would export a constant named "SERIAL_BAUD" with a value of 250000 diff --git a/src/atsam/adc.c b/src/atsam/adc.c index d5e74676..816b388e 100644 --- a/src/atsam/adc.c +++ b/src/atsam/adc.c @@ -27,7 +27,7 @@ static const uint8_t adc_pins[] = { }; #define ADC_FREQ_MAX 20000000 -DECL_CONSTANT(ADC_MAX, 4095); +DECL_CONSTANT("ADC_MAX", 4095); struct gpio_adc gpio_adc_setup(uint8_t pin) diff --git a/src/atsam/hard_pwm.c b/src/atsam/hard_pwm.c index 7d1881a6..0b238b24 100644 --- a/src/atsam/hard_pwm.c +++ b/src/atsam/hard_pwm.c @@ -54,7 +54,7 @@ static const struct gpio_pwm_info pwm_regs[] = { #define MAX_PWM 255 -DECL_CONSTANT(PWM_MAX, MAX_PWM); +DECL_CONSTANT("PWM_MAX", MAX_PWM); struct gpio_pwm gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint8_t val) diff --git a/src/atsam/main.c b/src/atsam/main.c index b6be2864..0bb9ff83 100644 --- a/src/atsam/main.c +++ b/src/atsam/main.c @@ -10,7 +10,7 @@ #include "internal.h" // WDT #include "sched.h" // sched_main -DECL_CONSTANT(MCU, CONFIG_MCU); +DECL_CONSTANT_STR("MCU", CONFIG_MCU); /**************************************************************** diff --git a/src/atsam/sam4e_afec.c b/src/atsam/sam4e_afec.c index 002e092f..4c78e958 100644 --- a/src/atsam/sam4e_afec.c +++ b/src/atsam/sam4e_afec.c @@ -51,7 +51,7 @@ gpio_adc_to_afec_chan(struct gpio_adc g) } #define ADC_FREQ_MAX 6000000UL -DECL_CONSTANT(ADC_MAX, 4095); +DECL_CONSTANT("ADC_MAX", 4095); static int init_afec(Afec* afec) { diff --git a/src/atsamd/adc.c b/src/atsamd/adc.c index 26465c2d..8d25d2f4 100644 --- a/src/atsamd/adc.c +++ b/src/atsamd/adc.c @@ -37,7 +37,7 @@ static const uint8_t adc_pins[] = { }; #endif -DECL_CONSTANT(ADC_MAX, 4095); +DECL_CONSTANT("ADC_MAX", 4095); static struct gpio_adc gpio_adc_pin_to_struct(uint8_t pin) { diff --git a/src/atsamd/hard_pwm.c b/src/atsamd/hard_pwm.c index 3f510520..0b3a6ba4 100644 --- a/src/atsamd/hard_pwm.c +++ b/src/atsamd/hard_pwm.c @@ -41,7 +41,7 @@ static const struct gpio_pwm_info pwm_regs[] = { #define MAX_PWM 255 -DECL_CONSTANT(PWM_MAX, MAX_PWM); +DECL_CONSTANT("PWM_MAX", MAX_PWM); struct gpio_pwm gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint8_t val) diff --git a/src/atsamd/main.c b/src/atsamd/main.c index 5a5a374d..c7dbe9fd 100644 --- a/src/atsamd/main.c +++ b/src/atsamd/main.c @@ -8,7 +8,7 @@ #include "internal.h" // NVIC_SystemReset #include "sched.h" // sched_main -DECL_CONSTANT(MCU, CONFIG_MCU); +DECL_CONSTANT_STR("MCU", CONFIG_MCU); // Return the start of memory available for dynamic allocations void * diff --git a/src/avr/adc.c b/src/avr/adc.c index 3087dce1..8b478d08 100644 --- a/src/avr/adc.c +++ b/src/avr/adc.c @@ -36,7 +36,7 @@ static const uint8_t adc_pins[] PROGMEM = { enum { ADMUX_DEFAULT = 0x40 }; enum { ADC_ENABLE = (1<