mirror of
https://github.com/travisgoodspeed/goodwatch
synced 2024-11-21 23:58:31 +00:00
parent
d29ced3326
commit
2f155d2ebb
@ -7,7 +7,7 @@ BSL = ../bin/cc430-bsl.py
|
||||
modules=main.o lcd.o lcdtext.o rtc.o keypad.o apps.o sidebutton.o radio.o power.o \
|
||||
dmesg.o \
|
||||
libs/assembler.o
|
||||
apps= apps/clock.o apps/rpn.o apps/hex.o apps/stopwatch.o
|
||||
apps= apps/clock.o apps/rpn.o apps/hex.o apps/stopwatch.o apps/morse.c
|
||||
|
||||
all: goodwatch.hex
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "apps/stopwatch.h"
|
||||
#include "apps/rpn.h"
|
||||
#include "apps/hex.h"
|
||||
|
||||
#include "apps/morse.h"
|
||||
|
||||
/* For each application, the init() function is called at entry. The
|
||||
draw() function is called 4 times per second. The exit() function
|
||||
@ -23,6 +23,8 @@ static struct app apps[]={
|
||||
{.name="rpn calc", .init=rpn_init, .draw=rpn_draw, .exit=rpn_exit},
|
||||
//Hex Viewer.
|
||||
{.name="memory", .init=hex_init, .draw=hex_draw, .exit=hex_exit},
|
||||
//Radio Tool
|
||||
{.name="morse", .init=morse_init, .draw=morse_draw, .exit=morse_exit},
|
||||
|
||||
//End on null entry.
|
||||
{.name=0, .init=0, .draw=0, .exit=0}
|
||||
|
63
firmware/apps/morse.c
Normal file
63
firmware/apps/morse.c
Normal file
@ -0,0 +1,63 @@
|
||||
/*! \file morse.c
|
||||
\brief Handy morse code tool for 70cm.
|
||||
|
||||
This is a handy little application for playing with the radio. It
|
||||
will be modified to use radio interrupt callbacks in the future, and
|
||||
any particularly large or complicated radio tools should go in a
|
||||
different applet.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "api.h"
|
||||
|
||||
|
||||
//! Enter the radio tool.
|
||||
void morse_init(){
|
||||
/* Power management being king, we shouldn't initialize the radio
|
||||
until we need it, but for now we'll start it at entry to keep
|
||||
things simple.
|
||||
*/
|
||||
radio_init();
|
||||
}
|
||||
//! Exit the radio tool.
|
||||
int morse_exit(){
|
||||
/* Always turn the radio off at exit.
|
||||
*/
|
||||
radio_off();
|
||||
|
||||
//Allow the exit.
|
||||
return 0;
|
||||
}
|
||||
//! Draw the screen and increase the count.
|
||||
void morse_draw(){
|
||||
char ch=getchar();
|
||||
|
||||
switch(ch){
|
||||
case '7':
|
||||
lcd_string(" 73");
|
||||
radio_morse("--... ...-- ");
|
||||
break;
|
||||
case '1':
|
||||
lcd_string(" CQ");
|
||||
radio_morse("-.-. --.- ");
|
||||
break;
|
||||
case '0':
|
||||
lcd_string(" K");
|
||||
radio_morse("-.- ");
|
||||
break;
|
||||
|
||||
|
||||
case '/':
|
||||
/* TODO Replace this with a configurable callsign. */
|
||||
radio_morse("-.- -.- ....- ...- --.. ");
|
||||
lcd_string(" KK4VCZ");
|
||||
break;
|
||||
|
||||
default: //Show the callsign by default.
|
||||
lcd_string("RAD TOOL");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
11
firmware/apps/morse.h
Normal file
11
firmware/apps/morse.h
Normal file
@ -0,0 +1,11 @@
|
||||
/*! \file morse.h
|
||||
\brief Handy morse code tool for 70cm.
|
||||
|
||||
*/
|
||||
|
||||
//! Enter the radio tool.
|
||||
void morse_init();
|
||||
//! Exit the radio tool.
|
||||
int morse_exit();
|
||||
//! Draw the screen and increase the count.
|
||||
void morse_draw();
|
Loading…
Reference in New Issue
Block a user