-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratchpad.txt
58 lines (30 loc) · 1.83 KB
/
scratchpad.txt
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
I don't think i really 'get' the timing system, so doing a project fork to investigate this..
Todo:
need to generate some ways of creating the program - but the timings are all voltage/etc dependent (apart from the base program)
next challenge - set up the program/driver structure. THe sleep timings and concept works nicely.
on the concept of bounces - what happens if you have a bad bounce? you still need to do debouncing, fool.
consider if you flip the main switch, and it twiddles 50 times, you will get 50 state changes.
Fool.
Drop your OCRA and do better debounces. No debounce necessary for the interrupt switch as long as you have proper debounce on the rest (CPU wake and all)
might need to rethink any of the input read systems.. we could fire up TCCNT0?
A button read needs to be significantly faster than anything else out there.. oh, so we have a TCCNT0 which is just doing button polls and shoves the result in portXYZ state
Avail 'threads'
main
Timer2 (8bit)
Timer1 (16 bit)
Timer0 (8bit)
PCINT0/1/2 (not really a thread though)
main is woken by timer2. So timer2 is our primary heartbeat.
We use idle in main to do stuff..
a = 1010
b = 1011
f = 1111
3 = 0011
7 = 0111
8 = 1000
2 = 0010
d = 1101
Timer0 - runs constantly and deals with grabbing input data from the two (or however many) data switches we have. Get the timing right for the 12-bit thing. Any pin sense data must go here, because we can easily control the timing and how quickly we get the data off the signal pins
Timer1 - currently unused
Timer2 - ONLY thing that will wake the main thread. There's no such thing as a wake command.
Huh, funny, implications for atomicitiy - try make sure that the main thread only ever reads variables that could get munched in the ISRs. So allow the ISR to do all housekeeping (including flagging tick counters as exhausted!)