-
Notifications
You must be signed in to change notification settings - Fork 2
/
LEDF103.F
73 lines (59 loc) · 1.41 KB
/
LEDF103.F
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
\ F103 BLUE PILL BLINK PC13
\ REFER TO STM PDF RM0008 FOR GPIO SETUPS
HEX
: BIT ( PIN# - BIT ) \ USED AS A GENERAL PORT MASK VALUE
1 SWAP LSHIFT ;
: CONF ( PIN# - MASK OFFSET ) \ USED FOR MODE AND CONFIG
4 * 20 /MOD
4 *
0F ROT LSHIFT
SWAP ;
\ MODE MASK FIRST THEN MODIFIERS
CCCCCCCC CONSTANT INMODE
33333333 CONSTANT OUT50
11111111 CONSTANT OUT10
22222222 CONSTANT OUT2
\ CONFIG MODIFIERS
\ INPUT MODIFIERS
: ANALOG 0 AND ;
: FLOAT 44444444 AND ;
: UP/DN 88888888 AND ;
\ OUTS TYPE MODIFIERS
: ALT 88888888 OR ;
: P/P ;
: DRAIN 44444444 OR ;
\ GPIO DATA PORTS OFFSETS
08 CONSTANT INPUT
10 CONSTANT S/R
0C CONSTANT OUTPUT
EXAMPLE TO PLAY WITH GREEN LED
DECIMAL
13 CONSTANT LED#
LED# BIT CONSTANT LED \ PORT MASK
OUT2 DRAIN LED# CONF PC+ MSK!
\ MODE MASK FIRST THEN MODIFIERS
\ CCCCCCCC CONSTANT INMODE
\ 33333333 CONSTANT OUT50
\ 11111111 CONSTANT OUT10
\ 22222222 CONSTANT OUT2
\ CONFIG MODIFIERS
\ INPUT MODIFIERS
\ : ANALOG 0 AND ;
\ : FLOAT 44444444 AND ;
\ : UP/DN 88888888 AND ;
\ OUTS TYPE MODIFIERS
\ : ALT 88888888 OR ;
\ : P/P ;
\ : DRAIN 44444444 OR ;
\ GPIO DATA PORTS OFFSETS
\ 08 CONSTANT INPUT
\ 10 CONSTANT S/R
\ 0C CONSTANT OUTPUT
\ EXAMPLE TO PLAY WITH GREEN LED
DECIMAL
13 CONSTANT LED#
LED# BIT CONSTANT LED \ PORT MASK
OUT2 DRAIN LED# CONF PC+ MSK!
HEX
: OFF LED 0 PC+ SET! ;
: ON LED 0 PC+ CLR! ;