aboutsummaryrefslogtreecommitdiffstats
path: root/src/testapp1/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testapp1/main.c')
-rw-r--r--src/testapp1/main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/testapp1/main.c b/src/testapp1/main.c
index c266684..b305372 100644
--- a/src/testapp1/main.c
+++ b/src/testapp1/main.c
@@ -4,8 +4,11 @@
#include <avr/interrupt.h>
#include "delay.h"
+#include "morse.h"
+
#define PORTB_PTT (1 << 0)
+#define PORTB_LED (1 << 4)
volatile uint8_t Timer; /* Timer (100Hz increment) */
@@ -31,13 +34,12 @@ static int inittimer(void)
return 0;
}
-#define DIT_DURATION 100 // ms
#define PTT_LOGIC_LOW 0
#if PTT_LOGIC_LOW
void dah(void)
{
- PORTB = 0; // PTT is inverted logic
+ PORTB = PORTB_LED; // LED is non-inverted logic
delay_ms(3*DIT_DURATION);
PORTB = PORTB_PTT; // PTT is inverted logic
@@ -46,7 +48,7 @@ void dah(void)
void dit(void)
{
- PORTB = 0; // PTT is inverted logic
+ PORTB = PORTB_LED; // LED is non-inverted logic
delay_ms(DIT_DURATION);
PORTB = PORTB_PTT; // PTT is inverted logic
@@ -55,7 +57,7 @@ void dit(void)
#else
void dah(void)
{
- PORTB = PORTB_PTT;
+ PORTB = PORTB_PTT | PORTB_LED;
delay_ms(3*DIT_DURATION);
PORTB = 0;
@@ -64,7 +66,7 @@ void dah(void)
void dit(void)
{
- PORTB = PORTB_PTT;
+ PORTB = PORTB_PTT | PORTB_LED;
delay_ms(DIT_DURATION);
PORTB = 0;
@@ -72,21 +74,19 @@ void dit(void)
}
#endif
-#include "morse.c"
-
int main(void)
{
/* Enable PTT output on PB0 */
- PORTB = PORTB_PTT;
#if PTT_LOGIC_LOW
- DDRB = PORTB_PTT;
-#else
- DDRB = 0;
+ PORTB = PORTB_PTT;
#endif
+ /* LED is never inverted */
+ DDRB = PORTB_PTT | PORTB_LED;
/* initialise timer interrupt */
inittimer();
+ delay_ms(12*DIT_DURATION);
morse("HB9EGM");
delay_ms(12*DIT_DURATION);