aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-06-04 20:45:00 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-06-05 10:52:46 -0400
commit2a17d9457a7459414d70ca3ce1ce8dd0edeeb524 (patch)
treed92d9b4797902461b5c5ec7a56bcb4b3a117244e /src
parent7531d0c678ff3c388d8ca148211ff82c3c3380c1 (diff)
downloadkutter-2a17d9457a7459414d70ca3ce1ce8dd0edeeb524.tar.gz
kutter-2a17d9457a7459414d70ca3ce1ce8dd0edeeb524.tar.xz
kutter-2a17d9457a7459414d70ca3ce1ce8dd0edeeb524.zip
avr: Eliminate gpio_adc_info struct in gpio adc pin definitions
The gpio_adc_info only contains a single uint8_t field - it's simpler to use an array of uint8_t instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/avr/gpio.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/avr/gpio.c b/src/avr/gpio.c
index 365053a9..af127ba1 100644
--- a/src/avr/gpio.c
+++ b/src/avr/gpio.c
@@ -98,25 +98,21 @@ static const struct gpio_pwm_info pwm_regs[] PROGMEM = {
#endif
};
-struct gpio_adc_info {
- uint8_t pin;
-};
-
-static const struct gpio_adc_info adc_pins[] PROGMEM = {
+static const uint8_t adc_pins[] PROGMEM = {
#if CONFIG_MACH_atmega168
- { GPIO('C', 0) }, { GPIO('C', 1) }, { GPIO('C', 2) }, { GPIO('C', 3) },
- { GPIO('C', 4) }, { GPIO('C', 5) }, { GPIO('E', 0) }, { GPIO('E', 1) },
+ GPIO('C', 0), GPIO('C', 1), GPIO('C', 2), GPIO('C', 3),
+ GPIO('C', 4), GPIO('C', 5), GPIO('E', 0), GPIO('E', 1),
#elif CONFIG_MACH_atmega644p
- { GPIO('A', 0) }, { GPIO('A', 1) }, { GPIO('A', 2) }, { GPIO('A', 3) },
- { GPIO('A', 4) }, { GPIO('A', 5) }, { GPIO('A', 6) }, { GPIO('A', 7) },
+ GPIO('A', 0), GPIO('A', 1), GPIO('A', 2), GPIO('A', 3),
+ GPIO('A', 4), GPIO('A', 5), GPIO('A', 6), GPIO('A', 7),
#elif CONFIG_MACH_at90usb1286
- { GPIO('F', 0) }, { GPIO('F', 1) }, { GPIO('F', 2) }, { GPIO('F', 3) },
- { GPIO('F', 4) }, { GPIO('F', 5) }, { GPIO('F', 6) }, { GPIO('F', 7) },
+ GPIO('F', 0), GPIO('F', 1), GPIO('F', 2), GPIO('F', 3),
+ GPIO('F', 4), GPIO('F', 5), GPIO('F', 6), GPIO('F', 7),
#elif CONFIG_MACH_atmega1280 || CONFIG_MACH_atmega2560
- { GPIO('F', 0) }, { GPIO('F', 1) }, { GPIO('F', 2) }, { GPIO('F', 3) },
- { GPIO('F', 4) }, { GPIO('F', 5) }, { GPIO('F', 6) }, { GPIO('F', 7) },
- { GPIO('K', 0) }, { GPIO('K', 1) }, { GPIO('K', 2) }, { GPIO('K', 3) },
- { GPIO('K', 4) }, { GPIO('K', 5) }, { GPIO('K', 6) }, { GPIO('K', 7) },
+ GPIO('F', 0), GPIO('F', 1), GPIO('F', 2), GPIO('F', 3),
+ GPIO('F', 4), GPIO('F', 5), GPIO('F', 6), GPIO('F', 7),
+ GPIO('K', 0), GPIO('K', 1), GPIO('K', 2), GPIO('K', 3),
+ GPIO('K', 4), GPIO('K', 5), GPIO('K', 6), GPIO('K', 7),
#endif
};
@@ -264,8 +260,7 @@ gpio_adc_setup(uint8_t pin)
{
uint8_t chan;
for (chan=0; chan<ARRAY_SIZE(adc_pins); chan++) {
- const struct gpio_adc_info *a = &adc_pins[chan];
- if (READP(a->pin) != pin)
+ if (READP(adc_pins[chan]) != pin)
continue;
// Enable ADC