aboutsummaryrefslogtreecommitdiff
path: root/wirish/wirish_digital.cpp
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-03-22 16:59:29 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-03-24 07:25:14 -0400
commit296b1188bfb8cf28466b95f1dd0fde309b1f9399 (patch)
treeb0ed2b9fecb2da85266e6b2b88c6fe31bb0ca2c8 /wirish/wirish_digital.cpp
parent68b57d90007a234e6a2fc82f6b9402fb6b77ef34 (diff)
Initial timer refactor.
Basic PWM works. Had some problems in testing that might be due to USART bugs. HardwareTimer has been removed from the build for now; I will re-implement it in terms of the new libmaple API, but consider it deprecated. Let's come up with something better. Servo is implemented in terms of HardwareTimer, so it also has been temporarily removed from the build. pwmWrite() likely got a little bit less inefficient due to indirection, but the PIN_MAPs shrank by a pointer per PinMapping.
Diffstat (limited to 'wirish/wirish_digital.cpp')
-rw-r--r--wirish/wirish_digital.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/wirish/wirish_digital.cpp b/wirish/wirish_digital.cpp
index 0c0bd85..4b68861 100644
--- a/wirish/wirish_digital.cpp
+++ b/wirish/wirish_digital.cpp
@@ -72,15 +72,15 @@ void pinMode(uint8 pin, WiringPinMode mode) {
gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].pin, outputMode);
- if (PIN_MAP[pin].timer_num != TIMER_INVALID) {
+ if (PIN_MAP[pin].timer_device != NULL) {
/* enable/disable timer channels if we're switching into or
out of pwm */
if (pwm) {
- timer_set_mode(PIN_MAP[pin].timer_num,
+ timer_set_mode(PIN_MAP[pin].timer_device,
PIN_MAP[pin].timer_chan,
TIMER_PWM);
} else {
- timer_set_mode(PIN_MAP[pin].timer_num,
+ timer_set_mode(PIN_MAP[pin].timer_device,
PIN_MAP[pin].timer_chan,
TIMER_DISABLED);
}