aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/wirish_digital.cpp
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-03-24 17:27:38 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-03-24 17:31:47 -0400
commit63ea7464925b8cbeb8623d08a2bde0b1d2044047 (patch)
treec1e0291202084d8d8011b0b66715a711108cbef4 /wirish/wirish_digital.cpp
parentbc246609ccd44601a0564fea8da407cc500ad471 (diff)
downloadlibrambutan-63ea7464925b8cbeb8623d08a2bde0b1d2044047.tar.gz
librambutan-63ea7464925b8cbeb8623d08a2bde0b1d2044047.zip
Adding /wirish/boards/ for easier porting; shrank PIN_MAPs.
/wirish/boards/ contains xxx.h and xxx.cpp (for xxx=maple, maple_native, maple_mini, maple_RET6). The headers contain the board-specific #defines that used to live in boards.h (except BOARD_INIT, which was removed). The CPP files contain the PIN_MAP definitions that used to live in boards.cpp, and a proper boardInit() function to replace the old BOARD_INIT macro. This will make it easier to add new boards in the future. struct PinMapping was renamed struct stm32_pin_info, and was moved into a new wirish_types.h. Its external interrupt field was moved into struct gpio_dev, which saves memory by storing an afio_exti_port per port, rather than one per pin. Also rearranged the stm32_pin_info fields to improve packing. Maple's PIN_MAP is now down to below 500 bytes.
Diffstat (limited to 'wirish/wirish_digital.cpp')
-rw-r--r--wirish/wirish_digital.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/wirish/wirish_digital.cpp b/wirish/wirish_digital.cpp
index 4b68861..278cf10 100644
--- a/wirish/wirish_digital.cpp
+++ b/wirish/wirish_digital.cpp
@@ -70,7 +70,7 @@ void pinMode(uint8 pin, WiringPinMode mode) {
return;
}
- gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].pin, outputMode);
+ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_pin, outputMode);
if (PIN_MAP[pin].timer_device != NULL) {
/* enable/disable timer channels if we're switching into or
@@ -93,7 +93,7 @@ uint32 digitalRead(uint8 pin) {
return 0;
}
- return gpio_read_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].pin) ?
+ return gpio_read_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_pin) ?
HIGH : LOW;
}
@@ -102,7 +102,7 @@ void digitalWrite(uint8 pin, uint8 val) {
return;
}
- gpio_write_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].pin, val);
+ gpio_write_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_pin, val);
}
void togglePin(uint8 pin) {
@@ -110,7 +110,7 @@ void togglePin(uint8 pin) {
return;
}
- gpio_toggle_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].pin);
+ gpio_toggle_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_pin);
}
uint8 isButtonPressed() {