aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/timers.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-11-29 01:49:26 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-11-29 01:49:26 -0500
commit078edc158da7906ba72e7e6528e1a811e07270e7 (patch)
tree1bc7b2e8137fb5ebfc7b59d59294d7adb9e95468 /docs/source/timers.rst
parent5e587be27a7c3bd854b686952a5c9637a2432ff0 (diff)
downloadlibrambutan-078edc158da7906ba72e7e6528e1a811e07270e7.tar.gz
librambutan-078edc158da7906ba72e7e6528e1a811e07270e7.zip
Finished converting the Arduino docs
Diffstat (limited to 'docs/source/timers.rst')
-rw-r--r--docs/source/timers.rst25
1 files changed, 12 insertions, 13 deletions
diff --git a/docs/source/timers.rst b/docs/source/timers.rst
index fe6ea4a..948805b 100644
--- a/docs/source/timers.rst
+++ b/docs/source/timers.rst
@@ -2,9 +2,8 @@
.. _timers:
-========
- Timers
-========
+Timers
+======
There are four general purpose timers in the Maple microcontroller
that can be configured to generate periodic or delayed events with
@@ -52,7 +51,7 @@ configuration being the same.
**Jitter:** other interrupts (USB, Serial, SysTick, or other
timers) can and will get called before or during the timer
- interrupt routines, causing pseudo-random delays and other
+ interrupt routines, causing pseudorandom delays and other
frustrations.
Disabling the USB port (by calling ``SerialUSB.end()``, or just
@@ -90,7 +89,7 @@ General Timer Modes
:ref:`PWM docs <pwm>` for more information on this mode.
.. note::
-
+
``Timer1.setChannel1Mode(TIMER_PWM)`` may not work as expected;
if you want PWM functionality on a channel, make sure you don't
set it to something else.
@@ -240,7 +239,7 @@ LED blink
void setup()
{
- // Set up the LED to blink
+ // Set up the LED to blink
pinMode(LED_PIN, OUTPUT);
// Setup Timer
@@ -251,13 +250,13 @@ LED blink
}
void loop() {
- // Nothing! It's all in the interrupts
+ // Nothing! It's all in the interrupts
}
void handler_led(void) {
toggle ^= 1;
digitalWrite(LED_PIN, toggle);
- }
+ }
Racing Counters
^^^^^^^^^^^^^^^
@@ -287,7 +286,7 @@ Racing Counters
Timer3.setOverflow(30000);
Timer4.setOverflow(30000);
Timer3.setCompare1(1000); // somewhere in the middle
- Timer4.setCompare1(1000);
+ Timer4.setCompare1(1000);
Timer3.attachCompare1Interrupt(handler1);
Timer4.attachCompare1Interrupt(handler2);
Timer3.resume();
@@ -296,9 +295,9 @@ Racing Counters
void loop() {
// Display the running counts
- SerialUSB.print("Count 1: ");
+ SerialUSB.print("Count 1: ");
SerialUSB.print(count1);
- SerialUSB.print("\t\tCount 2: ");
+ SerialUSB.print("\t\tCount 2: ");
SerialUSB.println(count2);
// Run... while BUT is held, pause Count2
@@ -314,7 +313,7 @@ Racing Counters
void handler1(void) {
count1++;
- }
+ }
void handler2(void) {
count2++;
- }
+ }