-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComms.spin
More file actions
92 lines (82 loc) · 1.66 KB
/
Comms.spin
File metadata and controls
92 lines (82 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
CON
_clkmode=xtal1+pll16x
_xinfreq=5_000_000
obj
serial : "FullDuplexSerial"
TC : "trackBallEx"
SC : "Screen"
SN : "Simple_Numbers"
str : "str3"
CL : "calendar"
var
byte details[30]
pub Init
serial.start(31,30,0,9600)
SC.Init
SC.MediaInit
pub ExportGPSSingle| dataByte
SC.SetSectorGPS
Transmit
DisplayMsg
pub ExportGPSTrack
SC.SetSectorGPSMap
Transmit
DisplayMsg
pub ImportCal | eventNum,day,month,year,buffer,count
eventNum:=serial.rx
day:=serial.rx
month:=serial.rx
year:=serial.rx
count:=0
repeat
buffer:=serial.rx
if buffer == $FF
quit
details[count]:=buffer
count++
buffer:=str.Combine(string(" "),@details)
serial.stop
SC.Clear
SC.Print(string("Calendar # "))
SC.Print(SN.dec(eventNum))
SC.Position(1,0)
SC.Print(SN.hex(day,2))
SC.Print(SN.hex(month,2))
SC.Print(SN.hex(year,2))
SC.Position(2,0)
SC.Print(buffer)
'Save that data
SC.MediaInit
case eventNum
0: SC.SetSectorCal0
1: SC.SetSectorCal1
2: SC.SetSectorCal2
3: SC.SetSectorCal3
4: SC.SetSectorCal4
SC.WriteByte(day)
SC.WriteByte(month)
SC.WriteByte(year)
SC.SaveStr(buffer)
SC.Flush
waitcnt(clkfreq+cnt)
SC.Clear
pub DelCal | num
num:=serial.rx
CL.DelCal(num)
SC.Clear
SC.Print(string("Caldendar "))
SC.Print(SN.dec(num))
SC.Print(string(" deleted"))
waitcnt(clkfreq+cnt)
SC.Clear
pri Transmit | dataByte
dataByte:=0
repeat until strcomp(dataByte,string("FF")) ==-1
dataByte:=SC.ReadByteAsString
serial.str(dataByte)
pri DisplayMsg
SC.Clear
SC.Position(0,0)
SC.Print(string("Export Complete"))
waitcnt(clkfreq+cnt)
waitcnt(clkfreq+cnt)