X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/05994bd90cb36f10ff72c6a70d7cecc61b67fb2f..5f7f3586b0444116d5c1340465ecae8d6daa2461:/avr/gpio.c diff --git a/avr/gpio.c b/avr/gpio.c index 3c47247..73e9c39 100644 --- a/avr/gpio.c +++ b/avr/gpio.c @@ -1,42 +1,46 @@ +/* + * (C) Copyright 2014 Leo C. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + #include "common.h" #include #include #include "debug.h" #include "gpio.h" - /* -Pin Name Port Timer Mode max div max div min f [Hz] ----------------------------------------------------------------------------------- -0 PG5 OC0B PWM (2**8)*1024 262144 70.31 -1 PG4 -2 CLK2 PB4 OC2A Toggle (2**8)*1024*2 524288 35.16 -3 ZCLK PB5 OC1A PWM (2**16)*1024 67108864 0.2746 -4 PB6 OC1B PWM (2**16)*1024 67108864 0.2746 -5 PB7 OC0A Toggle (2**8)*1024*2 524288 35.16 -6 PG3 -7 PG2 -8 PG1 -9 PG0 -10 CLKO PE7 - - -pre Timer0 Timer1 Timer2 +Pin Name Port Timer Mode max div max div min f [Hz] +-------------------------------------------------------------------------------- +0 PG5 OC0B PWM (2**8)*1024 262144 70.31 +1 PG4 +2 CLK2 PB4 OC2A Toggle (2**8)*1024*2 524288 35.16 +3 ZCLK PB5 OC1A PWM (2**16)*1024 67108864 0.2746 +4 PB6 OC1B PWM (2**16)*1024 67108864 0.2746 +5 PB7 OC0A Toggle (2**8)*1024*2 524288 35.16 +6 PG3 +7 PG2 +8 PG1 +9 PG0 +10 CLKO PE7 +-------------------------------------------------------------------------------- + + +pre Timer0 Timer1 Timer2 -------------------------------------------------- -0 0 0 0 -1 1 1 1 -2 8 x8 8 x8 8 x8 -3 64 x8 64 x8 32 x4 -4 256 x4 256 x4 64 x2 -5 1024 x4 1024 x4 128 x2 -6 256 x2 -7 1024 x4 +0 0 0 0 +1 1 1 1 +2 8 x8 8 x8 8 x8 +3 64 x8 64 x8 32 x4 +4 256 x4 256 x4 64 x2 +5 1024 x4 1024 x4 128 x2 +6 256 x2 +7 1024 x4 -------------------------------------------------- - */ - #define PWMTOGGLE 0b01 #define PWMPOS 0b10 #define PWMNEG 0b11 @@ -312,7 +316,7 @@ int gpio_clockdiv_set(int pin, unsigned long divider) top = ltop - 1; - PING |= _BV(0); /* Debug */ +// PING |= _BV(0); /* Debug */ switch (timertype & TIMER) { case TIMER0: @@ -363,7 +367,7 @@ int gpio_clockdiv_set(int pin, unsigned long divider) break; } - PING |= _BV(0); /* Debug */ +// PING |= _BV(0); /* Debug */ gpio_config(pin, OUTPUT_TIMER);