Skip to content

Commit

Permalink
ports/mega: Switch clock to timer 2
Browse files Browse the repository at this point in the history
This follows the other atmega users which want to allow timer 2 to be
used for the tone operation.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Feb 3, 2021
1 parent 079fbc1 commit 4304a1f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ports/mega/snek-mega.c
Expand Up @@ -13,6 +13,7 @@
*/

#include "snek.h"
#include "snek-io.h"

#define NUM_PIN 70
#define A0 54
Expand Down Expand Up @@ -51,13 +52,10 @@ port_init(void)

/* / 64 */
TCCR0B = ((0 << CS02) |
(1 << CS01) |
(0 << CS01) |
(1 << CS00) |
(0 << WGM02));

/* enable interrupt */
TIMSK0 = (1 << TOIE0);

/* Timer 1 */
TCCR1B = ((0 << CS12) |
(1 << CS11) |
Expand All @@ -77,6 +75,9 @@ port_init(void)

TCCR2A = ((1 << WGM20));

/* enable interrupt */
TIMSK2 = (1 << TOIE2);

/* Timer 3 */
TCCR3B = ((0 << CS12) |
(1 << CS11) |
Expand Down

0 comments on commit 4304a1f

Please sign in to comment.