├── .gitignore
├── LICENSE
├── README.md
├── board
├── Pin_Header_Straight_1x05_Pitch2.54mm_SMD.kicad_mod
├── TinyFPGA-A-Programmer-cache.lib
├── TinyFPGA-A-Programmer.kicad_pcb
├── TinyFPGA-A-Programmer.net
├── TinyFPGA-A-Programmer.pdf
├── TinyFPGA-A-Programmer.pro
├── TinyFPGA-A-Programmer.sch
├── fp-lib-table
├── pic.lib
├── tinyfpga.lib
└── tinyfpga.pretty
│ ├── CDFN3225-4LD-PL-1.kicad_mod
│ ├── CM81.kicad_mod
│ ├── FCI-Micro-USB.kicad_mod
│ ├── Lattice-32QFN.kicad_mod
│ ├── Lattice-QFN-32_5x5mm_Pitch0.5mm.kicad_mod
│ ├── PTS_810_SMT_Switch.kicad_mod
│ ├── Pin_Header_Straight_1x05_Pitch2.54mm_SMD.kicad_mod
│ ├── SC-70-C5.kicad_mod
│ └── SOT23.kicad_mod
├── firmware
├── Makefile
├── config.mc3
├── dist
│ └── default
│ │ └── production
│ │ ├── firmware.production.cmf
│ │ ├── firmware.production.elf
│ │ ├── firmware.production.hex
│ │ ├── firmware.production.hxl
│ │ ├── firmware.production.lst
│ │ ├── firmware.production.map
│ │ ├── firmware.production.mum
│ │ ├── firmware.production.obj
│ │ ├── firmware.production.rlf
│ │ ├── firmware.production.sdb
│ │ ├── firmware.production.sym
│ │ └── memoryfile.xml
├── lc-switch.h
├── lc.h
├── main.c
├── mcc_generated_files
│ ├── interrupt_manager.c
│ ├── interrupt_manager.h
│ ├── mcc.c
│ ├── mcc.h
│ ├── pin_manager.c
│ ├── pin_manager.h
│ └── usb
│ │ ├── usb.h
│ │ ├── usb_ch9.h
│ │ ├── usb_common.h
│ │ ├── usb_descriptors.c
│ │ ├── usb_device.c
│ │ ├── usb_device.h
│ │ ├── usb_device_cdc.c
│ │ ├── usb_device_cdc.h
│ │ ├── usb_device_config.h
│ │ ├── usb_device_events.c
│ │ ├── usb_device_local.h
│ │ ├── usb_hal.h
│ │ ├── usb_hal_pic16f1.h
│ │ └── utilities
│ │ ├── Readme Signed Driver Package.txt
│ │ ├── USB - Obtaining a WHQL Certified USB Driver Package.pdf
│ │ ├── mchpcdc.cat
│ │ └── mchpcdc.inf
├── nbproject
│ ├── Makefile-default.mk
│ ├── Makefile-genesis.properties
│ ├── Makefile-impl.mk
│ ├── Makefile-local-default.mk
│ ├── Makefile-variables.mk
│ ├── Package-default.bash
│ ├── configurations.xml
│ ├── private
│ │ ├── SuppressibleMessageMemo.properties
│ │ └── configurations.xml
│ └── project.xml
└── pt.h
├── pyproject.toml
├── python
└── tinyfpgaa
│ ├── __init__.py
│ ├── tinyfpgaa.py
│ └── tinyproga.py
├── setup.cfg
└── setup.py
/.gitignore:
--------------------------------------------------------------------------------
1 | *_Implmnt/
2 | stdout.log
3 | synlog.tcl
4 | *~
5 | *.swp
6 | *bak
7 | gerbers/
8 |
9 | # Python ignores
10 | build/
11 | /dist/
12 | *.pyc
13 | tinyfpgaa.egg-info/
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TinyFPGA Programmer
2 | The TinyFPGA Programmer is a very simple USB-JTAG bridge designed to
3 | program bitstreams onto TinyFPGA A1 and A2 boards.
4 |
5 | ## Serial Protocol
6 | The programmer firmware appears as a generic USB serial port when you connect it
7 | to a computer. Control of the GPIO pins on the programmer is through this simple
8 | serial interface.
9 |
10 | ### Command Format
11 | Commands are encoded as 8-bit bytes with a command type field and data payload.
12 | The payload is typically a 6-bit bitmap representing the GPIO pins of the programmer.
13 |
14 | | 7:6 | 5 | 4 | 3 | 2 | 1 | 0 |
15 | |--------------|---|---|---|---|---|---|
16 | | Command Type |TMS|TCK|TDI|TDO|RC1|RC0|
17 |
18 | ### Commands
19 |
20 | |Opcode | Command |
21 | |-------|-------------------------------|
22 | | 0 | Configure Input/Output |
23 | | 1 | Extended Command (Unused) |
24 | | 2 | Set Outputs |
25 | | 3 | Set Outputs and Sample Inputs |
26 |
27 | #### Configure Input/Output
28 | For each of the GPIO pins, set the direction of the pin.
29 | * 1: Set GPIO pin n to INPUT
30 | * 0: Set GPIO pin n to OUTPUT
31 |
32 | #### Extended Command
33 | Reserved for future command expansion.
34 |
35 | #### Set Outputs
36 | Set each of the output pins to the given values.
37 |
38 | #### Set Outputs and Sample Inputs
39 | Set each of the output pins to the given values and return a byte representing
40 | the current values of the input pins.
41 |
42 | ### General Usage
43 | For serial interfaces like JTAG this protocol divides the maximum possible bandwidth
44 | by 8 from the USB to JTAG interface. This means we might get 0.5MHz JTAG programming speed.
45 | That speed is actually fast enough to transfer all the data to the FPGA in a few seconds. However
46 | the configuration flash on the FPGA actually needs a fair bit of time after erase and write operations
47 | that will slow down the programming operatuon.
48 |
49 | What can really slow down programming is the turnaround time for reading back data from the FPGA.
50 | For the most part data is going in one direction from the host computer to the programmer to the FPGA.
51 | For these cases we can use the `Set Outputs` command and not wait for any data to return. However
52 | there are times when we may need to poll a status bit to see if the FPGA has finished an erase or
53 | write operation. In this cases we will want to also sample the inputs and check the status. These
54 | should not be timing sensitive because the FPGA is already busy.
55 |
56 | Verifying the configuration data on the other hand could take a long time if not done carefully. The
57 | application talking to the programmer should make sure to write as many commands as it can before attempting
58 | to read back the data from the serial interface. Rather than paying a penalty for the turnaround time on
59 | every read bit, we pay for it after reading dozens of bytes. This should allow read-back of the configuration
60 | data to be relatively quick and painless.
61 |
62 | ## Status
63 | The project is currently in progress. Initial schematic and PCBs have
64 | been designed along with firmware for the USB microcontroller. The PCBs
65 | have been received from OSH Park and programmed with the firwmware.
66 |
67 | The biggest task left is still developing the Python libraries for interfacing
68 | with the firmware and driving the JTAG interface and is currently in progress.
69 |
--------------------------------------------------------------------------------
/board/Pin_Header_Straight_1x05_Pitch2.54mm_SMD.kicad_mod:
--------------------------------------------------------------------------------
1 | (module Pin_Headers:Pin_Header_Straight_1x05_Pitch2.54mm_SMD_Pin1Left (layer F.Cu) (tedit 59ADD615)
2 | (descr "surface-mounted straight pin header, 1x05, 2.54mm pitch, single row, style 1 (pin 1 left)")
3 | (tags "Surface mounted pin header SMD 1x05 2.54mm single row style1 pin1 left")
4 | (attr smd)
5 | (fp_text reference J2 (at 0 0 90) (layer F.Fab) hide
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_text value Pin_Header_Straight_1x05_Pitch2.54mm_SMD_Pin1Left (at 0.635 0 90) (layer F.Fab)
9 | (effects (font (size 0.2 0.2) (thickness 0.05)))
10 | )
11 | (fp_line (start 1.27 6.35) (end -1.27 6.35) (layer F.Fab) (width 0.1))
12 | (fp_line (start -0.32 -6.35) (end 1.27 -6.35) (layer F.Fab) (width 0.1))
13 | (fp_line (start -1.27 6.35) (end -1.27 -5.4) (layer F.Fab) (width 0.1))
14 | (fp_line (start -1.27 -5.4) (end -0.32 -6.35) (layer F.Fab) (width 0.1))
15 | (fp_line (start 1.27 -6.35) (end 1.27 6.35) (layer F.Fab) (width 0.1))
16 | (fp_line (start -3.45 -6.85) (end -3.45 6.85) (layer F.CrtYd) (width 0.05))
17 | (fp_line (start -3.45 6.85) (end 3.45 6.85) (layer F.CrtYd) (width 0.05))
18 | (fp_line (start 3.45 6.85) (end 3.45 -6.85) (layer F.CrtYd) (width 0.05))
19 | (fp_line (start 3.45 -6.85) (end -3.45 -6.85) (layer F.CrtYd) (width 0.05))
20 | (fp_text user %R (at 0 0 90) (layer F.Fab)
21 | (effects (font (size 1 1) (thickness 0.15)))
22 | )
23 | (pad 1 smd rect (at 0 -5.08) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
24 | (pad 3 smd rect (at 0 0) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
25 | (pad 5 smd rect (at 0 5.08) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
26 | (pad 2 smd rect (at 0 -2.54) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
27 | (pad 4 smd rect (at 0 2.54) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
28 | (model ${KISYS3DMOD}/Pin_Headers.3dshapes/Pin_Header_Straight_1x05_Pitch2.54mm_SMD_Pin1Left.wrl
29 | (at (xyz 0 0 0))
30 | (scale (xyz 1 1 1))
31 | (rotate (xyz 0 0 0))
32 | )
33 | )
34 |
--------------------------------------------------------------------------------
/board/TinyFPGA-A-Programmer-cache.lib:
--------------------------------------------------------------------------------
1 | EESchema-LIBRARY Version 2.3
2 | #encoding utf-8
3 | #
4 | # +3V3
5 | #
6 | DEF +3V3 #PWR 0 0 Y Y 1 F P
7 | F0 "#PWR" 0 -150 50 H I C CNN
8 | F1 "+3V3" 0 140 50 H V C CNN
9 | F2 "" 0 0 50 H I C CNN
10 | F3 "" 0 0 50 H I C CNN
11 | ALIAS +3.3V
12 | DRAW
13 | P 2 0 1 0 -30 50 0 100 N
14 | P 2 0 1 0 0 0 0 100 N
15 | P 2 0 1 0 0 100 30 50 N
16 | X +3V3 1 0 0 0 U 50 50 1 1 W N
17 | ENDDRAW
18 | ENDDEF
19 | #
20 | # +5V
21 | #
22 | DEF +5V #PWR 0 0 Y Y 1 F P
23 | F0 "#PWR" 0 -150 50 H I C CNN
24 | F1 "+5V" 0 140 50 H V C CNN
25 | F2 "" 0 0 50 H I C CNN
26 | F3 "" 0 0 50 H I C CNN
27 | DRAW
28 | P 2 0 1 0 -30 50 0 100 N
29 | P 2 0 1 0 0 0 0 100 N
30 | P 2 0 1 0 0 100 30 50 N
31 | X +5V 1 0 0 0 U 50 50 1 1 W N
32 | ENDDRAW
33 | ENDDEF
34 | #
35 | # C
36 | #
37 | DEF C C 0 10 N Y 1 F N
38 | F0 "C" 25 100 50 H V L CNN
39 | F1 "C" 25 -100 50 H V L CNN
40 | F2 "" 38 -150 50 H I C CNN
41 | F3 "" 0 0 50 H I C CNN
42 | $FPLIST
43 | C_*
44 | $ENDFPLIST
45 | DRAW
46 | P 2 0 1 20 -80 -30 80 -30 N
47 | P 2 0 1 20 -80 30 80 30 N
48 | X ~ 1 0 150 110 D 50 50 1 1 P
49 | X ~ 2 0 -150 110 U 50 50 1 1 P
50 | ENDDRAW
51 | ENDDEF
52 | #
53 | # CONN_01X05
54 | #
55 | DEF CONN_01X05 J 0 40 Y N 1 F N
56 | F0 "J" 0 300 50 H V C CNN
57 | F1 "CONN_01X05" 100 0 50 V V C CNN
58 | F2 "" 0 0 50 H I C CNN
59 | F3 "" 0 0 50 H I C CNN
60 | $FPLIST
61 | Pin_Header_Straight_1X*
62 | Pin_Header_Angled_1X*
63 | Socket_Strip_Straight_1X*
64 | Socket_Strip_Angled_1X*
65 | $ENDFPLIST
66 | DRAW
67 | S -50 -195 10 -205 0 1 0 N
68 | S -50 -95 10 -105 0 1 0 N
69 | S -50 5 10 -5 0 1 0 N
70 | S -50 105 10 95 0 1 0 N
71 | S -50 205 10 195 0 1 0 N
72 | S -50 250 50 -250 0 1 0 N
73 | X P1 1 -200 200 150 R 50 50 1 1 P
74 | X P2 2 -200 100 150 R 50 50 1 1 P
75 | X P3 3 -200 0 150 R 50 50 1 1 P
76 | X P4 4 -200 -100 150 R 50 50 1 1 P
77 | X P5 5 -200 -200 150 R 50 50 1 1 P
78 | ENDDRAW
79 | ENDDEF
80 | #
81 | # CONN_01X06
82 | #
83 | DEF CONN_01X06 J 0 40 Y N 1 F N
84 | F0 "J" 0 350 50 H V C CNN
85 | F1 "CONN_01X06" 100 0 50 V V C CNN
86 | F2 "" 0 0 50 H I C CNN
87 | F3 "" 0 0 50 H I C CNN
88 | $FPLIST
89 | Pin_Header_Straight_1X*
90 | Pin_Header_Angled_1X*
91 | Socket_Strip_Straight_1X*
92 | Socket_Strip_Angled_1X*
93 | $ENDFPLIST
94 | DRAW
95 | S -50 -245 10 -255 0 1 0 N
96 | S -50 -145 10 -155 0 1 0 N
97 | S -50 -45 10 -55 0 1 0 N
98 | S -50 55 10 45 0 1 0 N
99 | S -50 155 10 145 0 1 0 N
100 | S -50 255 10 245 0 1 0 N
101 | S -50 300 50 -300 0 1 0 N
102 | X P1 1 -200 250 150 R 50 50 1 1 P
103 | X P2 2 -200 150 150 R 50 50 1 1 P
104 | X P3 3 -200 50 150 R 50 50 1 1 P
105 | X P4 4 -200 -50 150 R 50 50 1 1 P
106 | X P5 5 -200 -150 150 R 50 50 1 1 P
107 | X P6 6 -200 -250 150 R 50 50 1 1 P
108 | ENDDRAW
109 | ENDDEF
110 | #
111 | # GND
112 | #
113 | DEF GND #PWR 0 0 Y Y 1 F P
114 | F0 "#PWR" 0 -250 50 H I C CNN
115 | F1 "GND" 0 -150 50 H V C CNN
116 | F2 "" 0 0 50 H I C CNN
117 | F3 "" 0 0 50 H I C CNN
118 | DRAW
119 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
120 | X GND 1 0 0 0 D 50 50 1 1 W N
121 | ENDDRAW
122 | ENDDEF
123 | #
124 | # MIC5504-3.3YM5-TR
125 | #
126 | DEF MIC5504-3.3YM5-TR U 0 40 Y Y 1 L N
127 | F0 "U" 200 250 60 H V L CNN
128 | F1 "MIC5504-3.3YM5-TR" 200 150 60 H V L CNN
129 | F2 "" 0 0 60 H I C CNN
130 | F3 "" 0 0 60 H I C CNN
131 | DRAW
132 | S 200 100 1000 -500 1 1 12 N
133 | X VIN 1 0 0 200 R 50 50 1 1 B
134 | X GND 2 600 -700 200 U 50 50 1 1 B
135 | X EN 3 0 -100 200 R 50 50 1 1 B
136 | X NC 4 1200 0 200 L 50 50 1 1 B
137 | X VOUT 5 1200 -100 200 L 50 50 1 1 B
138 | ENDDRAW
139 | ENDDEF
140 | #
141 | # PIC16F1455-QFN16
142 | #
143 | DEF PIC16F1455-QFN16 U 0 40 Y Y 1 L N
144 | F0 "U" 150 250 60 H V R CNN
145 | F1 "PIC16F1455-QFN16" 150 150 60 H V R CNN
146 | F2 "" 0 0 60 H I C CNN
147 | F3 "" 0 0 60 H I C CNN
148 | DRAW
149 | S 200 800 2100 -1100 1 1 12 N
150 | X RA5 1 0 0 200 R 50 50 1 1 B
151 | X RA4 2 0 -100 200 R 50 50 1 1 B
152 | X !MCLR 3 0 -200 200 R 50 50 1 1 B
153 | X RC5 4 0 -300 200 R 50 50 1 1 B
154 | X RC4 5 1000 -1300 200 U 50 50 1 1 B
155 | X RC3 6 1100 -1300 200 U 50 50 1 1 B
156 | X RC2 7 1200 -1300 200 U 50 50 1 1 B
157 | X ICSPCLK/RC1 8 1300 -1300 200 U 50 50 1 1 B
158 | X ICSPDAT/RC0 9 2300 -300 200 L 50 50 1 1 B
159 | X VUSB3V3 10 2300 -200 200 L 50 50 1 1 B
160 | X DN 11 2300 -100 200 L 50 50 1 1 B
161 | X DP 12 2300 0 200 L 50 50 1 1 B
162 | X Vss 13 1200 1000 200 D 50 50 1 1 B
163 | X Vdd 16 1100 1000 200 D 50 50 1 1 B
164 | ENDDRAW
165 | ENDDEF
166 | #
167 | # TEST
168 | #
169 | DEF TEST TP 0 40 N N 1 F N
170 | F0 "TP" 0 300 50 H V C BNN
171 | F1 "TEST" 0 250 50 H V C CNN
172 | F2 "" 0 0 50 H I C CNN
173 | F3 "" 0 0 50 H I C CNN
174 | DRAW
175 | P 6 0 1 0 0 200 -50 150 0 100 50 150 0 200 0 200 N
176 | X ~ 1 0 0 100 U 50 50 1 1 P
177 | ENDDRAW
178 | ENDDEF
179 | #
180 | # USB_OTG
181 | #
182 | DEF USB_OTG J 0 40 Y Y 1 F N
183 | F0 "J" -200 450 50 H V L CNN
184 | F1 "USB_OTG" -200 350 50 H V L CNN
185 | F2 "" 150 -50 50 H I C CNN
186 | F3 "" 150 -50 50 H I C CNN
187 | $FPLIST
188 | USB*
189 | $ENDFPLIST
190 | DRAW
191 | C -150 85 25 0 1 10 F
192 | C -25 135 15 0 1 10 F
193 | S -200 -300 200 300 0 1 10 f
194 | S -5 -300 5 -270 0 1 0 N
195 | S 10 50 -20 20 0 1 10 F
196 | S 200 -205 170 -195 0 1 0 N
197 | S 200 -105 170 -95 0 1 0 N
198 | S 200 -5 170 5 0 1 0 N
199 | S 200 195 170 205 0 1 0 N
200 | P 2 0 1 10 -75 85 25 85 N
201 | P 4 0 1 10 -125 85 -100 85 -50 135 -25 135 N
202 | P 4 0 1 10 -100 85 -75 85 -50 35 0 35 N
203 | P 4 0 1 10 25 110 25 60 75 85 25 110 F
204 | P 5 0 1 0 -170 220 -70 220 -80 190 -160 190 -170 220 F
205 | P 9 0 1 0 -185 230 -185 220 -175 190 -175 180 -65 180 -65 190 -55 220 -55 230 -185 230 N
206 | X VBUS 1 300 200 100 L 50 50 1 1 W
207 | X D- 2 300 -100 100 L 50 50 1 1 P
208 | X D+ 3 300 0 100 L 50 50 1 1 P
209 | X ID 4 300 -200 100 L 50 50 1 1 P
210 | X GND 5 0 -400 100 U 50 50 1 1 W
211 | X Shield 6 -100 -400 100 U 50 50 1 1 P
212 | ENDDRAW
213 | ENDDEF
214 | #
215 | #End Library
216 |
--------------------------------------------------------------------------------
/board/TinyFPGA-A-Programmer.net:
--------------------------------------------------------------------------------
1 | (export (version D)
2 | (design
3 | (source C:/Users/lvale/Documents/TinyFPGA/repos/TinyFPGA-A-Programmer/board/TinyFPGA-A-Programmer.sch)
4 | (date "9/4/2017 8:57:31 PM")
5 | (tool "Eeschema 4.0.6")
6 | (sheet (number 1) (name /) (tstamps /)
7 | (title_block
8 | (title)
9 | (company)
10 | (rev)
11 | (date)
12 | (source TinyFPGA-A-Programmer.sch)
13 | (comment (number 1) (value ""))
14 | (comment (number 2) (value ""))
15 | (comment (number 3) (value ""))
16 | (comment (number 4) (value "")))))
17 | (components
18 | (comp (ref U1)
19 | (value PIC16F1455-QFN16)
20 | (footprint Housings_DFN_QFN:QFN-16-1EP_4x4mm_Pitch0.65mm)
21 | (libsource (lib pic) (part PIC16F1455-QFN16))
22 | (sheetpath (names /) (tstamps /))
23 | (tstamp 598405FB))
24 | (comp (ref U2)
25 | (value MIC5504-3.3YM5-TR)
26 | (footprint TinyFPGA:SOT23)
27 | (libsource (lib tinyfpga) (part MIC5504-3.3YM5-TR))
28 | (sheetpath (names /) (tstamps /))
29 | (tstamp 5984065C))
30 | (comp (ref C1)
31 | (value 1uF)
32 | (footprint Capacitors_SMD:C_0603)
33 | (libsource (lib device) (part C))
34 | (sheetpath (names /) (tstamps /))
35 | (tstamp 5984091E))
36 | (comp (ref C2)
37 | (value 1uF)
38 | (footprint Capacitors_SMD:C_0603)
39 | (libsource (lib device) (part C))
40 | (sheetpath (names /) (tstamps /))
41 | (tstamp 59840991))
42 | (comp (ref C4)
43 | (value 1uF)
44 | (footprint Capacitors_SMD:C_0603)
45 | (libsource (lib device) (part C))
46 | (sheetpath (names /) (tstamps /))
47 | (tstamp 598409EE))
48 | (comp (ref C3)
49 | (value 100nF)
50 | (footprint Capacitors_SMD:C_0603)
51 | (libsource (lib device) (part C))
52 | (sheetpath (names /) (tstamps /))
53 | (tstamp 59840AB1))
54 | (comp (ref J2)
55 | (value JTAG)
56 | (footprint Pin_Headers:Pin_Header_Straight_1x05_Pitch2.54mm)
57 | (libsource (lib conn) (part CONN_01X05))
58 | (sheetpath (names /) (tstamps /))
59 | (tstamp 598412AC))
60 | (comp (ref J1)
61 | (value USB)
62 | (footprint TinyFPGA:FCI-Micro-USB)
63 | (libsource (lib conn) (part USB_OTG))
64 | (sheetpath (names /) (tstamps /))
65 | (tstamp 598417AF))
66 | (comp (ref J3)
67 | (value ICSP)
68 | (footprint Pin_Headers:Pin_Header_Straight_1x06_Pitch2.54mm)
69 | (libsource (lib conn) (part CONN_01X06))
70 | (sheetpath (names /) (tstamps /))
71 | (tstamp 59841999))
72 | (comp (ref J4)
73 | (value CONN_01X06)
74 | (footprint Pin_Headers:Pin_Header_Straight_1x06_Pitch2.54mm)
75 | (libsource (lib conn) (part CONN_01X06))
76 | (sheetpath (names /) (tstamps /))
77 | (tstamp 59ADF270))
78 | (comp (ref TP3)
79 | (value TEST)
80 | (footprint Measurement_Points:Measurement_Point_Round-SMD-Pad_Big)
81 | (libsource (lib device) (part TEST))
82 | (sheetpath (names /) (tstamps /))
83 | (tstamp 59AE1FC1))
84 | (comp (ref TP1)
85 | (value TEST)
86 | (footprint Measurement_Points:Measurement_Point_Round-SMD-Pad_Big)
87 | (libsource (lib device) (part TEST))
88 | (sheetpath (names /) (tstamps /))
89 | (tstamp 59AE210A))
90 | (comp (ref TP2)
91 | (value TEST)
92 | (footprint Measurement_Points:Measurement_Point_Round-SMD-Pad_Big)
93 | (libsource (lib device) (part TEST))
94 | (sheetpath (names /) (tstamps /))
95 | (tstamp 59AE214D)))
96 | (libparts
97 | (libpart (lib device) (part C)
98 | (description "Unpolarized capacitor")
99 | (footprints
100 | (fp C_*))
101 | (fields
102 | (field (name Reference) C)
103 | (field (name Value) C))
104 | (pins
105 | (pin (num 1) (name ~) (type passive))
106 | (pin (num 2) (name ~) (type passive))))
107 | (libpart (lib conn) (part CONN_01X05)
108 | (description "Connector, single row, 01x05, pin header")
109 | (footprints
110 | (fp Pin_Header_Straight_1X*)
111 | (fp Pin_Header_Angled_1X*)
112 | (fp Socket_Strip_Straight_1X*)
113 | (fp Socket_Strip_Angled_1X*))
114 | (fields
115 | (field (name Reference) J)
116 | (field (name Value) CONN_01X05))
117 | (pins
118 | (pin (num 1) (name P1) (type passive))
119 | (pin (num 2) (name P2) (type passive))
120 | (pin (num 3) (name P3) (type passive))
121 | (pin (num 4) (name P4) (type passive))
122 | (pin (num 5) (name P5) (type passive))))
123 | (libpart (lib conn) (part CONN_01X06)
124 | (description "Connector, single row, 01x06, pin header")
125 | (footprints
126 | (fp Pin_Header_Straight_1X*)
127 | (fp Pin_Header_Angled_1X*)
128 | (fp Socket_Strip_Straight_1X*)
129 | (fp Socket_Strip_Angled_1X*))
130 | (fields
131 | (field (name Reference) J)
132 | (field (name Value) CONN_01X06))
133 | (pins
134 | (pin (num 1) (name P1) (type passive))
135 | (pin (num 2) (name P2) (type passive))
136 | (pin (num 3) (name P3) (type passive))
137 | (pin (num 4) (name P4) (type passive))
138 | (pin (num 5) (name P5) (type passive))
139 | (pin (num 6) (name P6) (type passive))))
140 | (libpart (lib tinyfpga) (part MIC5504-3.3YM5-TR)
141 | (fields
142 | (field (name Reference) U)
143 | (field (name Value) MIC5504-3.3YM5-TR))
144 | (pins
145 | (pin (num 1) (name VIN) (type BiDi))
146 | (pin (num 2) (name GND) (type BiDi))
147 | (pin (num 3) (name EN) (type BiDi))
148 | (pin (num 4) (name NC) (type BiDi))
149 | (pin (num 5) (name VOUT) (type BiDi))))
150 | (libpart (lib pic) (part PIC16F1455-QFN16)
151 | (fields
152 | (field (name Reference) U)
153 | (field (name Value) PIC16F1455-QFN16))
154 | (pins
155 | (pin (num 1) (name RA5) (type BiDi))
156 | (pin (num 2) (name RA4) (type BiDi))
157 | (pin (num 3) (name !MCLR) (type BiDi))
158 | (pin (num 4) (name RC5) (type BiDi))
159 | (pin (num 5) (name RC4) (type BiDi))
160 | (pin (num 6) (name RC3) (type BiDi))
161 | (pin (num 7) (name RC2) (type BiDi))
162 | (pin (num 8) (name ICSPCLK/RC1) (type BiDi))
163 | (pin (num 9) (name ICSPDAT/RC0) (type BiDi))
164 | (pin (num 10) (name VUSB3V3) (type BiDi))
165 | (pin (num 11) (name DN) (type BiDi))
166 | (pin (num 12) (name DP) (type BiDi))
167 | (pin (num 13) (name Vss) (type BiDi))
168 | (pin (num 16) (name Vdd) (type BiDi))))
169 | (libpart (lib device) (part TEST)
170 | (description "Testpoint, connection for test equipment")
171 | (fields
172 | (field (name Reference) TP)
173 | (field (name Value) TEST))
174 | (pins
175 | (pin (num 1) (name ~) (type passive))))
176 | (libpart (lib conn) (part USB_OTG)
177 | (description "USB mini/micro connector")
178 | (footprints
179 | (fp USB*))
180 | (fields
181 | (field (name Reference) J)
182 | (field (name Value) USB_OTG))
183 | (pins
184 | (pin (num 1) (name VBUS) (type power_in))
185 | (pin (num 2) (name D-) (type passive))
186 | (pin (num 3) (name D+) (type passive))
187 | (pin (num 4) (name ID) (type passive))
188 | (pin (num 5) (name GND) (type power_in))
189 | (pin (num 6) (name Shield) (type passive)))))
190 | (libraries
191 | (library (logical device)
192 | (uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\device.lib"))
193 | (library (logical conn)
194 | (uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\conn.lib"))
195 | (library (logical pic)
196 | (uri C:\Users\lvale\Documents\TinyFPGA\repos\TinyFPGA-A-Programmer\board\pic.lib))
197 | (library (logical tinyfpga)
198 | (uri C:\Users\lvale\Documents\TinyFPGA\repos\TinyFPGA-A-Programmer\board\tinyfpga.lib)))
199 | (nets
200 | (net (code 1) (name GND)
201 | (node (ref J1) (pin 5))
202 | (node (ref C1) (pin 2))
203 | (node (ref J1) (pin 6))
204 | (node (ref C3) (pin 2))
205 | (node (ref J3) (pin 3))
206 | (node (ref C4) (pin 1))
207 | (node (ref C2) (pin 2))
208 | (node (ref J4) (pin 1))
209 | (node (ref J2) (pin 4))
210 | (node (ref U2) (pin 2))
211 | (node (ref U1) (pin 13)))
212 | (net (code 2) (name ICSPDAT)
213 | (node (ref U1) (pin 9))
214 | (node (ref J4) (pin 5))
215 | (node (ref J3) (pin 4)))
216 | (net (code 3) (name ICSPCLK)
217 | (node (ref J3) (pin 5))
218 | (node (ref U1) (pin 8))
219 | (node (ref J4) (pin 6)))
220 | (net (code 4) (name VPP)
221 | (node (ref J3) (pin 1))
222 | (node (ref U1) (pin 3)))
223 | (net (code 5) (name "Net-(J3-Pad6)")
224 | (node (ref J3) (pin 6)))
225 | (net (code 6) (name +3V3)
226 | (node (ref U1) (pin 16))
227 | (node (ref U2) (pin 4))
228 | (node (ref U2) (pin 5))
229 | (node (ref J3) (pin 2))
230 | (node (ref C2) (pin 1))
231 | (node (ref C3) (pin 1))
232 | (node (ref J4) (pin 2)))
233 | (net (code 7) (name "Net-(J1-Pad4)")
234 | (node (ref J1) (pin 4)))
235 | (net (code 8) (name +5V)
236 | (node (ref U2) (pin 3))
237 | (node (ref C1) (pin 1))
238 | (node (ref U2) (pin 1))
239 | (node (ref J1) (pin 1))
240 | (node (ref TP3) (pin 1)))
241 | (net (code 9) (name RA5)
242 | (node (ref J4) (pin 3))
243 | (node (ref U1) (pin 1)))
244 | (net (code 10) (name RA4)
245 | (node (ref J4) (pin 4))
246 | (node (ref U1) (pin 2)))
247 | (net (code 11) (name "Net-(J1-Pad3)")
248 | (node (ref U1) (pin 12))
249 | (node (ref J1) (pin 3))
250 | (node (ref TP1) (pin 1)))
251 | (net (code 12) (name "Net-(J1-Pad2)")
252 | (node (ref J1) (pin 2))
253 | (node (ref U1) (pin 11))
254 | (node (ref TP2) (pin 1)))
255 | (net (code 13) (name "Net-(C4-Pad2)")
256 | (node (ref U1) (pin 10))
257 | (node (ref C4) (pin 2)))
258 | (net (code 14) (name "Net-(J2-Pad1)")
259 | (node (ref J2) (pin 1))
260 | (node (ref U1) (pin 4)))
261 | (net (code 15) (name "Net-(J2-Pad5)")
262 | (node (ref J2) (pin 5))
263 | (node (ref U1) (pin 7)))
264 | (net (code 16) (name "Net-(J2-Pad2)")
265 | (node (ref U1) (pin 5))
266 | (node (ref J2) (pin 2)))
267 | (net (code 17) (name "Net-(J2-Pad3)")
268 | (node (ref U1) (pin 6))
269 | (node (ref J2) (pin 3)))))
--------------------------------------------------------------------------------
/board/TinyFPGA-A-Programmer.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinyfpga/TinyFPGA-A-Programmer/108b9ea165499d14b3ebf5a4cbf1396d4721737e/board/TinyFPGA-A-Programmer.pdf
--------------------------------------------------------------------------------
/board/TinyFPGA-A-Programmer.pro:
--------------------------------------------------------------------------------
1 | update=8/4/2017 10:07:57 PM
2 | version=1
3 | last_client=kicad
4 | [pcbnew]
5 | version=1
6 | LastNetListRead=
7 | UseCmpFile=1
8 | PadDrill=0.600000000000
9 | PadDrillOvalY=0.600000000000
10 | PadSizeH=1.500000000000
11 | PadSizeV=1.500000000000
12 | PcbTextSizeV=1.500000000000
13 | PcbTextSizeH=1.500000000000
14 | PcbTextThickness=0.300000000000
15 | ModuleTextSizeV=1.000000000000
16 | ModuleTextSizeH=1.000000000000
17 | ModuleTextSizeThickness=0.150000000000
18 | SolderMaskClearance=0.000000000000
19 | SolderMaskMinWidth=0.000000000000
20 | DrawSegmentWidth=0.200000000000
21 | BoardOutlineThickness=0.100000000000
22 | ModuleOutlineThickness=0.150000000000
23 | [cvpcb]
24 | version=1
25 | NetIExt=net
26 | [eeschema]
27 | version=1
28 | LibDir=
29 | [eeschema/libraries]
30 | LibName1=power
31 | LibName2=device
32 | LibName3=transistors
33 | LibName4=conn
34 | LibName5=linear
35 | LibName6=regul
36 | LibName7=74xx
37 | LibName8=cmos4000
38 | LibName9=adc-dac
39 | LibName10=memory
40 | LibName11=xilinx
41 | LibName12=microcontrollers
42 | LibName13=dsp
43 | LibName14=microchip
44 | LibName15=analog_switches
45 | LibName16=motorola
46 | LibName17=texas
47 | LibName18=intel
48 | LibName19=audio
49 | LibName20=interface
50 | LibName21=digital-audio
51 | LibName22=philips
52 | LibName23=display
53 | LibName24=cypress
54 | LibName25=siliconi
55 | LibName26=opto
56 | LibName27=atmel
57 | LibName28=contrib
58 | LibName29=valves
59 | LibName30=pic
60 | LibName31=tinyfpga
61 | [general]
62 | version=1
63 |
--------------------------------------------------------------------------------
/board/TinyFPGA-A-Programmer.sch:
--------------------------------------------------------------------------------
1 | EESchema Schematic File Version 2
2 | LIBS:power
3 | LIBS:device
4 | LIBS:transistors
5 | LIBS:conn
6 | LIBS:linear
7 | LIBS:regul
8 | LIBS:74xx
9 | LIBS:cmos4000
10 | LIBS:adc-dac
11 | LIBS:memory
12 | LIBS:xilinx
13 | LIBS:microcontrollers
14 | LIBS:dsp
15 | LIBS:microchip
16 | LIBS:analog_switches
17 | LIBS:motorola
18 | LIBS:texas
19 | LIBS:intel
20 | LIBS:audio
21 | LIBS:interface
22 | LIBS:digital-audio
23 | LIBS:philips
24 | LIBS:display
25 | LIBS:cypress
26 | LIBS:siliconi
27 | LIBS:opto
28 | LIBS:atmel
29 | LIBS:contrib
30 | LIBS:valves
31 | LIBS:pic
32 | LIBS:tinyfpga
33 | LIBS:TinyFPGA-A-Programmer-cache
34 | EELAYER 25 0
35 | EELAYER END
36 | $Descr A4 11693 8268
37 | encoding utf-8
38 | Sheet 1 1
39 | Title "TinyFPGA Programmer"
40 | Date "2017-10-05"
41 | Rev "v1.1"
42 | Comp "TinyFPGA"
43 | Comment1 ""
44 | Comment2 ""
45 | Comment3 ""
46 | Comment4 ""
47 | $EndDescr
48 | $Comp
49 | L PIC16F1455-QFN16 U1
50 | U 1 1 598405FB
51 | P 2000 4400
52 | F 0 "U1" H 3200 4550 60 0000 R CNN
53 | F 1 "PIC16F1455-QFN16" H 3600 4400 60 0000 R CNN
54 | F 2 "Housings_DFN_QFN:QFN-16-1EP_4x4mm_Pitch0.65mm" H 2000 4400 60 0001 C CNN
55 | F 3 "" H 2000 4400 60 0001 C CNN
56 | 1 2000 4400
57 | 1 0 0 -1
58 | $EndComp
59 | $Comp
60 | L MIC5504-3.3YM5-TR U2
61 | U 1 1 5984065C
62 | P 2350 1300
63 | F 0 "U2" H 2550 1550 60 0000 L CNN
64 | F 1 "MIC5504-3.3YM5-TR" H 2550 1450 60 0000 L CNN
65 | F 2 "TinyFPGA:SOT23" H 2350 1300 60 0001 C CNN
66 | F 3 "" H 2350 1300 60 0001 C CNN
67 | 1 2350 1300
68 | 1 0 0 -1
69 | $EndComp
70 | $Comp
71 | L C C1
72 | U 1 1 5984091E
73 | P 1950 1550
74 | F 0 "C1" H 1975 1650 50 0000 L CNN
75 | F 1 "1uF" H 1975 1450 50 0000 L CNN
76 | F 2 "Capacitors_SMD:C_0603" H 1988 1400 50 0001 C CNN
77 | F 3 "" H 1950 1550 50 0001 C CNN
78 | 1 1950 1550
79 | 1 0 0 -1
80 | $EndComp
81 | $Comp
82 | L C C2
83 | U 1 1 59840991
84 | P 3900 1550
85 | F 0 "C2" H 3925 1650 50 0000 L CNN
86 | F 1 "1uF" H 3925 1450 50 0000 L CNN
87 | F 2 "Capacitors_SMD:C_0603" H 3938 1400 50 0001 C CNN
88 | F 3 "" H 3900 1550 50 0001 C CNN
89 | 1 3900 1550
90 | 1 0 0 -1
91 | $EndComp
92 | $Comp
93 | L C C4
94 | U 1 1 598409EE
95 | P 5050 4600
96 | F 0 "C4" H 5075 4700 50 0000 L CNN
97 | F 1 "1uF" H 5075 4500 50 0000 L CNN
98 | F 2 "Capacitors_SMD:C_0603" H 5088 4450 50 0001 C CNN
99 | F 3 "" H 5050 4600 50 0001 C CNN
100 | 1 5050 4600
101 | 0 1 1 0
102 | $EndComp
103 | $Comp
104 | L C C3
105 | U 1 1 59840AB1
106 | P 4300 1550
107 | F 0 "C3" H 4325 1650 50 0000 L CNN
108 | F 1 "100nF" H 4325 1450 50 0000 L CNN
109 | F 2 "Capacitors_SMD:C_0603" H 4338 1400 50 0001 C CNN
110 | F 3 "" H 4300 1550 50 0001 C CNN
111 | 1 4300 1550
112 | 1 0 0 -1
113 | $EndComp
114 | $Comp
115 | L GND #PWR3
116 | U 1 1 59840C77
117 | P 3350 3250
118 | F 0 "#PWR3" H 3350 3000 50 0001 C CNN
119 | F 1 "GND" H 3350 3100 50 0000 C CNN
120 | F 2 "" H 3350 3250 50 0001 C CNN
121 | F 3 "" H 3350 3250 50 0001 C CNN
122 | 1 3350 3250
123 | 0 -1 -1 0
124 | $EndComp
125 | $Comp
126 | L +3V3 #PWR2
127 | U 1 1 59840CA3
128 | P 2950 3250
129 | F 0 "#PWR2" H 2950 3100 50 0001 C CNN
130 | F 1 "+3V3" H 2950 3390 50 0000 C CNN
131 | F 2 "" H 2950 3250 50 0001 C CNN
132 | F 3 "" H 2950 3250 50 0001 C CNN
133 | 1 2950 3250
134 | 0 -1 -1 0
135 | $EndComp
136 | Wire Wire Line
137 | 3100 3400 3100 3250
138 | Wire Wire Line
139 | 3100 3250 2950 3250
140 | Wire Wire Line
141 | 3200 3400 3200 3250
142 | Wire Wire Line
143 | 3200 3250 3350 3250
144 | $Comp
145 | L GND #PWR8
146 | U 1 1 59840FB3
147 | P 5400 4600
148 | F 0 "#PWR8" H 5400 4350 50 0001 C CNN
149 | F 1 "GND" H 5400 4450 50 0000 C CNN
150 | F 2 "" H 5400 4600 50 0001 C CNN
151 | F 3 "" H 5400 4600 50 0001 C CNN
152 | 1 5400 4600
153 | 0 -1 -1 0
154 | $EndComp
155 | Wire Wire Line
156 | 5200 4600 5400 4600
157 | Wire Wire Line
158 | 4900 4600 4300 4600
159 | $Comp
160 | L +3V3 #PWR7
161 | U 1 1 5984106F
162 | P 4700 1200
163 | F 0 "#PWR7" H 4700 1050 50 0001 C CNN
164 | F 1 "+3V3" H 4700 1340 50 0000 C CNN
165 | F 2 "" H 4700 1200 50 0001 C CNN
166 | F 3 "" H 4700 1200 50 0001 C CNN
167 | 1 4700 1200
168 | 1 0 0 -1
169 | $EndComp
170 | $Comp
171 | L GND #PWR5
172 | U 1 1 5984108F
173 | P 2950 2200
174 | F 0 "#PWR5" H 2950 1950 50 0001 C CNN
175 | F 1 "GND" H 2950 2050 50 0000 C CNN
176 | F 2 "" H 2950 2200 50 0001 C CNN
177 | F 3 "" H 2950 2200 50 0001 C CNN
178 | 1 2950 2200
179 | 1 0 0 -1
180 | $EndComp
181 | $Comp
182 | L +5V #PWR1
183 | U 1 1 598410AF
184 | P 1600 1200
185 | F 0 "#PWR1" H 1600 1050 50 0001 C CNN
186 | F 1 "+5V" H 1600 1340 50 0000 C CNN
187 | F 2 "" H 1600 1200 50 0001 C CNN
188 | F 3 "" H 1600 1200 50 0001 C CNN
189 | 1 1600 1200
190 | 1 0 0 -1
191 | $EndComp
192 | Wire Wire Line
193 | 3550 1400 4700 1400
194 | Connection ~ 3900 1400
195 | Wire Wire Line
196 | 4700 1400 4700 1200
197 | Connection ~ 4300 1400
198 | Wire Wire Line
199 | 1600 1200 1600 1400
200 | Wire Wire Line
201 | 1600 1400 2350 1400
202 | Connection ~ 1950 1400
203 | Wire Wire Line
204 | 2350 1400 2350 1300
205 | Wire Wire Line
206 | 2950 2000 2950 2200
207 | Wire Wire Line
208 | 1950 1700 1950 2100
209 | Wire Wire Line
210 | 1950 2100 4300 2100
211 | Connection ~ 2950 2100
212 | Wire Wire Line
213 | 3900 2100 3900 1700
214 | Wire Wire Line
215 | 4300 2100 4300 1700
216 | Connection ~ 3900 2100
217 | $Comp
218 | L CONN_01X05 J2
219 | U 1 1 598412AC
220 | P 3100 6550
221 | F 0 "J2" H 3100 6850 50 0000 C CNN
222 | F 1 "JTAG" V 3200 6550 50 0000 C CNN
223 | F 2 "Pin_Headers:Pin_Header_Straight_1x05_Pitch2.54mm" H 3100 6550 50 0001 C CNN
224 | F 3 "" H 3100 6550 50 0001 C CNN
225 | 1 3100 6550
226 | 0 -1 1 0
227 | $EndComp
228 | $Comp
229 | L GND #PWR4
230 | U 1 1 59841444
231 | P 3450 6250
232 | F 0 "#PWR4" H 3450 6000 50 0001 C CNN
233 | F 1 "GND" H 3450 6100 50 0000 C CNN
234 | F 2 "" H 3450 6250 50 0001 C CNN
235 | F 3 "" H 3450 6250 50 0001 C CNN
236 | 1 3450 6250
237 | 0 -1 -1 0
238 | $EndComp
239 | Wire Wire Line
240 | 2000 4700 1750 4700
241 | Wire Wire Line
242 | 1750 4700 1750 6050
243 | Wire Wire Line
244 | 1750 6050 2900 6050
245 | Wire Wire Line
246 | 2900 6050 2900 6350
247 | Wire Wire Line
248 | 3000 5700 3000 6350
249 | Wire Wire Line
250 | 3100 5700 3100 6350
251 | Wire Wire Line
252 | 3200 5700 3200 6050
253 | Wire Wire Line
254 | 3200 6050 3300 6050
255 | Wire Wire Line
256 | 3300 6050 3300 6350
257 | Wire Wire Line
258 | 3450 6250 3200 6250
259 | Wire Wire Line
260 | 3200 6250 3200 6350
261 | $Comp
262 | L USB_OTG J1
263 | U 1 1 598417AF
264 | P 5050 3700
265 | F 0 "J1" H 4850 4150 50 0000 L CNN
266 | F 1 "USB" H 4850 4050 50 0000 L CNN
267 | F 2 "TinyFPGA:FCI-Micro-USB" H 5200 3650 50 0001 C CNN
268 | F 3 "" H 5200 3650 50 0001 C CNN
269 | 1 5050 3700
270 | -1 0 0 -1
271 | $EndComp
272 | Wire Wire Line
273 | 4750 3800 4450 3800
274 | Wire Wire Line
275 | 4450 4500 4300 4500
276 | Wire Wire Line
277 | 5300 4100 5300 4600
278 | Wire Wire Line
279 | 5050 4100 5300 4100
280 | Connection ~ 5300 4600
281 | Connection ~ 5150 4100
282 | $Comp
283 | L +5V #PWR6
284 | U 1 1 59841909
285 | P 4500 3300
286 | F 0 "#PWR6" H 4500 3150 50 0001 C CNN
287 | F 1 "+5V" H 4500 3440 50 0000 C CNN
288 | F 2 "" H 4500 3300 50 0001 C CNN
289 | F 3 "" H 4500 3300 50 0001 C CNN
290 | 1 4500 3300
291 | 1 0 0 -1
292 | $EndComp
293 | Wire Wire Line
294 | 4500 3300 4500 3500
295 | Wire Wire Line
296 | 4500 3500 4750 3500
297 | $Comp
298 | L CONN_01X06 J3
299 | U 1 1 59841999
300 | P 7650 4600
301 | F 0 "J3" H 7650 4950 50 0000 C CNN
302 | F 1 "ICSP" V 7750 4600 50 0000 C CNN
303 | F 2 "Pin_Headers:Pin_Header_Straight_1x06_Pitch2.54mm" H 7650 4600 50 0001 C CNN
304 | F 3 "" H 7650 4600 50 0001 C CNN
305 | 1 7650 4600
306 | 1 0 0 -1
307 | $EndComp
308 | Text GLabel 4500 5000 2 60 Input ~ 0
309 | ICSPDAT
310 | Wire Wire Line
311 | 4300 4700 4350 4700
312 | Wire Wire Line
313 | 4350 4700 4350 5000
314 | Wire Wire Line
315 | 4350 5000 4500 5000
316 | Text GLabel 3500 5850 2 60 Input ~ 0
317 | ICSPCLK
318 | Wire Wire Line
319 | 3300 5700 3300 5850
320 | Wire Wire Line
321 | 3300 5850 3500 5850
322 | Text GLabel 1400 4600 0 60 Input ~ 0
323 | VPP
324 | Wire Wire Line
325 | 2000 4600 1400 4600
326 | $Comp
327 | L GND #PWR13
328 | U 1 1 598420BF
329 | P 7300 5100
330 | F 0 "#PWR13" H 7300 4850 50 0001 C CNN
331 | F 1 "GND" H 7300 4950 50 0000 C CNN
332 | F 2 "" H 7300 5100 50 0001 C CNN
333 | F 3 "" H 7300 5100 50 0001 C CNN
334 | 1 7300 5100
335 | 1 0 0 -1
336 | $EndComp
337 | Wire Wire Line
338 | 7300 5100 7300 4550
339 | Wire Wire Line
340 | 7300 4550 7450 4550
341 | $Comp
342 | L +3V3 #PWR12
343 | U 1 1 59842121
344 | P 7300 4250
345 | F 0 "#PWR12" H 7300 4100 50 0001 C CNN
346 | F 1 "+3V3" H 7300 4390 50 0000 C CNN
347 | F 2 "" H 7300 4250 50 0001 C CNN
348 | F 3 "" H 7300 4250 50 0001 C CNN
349 | 1 7300 4250
350 | 1 0 0 -1
351 | $EndComp
352 | Wire Wire Line
353 | 7300 4250 7300 4450
354 | Wire Wire Line
355 | 7300 4450 7450 4450
356 | Text GLabel 7050 4350 0 60 Input ~ 0
357 | VPP
358 | Wire Wire Line
359 | 7050 4350 7450 4350
360 | Text GLabel 7050 4650 0 60 Input ~ 0
361 | ICSPDAT
362 | Text GLabel 7050 4750 0 60 Input ~ 0
363 | ICSPCLK
364 | Wire Wire Line
365 | 7050 4650 7450 4650
366 | Wire Wire Line
367 | 7450 4750 7050 4750
368 | Wire Wire Line
369 | 3550 1300 3550 1400
370 | $Comp
371 | L CONN_01X06 J4
372 | U 1 1 59ADF270
373 | P 7650 2900
374 | F 0 "J4" H 7650 3250 50 0000 C CNN
375 | F 1 "CONN_01X06" V 7750 2900 50 0000 C CNN
376 | F 2 "Pin_Headers:Pin_Header_Straight_1x06_Pitch2.54mm" H 7650 2900 50 0001 C CNN
377 | F 3 "" H 7650 2900 50 0001 C CNN
378 | 1 7650 2900
379 | 1 0 0 -1
380 | $EndComp
381 | $Comp
382 | L +3V3 #PWR10
383 | U 1 1 59ADF4D2
384 | P 7200 2500
385 | F 0 "#PWR10" H 7200 2350 50 0001 C CNN
386 | F 1 "+3V3" H 7200 2640 50 0000 C CNN
387 | F 2 "" H 7200 2500 50 0001 C CNN
388 | F 3 "" H 7200 2500 50 0001 C CNN
389 | 1 7200 2500
390 | 1 0 0 -1
391 | $EndComp
392 | $Comp
393 | L GND #PWR11
394 | U 1 1 59ADF4FA
395 | P 7300 3300
396 | F 0 "#PWR11" H 7300 3050 50 0001 C CNN
397 | F 1 "GND" H 7300 3150 50 0000 C CNN
398 | F 2 "" H 7300 3300 50 0001 C CNN
399 | F 3 "" H 7300 3300 50 0001 C CNN
400 | 1 7300 3300
401 | 1 0 0 -1
402 | $EndComp
403 | Wire Wire Line
404 | 7300 2650 7300 3300
405 | Text GLabel 6950 3050 0 60 Input ~ 0
406 | ICSPDAT
407 | Text GLabel 6950 3150 0 60 Input ~ 0
408 | ICSPCLK
409 | Text GLabel 6950 2950 0 60 Input ~ 0
410 | RA4
411 | Text GLabel 6950 2850 0 60 Input ~ 0
412 | RA5
413 | Wire Wire Line
414 | 6950 2850 7450 2850
415 | Wire Wire Line
416 | 6950 2950 7450 2950
417 | Wire Wire Line
418 | 6950 3050 7450 3050
419 | Wire Wire Line
420 | 6950 3150 7450 3150
421 | Text GLabel 1400 4400 0 60 Input ~ 0
422 | RA5
423 | Text GLabel 1400 4500 0 60 Input ~ 0
424 | RA4
425 | Wire Wire Line
426 | 1400 4400 2000 4400
427 | Wire Wire Line
428 | 2000 4500 1400 4500
429 | Wire Wire Line
430 | 7300 2650 7450 2650
431 | Wire Wire Line
432 | 7200 2500 7200 2750
433 | Wire Wire Line
434 | 7200 2750 7450 2750
435 | $Comp
436 | L TEST TP3
437 | U 1 1 59AE1FC1
438 | P 1200 1550
439 | F 0 "TP3" H 1200 1850 50 0000 C BNN
440 | F 1 "TEST" H 1200 1800 50 0000 C CNN
441 | F 2 "Measurement_Points:Measurement_Point_Round-SMD-Pad_Big" H 1200 1550 50 0001 C CNN
442 | F 3 "" H 1200 1550 50 0001 C CNN
443 | 1 1200 1550
444 | 1 0 0 -1
445 | $EndComp
446 | $Comp
447 | L TEST TP1
448 | U 1 1 59AE210A
449 | P 4300 3700
450 | F 0 "TP1" H 4300 4000 50 0000 C BNN
451 | F 1 "TEST" H 4300 3950 50 0000 C CNN
452 | F 2 "Measurement_Points:Measurement_Point_Round-SMD-Pad_Big" H 4300 3700 50 0001 C CNN
453 | F 3 "" H 4300 3700 50 0001 C CNN
454 | 1 4300 3700
455 | 1 0 0 -1
456 | $EndComp
457 | $Comp
458 | L TEST TP2
459 | U 1 1 59AE214D
460 | P 4450 4150
461 | F 0 "TP2" H 4450 4450 50 0000 C BNN
462 | F 1 "TEST" H 4450 4400 50 0000 C CNN
463 | F 2 "Measurement_Points:Measurement_Point_Round-SMD-Pad_Big" H 4450 4150 50 0001 C CNN
464 | F 3 "" H 4450 4150 50 0001 C CNN
465 | 1 4450 4150
466 | 0 1 1 0
467 | $EndComp
468 | $Comp
469 | L +5V #PWR9
470 | U 1 1 59AE2249
471 | P 1200 1550
472 | F 0 "#PWR9" H 1200 1400 50 0001 C CNN
473 | F 1 "+5V" H 1200 1690 50 0000 C CNN
474 | F 2 "" H 1200 1550 50 0001 C CNN
475 | F 3 "" H 1200 1550 50 0001 C CNN
476 | 1 1200 1550
477 | -1 0 0 1
478 | $EndComp
479 | Wire Wire Line
480 | 4450 3800 4450 4500
481 | Connection ~ 4450 4150
482 | Wire Wire Line
483 | 4300 4400 4300 3700
484 | Wire Wire Line
485 | 4300 3700 4750 3700
486 | Text Notes 6550 2250 0 60 ~ 0
487 | GPIO for custom applications
488 | Text Notes 6450 3950 0 60 ~ 0
489 | PIC in circuit programming header
490 | Text Notes 2650 850 0 60 ~ 0
491 | Power supply
492 | Text Notes 2600 3000 0 60 ~ 0
493 | PIC16F1455 connections
494 | $EndSCHEMATC
495 |
--------------------------------------------------------------------------------
/board/fp-lib-table:
--------------------------------------------------------------------------------
1 | (fp_lib_table
2 | (lib (name TinyFPGA)(type KiCad)(uri ${KIPRJMOD}/tinyfpga.pretty)(options "")(descr ""))
3 | )
4 |
--------------------------------------------------------------------------------
/board/pic.lib:
--------------------------------------------------------------------------------
1 | EESchema-LIBRARY Version 2.3
2 | DEF PIC16F1455-QFN16 U 0 40 Y Y 1 L N
3 | F0 "U" 150 250 60 H V R CNN
4 | F1 "PIC16F1455-QFN16" 150 150 60 H V R CNN
5 | DRAW
6 | X Vss 13 1200 1000 200 D 50 50 1 1 B
7 | X Vdd 16 1100 1000 200 D 50 50 1 1 B
8 | X RC4 5 1000 -1300 200 U 50 50 1 1 B
9 | X RC3 6 1100 -1300 200 U 50 50 1 1 B
10 | X RC2 7 1200 -1300 200 U 50 50 1 1 B
11 | X ICSPCLK/RC1 8 1300 -1300 200 U 50 50 1 1 B
12 | X ICSPDAT/RC0 9 2300 -300 200 L 50 50 1 1 B
13 | X VUSB3V3 10 2300 -200 200 L 50 50 1 1 B
14 | X DN 11 2300 -100 200 L 50 50 1 1 B
15 | X DP 12 2300 0 200 L 50 50 1 1 B
16 | X RA5 1 0 0 200 R 50 50 1 1 B
17 | X RA4 2 0 -100 200 R 50 50 1 1 B
18 | X !MCLR 3 0 -200 200 R 50 50 1 1 B
19 | X RC5 4 0 -300 200 R 50 50 1 1 B
20 | S 200 800 2100 -1100 1 1 12 N
21 | ENDDRAW
22 | ENDDEF
23 |
--------------------------------------------------------------------------------
/board/tinyfpga.lib:
--------------------------------------------------------------------------------
1 | EESchema-LIBRARY Version 2.3
2 | DEF MachXO2-1200-QFN32 U 0 40 Y Y 1 L N
3 | F0 "U" 150 250 60 H V R CNN
4 | F1 "MachXO2-1200-QFN32" 150 150 60 H V R CNN
5 | DRAW
6 | X VCCIO3 6 2000 1100 200 D 50 50 1 1 B
7 | X VCCIO2 7 1900 1100 200 D 50 50 1 1 B
8 | X VCCIO2 15 1800 1100 200 D 50 50 1 1 B
9 | X VCC 18 1700 1100 200 D 50 50 1 1 B
10 | X VCCIO1 19 1600 1100 200 D 50 50 1 1 B
11 | X VCCIO0 24 1500 1100 200 D 50 50 1 1 B
12 | X VCCIO0 31 1400 1100 200 D 50 50 1 1 B
13 | X VCC 2 1300 1100 200 D 50 50 1 1 B
14 | X PR5D 20 3200 -1000 200 L 50 50 1 1 B
15 | X PR5C 21 3200 -900 200 L 50 50 1 1 B
16 | X PT17D/DONE 23 3200 -800 200 L 50 50 1 1 B
17 | X PT15D/PROGRAMN 25 3200 -700 200 L 50 50 1 1 B
18 | X PT15C/JTAGENB 26 3200 -600 200 L 50 50 1 1 B
19 | X PT12D/SDA 27 3200 -500 200 L 50 50 1 1 B
20 | X PT12C/SCL 28 3200 -400 200 L 50 50 1 1 B
21 | X PT11D/TMS 29 3200 -300 200 L 50 50 1 1 B
22 | X PT11C/TCK 30 3200 -200 200 L 50 50 1 1 B
23 | X PT10D/TDI 32 3200 -100 200 L 50 50 1 1 B
24 | X PT10C/TDO 1 3200 0 200 L 50 50 1 1 B
25 | X GND 3 1500 -2100 200 U 50 50 1 1 B
26 | X GND 22 1600 -2100 200 U 50 50 1 1 B
27 | X GND 33 1700 -2100 200 U 50 50 1 1 B
28 | X PL9A 4 0 0 200 R 50 50 1 1 B
29 | X PL9B 5 0 -100 200 R 50 50 1 1 B
30 | X PB4C/CS 8 0 -200 200 R 50 50 1 1 B
31 | X PB6C/SCLK 9 0 -300 200 R 50 50 1 1 B
32 | X PB6D/MISO 10 0 -400 200 R 50 50 1 1 B
33 | X PB9A 11 0 -500 200 R 50 50 1 1 B
34 | X PB9B 12 0 -600 200 R 50 50 1 1 B
35 | X PB11A 13 0 -700 200 R 50 50 1 1 B
36 | X PB11B 14 0 -800 200 R 50 50 1 1 B
37 | X PB20C/SN 16 0 -900 200 R 50 50 1 1 B
38 | X PB20D/MOSI 17 0 -1000 200 R 50 50 1 1 B
39 | S 200 900 3000 -1900 1 1 12 N
40 | ENDDRAW
41 | ENDDEF
42 | DEF iCE40-LP8K-CM81 U 0 40 Y Y 8 L N
43 | F0 "U" 200 250 60 H V L CNN
44 | F1 "iCE40-LP8K-CM81" 200 150 60 H V L CNN
45 | DRAW
46 | X VPP_FAST C7 0 0 200 R 50 50 1 1 B
47 | X VPP_2V5 C8 0 -100 200 R 50 50 1 1 B
48 | X CDONE E6 0 -200 200 R 50 50 1 1 B
49 | X IOB_103_CBSEL0 G5 0 -300 200 R 50 50 1 1 B
50 | X IOB_105_SDO G6 0 -400 200 R 50 50 1 1 B
51 | X IOB_107_SCK G7 0 -500 200 R 50 50 1 1 B
52 | X IOB_104_CBSEL1 H5 0 -600 200 R 50 50 1 1 B
53 | X CRESET_B H6 0 -700 200 R 50 50 1 1 B
54 | X IOB_106_SDI H7 0 -800 200 R 50 50 1 1 B
55 | X VCC_SPI H8 0 -900 200 R 50 50 1 1 B
56 | S 200 100 1000 -1000 1 1 12 N
57 | X GND F4 0 0 200 R 50 50 2 1 B
58 | X GND F5 0 -100 200 R 50 50 2 1 B
59 | X GND F6 0 -200 200 R 50 50 2 1 B
60 | X GND F9 0 -300 200 R 50 50 2 1 B
61 | S 200 100 500 -400 2 1 12 N
62 | X IOB_108_SS F7 0 0 200 R 50 50 3 1 B
63 | X IOB_81_GBIN5 G4 0 -100 200 R 50 50 3 1 B
64 | X IOB_54 H1 0 -200 200 R 50 50 3 1 B
65 | X IOB_82_GBIN4 H4 0 -300 200 R 50 50 3 1 B
66 | X IOB_55 J1 0 -400 200 R 50 50 3 1 B
67 | X IOB_56 J2 0 -500 200 R 50 50 3 1 B
68 | X IOB_57 J3 0 -600 200 R 50 50 3 1 B
69 | X IOB_70 J4 0 -700 200 R 50 50 3 1 B
70 | S 200 100 900 -800 3 1 12 N
71 | X IOL_3A B1 0 0 200 R 50 50 4 1 B
72 | X IOL_2B B2 0 -100 200 R 50 50 4 1 B
73 | X IOL_3B C1 0 -200 200 R 50 50 4 1 B
74 | X IOL_2A C2 0 -300 200 R 50 50 4 1 B
75 | X IOL_7B C3 0 -400 200 R 50 50 4 1 B
76 | X IOL_10A D1 0 -500 200 R 50 50 4 1 B
77 | X IOL_7A D2 0 -600 200 R 50 50 4 1 B
78 | X IOL_13B_GBIN7 D3 0 -700 200 R 50 50 4 1 B
79 | X IOL_10B E1 0 -800 200 R 50 50 4 1 B
80 | X IOL_13A E2 0 -900 200 R 50 50 4 1 B
81 | X IOL_14A_GBIN6 E3 0 -1000 200 R 50 50 4 1 B
82 | X IOL_14B E4 0 -1100 200 R 50 50 4 1 B
83 | X IOL_22A F1 0 -1200 200 R 50 50 4 1 B
84 | X IOL_22B F3 0 -1300 200 R 50 50 4 1 B
85 | X IOL_24B G1 0 -1400 200 R 50 50 4 1 B
86 | X IOL_26A G2 0 -1500 200 R 50 50 4 1 B
87 | X IOL_24A G3 0 -1600 200 R 50 50 4 1 B
88 | X IOL_26B H2 0 -1700 200 R 50 50 4 1 B
89 | S 200 100 1000 -1800 4 1 12 N
90 | X IOR_116 A9 0 0 200 R 50 50 5 1 B
91 | X IOR_120 B9 0 -100 200 R 50 50 5 1 B
92 | X IOR_148 C9 0 -200 200 R 50 50 5 1 B
93 | X IOR_115 D6 0 -300 200 R 50 50 5 1 B
94 | X IOR_117 D7 0 -400 200 R 50 50 5 1 B
95 | X IOR_141_GBIN2 D8 0 -500 200 R 50 50 5 1 B
96 | X IOR_119 D9 0 -600 200 R 50 50 5 1 B
97 | X IOR_118 E7 0 -700 200 R 50 50 5 1 B
98 | X IOR_140_GBIN3 E8 0 -800 200 R 50 50 5 1 B
99 | X IOR_113 F8 0 -900 200 R 50 50 5 1 B
100 | X IOR_114 G8 0 -1000 200 R 50 50 5 1 B
101 | X IOR_112 G9 0 -1100 200 R 50 50 5 1 B
102 | X IOR_111 H9 0 -1200 200 R 50 50 5 1 B
103 | X IOR_109 J8 0 -1300 200 R 50 50 5 1 B
104 | X IOR_110 J9 0 -1400 200 R 50 50 5 1 B
105 | S 200 100 1000 -1500 5 1 12 N
106 | X IOT_224 A1 0 0 200 R 50 50 6 1 B
107 | X IOT_221 A2 0 -100 200 R 50 50 6 1 B
108 | X IOT_217 A3 0 -200 200 R 50 50 6 1 B
109 | X IOT_208 A4 0 -300 200 R 50 50 6 1 B
110 | X IOT_185 A6 0 -400 200 R 50 50 6 1 B
111 | X IOT_177 A7 0 -500 200 R 50 50 6 1 B
112 | X IOT_174 A8 0 -600 200 R 50 50 6 1 B
113 | X IOT_218 B3 0 -700 200 R 50 50 6 1 B
114 | X IOT_211 B4 0 -800 200 R 50 50 6 1 B
115 | X IOT_188 B5 0 -900 200 R 50 50 6 1 B
116 | X IOT_183 B6 0 -1000 200 R 50 50 6 1 B
117 | X IOT_180 B7 0 -1100 200 R 50 50 6 1 B
118 | X IOT_170 B8 0 -1200 200 R 50 50 6 1 B
119 | X IOT_198_GBIN0 C4 0 -1300 200 R 50 50 6 1 B
120 | X IOT_197_GBIN1 C5 0 -1400 200 R 50 50 6 1 B
121 | X IOT_212 D5 0 -1500 200 R 50 50 6 1 B
122 | X IOT_214 E5 0 -1600 200 R 50 50 6 1 B
123 | S 200 100 1000 -1700 6 1 12 N
124 | X GNDPLL0 J6 0 0 200 R 50 50 7 1 B
125 | X VCCPLL0 J7 0 -100 200 R 50 50 7 1 B
126 | S 200 100 700 -200 7 1 12 N
127 | X VCCIO_0 A5 0 0 200 R 50 50 8 1 B
128 | X VCCIO_1 C6 0 -100 200 R 50 50 8 1 B
129 | X VCC D4 0 -200 200 R 50 50 8 1 B
130 | X VCC E9 0 -300 200 R 50 50 8 1 B
131 | X VCC F2 0 -400 200 R 50 50 8 1 B
132 | X VCCIO_3 H3 0 -500 200 R 50 50 8 1 B
133 | X VCCIO_2 J5 0 -600 200 R 50 50 8 1 B
134 | S 200 100 700 -700 8 1 12 N
135 | ENDDRAW
136 | ENDDEF
137 | DEF MIC5365-1.2YC5-TR U 0 40 Y Y 1 L N
138 | F0 "U" 200 250 60 H V L CNN
139 | F1 "MIC5365-1.2YC5-TR" 200 150 60 H V L CNN
140 | DRAW
141 | X GND 2 600 -700 200 U 50 50 1 1 B
142 | X VOUT 5 1200 -100 200 L 50 50 1 1 B
143 | X NC 4 1200 0 200 L 50 50 1 1 B
144 | X VIN 1 0 0 200 R 50 50 1 1 B
145 | X EN 3 0 -100 200 R 50 50 1 1 B
146 | S 200 100 1000 -500 1 1 12 N
147 | ENDDRAW
148 | ENDDEF
149 | DEF MIC5504-3.3YM5-TR U 0 40 Y Y 1 L N
150 | F0 "U" 200 250 60 H V L CNN
151 | F1 "MIC5504-3.3YM5-TR" 200 150 60 H V L CNN
152 | DRAW
153 | X GND 2 600 -700 200 U 50 50 1 1 B
154 | X VOUT 5 1200 -100 200 L 50 50 1 1 B
155 | X NC 4 1200 0 200 L 50 50 1 1 B
156 | X VIN 1 0 0 200 R 50 50 1 1 B
157 | X EN 3 0 -100 200 R 50 50 1 1 B
158 | S 200 100 1000 -500 1 1 12 N
159 | ENDDRAW
160 | ENDDEF
161 | DEF DSC6001CI2A-016.0000T U 0 40 Y Y 1 L N
162 | F0 "U" 150 250 60 H V R CNN
163 | F1 "DSC6001CI2A-016.0000T" 150 150 60 H V R CNN
164 | DRAW
165 | X VDD 4 600 600 200 D 50 50 1 1 B
166 | X GND 2 600 -600 200 U 50 50 1 1 B
167 | X OUT 3 1200 0 200 L 50 50 1 1 B
168 | X OE 1 0 0 200 R 50 50 1 1 B
169 | S 200 400 1000 -400 1 1 12 N
170 | ENDDRAW
171 | ENDDEF
172 | DEF AT25SF041-SSHD-B U 0 40 Y Y 1 L N
173 | F0 "U" 150 250 60 H V R CNN
174 | F1 "AT25SF041-SSHD-B" 150 150 60 H V R CNN
175 | DRAW
176 | X VCC 8 700 600 200 D 50 50 1 1 B
177 | X !CS 1 1400 -300 200 L 50 50 1 1 B
178 | X SO 2 1400 -200 200 L 50 50 1 1 B
179 | X SI 5 1400 -100 200 L 50 50 1 1 B
180 | X SCK 6 1400 0 200 L 50 50 1 1 B
181 | X GND 4 700 -900 200 U 50 50 1 1 B
182 | X !WP 3 0 -100 200 R 50 50 1 1 B
183 | X !HOLD 7 0 -200 200 R 50 50 1 1 B
184 | S 200 400 1200 -700 1 1 12 N
185 | ENDDRAW
186 | ENDDEF
187 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/CDFN3225-4LD-PL-1.kicad_mod:
--------------------------------------------------------------------------------
1 | (module CDFN3225-4LD-PL-1 (layer F.Cu) (tedit 591AA274)
2 | (fp_text reference REF** (at 0 3.05) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value CDFN3225-4LD-PL-1 (at 0 -2.85) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_circle (center -2.361386 1.541754) (end -2.161386 1.391754) (layer F.Fab) (width 0.15))
9 | (fp_line (start 1.438614 1.041754) (end -1.761386 1.041754) (layer F.Fab) (width 0.15))
10 | (fp_line (start 1.438614 -1.458246) (end 1.438614 1.041754) (layer F.Fab) (width 0.15))
11 | (fp_line (start -1.761386 -1.458246) (end 1.438614 -1.458246) (layer F.Fab) (width 0.15))
12 | (fp_line (start -1.761386 1.041754) (end -1.761386 -1.458246) (layer F.Fab) (width 0.15))
13 | (pad 1 smd rect (at -1.211386 0.741754 90) (size 1 0.9) (layers F.Cu F.Paste F.Mask))
14 | (pad 4 smd rect (at -1.211386 -1.158246 90) (size 1 0.9) (layers F.Cu F.Paste F.Mask))
15 | (pad 3 smd rect (at 0.888614 -1.158246 90) (size 1 0.9) (layers F.Cu F.Paste F.Mask))
16 | (pad 2 smd rect (at 0.888614 0.741754 90) (size 1 0.9) (layers F.Cu F.Paste F.Mask))
17 | )
18 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/CM81.kicad_mod:
--------------------------------------------------------------------------------
1 | (module CM81 (layer F.Cu) (tedit 5902DC62)
2 | (clearance 0.102)
3 | (fp_text reference REF** (at 1.6 6.4) (layer F.SilkS)
4 | (effects (font (size 1 1) (thickness 0.15)))
5 | )
6 | (fp_text value CM81 (at 1.6 0.8) (layer F.Fab)
7 | (effects (font (size 1 1) (thickness 0.15)))
8 | )
9 | (fp_line (start -0.4 2.4) (end -0.4 5.6) (layer F.SilkS) (width 0.15))
10 | (fp_line (start -0.4 5.6) (end 3.6 5.6) (layer F.SilkS) (width 0.15))
11 | (fp_line (start 3.6 5.6) (end 3.6 1.6) (layer F.SilkS) (width 0.15))
12 | (fp_line (start 3.6 1.6) (end 0.4 1.6) (layer F.SilkS) (width 0.15))
13 | (pad A1 smd circle (at 0 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
14 | (pad A2 smd circle (at 0.4 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
15 | (pad A3 smd circle (at 0.8 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
16 | (pad A4 smd circle (at 1.2 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
17 | (pad A5 smd circle (at 1.6 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
18 | (pad A6 smd circle (at 2 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
19 | (pad A7 smd circle (at 2.4 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
20 | (pad A8 smd circle (at 2.8 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
21 | (pad A9 smd circle (at 3.2 2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
22 | (pad B1 smd circle (at 0 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
23 | (pad B2 smd circle (at 0.4 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
24 | (pad B3 smd circle (at 0.8 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
25 | (pad B4 smd circle (at 1.2 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
26 | (pad B5 smd circle (at 1.6 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
27 | (pad B6 smd circle (at 2 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
28 | (pad B7 smd circle (at 2.4 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
29 | (pad B8 smd circle (at 2.8 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
30 | (pad B9 smd circle (at 3.2 2.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
31 | (pad C1 smd circle (at 0 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
32 | (pad C2 smd circle (at 0.4 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
33 | (pad C3 smd circle (at 0.8 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
34 | (pad C4 smd circle (at 1.2 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
35 | (pad C5 smd circle (at 1.6 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
36 | (pad C6 smd circle (at 2 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
37 | (pad C7 smd circle (at 2.4 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
38 | (pad C8 smd circle (at 2.8 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
39 | (pad C9 smd circle (at 3.2 2.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
40 | (pad D1 smd circle (at 0 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
41 | (pad D2 smd circle (at 0.4 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
42 | (pad D3 smd circle (at 0.8 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
43 | (pad D4 smd circle (at 1.2 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
44 | (pad D5 smd circle (at 1.6 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
45 | (pad D6 smd circle (at 2 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
46 | (pad D7 smd circle (at 2.4 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
47 | (pad D8 smd circle (at 2.8 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
48 | (pad D9 smd circle (at 3.2 3.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
49 | (pad E1 smd circle (at 0 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
50 | (pad E2 smd circle (at 0.4 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
51 | (pad E3 smd circle (at 0.8 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
52 | (pad E4 smd circle (at 1.2 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
53 | (pad E5 smd circle (at 1.6 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
54 | (pad E6 smd circle (at 2 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
55 | (pad E7 smd circle (at 2.4 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
56 | (pad E8 smd circle (at 2.8 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
57 | (pad E9 smd circle (at 3.2 3.6) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
58 | (pad F1 smd circle (at 0 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
59 | (pad F2 smd circle (at 0.4 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
60 | (pad F3 smd circle (at 0.8 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
61 | (pad F4 smd circle (at 1.2 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
62 | (pad F5 smd circle (at 1.6 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
63 | (pad F6 smd circle (at 2 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
64 | (pad F7 smd circle (at 2.4 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
65 | (pad F8 smd circle (at 2.8 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
66 | (pad F9 smd circle (at 3.2 4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
67 | (pad G1 smd circle (at 0 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
68 | (pad G2 smd circle (at 0.4 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
69 | (pad G3 smd circle (at 0.8 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
70 | (pad G4 smd circle (at 1.2 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
71 | (pad G5 smd circle (at 1.6 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
72 | (pad G6 smd circle (at 2 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
73 | (pad G7 smd circle (at 2.4 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
74 | (pad G8 smd circle (at 2.8 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
75 | (pad G9 smd circle (at 3.2 4.4) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
76 | (pad H1 smd circle (at 0 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
77 | (pad H2 smd circle (at 0.4 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
78 | (pad H3 smd circle (at 0.8 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
79 | (pad H4 smd circle (at 1.2 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
80 | (pad H5 smd circle (at 1.6 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
81 | (pad H6 smd circle (at 2 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
82 | (pad H7 smd circle (at 2.4 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
83 | (pad H8 smd circle (at 2.8 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
84 | (pad H9 smd circle (at 3.2 4.8) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
85 | (pad J1 smd circle (at 0 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
86 | (pad J2 smd circle (at 0.4 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
87 | (pad J3 smd circle (at 0.8 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
88 | (pad J4 smd circle (at 1.2 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
89 | (pad J5 smd circle (at 1.6 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
90 | (pad J6 smd circle (at 2 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
91 | (pad J7 smd circle (at 2.4 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
92 | (pad J8 smd circle (at 2.8 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
93 | (pad J9 smd circle (at 3.2 5.2) (size 0.2 0.2) (layers F.Cu F.Paste F.Mask))
94 | )
95 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/FCI-Micro-USB.kicad_mod:
--------------------------------------------------------------------------------
1 | (module FCI-Micro-USB (layer F.Cu) (tedit 595DDA79)
2 | (descr http://www.molex.com/pdm_docs/sd/473460001_sd.pdf)
3 | (tags "Micro-USB SMD")
4 | (solder_mask_margin 0.05)
5 | (attr smd)
6 | (fp_text reference J3 (at 0 4.55 180) (layer F.Fab)
7 | (effects (font (size 1 1) (thickness 0.15)))
8 | )
9 | (fp_text value USB_OTG (at -0.005637 3.079657 180) (layer F.Fab)
10 | (effects (font (size 1 1) (thickness 0.15)))
11 | )
12 | (fp_text user "PCB Front Edge" (at 7.65 1.5 180) (layer Dwgs.User)
13 | (effects (font (size 0.4 0.4) (thickness 0.04)))
14 | )
15 | (fp_line (start 4.594363 2.419657) (end -4.605637 2.419657) (layer F.CrtYd) (width 0.05))
16 | (fp_line (start 4.594363 -3.840343) (end 4.594363 2.419657) (layer F.CrtYd) (width 0.05))
17 | (fp_line (start -4.605637 -3.840343) (end 4.594363 -3.840343) (layer F.CrtYd) (width 0.05))
18 | (fp_line (start -4.605637 2.419657) (end -4.605637 -3.840343) (layer F.CrtYd) (width 0.05))
19 | (fp_line (start 3.75 2.15) (end -3.75 2.15) (layer F.Fab) (width 0.1))
20 | (fp_line (start 3.75 -2.85) (end 3.75 2.15) (layer F.Fab) (width 0.1))
21 | (fp_line (start -3.75 -2.85) (end 3.75 -2.85) (layer F.Fab) (width 0.1))
22 | (fp_line (start -3.75 2.15) (end -3.75 -2.85) (layer F.Fab) (width 0.1))
23 | (fp_line (start -5 1.45) (end 5 1.45) (layer Dwgs.User) (width 0.15))
24 | (pad 1 smd rect (at -1.3 -2.675 90) (size 1.35 0.4) (layers F.Cu F.Paste F.Mask))
25 | (pad 2 smd rect (at -0.65 -2.675 90) (size 1.35 0.4) (layers F.Cu F.Paste F.Mask))
26 | (pad 3 smd rect (at 0 -2.675 90) (size 1.35 0.4) (layers F.Cu F.Paste F.Mask))
27 | (pad 4 smd rect (at 0.65 -2.675 90) (size 1.35 0.4) (layers F.Cu F.Paste F.Mask))
28 | (pad 5 smd rect (at 1.3 -2.675 90) (size 1.35 0.4) (layers F.Cu F.Paste F.Mask))
29 | (pad 6 smd rect (at -3.1 -2.55) (size 2.1 1.6) (layers F.Cu F.Paste F.Mask))
30 | (pad 6 smd rect (at 3.1 -2.55) (size 2.1 1.6) (layers F.Cu F.Paste F.Mask))
31 | (pad 6 smd rect (at -3.8 0 90) (size 1.9 1.8) (layers F.Cu F.Paste F.Mask))
32 | (pad 6 smd rect (at 3.8 0 90) (size 1.9 1.8) (layers F.Cu F.Paste F.Mask))
33 | (pad 6 smd rect (at -1.2 0 90) (size 1.9 1.9) (layers F.Cu F.Paste F.Mask))
34 | (pad 6 smd rect (at 1.2 0 90) (size 1.9 1.9) (layers F.Cu F.Paste F.Mask))
35 | (model Connectors_Molex.3dshapes/USB_Micro-B_Molex_47346-0001.wrl
36 | (at (xyz -0.05 0 0.05))
37 | (scale (xyz 0.39 0.39 0.39))
38 | (rotate (xyz -90 0 90))
39 | )
40 | )
41 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/Lattice-32QFN.kicad_mod:
--------------------------------------------------------------------------------
1 | (module Lattice-32QFN (layer F.Cu) (tedit 59058BFE)
2 | (fp_text reference REF** (at 0.1 4.75) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value Lattice-32QFN (at 0.05 -4.8) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_line (start -2.5 -1.5) (end -1.5 -2.5) (layer F.Fab) (width 0.15))
9 | (fp_line (start -2.5 2.5) (end -2.5 -1.5) (layer F.Fab) (width 0.15))
10 | (fp_line (start 2.5 2.5) (end -2.5 2.5) (layer F.Fab) (width 0.15))
11 | (fp_line (start 2.5 -2.5) (end 2.5 2.5) (layer F.Fab) (width 0.15))
12 | (fp_line (start -1.5 -2.5) (end 2.5 -2.5) (layer F.Fab) (width 0.15))
13 | (fp_line (start -1.25 0) (end 1.25 0) (layer F.Mask) (width 0.3))
14 | (fp_line (start -1.35 1.35) (end -1.35 -1.35) (layer F.Mask) (width 0.15))
15 | (fp_line (start 1.35 1.35) (end -1.35 1.35) (layer F.Mask) (width 0.15))
16 | (fp_line (start 1.35 -1.35) (end 1.35 1.35) (layer F.Mask) (width 0.15))
17 | (fp_line (start -1.35 -1.35) (end 1.35 -1.35) (layer F.Mask) (width 0.15))
18 | (fp_line (start 0 -1.25) (end 0 1.25) (layer F.Mask) (width 0.3))
19 | (pad 32 smd oval (at -1.75 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
20 | (solder_mask_margin 0.07))
21 | (pad 31 smd oval (at -1.25 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
22 | (solder_mask_margin 0.07))
23 | (pad 30 smd oval (at -0.75 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
24 | (solder_mask_margin 0.07))
25 | (pad 29 smd oval (at -0.25 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
26 | (solder_mask_margin 0.07))
27 | (pad 28 smd oval (at 0.25 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
28 | (solder_mask_margin 0.07))
29 | (pad 27 smd oval (at 0.75 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
30 | (solder_mask_margin 0.07))
31 | (pad 26 smd oval (at 1.25 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
32 | (solder_mask_margin 0.07))
33 | (pad 25 smd oval (at 1.75 -2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
34 | (solder_mask_margin 0.07))
35 | (pad 24 smd oval (at 2.5 -1.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
36 | (solder_mask_margin 0.07))
37 | (pad 23 smd oval (at 2.5 -1.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
38 | (solder_mask_margin 0.07))
39 | (pad 22 smd oval (at 2.5 -0.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
40 | (solder_mask_margin 0.07))
41 | (pad 21 smd oval (at 2.5 -0.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
42 | (solder_mask_margin 0.07))
43 | (pad 20 smd oval (at 2.5 0.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
44 | (solder_mask_margin 0.07))
45 | (pad 19 smd oval (at 2.5 0.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
46 | (solder_mask_margin 0.07))
47 | (pad 18 smd oval (at 2.5 1.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
48 | (solder_mask_margin 0.07))
49 | (pad 17 smd oval (at 2.5 1.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
50 | (solder_mask_margin 0.07))
51 | (pad 16 smd oval (at 1.75 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
52 | (solder_mask_margin 0.07))
53 | (pad 15 smd oval (at 1.25 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
54 | (solder_mask_margin 0.07))
55 | (pad 14 smd oval (at 0.75 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
56 | (solder_mask_margin 0.07))
57 | (pad 13 smd oval (at 0.25 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
58 | (solder_mask_margin 0.07))
59 | (pad 12 smd oval (at -0.25 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
60 | (solder_mask_margin 0.07))
61 | (pad 11 smd oval (at -0.75 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
62 | (solder_mask_margin 0.07))
63 | (pad 10 smd oval (at -1.25 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
64 | (solder_mask_margin 0.07))
65 | (pad 9 smd oval (at -1.75 2.5 90) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
66 | (solder_mask_margin 0.07))
67 | (pad 8 smd oval (at -2.5 1.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
68 | (solder_mask_margin 0.07))
69 | (pad 7 smd oval (at -2.5 1.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
70 | (solder_mask_margin 0.07))
71 | (pad 6 smd oval (at -2.5 0.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
72 | (solder_mask_margin 0.07))
73 | (pad 5 smd oval (at -2.5 0.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
74 | (solder_mask_margin 0.07))
75 | (pad 4 smd oval (at -2.5 -0.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
76 | (solder_mask_margin 0.07))
77 | (pad 3 smd oval (at -2.5 -0.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
78 | (solder_mask_margin 0.07))
79 | (pad 2 smd oval (at -2.5 -1.25) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
80 | (solder_mask_margin 0.07))
81 | (pad 1 smd oval (at -2.5 -1.75) (size 0.7 0.24) (layers F.Cu F.Paste F.Mask)
82 | (solder_mask_margin 0.07))
83 | (pad 33 smd rect (at -0.7 -0.7) (size 1.17 1.17) (layers F.Cu F.Paste F.Mask))
84 | (pad 33 smd rect (at 0.7 0.7) (size 1.17 1.17) (layers F.Cu F.Paste F.Mask))
85 | (pad 33 smd rect (at 0.7 -0.7) (size 1.17 1.17) (layers F.Cu F.Paste F.Mask))
86 | (pad 33 smd rect (at -0.7 0.7) (size 1.17 1.17) (layers F.Cu F.Paste F.Mask))
87 | )
88 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/Lattice-QFN-32_5x5mm_Pitch0.5mm.kicad_mod:
--------------------------------------------------------------------------------
1 | (module Lattice-QFN-32_5x5mm_Pitch0.5mm locked (layer F.Cu) (tedit 59043BB9)
2 | (descr "UH Package; 32-Lead Plastic QFN (5mm x 5mm); (see Linear Technology QFN_32_05-08-1693.pdf)")
3 | (tags "QFN 0.5")
4 | (attr smd)
5 | (fp_text reference U2 (at 0 -3.75) (layer F.SilkS) hide
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_text value MachXO2-1200-QFN32 (at 0 3.75) (layer F.Fab)
9 | (effects (font (size 1 1) (thickness 0.15)))
10 | )
11 | (fp_line (start -1.5 -2.5) (end 2.5 -2.5) (layer F.Fab) (width 0.15))
12 | (fp_line (start 2.5 -2.5) (end 2.5 2.5) (layer F.Fab) (width 0.15))
13 | (fp_line (start 2.5 2.5) (end -2.5 2.5) (layer F.Fab) (width 0.15))
14 | (fp_line (start -2.5 2.5) (end -2.5 -1.5) (layer F.Fab) (width 0.15))
15 | (fp_line (start -2.5 -1.5) (end -1.5 -2.5) (layer F.Fab) (width 0.15))
16 | (fp_line (start -3 -3) (end -3 3) (layer F.CrtYd) (width 0.05))
17 | (fp_line (start 3 -3) (end 3 3) (layer F.CrtYd) (width 0.05))
18 | (fp_line (start -3 -3) (end 3 -3) (layer F.CrtYd) (width 0.05))
19 | (fp_line (start -3 3) (end 3 3) (layer F.CrtYd) (width 0.05))
20 | (fp_line (start 2.625 -2.625) (end 2.625 -2.1) (layer F.SilkS) (width 0.15))
21 | (fp_line (start -2.625 2.625) (end -2.625 2.1) (layer F.SilkS) (width 0.15))
22 | (fp_line (start 2.625 2.625) (end 2.625 2.1) (layer F.SilkS) (width 0.15))
23 | (fp_line (start -2.625 -2.625) (end -2.1 -2.625) (layer F.SilkS) (width 0.15))
24 | (fp_line (start -2.625 2.625) (end -2.1 2.625) (layer F.SilkS) (width 0.15))
25 | (fp_line (start 2.625 2.625) (end 2.1 2.625) (layer F.SilkS) (width 0.15))
26 | (fp_line (start 2.625 -2.625) (end 2.1 -2.625) (layer F.SilkS) (width 0.15))
27 | (pad 1 smd rect (at -2.4 -1.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
28 | (pad 2 smd rect (at -2.4 -1.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
29 | (pad 3 smd rect (at -2.4 -0.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
30 | (pad 4 smd rect (at -2.4 -0.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
31 | (pad 5 smd rect (at -2.4 0.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
32 | (pad 6 smd rect (at -2.4 0.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
33 | (pad 7 smd rect (at -2.4 1.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
34 | (pad 8 smd rect (at -2.4 1.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
35 | (pad 9 smd rect (at -1.75 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
36 | (pad 10 smd rect (at -1.25 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
37 | (pad 11 smd rect (at -0.75 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
38 | (pad 12 smd rect (at -0.25 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
39 | (pad 13 smd rect (at 0.25 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
40 | (pad 14 smd rect (at 0.75 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
41 | (pad 15 smd rect (at 1.25 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
42 | (pad 16 smd rect (at 1.75 2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
43 | (pad 17 smd rect (at 2.4 1.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
44 | (pad 18 smd rect (at 2.4 1.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
45 | (pad 19 smd rect (at 2.4 0.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
46 | (pad 20 smd rect (at 2.4 0.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
47 | (pad 21 smd rect (at 2.4 -0.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
48 | (pad 22 smd rect (at 2.4 -0.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
49 | (pad 23 smd rect (at 2.4 -1.25) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
50 | (pad 24 smd rect (at 2.4 -1.75) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
51 | (pad 25 smd rect (at 1.75 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
52 | (pad 26 smd rect (at 1.25 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
53 | (pad 27 smd rect (at 0.75 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
54 | (pad 28 smd rect (at 0.25 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
55 | (pad 29 smd rect (at -0.25 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
56 | (pad 30 smd rect (at -0.75 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
57 | (pad 31 smd rect (at -1.25 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
58 | (pad 32 smd rect (at -1.75 -2.4 90) (size 0.7 0.25) (layers F.Cu F.Paste F.Mask))
59 | (pad 33 smd rect (at 0.8625 0.8625) (size 1.725 1.725) (layers F.Cu F.Paste F.Mask)
60 | (solder_paste_margin_ratio -0.2))
61 | (pad 33 smd rect (at 0.8625 -0.8625) (size 1.725 1.725) (layers F.Cu F.Paste F.Mask)
62 | (solder_paste_margin_ratio -0.2))
63 | (pad 33 smd rect (at -0.8625 0.8625) (size 1.725 1.725) (layers F.Cu F.Paste F.Mask)
64 | (solder_paste_margin_ratio -0.2))
65 | (pad 33 smd rect (at -0.8625 -0.8625) (size 1.725 1.725) (layers F.Cu F.Paste F.Mask)
66 | (solder_paste_margin_ratio -0.2))
67 | (model Housings_DFN_QFN.3dshapes/QFN-32-1EP_5x5mm_Pitch0.5mm.wrl
68 | (at (xyz 0 0 0))
69 | (scale (xyz 1 1 1))
70 | (rotate (xyz 0 0 0))
71 | )
72 | )
73 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/PTS_810_SMT_Switch.kicad_mod:
--------------------------------------------------------------------------------
1 | (module PTS_810_SMT_Switch (layer F.Cu) (tedit 591A91F4)
2 | (fp_text reference REF** (at 0 3.2) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value "PTS 810 SMT Switch" (at 0 -3) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_line (start 2.1 -1.6) (end -2.1 -1.6) (layer F.Fab) (width 0.15))
9 | (fp_line (start 2.1 1.6) (end 2.1 -1.6) (layer F.Fab) (width 0.15))
10 | (fp_line (start -2.1 1.6) (end 2.1 1.6) (layer F.Fab) (width 0.15))
11 | (fp_line (start -2.1 1.2) (end -2.1 1.6) (layer F.Fab) (width 0.15))
12 | (fp_line (start -2.1 -1.6) (end -2.1 1.2) (layer F.Fab) (width 0.15))
13 | (pad 1 smd rect (at -2.075 -1.075) (size 1.05 0.65) (layers F.Cu F.Paste F.Mask))
14 | (pad 1 smd rect (at 2.075 -1.075) (size 1.05 0.65) (layers F.Cu F.Paste F.Mask))
15 | (pad 2 smd rect (at 2.075 1.075) (size 1.05 0.65) (layers F.Cu F.Paste F.Mask))
16 | (pad 2 smd rect (at -2.075 1.075) (size 1.05 0.65) (layers F.Cu F.Paste F.Mask))
17 | )
18 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/Pin_Header_Straight_1x05_Pitch2.54mm_SMD.kicad_mod:
--------------------------------------------------------------------------------
1 | (module Pin_Header_Straight_1x05_Pitch2.54mm_SMD (layer F.Cu) (tedit 59ADD615)
2 | (descr "surface-mounted straight pin header, 1x05, 2.54mm pitch, single row, style 1 (pin 1 left)")
3 | (tags "Surface mounted pin header SMD 1x05 2.54mm single row style1 pin1 left")
4 | (attr smd)
5 | (fp_text reference J2 (at 0 0 90) (layer F.Fab) hide
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_text value Pin_Header_Straight_1x05_Pitch2.54mm_SMD_Pin1Left (at 0.635 0 90) (layer F.Fab)
9 | (effects (font (size 0.2 0.2) (thickness 0.05)))
10 | )
11 | (fp_line (start 1.27 6.35) (end -1.27 6.35) (layer F.Fab) (width 0.1))
12 | (fp_line (start -0.32 -6.35) (end 1.27 -6.35) (layer F.Fab) (width 0.1))
13 | (fp_line (start -1.27 6.35) (end -1.27 -5.4) (layer F.Fab) (width 0.1))
14 | (fp_line (start -1.27 -5.4) (end -0.32 -6.35) (layer F.Fab) (width 0.1))
15 | (fp_line (start 1.27 -6.35) (end 1.27 6.35) (layer F.Fab) (width 0.1))
16 | (fp_line (start -3.45 -6.85) (end -3.45 6.85) (layer F.CrtYd) (width 0.05))
17 | (fp_line (start -3.45 6.85) (end 3.45 6.85) (layer F.CrtYd) (width 0.05))
18 | (fp_line (start 3.45 6.85) (end 3.45 -6.85) (layer F.CrtYd) (width 0.05))
19 | (fp_line (start 3.45 -6.85) (end -3.45 -6.85) (layer F.CrtYd) (width 0.05))
20 | (fp_text user %R (at 0 0 90) (layer F.Fab)
21 | (effects (font (size 1 1) (thickness 0.15)))
22 | )
23 | (pad 1 smd rect (at 0 -5.08) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
24 | (pad 3 smd rect (at 0 0) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
25 | (pad 5 smd rect (at 0 5.08) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
26 | (pad 2 smd rect (at 0 -2.54) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
27 | (pad 4 smd rect (at 0 2.54) (size 2.51 1) (layers F.Cu F.Paste F.Mask))
28 | (model ${KISYS3DMOD}/Pin_Headers.3dshapes/Pin_Header_Straight_1x05_Pitch2.54mm_SMD_Pin1Left.wrl
29 | (at (xyz 0 0 0))
30 | (scale (xyz 1 1 1))
31 | (rotate (xyz 0 0 0))
32 | )
33 | )
34 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/SC-70-C5.kicad_mod:
--------------------------------------------------------------------------------
1 | (module SC-70-C5 (layer F.Cu) (tedit 591AA024)
2 | (fp_text reference REF** (at 0 2.85) (layer F.SilkS)
3 | (effects (font (size 1 1) (thickness 0.15)))
4 | )
5 | (fp_text value SC-70-C5 (at 0 -2.85) (layer F.Fab)
6 | (effects (font (size 1 1) (thickness 0.15)))
7 | )
8 | (fp_circle (center 1.4 -1) (end 1.6 -0.925) (layer F.Fab) (width 0.15))
9 | (fp_line (start 1 -0.625) (end 1 0.625) (layer F.Fab) (width 0.15))
10 | (fp_line (start -1 -0.625) (end -1 0.625) (layer F.Fab) (width 0.15))
11 | (fp_line (start 1 0.625) (end -1 0.625) (layer F.Fab) (width 0.15))
12 | (fp_line (start 1 -0.625) (end -1 -0.625) (layer F.Fab) (width 0.15))
13 | (pad 2 smd rect (at 0 -1.1) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
14 | (pad 3 smd rect (at -0.65 -1.1) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
15 | (pad 1 smd rect (at 0.65 -1.1) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
16 | (pad 4 smd rect (at -0.65 1.1) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
17 | (pad 5 smd rect (at 0.65 1.1) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
18 | )
19 |
--------------------------------------------------------------------------------
/board/tinyfpga.pretty/SOT23.kicad_mod:
--------------------------------------------------------------------------------
1 | (module tinyfpga:SOT23 (layer F.Cu) (tedit 593651E8)
2 | (solder_mask_margin 0.05)
3 | (fp_text reference U2 (at 0 -0.1) (layer F.Fab)
4 | (effects (font (size 0.3 0.3) (thickness 0.075)))
5 | )
6 | (fp_text value MIC5504-3.3YM5-TR (at 0 0.3) (layer F.Fab)
7 | (effects (font (size 0.2 0.16) (thickness 0.03175)))
8 | )
9 | (fp_circle (center 0.9364 -0.2386) (end 1.1364 -0.1636) (layer F.Fab) (width 0.15))
10 | (fp_line (start 1.45 -0.8) (end 1.45 0.8) (layer F.Fab) (width 0.15))
11 | (fp_line (start -1.45 -0.8) (end -1.45 0.8) (layer F.Fab) (width 0.15))
12 | (fp_line (start 1.45 0.8) (end -1.45 0.8) (layer F.Fab) (width 0.15))
13 | (fp_line (start 1.45 -0.8) (end -1.45 -0.8) (layer F.Fab) (width 0.15))
14 | (pad 2 smd rect (at 0 -1.3) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
15 | (pad 3 smd rect (at -0.95 -1.3) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
16 | (pad 1 smd rect (at 0.95 -1.3) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
17 | (pad 4 smd rect (at -0.95 1.3) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
18 | (pad 5 smd rect (at 0.95 1.3) (size 0.45 0.95) (layers F.Cu F.Paste F.Mask))
19 | )
20 |
--------------------------------------------------------------------------------
/firmware/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # There exist several targets which are by default empty and which can be
3 | # used for execution of your targets. These targets are usually executed
4 | # before and after some main targets. They are:
5 | #
6 | # .build-pre: called before 'build' target
7 | # .build-post: called after 'build' target
8 | # .clean-pre: called before 'clean' target
9 | # .clean-post: called after 'clean' target
10 | # .clobber-pre: called before 'clobber' target
11 | # .clobber-post: called after 'clobber' target
12 | # .all-pre: called before 'all' target
13 | # .all-post: called after 'all' target
14 | # .help-pre: called before 'help' target
15 | # .help-post: called after 'help' target
16 | #
17 | # Targets beginning with '.' are not intended to be called on their own.
18 | #
19 | # Main targets can be executed directly, and they are:
20 | #
21 | # build build a specific configuration
22 | # clean remove built files from a configuration
23 | # clobber remove all built files
24 | # all build all configurations
25 | # help print help mesage
26 | #
27 | # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
28 | # .help-impl are implemented in nbproject/makefile-impl.mk.
29 | #
30 | # Available make variables:
31 | #
32 | # CND_BASEDIR base directory for relative paths
33 | # CND_DISTDIR default top distribution directory (build artifacts)
34 | # CND_BUILDDIR default top build directory (object files, ...)
35 | # CONF name of current configuration
36 | # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
37 | # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
38 | # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
39 | # CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
40 | # CND_PACKAGE_NAME_${CONF} name of package (current configuration)
41 | # CND_PACKAGE_PATH_${CONF} path to package (current configuration)
42 | #
43 | # NOCDDL
44 |
45 |
46 | # Environment
47 | MKDIR=mkdir
48 | CP=cp
49 | CCADMIN=CCadmin
50 | RANLIB=ranlib
51 |
52 |
53 | # build
54 | build: .build-post
55 |
56 | .build-pre:
57 | # Add your pre 'build' code here...
58 |
59 | .build-post: .build-impl
60 | # Add your post 'build' code here...
61 |
62 |
63 | # clean
64 | clean: .clean-post
65 |
66 | .clean-pre:
67 | # Add your pre 'clean' code here...
68 | # WARNING: the IDE does not call this target since it takes a long time to
69 | # simply run make. Instead, the IDE removes the configuration directories
70 | # under build and dist directly without calling make.
71 | # This target is left here so people can do a clean when running a clean
72 | # outside the IDE.
73 |
74 | .clean-post: .clean-impl
75 | # Add your post 'clean' code here...
76 |
77 |
78 | # clobber
79 | clobber: .clobber-post
80 |
81 | .clobber-pre:
82 | # Add your pre 'clobber' code here...
83 |
84 | .clobber-post: .clobber-impl
85 | # Add your post 'clobber' code here...
86 |
87 |
88 | # all
89 | all: .all-post
90 |
91 | .all-pre:
92 | # Add your pre 'all' code here...
93 |
94 | .all-post: .all-impl
95 | # Add your post 'all' code here...
96 |
97 |
98 | # help
99 | help: .help-post
100 |
101 | .help-pre:
102 | # Add your pre 'help' code here...
103 |
104 | .help-post: .help-impl
105 | # Add your post 'help' code here...
106 |
107 |
108 |
109 | # include project implementation makefile
110 | include nbproject/Makefile-impl.mk
111 |
112 | # include project make variables
113 | include nbproject/Makefile-variables.mk
114 |
--------------------------------------------------------------------------------
/firmware/dist/default/production/firmware.production.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinyfpga/TinyFPGA-A-Programmer/108b9ea165499d14b3ebf5a4cbf1396d4721737e/firmware/dist/default/production/firmware.production.elf
--------------------------------------------------------------------------------
/firmware/dist/default/production/firmware.production.mum:
--------------------------------------------------------------------------------
1 |
2 | Memory Summary:
3 | Program space used 1F44h ( 8004) of 2000h words ( 97.7%)
4 | Data space used 246h ( 582) of 400h bytes ( 56.8%)
5 | EEPROM space None available
6 | Data stack space used 0h ( 0) of 180h bytes ( 0.0%)
7 | Configuration bits used 2h ( 2) of 2h words (100.0%)
8 | ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
9 |
10 |
--------------------------------------------------------------------------------
/firmware/dist/default/production/firmware.production.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinyfpga/TinyFPGA-A-Programmer/108b9ea165499d14b3ebf5a4cbf1396d4721737e/firmware/dist/default/production/firmware.production.obj
--------------------------------------------------------------------------------
/firmware/dist/default/production/firmware.production.rlf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinyfpga/TinyFPGA-A-Programmer/108b9ea165499d14b3ebf5a4cbf1396d4721737e/firmware/dist/default/production/firmware.production.rlf
--------------------------------------------------------------------------------
/firmware/dist/default/production/memoryfile.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | words
6 | 8192
7 | 8004
8 | 188
9 |
10 |
11 | bytes
12 | 1024
13 | 582
14 | 442
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/firmware/lc-switch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. Neither the name of the Institute nor the names of its contributors
14 | * may be used to endorse or promote products derived from this software
15 | * without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 | * SUCH DAMAGE.
28 | *
29 | * This file is part of the Contiki operating system.
30 | *
31 | * Author: Adam Dunkels
32 | *
33 | * $Id: lc-switch.h,v 1.4 2006/06/03 11:29:43 adam Exp $
34 | */
35 |
36 | /**
37 | * \addtogroup lc
38 | * @{
39 | */
40 |
41 | /**
42 | * \file
43 | * Implementation of local continuations based on switch() statment
44 | * \author Adam Dunkels
45 | *
46 | * This implementation of local continuations uses the C switch()
47 | * statement to resume execution of a function somewhere inside the
48 | * function's body. The implementation is based on the fact that
49 | * switch() statements are able to jump directly into the bodies of
50 | * control structures such as if() or while() statmenets.
51 | *
52 | * This implementation borrows heavily from Simon Tatham's coroutines
53 | * implementation in C:
54 | * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
55 | */
56 |
57 | #ifndef __LC_SWITCH_H__
58 | #define __LC_SWITCH_H__
59 |
60 | /* WARNING! lc implementation using switch() does not work if an
61 | LC_SET() is done within another switch() statement! */
62 |
63 | /** \hideinitializer */
64 | typedef unsigned short lc_t;
65 |
66 | #define LC_INIT(s) s = 0;
67 |
68 | #define LC_RESUME(s) switch(s) { case 0:
69 |
70 | #define LC_SET(s) s = __LINE__; case __LINE__:
71 |
72 | #define LC_END(s) }
73 |
74 | #endif /* __LC_SWITCH_H__ */
75 |
76 | /** @} */
77 |
--------------------------------------------------------------------------------
/firmware/lc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. Neither the name of the Institute nor the names of its contributors
14 | * may be used to endorse or promote products derived from this software
15 | * without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 | * SUCH DAMAGE.
28 | *
29 | * This file is part of the protothreads library.
30 | *
31 | * Author: Adam Dunkels
32 | *
33 | * $Id: lc.h,v 1.2 2005/02/24 10:36:59 adam Exp $
34 | */
35 |
36 | /**
37 | * \addtogroup pt
38 | * @{
39 | */
40 |
41 | /**
42 | * \defgroup lc Local continuations
43 | * @{
44 | *
45 | * Local continuations form the basis for implementing protothreads. A
46 | * local continuation can be set in a specific function to
47 | * capture the state of the function. After a local continuation has
48 | * been set can be resumed in order to restore the state of the
49 | * function at the point where the local continuation was set.
50 | *
51 | *
52 | */
53 |
54 | /**
55 | * \file lc.h
56 | * Local continuations
57 | * \author
58 | * Adam Dunkels
59 | *
60 | */
61 |
62 | #ifdef DOXYGEN
63 | /**
64 | * Initialize a local continuation.
65 | *
66 | * This operation initializes the local continuation, thereby
67 | * unsetting any previously set continuation state.
68 | *
69 | * \hideinitializer
70 | */
71 | #define LC_INIT(lc)
72 |
73 | /**
74 | * Set a local continuation.
75 | *
76 | * The set operation saves the state of the function at the point
77 | * where the operation is executed. As far as the set operation is
78 | * concerned, the state of the function does not include the
79 | * call-stack or local (automatic) variables, but only the program
80 | * counter and such CPU registers that needs to be saved.
81 | *
82 | * \hideinitializer
83 | */
84 | #define LC_SET(lc)
85 |
86 | /**
87 | * Resume a local continuation.
88 | *
89 | * The resume operation resumes a previously set local continuation, thus
90 | * restoring the state in which the function was when the local
91 | * continuation was set. If the local continuation has not been
92 | * previously set, the resume operation does nothing.
93 | *
94 | * \hideinitializer
95 | */
96 | #define LC_RESUME(lc)
97 |
98 | /**
99 | * Mark the end of local continuation usage.
100 | *
101 | * The end operation signifies that local continuations should not be
102 | * used any more in the function. This operation is not needed for
103 | * most implementations of local continuation, but is required by a
104 | * few implementations.
105 | *
106 | * \hideinitializer
107 | */
108 | #define LC_END(lc)
109 |
110 | /**
111 | * \var typedef lc_t;
112 | *
113 | * The local continuation type.
114 | *
115 | * \hideinitializer
116 | */
117 | #endif /* DOXYGEN */
118 |
119 | #ifndef __LC_H__
120 | #define __LC_H__
121 |
122 |
123 | #ifdef LC_INCLUDE
124 | #include LC_INCLUDE
125 | #else
126 | #include "lc-switch.h"
127 | #endif /* LC_INCLUDE */
128 |
129 | #endif /* __LC_H__ */
130 |
131 | /** @} */
132 | /** @} */
133 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/interrupt_manager.c:
--------------------------------------------------------------------------------
1 | /**
2 | Generated Interrupt Manager Source File
3 |
4 | @Company:
5 | Microchip Technology Inc.
6 |
7 | @File Name:
8 | interrupt_manager.c
9 |
10 | @Summary:
11 | This is the Interrupt Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
12 |
13 | @Description:
14 | This header file provides implementations for global interrupt handling.
15 | For individual peripheral handlers please see the peripheral driver for
16 | all modules selected in the GUI.
17 | Generation Information :
18 | Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.45
19 | Device : PIC16F1455
20 | Driver Version : 1.02
21 | The generated drivers are tested against the following:
22 | Compiler : XC8 1.35
23 | MPLAB : MPLAB X 3.40
24 | */
25 |
26 | /*
27 | (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
28 | software and any derivatives exclusively with Microchip products.
29 |
30 | THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
31 | EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
32 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
33 | PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
34 | WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
35 |
36 | IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
37 | INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
38 | WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
39 | BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
40 | FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
41 | ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
42 | THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
43 |
44 | MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
45 | TERMS.
46 | */
47 |
48 | #include "interrupt_manager.h"
49 | #include "mcc.h"
50 |
51 | void interrupt INTERRUPT_InterruptManager (void)
52 | {
53 | // interrupt handler
54 | if(INTCONbits.PEIE == 1 && PIE2bits.USBIE == 1 && PIR2bits.USBIF == 1)
55 | {
56 | USB_USBDeviceTasks();
57 | }
58 | else
59 | {
60 | //Unhandled Interrupt
61 | }
62 | }
63 | /**
64 | End of File
65 | */
66 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/interrupt_manager.h:
--------------------------------------------------------------------------------
1 | /**
2 | Generated Interrupt Manager Header File
3 |
4 | @Company:
5 | Microchip Technology Inc.
6 |
7 | @File Name:
8 | interrupt_manager.h
9 |
10 | @Summary:
11 | This is the Interrupt Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
12 |
13 | @Description:
14 | This header file provides implementations for global interrupt handling.
15 | For individual peripheral handlers please see the peripheral driver for
16 | all modules selected in the GUI.
17 | Generation Information :
18 | Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.45
19 | Device : PIC16F1455
20 | Driver Version : 2.00
21 | The generated drivers are tested against the following:
22 | Compiler : XC8 1.35
23 | MPLAB : MPLAB X 3.40
24 | */
25 |
26 | /*
27 | (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
28 | software and any derivatives exclusively with Microchip products.
29 |
30 | THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
31 | EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
32 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
33 | PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
34 | WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
35 |
36 | IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
37 | INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
38 | WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
39 | BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
40 | FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
41 | ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
42 | THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
43 |
44 | MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
45 | TERMS.
46 | */
47 |
48 | #ifndef INTERRUPT_MANAGER_H
49 | #define INTERRUPT_MANAGER_H
50 |
51 |
52 | /**
53 | * @Param
54 | none
55 | * @Returns
56 | none
57 | * @Description
58 | This macro will enable global interrupts.
59 | * @Example
60 | INTERRUPT_GlobalInterruptEnable();
61 | */
62 | #define INTERRUPT_GlobalInterruptEnable() (INTCONbits.GIE = 1)
63 |
64 | /**
65 | * @Param
66 | none
67 | * @Returns
68 | none
69 | * @Description
70 | This macro will disable global interrupts.
71 | * @Example
72 | INTERRUPT_GlobalInterruptDisable();
73 | */
74 | #define INTERRUPT_GlobalInterruptDisable() (INTCONbits.GIE = 0)
75 |
76 | /**
77 | * @Param
78 | none
79 | * @Returns
80 | none
81 | * @Description
82 | This macro will enable peripheral interrupts.
83 | * @Example
84 | INTERRUPT_PeripheralInterruptEnable();
85 | */
86 | #define INTERRUPT_PeripheralInterruptEnable() (INTCONbits.PEIE = 1)
87 |
88 | /**
89 | * @Param
90 | none
91 | * @Returns
92 | none
93 | * @Description
94 | This macro will disable peripheral interrupts.
95 | * @Example
96 | INTERRUPT_PeripheralInterruptDisable();
97 | */
98 | #define INTERRUPT_PeripheralInterruptDisable() (INTCONbits.PEIE = 0)
99 |
100 | /**
101 | * @Param
102 | none
103 | * @Returns
104 | none
105 | * @Description
106 | Main interrupt service routine. Calls module interrupt handlers.
107 | * @Example
108 | INTERRUPT_InterruptManager();
109 | */
110 | void interrupt INTERRUPT_InterruptManager(void);
111 |
112 |
113 | #endif // INTERRUPT_MANAGER_H
114 | /**
115 | End of File
116 | */
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/mcc.c:
--------------------------------------------------------------------------------
1 | /**
2 | @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Source File
3 |
4 | @Company:
5 | Microchip Technology Inc.
6 |
7 | @File Name:
8 | mcc.c
9 |
10 | @Summary:
11 | This is the mcc.c file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
12 |
13 | @Description:
14 | This header file provides implementations for driver APIs for all modules selected in the GUI.
15 | Generation Information :
16 | Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.45
17 | Device : PIC16F1455
18 | Driver Version : 1.02
19 | The generated drivers are tested against the following:
20 | Compiler : XC8 1.35
21 | MPLAB : MPLAB X 3.40
22 | */
23 |
24 | /*
25 | (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
26 | software and any derivatives exclusively with Microchip products.
27 |
28 | THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
29 | EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
30 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
31 | PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
32 | WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
33 |
34 | IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
35 | INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
36 | WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
37 | BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
38 | FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
39 | ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
40 | THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
41 |
42 | MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
43 | TERMS.
44 | */
45 |
46 | // Configuration bits: selected in the GUI
47 |
48 | // CONFIG1
49 | #pragma config FOSC = INTOSC // Oscillator Selection Bits->INTOSC oscillator: I/O function on CLKIN pin
50 | #pragma config WDTE = OFF // Watchdog Timer Enable->WDT disabled
51 | #pragma config PWRTE = OFF // Power-up Timer Enable->PWRT disabled
52 | #pragma config MCLRE = ON // MCLR Pin Function Select->MCLR/VPP pin function is MCLR
53 | #pragma config CP = OFF // Flash Program Memory Code Protection->Program memory code protection is disabled
54 | #pragma config BOREN = ON // Brown-out Reset Enable->Brown-out Reset enabled
55 | #pragma config CLKOUTEN = OFF // Clock Out Enable->CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
56 | #pragma config IESO = ON // Internal/External Switchover Mode->Internal/External Switchover Mode is enabled
57 | #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable->Fail-Safe Clock Monitor is enabled
58 |
59 | // CONFIG2
60 | #pragma config WRT = OFF // Flash Memory Self-Write Protection->Write protection off
61 | #pragma config CPUDIV = NOCLKDIV // CPU System Clock Selection Bit->NO CPU system divide
62 | #pragma config USBLSCLK = 48MHz // USB Low SPeed Clock Selection bit->System clock expects 48 MHz, FS/LS USB CLKENs divide-by is set to 8.
63 | #pragma config PLLMULT = 3x // PLL Multipler Selection Bit->3x Output Frequency Selected
64 | #pragma config PLLEN = ENABLED // PLL Enable Bit->3x or 4x PLL Enabled
65 | #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable->Stack Overflow or Underflow will cause a Reset
66 | #pragma config BORV = LO // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.
67 | #pragma config LPBOR = OFF // Low-Power Brown Out Reset->Low-Power BOR is disabled
68 | #pragma config LVP = ON // Low-Voltage Programming Enable->Low-voltage programming enabled
69 |
70 | #include "mcc.h"
71 |
72 | void SYSTEM_Initialize(void)
73 | {
74 |
75 | PIN_MANAGER_Initialize();
76 | OSCILLATOR_Initialize();
77 | WDT_Initialize();
78 | USBDeviceInit();
79 | USBDeviceAttach();
80 | }
81 |
82 | void OSCILLATOR_Initialize(void)
83 | {
84 | // SCS FOSC; SPLLMULT 4xPLL; SPLLEN disabled; IRCF 16MHz_HF;
85 | OSCCON = 0x3C;
86 | // TUN 0;
87 | OSCTUNE = 0x00;
88 | // ACTSRC SOSC; ACTUD enabled; ACTEN disabled;
89 | ACTCON = 0x00;
90 | // Wait for PLL to stabilize
91 | while(PLLRDY == 0)
92 | {
93 | }
94 | }
95 |
96 | void WDT_Initialize(void)
97 | {
98 | // WDTPS 1:65536; SWDTEN OFF;
99 | WDTCON = 0x16;
100 | }
101 |
102 | /**
103 | End of File
104 | */
105 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/mcc.h:
--------------------------------------------------------------------------------
1 | /**
2 | @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Header File
3 |
4 | @Company:
5 | Microchip Technology Inc.
6 |
7 | @File Name:
8 | mcc.h
9 |
10 | @Summary:
11 | This is the mcc.h file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
12 |
13 | @Description:
14 | This header file provides implementations for driver APIs for all modules selected in the GUI.
15 | Generation Information :
16 | Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.45
17 | Device : PIC16F1455
18 | Version : 1.02
19 | The generated drivers are tested against the following:
20 | Compiler : XC8 1.35
21 | MPLAB : MPLAB X 3.40
22 | */
23 |
24 | /*
25 | (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
26 | software and any derivatives exclusively with Microchip products.
27 |
28 | THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
29 | EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
30 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
31 | PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
32 | WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
33 |
34 | IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
35 | INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
36 | WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
37 | BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
38 | FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
39 | ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
40 | THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
41 |
42 | MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
43 | TERMS.
44 | */
45 |
46 | #ifndef MCC_H
47 | #define MCC_H
48 | #include
49 | #include "pin_manager.h"
50 | #include
51 | #include
52 | #include "interrupt_manager.h"
53 | #include "usb/usb.h"
54 |
55 | #define _XTAL_FREQ 48000000
56 |
57 |
58 | /**
59 | * @Param
60 | none
61 | * @Returns
62 | none
63 | * @Description
64 | Initializes the device to the default states configured in the
65 | * MCC GUI
66 | * @Example
67 | SYSTEM_Initialize(void);
68 | */
69 | void SYSTEM_Initialize(void);
70 |
71 | /**
72 | * @Param
73 | none
74 | * @Returns
75 | none
76 | * @Description
77 | Initializes the oscillator to the default states configured in the
78 | * MCC GUI
79 | * @Example
80 | OSCILLATOR_Initialize(void);
81 | */
82 | void OSCILLATOR_Initialize(void);
83 |
84 | /**
85 | * @Param
86 | none
87 | * @Returns
88 | none
89 | * @Description
90 | Initializes the WDT module to the default states configured in the
91 | * MCC GUI
92 | * @Example
93 | WDT_Initialize(void);
94 | */
95 | void WDT_Initialize(void);
96 |
97 |
98 | #endif /* MCC_H */
99 | /**
100 | End of File
101 | */
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/pin_manager.c:
--------------------------------------------------------------------------------
1 | /**
2 | Generated Pin Manager File
3 |
4 | Company:
5 | Microchip Technology Inc.
6 |
7 | File Name:
8 | pin_manager.c
9 |
10 | Summary:
11 | This is the Pin Manager file generated using MPLAB(c) Code Configurator
12 |
13 | Description:
14 | This header file provides implementations for pin APIs for all pins selected in the GUI.
15 | Generation Information :
16 | Product Revision : MPLAB(c) Code Configurator - 4.26
17 | Device : PIC16F1455
18 | Driver Version : 1.02
19 | The generated drivers are tested against the following:
20 | Compiler : XC8 1.35
21 | MPLAB : MPLAB X 3.40
22 |
23 | Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved.
24 |
25 | Microchip licenses to you the right to use, modify, copy and distribute
26 | Software only when embedded on a Microchip microcontroller or digital signal
27 | controller that is integrated into your product or third party product
28 | (pursuant to the sublicense terms in the accompanying license agreement).
29 |
30 | You should refer to the license agreement accompanying this Software for
31 | additional information regarding your rights and obligations.
32 |
33 | SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
34 | EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
35 | MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
36 | IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
37 | CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
38 | OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
39 | INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
40 | CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
41 | SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
42 | (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
43 |
44 | */
45 |
46 | #include
47 | #include "pin_manager.h"
48 | #include "stdbool.h"
49 |
50 |
51 |
52 | void PIN_MANAGER_Initialize(void)
53 | {
54 | /**
55 | LATx registers
56 | */
57 | LATA = 0x00;
58 | LATC = 0x00;
59 |
60 | /**
61 | TRISx registers
62 | */
63 | TRISA = 0x30;
64 | TRISC = 0x07;
65 |
66 | /**
67 | ANSELx registers
68 | */
69 | ANSELC = 0x08;
70 | ANSELA = 0x10;
71 |
72 | /**
73 | WPUx registers
74 | */
75 | WPUA = 0x38;
76 | OPTION_REGbits.nWPUEN = 0;
77 |
78 |
79 | /**
80 | APFCONx registers
81 | */
82 | APFCON = 0x00;
83 |
84 |
85 |
86 |
87 | }
88 |
89 | void PIN_MANAGER_IOC(void)
90 | {
91 |
92 | }
93 |
94 | /**
95 | End of File
96 | */
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/pin_manager.h:
--------------------------------------------------------------------------------
1 | /**
2 | @Generated Pin Manager Header File
3 |
4 | @Company:
5 | Microchip Technology Inc.
6 |
7 | @File Name:
8 | pin_manager.h
9 |
10 | @Summary:
11 | This is the Pin Manager file generated using MPLAB(c) Code Configurator
12 |
13 | @Description:
14 | This header file provides implementations for pin APIs for all pins selected in the GUI.
15 | Generation Information :
16 | Product Revision : MPLAB(c) Code Configurator - 4.26
17 | Device : PIC16F1455
18 | Version : 1.01
19 | The generated drivers are tested against the following:
20 | Compiler : XC8 1.35
21 | MPLAB : MPLAB X 3.40
22 |
23 | Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved.
24 |
25 | Microchip licenses to you the right to use, modify, copy and distribute
26 | Software only when embedded on a Microchip microcontroller or digital signal
27 | controller that is integrated into your product or third party product
28 | (pursuant to the sublicense terms in the accompanying license agreement).
29 |
30 | You should refer to the license agreement accompanying this Software for
31 | additional information regarding your rights and obligations.
32 |
33 | SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
34 | EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
35 | MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
36 | IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
37 | CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
38 | OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
39 | INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
40 | CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
41 | SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
42 | (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
43 |
44 | */
45 |
46 |
47 | #ifndef PIN_MANAGER_H
48 | #define PIN_MANAGER_H
49 |
50 | #define INPUT 1
51 | #define OUTPUT 0
52 |
53 | #define HIGH 1
54 | #define LOW 0
55 |
56 | #define ANALOG 1
57 | #define DIGITAL 0
58 |
59 | #define PULL_UP_ENABLED 1
60 | #define PULL_UP_DISABLED 0
61 |
62 | // get/set RA0 procedures
63 | #define RA0_GetValue() PORTAbits.RA0
64 |
65 | // get/set RA1 procedures
66 | #define RA1_GetValue() PORTAbits.RA1
67 |
68 | // get/set IO_RC0 aliases
69 | #define IO_RC0_TRIS TRISCbits.TRISC0
70 | #define IO_RC0_LAT LATCbits.LATC0
71 | #define IO_RC0_PORT PORTCbits.RC0
72 | #define IO_RC0_ANS ANSELCbits.ANSC0
73 | #define IO_RC0_SetHigh() do { LATCbits.LATC0 = 1; } while(0)
74 | #define IO_RC0_SetLow() do { LATCbits.LATC0 = 0; } while(0)
75 | #define IO_RC0_Toggle() do { LATCbits.LATC0 = ~LATCbits.LATC0; } while(0)
76 | #define IO_RC0_GetValue() PORTCbits.RC0
77 | #define IO_RC0_SetDigitalInput() do { TRISCbits.TRISC0 = 1; } while(0)
78 | #define IO_RC0_SetDigitalOutput() do { TRISCbits.TRISC0 = 0; } while(0)
79 | #define IO_RC0_SetAnalogMode() do { ANSELCbits.ANSC0 = 1; } while(0)
80 | #define IO_RC0_SetDigitalMode() do { ANSELCbits.ANSC0 = 0; } while(0)
81 |
82 | // get/set IO_RC1 aliases
83 | #define IO_RC1_TRIS TRISCbits.TRISC1
84 | #define IO_RC1_LAT LATCbits.LATC1
85 | #define IO_RC1_PORT PORTCbits.RC1
86 | #define IO_RC1_ANS ANSELCbits.ANSC1
87 | #define IO_RC1_SetHigh() do { LATCbits.LATC1 = 1; } while(0)
88 | #define IO_RC1_SetLow() do { LATCbits.LATC1 = 0; } while(0)
89 | #define IO_RC1_Toggle() do { LATCbits.LATC1 = ~LATCbits.LATC1; } while(0)
90 | #define IO_RC1_GetValue() PORTCbits.RC1
91 | #define IO_RC1_SetDigitalInput() do { TRISCbits.TRISC1 = 1; } while(0)
92 | #define IO_RC1_SetDigitalOutput() do { TRISCbits.TRISC1 = 0; } while(0)
93 | #define IO_RC1_SetAnalogMode() do { ANSELCbits.ANSC1 = 1; } while(0)
94 | #define IO_RC1_SetDigitalMode() do { ANSELCbits.ANSC1 = 0; } while(0)
95 |
96 | // get/set IO_RC2 aliases
97 | #define IO_RC2_TRIS TRISCbits.TRISC2
98 | #define IO_RC2_LAT LATCbits.LATC2
99 | #define IO_RC2_PORT PORTCbits.RC2
100 | #define IO_RC2_ANS ANSELCbits.ANSC2
101 | #define IO_RC2_SetHigh() do { LATCbits.LATC2 = 1; } while(0)
102 | #define IO_RC2_SetLow() do { LATCbits.LATC2 = 0; } while(0)
103 | #define IO_RC2_Toggle() do { LATCbits.LATC2 = ~LATCbits.LATC2; } while(0)
104 | #define IO_RC2_GetValue() PORTCbits.RC2
105 | #define IO_RC2_SetDigitalInput() do { TRISCbits.TRISC2 = 1; } while(0)
106 | #define IO_RC2_SetDigitalOutput() do { TRISCbits.TRISC2 = 0; } while(0)
107 | #define IO_RC2_SetAnalogMode() do { ANSELCbits.ANSC2 = 1; } while(0)
108 | #define IO_RC2_SetDigitalMode() do { ANSELCbits.ANSC2 = 0; } while(0)
109 |
110 | // get/set IO_RC3 aliases
111 | #define IO_RC3_TRIS TRISCbits.TRISC4
112 | #define IO_RC3_LAT LATCbits.LATC3
113 | #define IO_RC3_PORT PORTCbits.RC3
114 | #define IO_RC3_ANS ANSELCbits.ANSC3
115 | #define IO_RC3_SetHigh() do { LATCbits.LATC3 = 1; } while(0)
116 | #define IO_RC3_SetLow() do { LATCbits.LATC3 = 0; } while(0)
117 | #define IO_RC3_Toggle() do { LATCbits.LATC3 = ~LATCbits.LATC3; } while(0)
118 | #define IO_RC3_GetValue() PORTCbits.RC3
119 | #define IO_RC3_SetDigitalInput() do { TRISCbits.TRISC4 = 1; } while(0)
120 | #define IO_RC3_SetDigitalOutput() do { TRISCbits.TRISC4 = 0; } while(0)
121 | #define IO_RC3_SetAnalogMode() do { ANSELCbits.ANSC3 = 1; } while(0)
122 | #define IO_RC3_SetDigitalMode() do { ANSELCbits.ANSC3 = 0; } while(0)
123 |
124 | // get/set IO_RC4 aliases
125 | #define IO_RC4_LAT LATCbits.LATC4
126 | #define IO_RC4_PORT PORTCbits.RC4
127 | #define IO_RC4_SetHigh() do { LATCbits.LATC4 = 1; } while(0)
128 | #define IO_RC4_SetLow() do { LATCbits.LATC4 = 0; } while(0)
129 | #define IO_RC4_Toggle() do { LATCbits.LATC4 = ~LATCbits.LATC4; } while(0)
130 | #define IO_RC4_GetValue() PORTCbits.RC4
131 |
132 | // get/set IO_RC5 aliases
133 | #define IO_RC5_TRIS TRISCbits.TRISC5
134 | #define IO_RC5_LAT LATCbits.LATC5
135 | #define IO_RC5_PORT PORTCbits.RC5
136 | #define IO_RC5_SetHigh() do { LATCbits.LATC5 = 1; } while(0)
137 | #define IO_RC5_SetLow() do { LATCbits.LATC5 = 0; } while(0)
138 | #define IO_RC5_Toggle() do { LATCbits.LATC5 = ~LATCbits.LATC5; } while(0)
139 | #define IO_RC5_GetValue() PORTCbits.RC5
140 | #define IO_RC5_SetDigitalInput() do { TRISCbits.TRISC5 = 1; } while(0)
141 | #define IO_RC5_SetDigitalOutput() do { TRISCbits.TRISC5 = 0; } while(0)
142 |
143 | /**
144 | @Param
145 | none
146 | @Returns
147 | none
148 | @Description
149 | GPIO and peripheral I/O initialization
150 | @Example
151 | PIN_MANAGER_Initialize();
152 | */
153 | void PIN_MANAGER_Initialize (void);
154 |
155 | /**
156 | * @Param
157 | none
158 | * @Returns
159 | none
160 | * @Description
161 | Interrupt on Change Handling routine
162 | * @Example
163 | PIN_MANAGER_IOC();
164 | */
165 | void PIN_MANAGER_IOC(void);
166 |
167 |
168 |
169 | #endif // PIN_MANAGER_H
170 | /**
171 | End of File
172 | */
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb.h:
--------------------------------------------------------------------------------
1 | // DOM-IGNORE-BEGIN
2 | /*******************************************************************************
3 | Copyright 2015 Microchip Technology Inc. (www.microchip.com)
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | To request to license the code under the MLA license (www.microchip.com/mla_license),
18 | please contact mla_licensing@microchip.com
19 | *******************************************************************************/
20 | //DOM-IGNORE-END
21 |
22 |
23 | /*******************************************************************************
24 | Module for Microchip USB Library
25 |
26 | Company:
27 | Microchip Technology Inc.
28 |
29 | File Name:
30 | usb.h
31 |
32 | Summary:
33 | This header file exposes the core library APIs and definitions for the USB
34 | library.
35 |
36 | Description:
37 | This header file exposes the core library APIs and definitions for the USB
38 | library. The user is responsible for also including the header file for
39 | the specific driver they will be using.
40 | *******************************************************************************/
41 |
42 | #ifndef _USB_H_
43 | #define _USB_H_
44 |
45 | #include "usb_device_config.h"
46 |
47 | #include "usb_common.h" // Common USB library definitions
48 | #include "usb_ch9.h" // USB device framework definitions
49 |
50 | #if defined( USB_SUPPORT_DEVICE )
51 | #include "usb_device.h" // USB Device abstraction layer interface
52 | #include "usb_device_cdc.h"
53 | #endif
54 |
55 | #include "usb_hal.h" // Hardware Abstraction Layer interface
56 |
57 | /* USB Library version number. This can be used to verify in an application
58 | specific version of the library is being used.
59 | */
60 | #define USB_MAJOR_VER 2 // Firmware version, major release number.
61 | #define USB_MINOR_VER 13 // Firmware version, minor release number.
62 | #define USB_DOT_VER 0 // Firmware version, dot release number.
63 |
64 | #endif // _USB_H_
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb_descriptors.c:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | /*******************************************************************************
5 | Copyright 2016 Microchip Technology Inc. (www.microchip.com)
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | To request to license the code under the MLA license (www.microchip.com/mla_license),
20 | please contact mla_licensing@microchip.com
21 | *******************************************************************************/
22 |
23 | /********************************************************************
24 | -usb_descriptors.c-
25 | -------------------------------------------------------------------
26 | Filling in the descriptor values in the usb_descriptors.c file:
27 | -------------------------------------------------------------------
28 |
29 | [Device Descriptors]
30 | The device descriptor is defined as a USB_DEVICE_DESCRIPTOR type.
31 | This type is defined in usb_ch9.h Each entry into this structure
32 | needs to be the correct length for the data type of the entry.
33 |
34 | [Configuration Descriptors]
35 | The configuration descriptor was changed in v2.x from a structure
36 | to a uint8_t array. Given that the configuration is now a byte array
37 | each byte of multi-byte fields must be listed individually. This
38 | means that for fields like the total size of the configuration where
39 | the field is a 16-bit value "64,0," is the correct entry for a
40 | configuration that is only 64 bytes long and not "64," which is one
41 | too few bytes.
42 |
43 | The configuration attribute must always have the _DEFAULT
44 | definition at the minimum. Additional options can be ORed
45 | to the _DEFAULT attribute. Available options are _SELF and _RWU.
46 | These definitions are defined in the usb_device.h file. The
47 | _SELF tells the USB host that this device is self-powered. The
48 | _RWU tells the USB host that this device supports Remote Wakeup.
49 |
50 | [Endpoint Descriptors]
51 | Like the configuration descriptor, the endpoint descriptors were
52 | changed in v2.x of the stack from a structure to a uint8_t array. As
53 | endpoint descriptors also has a field that are multi-byte entities,
54 | please be sure to specify both bytes of the field. For example, for
55 | the endpoint size an endpoint that is 64 bytes needs to have the size
56 | defined as "64,0," instead of "64,"
57 |
58 | Take the following example:
59 | // Endpoint Descriptor //
60 | 0x07, //the size of this descriptor //
61 | USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
62 | _EP02_IN, //EndpointAddress
63 | _INT, //Attributes
64 | 0x08,0x00, //size (note: 2 bytes)
65 | 0x02, //Interval
66 |
67 | The first two parameters are self-explanatory. They specify the
68 | length of this endpoint descriptor (7) and the descriptor type.
69 | The next parameter identifies the endpoint, the definitions are
70 | defined in usb_device.h and has the following naming
71 | convention:
72 | _EP<##>_
73 | where ## is the endpoint number and dir is the direction of
74 | transfer. The dir has the value of either 'OUT' or 'IN'.
75 | The next parameter identifies the type of the endpoint. Available
76 | options are _BULK, _INT, _ISO, and _CTRL. The _CTRL is not
77 | typically used because the default control transfer endpoint is
78 | not defined in the USB descriptors. When _ISO option is used,
79 | addition options can be ORed to _ISO. Example:
80 | _ISO|_AD|_FE
81 | This describes the endpoint as an isochronous pipe with adaptive
82 | and feedback attributes. See usb_device.h and the USB
83 | specification for details. The next parameter defines the size of
84 | the endpoint. The last parameter in the polling interval.
85 |
86 | -------------------------------------------------------------------
87 | Adding a USB String
88 | -------------------------------------------------------------------
89 | A string descriptor array should have the following format:
90 |
91 | rom struct{byte bLength;byte bDscType;word string[size];}sdxxx={
92 | sizeof(sdxxx),DSC_STR,};
93 |
94 | The above structure provides a means for the C compiler to
95 | calculate the length of string descriptor sdxxx, where xxx is the
96 | index number. The first two bytes of the descriptor are descriptor
97 | length and type. The rest are string texts which must be
98 | in the unicode format. The unicode format is achieved by declaring
99 | each character as a word type. The whole text string is declared
100 | as a word array with the number of characters equals to .
101 | has to be manually counted and entered into the array
102 | declaration. Let's study this through an example:
103 | if the string is "USB" , then the string descriptor should be:
104 | (Using index 02)
105 | rom struct{byte bLength;byte bDscType;word string[3];}sd002={
106 | sizeof(sd002),DSC_STR,'U','S','B'};
107 |
108 | A USB project may have multiple strings and the firmware supports
109 | the management of multiple strings through a look-up table.
110 | The look-up table is defined as:
111 | rom const unsigned char *rom USB_SD_Ptr[]={&sd000,&sd001,&sd002};
112 |
113 | The above declaration has 3 strings, sd000, sd001, and sd002.
114 | Strings can be removed or added. sd000 is a specialized string
115 | descriptor. It defines the language code, usually this is
116 | US English (0x0409). The index of the string must match the index
117 | position of the USB_SD_Ptr array, &sd000 must be in position
118 | USB_SD_Ptr[0], &sd001 must be in position USB_SD_Ptr[1] and so on.
119 | The look-up table USB_SD_Ptr is used by the get string handler
120 | function.
121 |
122 | -------------------------------------------------------------------
123 |
124 | The look-up table scheme also applies to the configuration
125 | descriptor. A USB device may have multiple configuration
126 | descriptors, i.e. CFG01, CFG02, etc. To add a configuration
127 | descriptor, user must implement a structure similar to CFG01.
128 | The next step is to add the configuration descriptor name, i.e.
129 | cfg01, cfg02,.., to the look-up table USB_CD_Ptr. USB_CD_Ptr[0]
130 | is a dummy place holder since configuration 0 is the un-configured
131 | state according to the definition in the USB specification.
132 |
133 | ********************************************************************/
134 |
135 | /*********************************************************************
136 | * Descriptor specific type definitions are defined in:
137 | * usb_device.h
138 | *
139 | * Configuration options are defined in:
140 | * usb_device_config.h
141 | ********************************************************************/
142 | #ifndef __USB_DESCRIPTORS_C
143 | #define __USB_DESCRIPTORS_C
144 |
145 | /** INCLUDES *******************************************************/
146 | #include "usb.h"
147 | #include "usb_device_cdc.h"
148 |
149 | /** CONSTANTS ******************************************************/
150 | #if defined(__18CXX)
151 | #pragma romdata
152 | #endif
153 |
154 | /* Device Descriptor */
155 | const USB_DEVICE_DESCRIPTOR device_dsc=
156 | {
157 | 0x12, // Size of this descriptor in bytes
158 | USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type
159 | 0x0200, // USB Spec Release Number in BCD format
160 | CDC_DEVICE, // Class Code
161 | 0x00, // Subclass code
162 | 0x00, // Protocol code
163 | USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usb_device_config.h
164 | 0x1209, // Vendor ID
165 | 0x2101, // Product ID
166 | 0x0100, // Device release number in BCD format
167 | 0x01, // Manufacturer string index
168 | 0x02, // Product string index
169 | 0x00, // Device serial number string index
170 | 0x01 // Number of possible configurations
171 | };
172 |
173 | /* Configuration 1 Descriptor */
174 | const uint8_t configDescriptor1[]={
175 | /* Configuration Descriptor */
176 | 0x09,//sizeof(USB_CFG_DSC), // Size of this descriptor in bytes
177 | USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type
178 | 67,0, // Total length of data for this cfg
179 | 2, // Number of interfaces in this cfg
180 | 1, // Index value of this configuration
181 | 0, // Configuration string index
182 | _DEFAULT | _SELF, // Attributes, see usb_device.h
183 | 50, // Max power consumption (2X mA)
184 |
185 | /* Interface Descriptor */
186 | 9,//sizeof(USB_INTF_DSC), // Size of this descriptor in bytes
187 | USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
188 | 0, // Interface Number
189 | 0, // Alternate Setting Number
190 | 1, // Number of endpoints in this intf
191 | COMM_INTF, // Class code
192 | ABSTRACT_CONTROL_MODEL, // Subclass code
193 | V25TER, // Protocol code
194 | 0, // Interface string index
195 |
196 | /* CDC Class-Specific Descriptors */
197 | sizeof(USB_CDC_HEADER_FN_DSC),
198 | CS_INTERFACE,
199 | DSC_FN_HEADER,
200 | 0x10,0x01,
201 |
202 | sizeof(USB_CDC_ACM_FN_DSC),
203 | CS_INTERFACE,
204 | DSC_FN_ACM,
205 | USB_CDC_ACM_FN_DSC_VAL,
206 |
207 | sizeof(USB_CDC_UNION_FN_DSC),
208 | CS_INTERFACE,
209 | DSC_FN_UNION,
210 | CDC_COMM_INTF_ID,
211 | CDC_DATA_INTF_ID,
212 |
213 | sizeof(USB_CDC_CALL_MGT_FN_DSC),
214 | CS_INTERFACE,
215 | DSC_FN_CALL_MGT,
216 | 0x00,
217 | CDC_DATA_INTF_ID,
218 |
219 | /* Endpoint Descriptor */
220 | //sizeof(USB_EP_DSC),DSC_EP,_EP02_IN,_INT,CDC_INT_EP_SIZE,0x02,
221 | 0x07,/*sizeof(USB_EP_DSC)*/
222 | USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
223 | _EP01_IN, //EndpointAddress
224 | _INTERRUPT, //Attributes
225 | 0x08,0x00, //size
226 | 0x02, //Interval
227 |
228 | /* Interface Descriptor */
229 | 9,//sizeof(USB_INTF_DSC), // Size of this descriptor in bytes
230 | USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
231 | 1, // Interface Number
232 | 0, // Alternate Setting Number
233 | 2, // Number of endpoints in this intf
234 | DATA_INTF, // Class code
235 | 0, // Subclass code
236 | NO_PROTOCOL, // Protocol code
237 | 0, // Interface string index
238 |
239 | /* Endpoint Descriptor */
240 | //sizeof(USB_EP_DSC),DSC_EP,_EP03_OUT,_BULK,CDC_BULK_OUT_EP_SIZE,0x00,
241 | 0x07,/*sizeof(USB_EP_DSC)*/
242 | USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
243 | _EP02_OUT, //EndpointAddress
244 | _BULK, //Attributes
245 | 0x40,0x00, //size
246 | 0x00, //Interval
247 |
248 | /* Endpoint Descriptor */
249 | //sizeof(USB_EP_DSC),DSC_EP,_EP03_IN,_BULK,CDC_BULK_IN_EP_SIZE,0x00
250 | 0x07,/*sizeof(USB_EP_DSC)*/
251 | USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
252 | _EP02_IN, //EndpointAddress
253 | _BULK, //Attributes
254 | 0x40,0x00, //size
255 | 0x00, //Interval
256 | };
257 |
258 | //Language code string descriptor
259 | const struct{uint8_t bLength;uint8_t bDscType;uint16_t string[1];}sd000={
260 | sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409}};
261 |
262 | //Manufacturer string descriptor
263 | const struct{uint8_t bLength;uint8_t bDscType;uint16_t string[8];}sd001={
264 | sizeof(sd001),USB_DESCRIPTOR_STRING,
265 | {'T','i','n','y','F','P','G','A'}
266 | };
267 |
268 | //Product string descriptor
269 | const struct{uint8_t bLength;uint8_t bDscType;uint16_t string[10];}sd002={
270 | sizeof(sd002),USB_DESCRIPTOR_STRING,
271 | {'P','r','o','g','r','a','m','m','e','r'}
272 | };
273 |
274 | //Array of configuration descriptors
275 | const uint8_t *const USB_CD_Ptr[]=
276 | {
277 | (const uint8_t *const)&configDescriptor1
278 | };
279 |
280 | //Array of string descriptors
281 | const uint8_t *const USB_SD_Ptr[USB_NUM_STRING_DESCRIPTORS]=
282 | {
283 | (const uint8_t *const)&sd000,
284 | (const uint8_t *const)&sd001,
285 | (const uint8_t *const)&sd002
286 | };
287 |
288 | #if defined(__18CXX)
289 | #pragma code
290 | #endif
291 |
292 | #endif
293 | /** EOF usb_descriptors.c ****************************************************/
294 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb_device.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinyfpga/TinyFPGA-A-Programmer/108b9ea165499d14b3ebf5a4cbf1396d4721737e/firmware/mcc_generated_files/usb/usb_device.c
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb_device_config.h:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | /*******************************************************************************
5 | Copyright 2016 Microchip Technology Inc. (www.microchip.com)
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | To request to license the code under the MLA license (www.microchip.com/mla_license),
20 | please contact mla_licensing@microchip.com
21 | *******************************************************************************/
22 |
23 | /*********************************************************************
24 | * Descriptor specific type definitions are defined in: usbd.h
25 | ********************************************************************/
26 |
27 | #ifndef USBCFG_H
28 | #define USBCFG_H
29 |
30 | /** DEFINITIONS ****************************************************/
31 | #define USB_EP0_BUFF_SIZE 16 // Valid Options: 8, 16, 32, or 64 bytes.
32 | // Using larger options take more SRAM, but
33 | // does not provide much advantage in most types
34 | // of applications. Exceptions to this, are applications
35 | // that use EP0 IN or OUT for sending large amounts of
36 | // application related data.
37 |
38 | #define USB_MAX_NUM_INT 2 //Set this number to match the maximum interface number used in the descriptors for this firmware project
39 | #define USB_MAX_EP_NUMBER 2 //Set this number to match the maximum endpoint number used in the descriptors for this firmware project
40 |
41 | //Device descriptor - if these two definitions are not defined then
42 | // a const USB_DEVICE_DESCRIPTOR variable by the exact name of device_dsc
43 | // must exist.
44 | #define USB_USER_DEVICE_DESCRIPTOR &device_dsc
45 | #define USB_USER_DEVICE_DESCRIPTOR_INCLUDE extern const USB_DEVICE_DESCRIPTOR device_dsc
46 |
47 | //Configuration descriptors - if these two definitions do not exist then
48 | // a const uint8_t *const variable named exactly USB_CD_Ptr[] must exist.
49 | #define USB_USER_CONFIG_DESCRIPTOR USB_CD_Ptr
50 | #define USB_USER_CONFIG_DESCRIPTOR_INCLUDE extern const uint8_t *const USB_CD_Ptr[]
51 |
52 |
53 | //------------------------------------------------------------------------------
54 | //Select an endpoint ping-pong buffering mode. Some microcontrollers only
55 | //support certain modes. For most applications, it is recommended to use either
56 | //the USB_PING_PONG__FULL_PING_PONG or USB_PING_PONG__EP0_OUT_ONLY options.
57 | //The other settings are supported on some devices, but they are not
58 | //recommended, as they offer inferior control transfer timing performance.
59 | //See inline code comments in usb_device.c for additional details.
60 | //Enabling ping pong buffering on an endpoint generally increases firmware
61 | //overhead somewhat, but when both buffers are used simultaneously in the
62 | //firmware, can offer better sustained bandwidth, especially for OUT endpoints.
63 | //------------------------------------------------------
64 | #define USB_PING_PONG_MODE USB_PING_PONG__FULL_PING_PONG
65 | //------------------------------------------------------------------------------
66 |
67 |
68 | //------------------------------------------------------------------------------
69 | //Select a USB stack operating mode. In the USB_INTERRUPT mode, the USB stack
70 | //main task handler gets called only when necessary as an interrupt handler.
71 | //This can potentially minimize CPU utilization, but adds context saving
72 | //and restoring overhead associated with interrupts, which can potentially
73 | //decrease performance.
74 | //When the USB_POLLING mode is selected, the USB stack main task handler
75 | //(ex: USBDeviceTasks()) must be called periodically by the application firmware
76 | //at a minimum rate as described in the inline code comments in usb_device.c.
77 | //------------------------------------------------------
78 | #define USB_INTERRUPT
79 | #define USB_USBDeviceTasks() USBDeviceTasks() //macro wrap tasks call from mcc
80 | //------------------------------------------------------------------------------
81 |
82 | /* Parameter definitions are defined in usb_device.h */
83 | #define USB_PULLUP_OPTION USB_PULLUP_ENABLE
84 |
85 | #define USB_TRANSCEIVER_OPTION USB_INTERNAL_TRANSCEIVER
86 | //External Transceiver support is not available on all product families. Please
87 | // refer to the product family datasheet for more information if this feature
88 | // is available on the target processor.
89 |
90 | #define USB_SPEED_OPTION USB_FULL_SPEED
91 |
92 | //------------------------------------------------------------------------------------------------------------------
93 | //Option to enable auto-arming of the status stage of control transfers, if no
94 | //"progress" has been made for the USB_STATUS_STAGE_TIMEOUT value.
95 | //If progress is made (any successful transactions completing on EP0 IN or OUT)
96 | //the timeout counter gets reset to the USB_STATUS_STAGE_TIMEOUT value.
97 | //
98 | //During normal control transfer processing, the USB stack or the application
99 | //firmware will call USBCtrlEPAllowStatusStage() as soon as the firmware is finished
100 | //processing the control transfer. Therefore, the status stage completes as
101 | //quickly as is physically possible. The USB_ENABLE_STATUS_STAGE_TIMEOUTS
102 | //feature, and the USB_STATUS_STAGE_TIMEOUT value are only relevant, when:
103 | //1. The application uses the USBDeferStatusStage() API function, but never calls
104 | // USBCtrlEPAllowStatusStage(). Or:
105 | //2. The application uses host to device (OUT) control transfers with data stage,
106 | // and some abnormal error occurs, where the host might try to abort the control
107 | // transfer, before it has sent all of the data it claimed it was going to send.
108 | //
109 | //If the application firmware never uses the USBDeferStatusStage() API function,
110 | //and it never uses host to device control transfers with data stage, then
111 | //it is not required to enable the USB_ENABLE_STATUS_STAGE_TIMEOUTS feature.
112 |
113 | #define USB_ENABLE_STATUS_STAGE_TIMEOUTS //Comment this out to disable this feature.
114 |
115 | //Section 9.2.6 of the USB 2.0 specifications indicate that:
116 | //1. Control transfers with no data stage: Status stage must complete within
117 | // 50ms of the start of the control transfer.
118 | //2. Control transfers with (IN) data stage: Status stage must complete within
119 | // 50ms of sending the last IN data packet in fulfillment of the data stage.
120 | //3. Control transfers with (OUT) data stage: No specific status stage timing
121 | // requirement. However, the total time of the entire control transfer (ex:
122 | // including the OUT data stage and IN status stage) must not exceed 5 seconds.
123 | //
124 | //Therefore, if the USB_ENABLE_STATUS_STAGE_TIMEOUTS feature is used, it is suggested
125 | //to set the USB_STATUS_STAGE_TIMEOUT value to timeout in less than 50ms. If the
126 | //USB_ENABLE_STATUS_STAGE_TIMEOUTS feature is not enabled, then the USB_STATUS_STAGE_TIMEOUT
127 | //parameter is not relevant.
128 |
129 | #define USB_STATUS_STAGE_TIMEOUT (uint8_t)45 //Approximate timeout in milliseconds, except when
130 | //USB_POLLING mode is used, and USBDeviceTasks() is called at < 1kHz
131 | //In this special case, the timeout becomes approximately:
132 | //Timeout(in milliseconds) = ((1000 * (USB_STATUS_STAGE_TIMEOUT - 1)) / (USBDeviceTasks() polling frequency in Hz))
133 | //------------------------------------------------------------------------------------------------------------------
134 |
135 | #define USB_SUPPORT_DEVICE
136 |
137 | #define USB_NUM_STRING_DESCRIPTORS 3 //Set this number to match the total number of string descriptors that are implemented in the usb_descriptors.c file
138 |
139 | /*******************************************************************
140 | * Event disable options
141 | * Enable a definition to suppress a specific event. By default
142 | * all events are sent.
143 | *******************************************************************/
144 | //#define USB_DISABLE_SUSPEND_HANDLER
145 | //#define USB_DISABLE_WAKEUP_FROM_SUSPEND_HANDLER
146 | //#define USB_DISABLE_SOF_HANDLER
147 | //#define USB_DISABLE_TRANSFER_TERMINATED_HANDLER
148 | //#define USB_DISABLE_ERROR_HANDLER
149 | //#define USB_DISABLE_NONSTANDARD_EP0_REQUEST_HANDLER
150 | //#define USB_DISABLE_SET_DESCRIPTOR_HANDLER
151 | //#define USB_DISABLE_SET_CONFIGURATION_HANDLER
152 | //#define USB_DISABLE_TRANSFER_COMPLETE_HANDLER
153 |
154 |
155 | /** DEVICE CLASS USAGE *********************************************/
156 | #define USB_USE_CDC
157 |
158 | /** ENDPOINTS ALLOCATION *******************************************/
159 | /* CDC */
160 | #define CDC_COMM_INTF_ID 0x0
161 | #define CDC_COMM_EP 1
162 | #define CDC_COMM_IN_EP_SIZE 10
163 |
164 | #define CDC_DATA_INTF_ID 0x01
165 | #define CDC_DATA_EP 2
166 | #define CDC_DATA_OUT_EP_SIZE 64
167 | #define CDC_DATA_IN_EP_SIZE 64
168 |
169 | #define USB_CDC_SUPPORT_ABSTRACT_CONTROL_MANAGEMENT_CAPABILITIES_D1 //Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and Serial_State commands
170 | //#define USB_CDC_SUPPORT_ABSTRACT_CONTROL_MANAGEMENT_CAPABILITIES_D2 //Send_Break command
171 |
172 | /** DEFINITIONS ****************************************************/
173 |
174 | /** DEFINITIONS ****************************************************/
175 |
176 | #endif //USBCFG_H
177 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb_device_events.c:
--------------------------------------------------------------------------------
1 | // DOM-IGNORE-BEGIN
2 | /*******************************************************************************
3 | Copyright 2015 Microchip Technology Inc. (www.microchip.com)
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | To request to license the code under the MLA license (www.microchip.com/mla_license),
18 | please contact mla_licensing@microchip.com
19 | *******************************************************************************/
20 | //DOM-IGNORE-END
21 |
22 | /** INCLUDES *******************************************************/
23 | #include
24 | #include
25 | #include "usb_device.h"
26 | #include "usb_device_cdc.h"
27 |
28 | /*******************************************************************
29 | * Function: bool USER_USB_CALLBACK_EVENT_HANDLER(
30 | * USB_EVENT event, void *pdata, uint16_t size)
31 | *
32 | * PreCondition: None
33 | *
34 | * Input: USB_EVENT event - the type of event
35 | * void *pdata - pointer to the event data
36 | * uint16_t size - size of the event data
37 | *
38 | * Output: None
39 | *
40 | * Side Effects: None
41 | *
42 | * Overview: This function is called from the USB stack to
43 | * notify a user application that a USB event
44 | * occured. This callback is in interrupt context
45 | * when the USB_INTERRUPT option is selected.
46 | *
47 | * Note: None
48 | *******************************************************************/
49 | bool USER_USB_CALLBACK_EVENT_HANDLER(USB_EVENT event, void *pdata, uint16_t size)
50 | {
51 | switch( (int) event )
52 | {
53 | case EVENT_TRANSFER:
54 | break;
55 |
56 | case EVENT_SOF:
57 | break;
58 |
59 | case EVENT_SUSPEND:
60 | //Call the hardware platform specific handler for suspend events for
61 | //possible further action (like optionally going reconfiguring the application
62 | //for lower power states and going to sleep during the suspend event). This
63 | //would normally be done in USB compliant bus powered applications, although
64 | //no further processing is needed for purely self powered applications that
65 | //don't consume power from the host.
66 | break;
67 |
68 | case EVENT_RESUME:
69 | //Call the hardware platform specific resume from suspend handler (ex: to
70 | //restore I/O pins to higher power states if they were changed during the
71 | //preceding SYSTEM_Initialize(SYSTEM_STATE_USB_SUSPEND) call at the start
72 | //of the suspend condition.
73 | break;
74 |
75 | case EVENT_CONFIGURED:
76 | CDCInitEP();
77 | break;
78 |
79 | case EVENT_SET_DESCRIPTOR:
80 | break;
81 |
82 | case EVENT_EP0_REQUEST:
83 | /* We have received a non-standard USB request. The CDC driver
84 | * needs to check to see if the request was for it. */
85 | USBCheckCDCRequest();
86 | break;
87 |
88 | case EVENT_BUS_ERROR:
89 | break;
90 |
91 | case EVENT_TRANSFER_TERMINATED:
92 | break;
93 |
94 | default:
95 | break;
96 | }
97 | return true;
98 | }
99 |
100 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb_device_local.h:
--------------------------------------------------------------------------------
1 | // DOM-IGNORE-BEGIN
2 | /*******************************************************************************
3 | Copyright 2015 Microchip Technology Inc. (www.microchip.com)
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | To request to license the code under the MLA license (www.microchip.com/mla_license),
18 | please contact mla_licensing@microchip.com
19 | *******************************************************************************/
20 | //DOM-IGNORE-END
21 |
22 | #include "usb_device_config.h"
23 |
24 | /* Short Packet States - Used by Control Transfer Read - CTRL_TRF_TX */
25 | #define SHORT_PKT_NOT_USED 0
26 | #define SHORT_PKT_PENDING 1
27 | #define SHORT_PKT_SENT 2
28 |
29 | /* Control Transfer States */
30 | #define WAIT_SETUP 0
31 | #define CTRL_TRF_TX 1
32 | #define CTRL_TRF_RX 2
33 |
34 |
35 | typedef union
36 | {
37 | struct
38 | {
39 | unsigned char ping_pong_state :1;
40 | unsigned char transfer_terminated :1;
41 | } bits;
42 | uint8_t Val;
43 | } EP_STATUS;
44 |
45 | #if (USB_PING_PONG_MODE == USB_PING_PONG__NO_PING_PONG)
46 | #define USB_NEXT_EP0_OUT_PING_PONG 0x0000 // Used in USB Device Mode only
47 | #define USB_NEXT_EP0_IN_PING_PONG 0x0000 // Used in USB Device Mode only
48 | #define USB_NEXT_PING_PONG 0x0000 // Used in USB Device Mode only
49 | #define EP0_OUT_EVEN 0 // Used in USB Device Mode only
50 | #define EP0_OUT_ODD 0 // Used in USB Device Mode only
51 | #define EP0_IN_EVEN 1 // Used in USB Device Mode only
52 | #define EP0_IN_ODD 1 // Used in USB Device Mode only
53 | #define EP1_OUT_EVEN 2 // Used in USB Device Mode only
54 | #define EP1_OUT_ODD 2 // Used in USB Device Mode only
55 | #define EP1_IN_EVEN 3 // Used in USB Device Mode only
56 | #define EP1_IN_ODD 3 // Used in USB Device Mode only
57 | #define EP2_OUT_EVEN 4 // Used in USB Device Mode only
58 | #define EP2_OUT_ODD 4 // Used in USB Device Mode only
59 | #define EP2_IN_EVEN 5 // Used in USB Device Mode only
60 | #define EP2_IN_ODD 5 // Used in USB Device Mode only
61 | #define EP3_OUT_EVEN 6 // Used in USB Device Mode only
62 | #define EP3_OUT_ODD 6 // Used in USB Device Mode only
63 | #define EP3_IN_EVEN 7 // Used in USB Device Mode only
64 | #define EP3_IN_ODD 7 // Used in USB Device Mode only
65 | #define EP4_OUT_EVEN 8 // Used in USB Device Mode only
66 | #define EP4_OUT_ODD 8 // Used in USB Device Mode only
67 | #define EP4_IN_EVEN 9 // Used in USB Device Mode only
68 | #define EP4_IN_ODD 9 // Used in USB Device Mode only
69 | #define EP5_OUT_EVEN 10 // Used in USB Device Mode only
70 | #define EP5_OUT_ODD 10 // Used in USB Device Mode only
71 | #define EP5_IN_EVEN 11 // Used in USB Device Mode only
72 | #define EP5_IN_ODD 11 // Used in USB Device Mode only
73 | #define EP6_OUT_EVEN 12 // Used in USB Device Mode only
74 | #define EP6_OUT_ODD 12 // Used in USB Device Mode only
75 | #define EP6_IN_EVEN 13 // Used in USB Device Mode only
76 | #define EP6_IN_ODD 13 // Used in USB Device Mode only
77 | #define EP7_OUT_EVEN 14 // Used in USB Device Mode only
78 | #define EP7_OUT_ODD 14 // Used in USB Device Mode only
79 | #define EP7_IN_EVEN 15 // Used in USB Device Mode only
80 | #define EP7_IN_ODD 15 // Used in USB Device Mode only
81 | #define EP8_OUT_EVEN 16 // Used in USB Device Mode only
82 | #define EP8_OUT_ODD 16 // Used in USB Device Mode only
83 | #define EP8_IN_EVEN 17 // Used in USB Device Mode only
84 | #define EP8_IN_ODD 17 // Used in USB Device Mode only
85 | #define EP9_OUT_EVEN 18 // Used in USB Device Mode only
86 | #define EP9_OUT_ODD 18 // Used in USB Device Mode only
87 | #define EP9_IN_EVEN 19 // Used in USB Device Mode only
88 | #define EP9_IN_ODD 19 // Used in USB Device Mode only
89 | #define EP10_OUT_EVEN 20 // Used in USB Device Mode only
90 | #define EP10_OUT_ODD 20 // Used in USB Device Mode only
91 | #define EP10_IN_EVEN 21 // Used in USB Device Mode only
92 | #define EP10_IN_ODD 21 // Used in USB Device Mode only
93 | #define EP11_OUT_EVEN 22 // Used in USB Device Mode only
94 | #define EP11_OUT_ODD 22 // Used in USB Device Mode only
95 | #define EP11_IN_EVEN 23 // Used in USB Device Mode only
96 | #define EP11_IN_ODD 23 // Used in USB Device Mode only
97 | #define EP12_OUT_EVEN 24 // Used in USB Device Mode only
98 | #define EP12_OUT_ODD 24 // Used in USB Device Mode only
99 | #define EP12_IN_EVEN 25 // Used in USB Device Mode only
100 | #define EP12_IN_ODD 25 // Used in USB Device Mode only
101 | #define EP13_OUT_EVEN 26 // Used in USB Device Mode only
102 | #define EP13_OUT_ODD 26 // Used in USB Device Mode only
103 | #define EP13_IN_EVEN 27 // Used in USB Device Mode only
104 | #define EP13_IN_ODD 27 // Used in USB Device Mode only
105 | #define EP14_OUT_EVEN 28 // Used in USB Device Mode only
106 | #define EP14_OUT_ODD 28 // Used in USB Device Mode only
107 | #define EP14_IN_EVEN 29 // Used in USB Device Mode only
108 | #define EP14_IN_ODD 29 // Used in USB Device Mode only
109 | #define EP15_OUT_EVEN 30 // Used in USB Device Mode only
110 | #define EP15_OUT_ODD 30 // Used in USB Device Mode only
111 | #define EP15_IN_EVEN 31 // Used in USB Device Mode only
112 | #define EP15_IN_ODD 31 // Used in USB Device Mode only
113 |
114 | #define EP(ep,dir,pp) (2*ep+dir) // Used in USB Device Mode only
115 | #define BD(ep,dir,pp) ((8 * ep) + (4 * dir)) // Used in USB Device Mode only
116 |
117 | #elif (USB_PING_PONG_MODE == USB_PING_PONG__EP0_OUT_ONLY)
118 | #define USB_NEXT_EP0_OUT_PING_PONG 0x0004
119 | #define USB_NEXT_EP0_IN_PING_PONG 0x0000
120 | #define USB_NEXT_PING_PONG 0x0000
121 | #define EP0_OUT_EVEN 0
122 | #define EP0_OUT_ODD 1
123 | #define EP0_IN_EVEN 2
124 | #define EP0_IN_ODD 2
125 | #define EP1_OUT_EVEN 3
126 | #define EP1_OUT_ODD 3
127 | #define EP1_IN_EVEN 4
128 | #define EP1_IN_ODD 4
129 | #define EP2_OUT_EVEN 5
130 | #define EP2_OUT_ODD 5
131 | #define EP2_IN_EVEN 6
132 | #define EP2_IN_ODD 6
133 | #define EP3_OUT_EVEN 7
134 | #define EP3_OUT_ODD 7
135 | #define EP3_IN_EVEN 8
136 | #define EP3_IN_ODD 8
137 | #define EP4_OUT_EVEN 9
138 | #define EP4_OUT_ODD 9
139 | #define EP4_IN_EVEN 10
140 | #define EP4_IN_ODD 10
141 | #define EP5_OUT_EVEN 11
142 | #define EP5_OUT_ODD 11
143 | #define EP5_IN_EVEN 12
144 | #define EP5_IN_ODD 12
145 | #define EP6_OUT_EVEN 13
146 | #define EP6_OUT_ODD 13
147 | #define EP6_IN_EVEN 14
148 | #define EP6_IN_ODD 14
149 | #define EP7_OUT_EVEN 15
150 | #define EP7_OUT_ODD 15
151 | #define EP7_IN_EVEN 16
152 | #define EP7_IN_ODD 16
153 | #define EP8_OUT_EVEN 17
154 | #define EP8_OUT_ODD 17
155 | #define EP8_IN_EVEN 18
156 | #define EP8_IN_ODD 18
157 | #define EP9_OUT_EVEN 19
158 | #define EP9_OUT_ODD 19
159 | #define EP9_IN_EVEN 20
160 | #define EP9_IN_ODD 20
161 | #define EP10_OUT_EVEN 21
162 | #define EP10_OUT_ODD 21
163 | #define EP10_IN_EVEN 22
164 | #define EP10_IN_ODD 22
165 | #define EP11_OUT_EVEN 23
166 | #define EP11_OUT_ODD 23
167 | #define EP11_IN_EVEN 24
168 | #define EP11_IN_ODD 24
169 | #define EP12_OUT_EVEN 25
170 | #define EP12_OUT_ODD 25
171 | #define EP12_IN_EVEN 26
172 | #define EP12_IN_ODD 26
173 | #define EP13_OUT_EVEN 27
174 | #define EP13_OUT_ODD 27
175 | #define EP13_IN_EVEN 28
176 | #define EP13_IN_ODD 28
177 | #define EP14_OUT_EVEN 29
178 | #define EP14_OUT_ODD 29
179 | #define EP14_IN_EVEN 30
180 | #define EP14_IN_ODD 30
181 | #define EP15_OUT_EVEN 31
182 | #define EP15_OUT_ODD 31
183 | #define EP15_IN_EVEN 32
184 | #define EP15_IN_ODD 32
185 |
186 | #define EP(ep,dir,pp) (2u*ep+dir+(((ep==0)&&(dir==0))?pp:1))
187 | #define BD(ep,dir,pp) (4u*((2u*ep)+dir+(((ep==0)&&(dir==0))?pp:1)))
188 |
189 | #elif (USB_PING_PONG_MODE == USB_PING_PONG__FULL_PING_PONG)
190 | #if defined (__18CXX) || defined(__C30__) || defined __XC16__ || defined(__XC8)
191 | #if (defined (__dsPIC33E__) || defined (__PIC24E__))
192 | #define USB_NEXT_EP0_OUT_PING_PONG 0x0008
193 | #define USB_NEXT_EP0_IN_PING_PONG 0x0008
194 | #define USB_NEXT_PING_PONG 0x0008
195 | #else
196 | #define USB_NEXT_EP0_OUT_PING_PONG 0x0004
197 | #define USB_NEXT_EP0_IN_PING_PONG 0x0004
198 | #define USB_NEXT_PING_PONG 0x0004
199 | #endif
200 | #elif defined(__C32__)
201 | #define USB_NEXT_EP0_OUT_PING_PONG 0x0008
202 | #define USB_NEXT_EP0_IN_PING_PONG 0x0008
203 | #define USB_NEXT_PING_PONG 0x0008
204 | #else
205 | #error "Not defined for this compiler"
206 | #endif
207 | #define EP0_OUT_EVEN 0
208 | #define EP0_OUT_ODD 1
209 | #define EP0_IN_EVEN 2
210 | #define EP0_IN_ODD 3
211 | #define EP1_OUT_EVEN 4
212 | #define EP1_OUT_ODD 5
213 | #define EP1_IN_EVEN 6
214 | #define EP1_IN_ODD 7
215 | #define EP2_OUT_EVEN 8
216 | #define EP2_OUT_ODD 9
217 | #define EP2_IN_EVEN 10
218 | #define EP2_IN_ODD 11
219 | #define EP3_OUT_EVEN 12
220 | #define EP3_OUT_ODD 13
221 | #define EP3_IN_EVEN 14
222 | #define EP3_IN_ODD 15
223 | #define EP4_OUT_EVEN 16
224 | #define EP4_OUT_ODD 17
225 | #define EP4_IN_EVEN 18
226 | #define EP4_IN_ODD 19
227 | #define EP5_OUT_EVEN 20
228 | #define EP5_OUT_ODD 21
229 | #define EP5_IN_EVEN 22
230 | #define EP5_IN_ODD 23
231 | #define EP6_OUT_EVEN 24
232 | #define EP6_OUT_ODD 25
233 | #define EP6_IN_EVEN 26
234 | #define EP6_IN_ODD 27
235 | #define EP7_OUT_EVEN 28
236 | #define EP7_OUT_ODD 29
237 | #define EP7_IN_EVEN 30
238 | #define EP7_IN_ODD 31
239 | #define EP8_OUT_EVEN 32
240 | #define EP8_OUT_ODD 33
241 | #define EP8_IN_EVEN 34
242 | #define EP8_IN_ODD 35
243 | #define EP9_OUT_EVEN 36
244 | #define EP9_OUT_ODD 37
245 | #define EP9_IN_EVEN 38
246 | #define EP9_IN_ODD 39
247 | #define EP10_OUT_EVEN 40
248 | #define EP10_OUT_ODD 41
249 | #define EP10_IN_EVEN 42
250 | #define EP10_IN_ODD 43
251 | #define EP11_OUT_EVEN 44
252 | #define EP11_OUT_ODD 45
253 | #define EP11_IN_EVEN 46
254 | #define EP11_IN_ODD 47
255 | #define EP12_OUT_EVEN 48
256 | #define EP12_OUT_ODD 49
257 | #define EP12_IN_EVEN 50
258 | #define EP12_IN_ODD 51
259 | #define EP13_OUT_EVEN 52
260 | #define EP13_OUT_ODD 53
261 | #define EP13_IN_EVEN 54
262 | #define EP13_IN_ODD 55
263 | #define EP14_OUT_EVEN 56
264 | #define EP14_OUT_ODD 57
265 | #define EP14_IN_EVEN 58
266 | #define EP14_IN_ODD 59
267 | #define EP15_OUT_EVEN 60
268 | #define EP15_OUT_ODD 61
269 | #define EP15_IN_EVEN 62
270 | #define EP15_IN_ODD 63
271 |
272 | #define EP(ep,dir,pp) (4*ep+2*dir+pp)
273 |
274 | #if defined (__18CXX) || defined(__C30__) || defined __XC16__ || (__XC8)
275 | #if (defined(__dsPIC33E__) || defined (__PIC24E__))
276 | #define BD(ep,dir,pp) (8*(4*ep+2*dir+pp))
277 | #else
278 | #define BD(ep,dir,pp) (4*(4*ep+2*dir+pp))
279 | #endif
280 | #elif defined(__C32__)
281 | #define BD(ep,dir,pp) (8*(4*ep+2*dir+pp))
282 | #else
283 | #error "Not defined for this compiler"
284 | #endif
285 |
286 | #elif (USB_PING_PONG_MODE == USB_PING_PONG__ALL_BUT_EP0)
287 | #define USB_NEXT_EP0_OUT_PING_PONG 0x0000
288 | #define USB_NEXT_EP0_IN_PING_PONG 0x0000
289 | #define USB_NEXT_PING_PONG 0x0004
290 | #define EP0_OUT_EVEN 0
291 | #define EP0_OUT_ODD 0
292 | #define EP0_IN_EVEN 1
293 | #define EP0_IN_ODD 1
294 | #define EP1_OUT_EVEN 2
295 | #define EP1_OUT_ODD 3
296 | #define EP1_IN_EVEN 4
297 | #define EP1_IN_ODD 5
298 | #define EP2_OUT_EVEN 6
299 | #define EP2_OUT_ODD 7
300 | #define EP2_IN_EVEN 8
301 | #define EP2_IN_ODD 9
302 | #define EP3_OUT_EVEN 10
303 | #define EP3_OUT_ODD 11
304 | #define EP3_IN_EVEN 12
305 | #define EP3_IN_ODD 13
306 | #define EP4_OUT_EVEN 14
307 | #define EP4_OUT_ODD 15
308 | #define EP4_IN_EVEN 16
309 | #define EP4_IN_ODD 17
310 | #define EP5_OUT_EVEN 18
311 | #define EP5_OUT_ODD 19
312 | #define EP5_IN_EVEN 20
313 | #define EP5_IN_ODD 21
314 | #define EP6_OUT_EVEN 22
315 | #define EP6_OUT_ODD 23
316 | #define EP6_IN_EVEN 24
317 | #define EP6_IN_ODD 25
318 | #define EP7_OUT_EVEN 26
319 | #define EP7_OUT_ODD 27
320 | #define EP7_IN_EVEN 28
321 | #define EP7_IN_ODD 29
322 | #define EP8_OUT_EVEN 30
323 | #define EP8_OUT_ODD 31
324 | #define EP8_IN_EVEN 32
325 | #define EP8_IN_ODD 33
326 | #define EP9_OUT_EVEN 34
327 | #define EP9_OUT_ODD 35
328 | #define EP9_IN_EVEN 36
329 | #define EP9_IN_ODD 37
330 | #define EP10_OUT_EVEN 38
331 | #define EP10_OUT_ODD 39
332 | #define EP10_IN_EVEN 40
333 | #define EP10_IN_ODD 41
334 | #define EP11_OUT_EVEN 42
335 | #define EP11_OUT_ODD 43
336 | #define EP11_IN_EVEN 44
337 | #define EP11_IN_ODD 45
338 | #define EP12_OUT_EVEN 46
339 | #define EP12_OUT_ODD 47
340 | #define EP12_IN_EVEN 48
341 | #define EP12_IN_ODD 49
342 | #define EP13_OUT_EVEN 50
343 | #define EP13_OUT_ODD 51
344 | #define EP13_IN_EVEN 52
345 | #define EP13_IN_ODD 53
346 | #define EP14_OUT_EVEN 54
347 | #define EP14_OUT_ODD 55
348 | #define EP14_IN_EVEN 56
349 | #define EP14_IN_ODD 57
350 | #define EP15_OUT_EVEN 58
351 | #define EP15_OUT_ODD 59
352 | #define EP15_IN_EVEN 60
353 | #define EP15_IN_ODD 61
354 |
355 | #define EP(ep,dir,pp) (4*ep+2*dir+((ep==0)?0:(pp-2)))
356 | #define BD(ep,dir,pp) (4*(4*ep+2*dir+((ep==0)?0:(pp-2))))
357 |
358 | #else
359 | #error "No ping pong mode defined."
360 | #endif
361 |
362 | /****** Event callback enabling/disabling macros ********************
363 | This section of code is used to disable specific USB events that may not be
364 | desired by the user. This can save code size and increase throughput and
365 | decrease CPU utiliazation.
366 | ********************************************************************/
367 | #if defined USB_DISABLE_SUSPEND_HANDLER
368 | #define USB_SUSPEND_HANDLER(event,pointer,size)
369 |
370 | #warning "Disabling the suspend handler is not recommended. Proper suspend handling is required to create a compliant USB device."
371 | #else
372 | #define USB_SUSPEND_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
373 | #endif
374 |
375 | #if defined USB_DISABLE_WAKEUP_FROM_SUSPEND_HANDLER
376 | #define USB_WAKEUP_FROM_SUSPEND_HANDLER(event,pointer,size)
377 |
378 | #warning "Disabling the wake from suspend handler is not recommended. Proper suspend handling is required to create a compliant USB device."
379 | #else
380 | #define USB_WAKEUP_FROM_SUSPEND_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
381 | #endif
382 |
383 | #if defined USB_DISABLE_SOF_HANDLER
384 | #define USB_SOF_HANDLER(event,pointer,size)
385 | #else
386 | #define USB_SOF_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
387 | #endif
388 |
389 | #if defined USB_DISABLE_TRANSFER_TERMINATED_HANDLER
390 | #define USB_TRANSFER_TERMINATED_HANDLER(event,pointer,size)
391 | #else
392 | #define USB_TRANSFER_TERMINATED_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
393 | #endif
394 |
395 | #if defined USB_DISABLE_ERROR_HANDLER
396 | #define USB_ERROR_HANDLER(event,pointer,size)
397 | #else
398 | #define USB_ERROR_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
399 | #endif
400 |
401 | #if defined USB_DISABLE_NONSTANDARD_EP0_REQUEST_HANDLER
402 | #define USB_NONSTANDARD_EP0_REQUEST_HANDLER(event,pointer,size)
403 | #else
404 | #define USB_NONSTANDARD_EP0_REQUEST_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
405 | #endif
406 |
407 | #if defined USB_DISABLE_SET_DESCRIPTOR_HANDLER
408 | #define USB_SET_DESCRIPTOR_HANDLER(event,pointer,size)
409 | #else
410 | #define USB_SET_DESCRIPTOR_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
411 | #endif
412 |
413 | #if defined USB_DISABLE_SET_CONFIGURATION_HANDLER
414 | #define USB_SET_CONFIGURATION_HANDLER(event,pointer,size)
415 | #else
416 | #define USB_SET_CONFIGURATION_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
417 | #endif
418 |
419 | #if defined USB_DISABLE_TRANSFER_COMPLETE_HANDLER
420 | #define USB_TRANSFER_COMPLETE_HANDLER(event,pointer,size)
421 | #else
422 | #define USB_TRANSFER_COMPLETE_HANDLER(event,pointer,size) USER_USB_CALLBACK_EVENT_HANDLER(event,pointer,size)
423 | #endif
424 |
425 |
--------------------------------------------------------------------------------
/firmware/mcc_generated_files/usb/usb_hal_pic16f1.h:
--------------------------------------------------------------------------------
1 | // DOM-IGNORE-BEGIN
2 | /*******************************************************************************
3 | Copyright 2015 Microchip Technology Inc. (www.microchip.com)
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | To request to license the code under the MLA license (www.microchip.com/mla_license),
18 | please contact mla_licensing@microchip.com
19 | *******************************************************************************/
20 | //DOM-IGNORE-END
21 |
22 | #ifndef _USB_HAL_PIC16F1_H
23 | #define _USB_HAL_PIC16F1_H
24 |
25 | /*****************************************************************************/
26 | /****** include files ********************************************************/
27 | /*****************************************************************************/
28 |
29 | #include
30 |
31 | #include
32 | #include
33 | #include
34 |
35 | #include "usb_device_config.h"
36 |
37 | #ifdef __cplusplus // Provide C++ Compatability
38 | extern "C" {
39 | #endif
40 |
41 | // *****************************************************************************
42 | // *****************************************************************************
43 | // Section: Constants
44 | // *****************************************************************************
45 | // *****************************************************************************
46 | #define USB_HAL_VBUSTristate() //No dedicated VBUS pin on these devices.
47 |
48 |
49 | //----- USBEnableEndpoint() input definitions ----------------------------------
50 | #define USB_HANDSHAKE_ENABLED 0x10
51 | #define USB_HANDSHAKE_DISABLED 0x00
52 |
53 | #define USB_OUT_ENABLED 0x04
54 | #define USB_OUT_DISABLED 0x00
55 |
56 | #define USB_IN_ENABLED 0x02
57 | #define USB_IN_DISABLED 0x00
58 |
59 | #define USB_ALLOW_SETUP 0x00
60 | #define USB_DISALLOW_SETUP 0x08
61 |
62 | #define USB_STALL_ENDPOINT 0x01
63 |
64 | //----- usb_device_config.h input definitions -----------------------------------------
65 | #define USB_PULLUP_ENABLE 0x10
66 | #define USB_PULLUP_DISABLED 0x00
67 |
68 | #define USB_INTERNAL_TRANSCEIVER 0x00
69 | #define USB_EXTERNAL_TRANSCEIVER 0x08
70 |
71 | #define USB_FULL_SPEED 0x04
72 | #define USB_LOW_SPEED 0x00
73 |
74 | //----- Interrupt Flag definitions --------------------------------------------
75 | #define USBTransactionCompleteIE UIEbits.TRNIE
76 | #define USBTransactionCompleteIF UIRbits.TRNIF
77 | #define USBTransactionCompleteIFReg UIR
78 | #define USBTransactionCompleteIFBitNum 0xF7 //AND mask for clearing TRNIF bit position 3
79 |
80 | #define USBResetIE UIEbits.URSTIE
81 | #define USBResetIF UIRbits.URSTIF
82 | #define USBResetIFReg UIR
83 | #define USBResetIFBitNum 0xFE //AND mask for clearing URSTIF bit position 0
84 |
85 | #define USBIdleIE UIEbits.IDLEIE
86 | #define USBIdleIF UIRbits.IDLEIF
87 | #define USBIdleIFReg UIR
88 | #define USBIdleIFBitNum 0xEF //AND mask for clearing IDLEIF bit position 5
89 |
90 | #define USBActivityIE UIEbits.ACTVIE
91 | #define USBActivityIF UIRbits.ACTVIF
92 | #define USBActivityIFReg UIR
93 | #define USBActivityIFBitNum 0xFB //AND mask for clearing ACTVIF bit position 2
94 |
95 | #define USBSOFIE UIEbits.SOFIE
96 | #define USBSOFIF UIRbits.SOFIF
97 | #define USBSOFIFReg UIR
98 | #define USBSOFIFBitNum 0xBF //AND mask for clearing SOFIF bit position 6
99 |
100 | #define USBStallIE UIEbits.STALLIE
101 | #define USBStallIF UIRbits.STALLIF
102 | #define USBStallIFReg UIR
103 | #define USBStallIFBitNum 0xDF //AND mask for clearing STALLIF bit position 5
104 |
105 | #define USBErrorIE UIEbits.UERRIE
106 | #define USBErrorIF UIRbits.UERRIF
107 | #define USBErrorIFReg UIR
108 | #define USBErrorIFBitNum 0xFD //UERRIF bit position 1. Note: This bit is read only and is cleared by clearing the enabled UEIR flags
109 |
110 | //----- Event call back definitions --------------------------------------------
111 | #if defined(USB_DISABLE_SOF_HANDLER)
112 | #define USB_SOF_INTERRUPT 0x00
113 | #else
114 | #define USB_SOF_INTERRUPT 0x40
115 | #endif
116 |
117 | #if defined(USB_DISABLE_ERROR_HANDLER)
118 | #define USB_ERROR_INTERRUPT 0x02
119 | #else
120 | #define USB_ERROR_INTERRUPT 0x02
121 | #endif
122 |
123 | //----- USB module control bits -----------------------------------------------
124 | #define USBPingPongBufferReset UCONbits.PPBRST
125 | #define USBSE0Event UCONbits.SE0
126 | #define USBSuspendControl UCONbits.SUSPND
127 | #define USBPacketDisable UCONbits.PKTDIS
128 | #define USBResumeControl UCONbits.RESUME
129 |
130 | //----- BDnSTAT bit definitions -----------------------------------------------
131 | #define _BSTALL 0x04 //Buffer Stall enable
132 | #define _DTSEN 0x08 //Data Toggle Synch enable
133 | #define _INCDIS 0x10 //Address increment disable
134 | #define _KEN 0x20 //SIE keeps buff descriptors enable
135 | #define _DAT0 0x00 //DATA0 packet expected next
136 | #define _DAT1 0x40 //DATA1 packet expected next
137 | #define _DTSMASK 0x40 //DTS Mask
138 | #define _USIE 0x80 //SIE owns buffer
139 | #define _UCPU 0x00 //CPU owns buffer
140 | #define _STAT_MASK 0xFF
141 |
142 | #define USTAT_EP0_PP_MASK ~0x02
143 | #define USTAT_EP_MASK 0x7E
144 | #define USTAT_EP0_OUT 0x00
145 | #define USTAT_EP0_OUT_EVEN 0x00
146 | #define USTAT_EP0_OUT_ODD 0x02
147 | #define USTAT_EP0_IN 0x04
148 | #define USTAT_EP0_IN_EVEN 0x04
149 | #define USTAT_EP0_IN_ODD 0x06
150 |
151 | #define ENDPOINT_MASK 0b01111000
152 |
153 | //----- U1EP bit definitions --------------------------------------------------
154 | #define UEP_STALL 0x0001
155 | // Cfg Control pipe for this ep
156 | /* Endpoint configuration options for USBEnableEndpoint() function */
157 | #define EP_CTRL 0x06 // Cfg Control pipe for this ep
158 | #define EP_OUT 0x0C // Cfg OUT only pipe for this ep
159 | #define EP_IN 0x0A // Cfg IN only pipe for this ep
160 | #define EP_OUT_IN 0x0E // Cfg both OUT & IN pipes for this ep
161 |
162 | //----- Remap the PIC18 register name space------------------------------------
163 | #define U1ADDR UADDR
164 | #define U1IE UIE
165 | #define U1IR UIR
166 | #define U1EIR UEIR
167 | #define U1EIE UEIE
168 | #define U1CON UCON
169 |
170 | #if (__XC8_VERSION == 1000)
171 | #define U1EP0 UEP7
172 | #define U1EP0bits UEP7bits
173 | #else
174 | #define U1EP0 UEP0
175 | #define U1EP0bits UEP0bits
176 | #endif
177 |
178 | #define U1CONbits UCONbits
179 | #define U1EP1 UEP1
180 | #define U1CNFG1 UCFG
181 | #define U1STAT USTAT
182 |
183 |
184 | //----- Definitions for BDT address --------------------------------------------
185 | #define BDT_BASE_ADDR 0x2000
186 | #define BDT_BASE_ADDR_TAG @ BDT_BASE_ADDR
187 | #define BDT_ENTRY_SIZE 4
188 |
189 | #if (USB_PING_PONG_MODE == USB_PING_PONG__NO_PING_PONG)
190 | #define BDT_NUM_ENTRIES ((USB_MAX_EP_NUMBER + 1) * 2)
191 | #elif (USB_PING_PONG_MODE == USB_PING_PONG__EP0_OUT_ONLY)
192 | #define BDT_NUM_ENTRIES (((USB_MAX_EP_NUMBER + 1) * 2)+1)
193 | #elif (USB_PING_PONG_MODE == USB_PING_PONG__FULL_PING_PONG)
194 | #define BDT_NUM_ENTRIES ((USB_MAX_EP_NUMBER + 1) * 4)
195 | #elif (USB_PING_PONG_MODE == USB_PING_PONG__ALL_BUT_EP0)
196 | #define BDT_NUM_ENTRIES (((USB_MAX_EP_NUMBER + 1) * 4)-2)
197 | #else
198 | #error "No ping pong mode defined."
199 | #endif
200 | #define CTRL_TRF_SETUP_ADDR BDT_BASE_ADDR + (BDT_ENTRY_SIZE * BDT_NUM_ENTRIES)
201 | #define CTRL_TRF_DATA_ADDR CTRL_TRF_SETUP_ADDR + USB_EP0_BUFF_SIZE
202 |
203 | #define CTRL_TRF_SETUP_ADDR_TAG @ CTRL_TRF_SETUP_ADDR
204 | #define CTRL_TRF_DATA_ADDR_TAG @ CTRL_TRF_DATA_ADDR
205 |
206 | //----- Deprecated definitions - will be removed at some point of time----------
207 | //--------- Deprecated in v2.2
208 | #define _LS 0x00 // Use Low-Speed USB Mode
209 | #define _FS 0x04 // Use Full-Speed USB Mode
210 | #define _TRINT 0x00 // Use internal transceiver
211 | #define _TREXT 0x08 // Use external transceiver
212 | #define _PUEN 0x10 // Use internal pull-up resistor
213 | #define _OEMON 0x40 // Use SIE output indicator
214 |
215 | // *****************************************************************************
216 | // *****************************************************************************
217 | // Section: Data Types
218 | // *****************************************************************************
219 | // *****************************************************************************
220 |
221 | // Buffer Descriptor Status Register layout.
222 | typedef union _BD_STAT
223 | {
224 | uint8_t Val;
225 | struct{
226 | //If the CPU owns the buffer then these are the values
227 | unsigned BC8:1; //bit 8 of the byte count
228 | unsigned BC9:1; //bit 9 of the byte count
229 | unsigned BSTALL:1; //Buffer Stall Enable
230 | unsigned DTSEN:1; //Data Toggle Synch Enable
231 | unsigned INCDIS:1; //Address Increment Disable
232 | unsigned KEN:1; //BD Keep Enable
233 | unsigned DTS:1; //Data Toggle Synch Value
234 | unsigned UOWN:1; //USB Ownership
235 | };
236 | struct{
237 | //if the USB module owns the buffer then these are
238 | // the values
239 | unsigned :2;
240 | unsigned PID0:1; //Packet Identifier
241 | unsigned PID1:1;
242 | unsigned PID2:1;
243 | unsigned PID3:1;
244 | unsigned :1;
245 | };
246 | struct{
247 | unsigned :2;
248 | unsigned PID:4; //Packet Identifier
249 | unsigned :2;
250 | };
251 | } BD_STAT; //Buffer Descriptor Status Register
252 |
253 | // BDT Entry Layout
254 | typedef union __BDT
255 | {
256 | struct
257 | {
258 | BD_STAT STAT;
259 | uint8_t CNT;
260 | uint8_t ADRL; //Buffer Address Low
261 | uint8_t ADRH; //Buffer Address High
262 | };
263 | struct
264 | {
265 | unsigned filler1:8;
266 | unsigned filler2:8;
267 | uint16_t ADR; //Buffer Address
268 | };
269 | uint32_t Val;
270 | uint8_t v[4];
271 | } BDT_ENTRY;
272 |
273 | // USTAT Register Layout
274 | typedef union __USTAT
275 | {
276 | struct
277 | {
278 | unsigned char filler1:1;
279 | unsigned char ping_pong:1;
280 | unsigned char direction:1;
281 | unsigned char endpoint_number:4;
282 | };
283 | uint8_t Val;
284 | } USTAT_FIELDS;
285 |
286 | //Macros for fetching parameters from a USTAT_FIELDS variable.
287 | #define USBHALGetLastEndpoint(stat) stat.endpoint_number
288 | #define USBHALGetLastDirection(stat) stat.direction
289 | #define USBHALGetLastPingPong(stat) stat.ping_pong
290 |
291 |
292 | typedef union _POINTER
293 | {
294 | struct
295 | {
296 | uint8_t bLow;
297 | uint8_t bHigh;
298 | //byte bUpper;
299 | };
300 | uint16_t _word; // bLow & bHigh
301 |
302 | //pFunc _pFunc; // Usage: ptr.pFunc(); Init: ptr.pFunc = &;
303 |
304 | uint8_t* bRam; // Ram byte pointer: 2 bytes pointer pointing
305 | // to 1 byte of data
306 | uint16_t* wRam; // Ram word pointer: 2 bytes pointer pointing
307 | // to 2 bytes of data
308 |
309 | const uint8_t* bRom; // Size depends on compiler setting
310 | const uint16_t* wRom;
311 | //rom near byte* nbRom; // Near = 2 bytes pointer
312 | //rom near word* nwRom;
313 | //rom far byte* fbRom; // Far = 3 bytes pointer
314 | //rom far word* fwRom;
315 | } POINTER;
316 |
317 | /*****************************************************************************/
318 | /****** Function prototypes and macro functions ******************************/
319 | /*****************************************************************************/
320 |
321 | #define ConvertToPhysicalAddress(a) (((uint16_t)(a)) & 0x7FFF)
322 | #define ConvertToVirtualAddress(a) ((void *)(a))
323 | #define USBClearUSBInterrupt() PIR2bits.USBIF = 0;
324 | #if defined(USB_INTERRUPT)
325 | #define USBMaskInterrupts() {PIE2bits.USBIE = 0;}
326 | #define USBUnmaskInterrupts() {PIE2bits.USBIE = 1;}
327 | #else
328 | #define USBMaskInterrupts()
329 | #define USBUnmaskInterrupts()
330 | #endif
331 |
332 | #define USBInterruptFlag PIR2bits.USBIF
333 |
334 | //STALLIE, IDLEIE, TRNIE, and URSTIE are all enabled by default and are required
335 | #if defined(USB_INTERRUPT)
336 | #define USBEnableInterrupts() {PIE2bits.USBIE = 1;INTCONbits.PEIE = 1; INTCONbits.GIE = 1;}
337 | #else
338 | #define USBEnableInterrupts()
339 | #endif
340 |
341 | #define USBDisableInterrupts() {PIE2bits.USBIE = 0;}
342 |
343 | #define SetConfigurationOptions() {\
344 | U1CNFG1 = USB_PULLUP_OPTION | USB_TRANSCEIVER_OPTION | USB_SPEED_OPTION | USB_PING_PONG_MODE;\
345 | U1EIE = 0x9F;\
346 | UIE = 0x39 | USB_SOF_INTERRUPT | USB_ERROR_INTERRUPT;\
347 | }
348 |
349 | /****************************************************************
350 | Function:
351 | void USBPowerModule(void)
352 |
353 | Description:
354 | This macro is used to power up the USB module if required
355 | PIC18: defines as nothing
356 | PIC24: defines as U1PWRCbits.USBPWR = 1;
357 |
358 | Parameters:
359 | None
360 |
361 | Return Values:
362 | None
363 |
364 | Remarks:
365 | None
366 |
367 | ****************************************************************/
368 | #define USBPowerModule()
369 |
370 | /****************************************************************
371 | Function:
372 | void USBModuleDisable(void)
373 |
374 | Description:
375 | This macro is used to disable the USB module
376 |
377 | Parameters:
378 | None
379 |
380 | Return Values:
381 | None
382 |
383 | Remarks:
384 | None
385 |
386 | ****************************************************************/
387 | #define USBModuleDisable() {\
388 | UCON = 0;\
389 | UIE = 0;\
390 | USBDeviceState = DETACHED_STATE;\
391 | }
392 |
393 | /****************************************************************
394 | Function:
395 | USBSetBDTAddress(addr)
396 |
397 | Description:
398 | This macro is used to power up the USB module if required
399 |
400 | Parameters:
401 | None
402 |
403 | Return Values:
404 | None
405 |
406 | Remarks:
407 | None
408 |
409 | ****************************************************************/
410 | #define USBSetBDTAddress(addr)
411 |
412 | /********************************************************************
413 | * Function (macro): void USBClearInterruptFlag(register, uint8_t if_and_flag_mask)
414 | *
415 | * PreCondition: None
416 | *
417 | * Input:
418 | * register - the register mnemonic for the register holding the interrupt
419 | flag to be cleared
420 | * uint8_t if_and_flag_mask - an AND mask for the interrupt flag that will be
421 | cleared
422 | *
423 | * Output: None
424 | *
425 | * Side Effects: None
426 | *
427 | * Overview: Clears the specified USB interrupt flag.
428 | *
429 | * Note:
430 | *******************************************************************/
431 | #define USBClearInterruptFlag(reg_name, if_and_flag_mask) (reg_name &= if_and_flag_mask)
432 |
433 | /********************************************************************
434 | Function:
435 | void USBClearInterruptRegister(uint16_t reg)
436 |
437 | Summary:
438 | Clears the specified interrupt register
439 |
440 | PreCondition:
441 | None
442 |
443 | Parameters:
444 | uint16_t reg - the register name that needs to be cleared
445 |
446 | Return Values:
447 | None
448 |
449 | Remarks:
450 | None
451 |
452 | *******************************************************************/
453 | #define USBClearInterruptRegister(reg) {reg = 0;}
454 |
455 | /********************************************************************
456 | Function:
457 | void DisableNonZeroEndpoints(UINT8 last_ep_num)
458 |
459 | Summary:
460 | Clears the control registers for the specified non-zero endpoints
461 |
462 | PreCondition:
463 | None
464 |
465 | Parameters:
466 | UINT8 last_ep_num - the last endpoint number to clear. This
467 | number should include all endpoints used in any configuration.
468 |
469 | Return Values:
470 | None
471 |
472 | Remarks:
473 | None
474 | *******************************************************************/
475 | #if (__XC8_VERSION == 1000)
476 | #define DisableNonZeroEndpoints(last_ep_num) \
477 | { \
478 | uint8_t i; \
479 | uint8_t* p = (uint8_t*)&UEP6; \
480 | for(i=0;i.dep.inc
61 | # @if [ -n "${MAKE_VERSION}" ]; then \
62 | # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
63 | # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
64 | # echo "include \$${DEPFILES}" >>.dep.inc; \
65 | # echo "endif" >>.dep.inc; \
66 | # else \
67 | # echo ".KEEP_STATE:" >>.dep.inc; \
68 | # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
69 | # fi
70 |
--------------------------------------------------------------------------------
/firmware/nbproject/Makefile-local-default.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated Makefile - do not edit!
3 | #
4 | #
5 | # This file contains information about the location of compilers and other tools.
6 | # If you commmit this file into your revision control server, you will be able to
7 | # to checkout the project and build it from the command line with make. However,
8 | # if more than one person works on the same project, then this file might show
9 | # conflicts since different users are bound to have compilers in different places.
10 | # In that case you might choose to not commit this file and let MPLAB X recreate this file
11 | # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at
12 | # least once so the file gets created and the project can be built. Finally, you can also
13 | # avoid using this file at all if you are only building from the command line with make.
14 | # You can invoke make with the values of the macros:
15 | # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
16 | #
17 | SHELL=cmd.exe
18 | PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v3.65/mplab_ide/platform/../mplab_ide/modules/../../bin/
19 | # Adding MPLAB X bin directory to path.
20 | PATH:=C:/Program Files (x86)/Microchip/MPLABX/v3.65/mplab_ide/platform/../mplab_ide/modules/../../bin/:$(PATH)
21 | # Path to java used to run MPLAB X when this makefile was created
22 | MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\v3.65\sys\java\jre1.8.0_121/bin/"
23 | OS_CURRENT="$(shell uname -s)"
24 | MP_CC="C:\Program Files (x86)\Microchip\xc8\v1.42\bin\xc8.exe"
25 | # MP_CPPC is not defined
26 | # MP_BC is not defined
27 | MP_AS="C:\Program Files (x86)\Microchip\xc8\v1.42\bin\xc8.exe"
28 | MP_LD="C:\Program Files (x86)\Microchip\xc8\v1.42\bin\xc8.exe"
29 | # MP_AR is not defined
30 | DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v3.65/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
31 | MP_CC_DIR="C:\Program Files (x86)\Microchip\xc8\v1.42\bin"
32 | # MP_CPPC_DIR is not defined
33 | # MP_BC_DIR is not defined
34 | MP_AS_DIR="C:\Program Files (x86)\Microchip\xc8\v1.42\bin"
35 | MP_LD_DIR="C:\Program Files (x86)\Microchip\xc8\v1.42\bin"
36 | # MP_AR_DIR is not defined
37 | # MP_BC_DIR is not defined
38 |
--------------------------------------------------------------------------------
/firmware/nbproject/Makefile-variables.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated - do not edit!
3 | #
4 | # NOCDDL
5 | #
6 | CND_BASEDIR=`pwd`
7 | # default configuration
8 | CND_ARTIFACT_DIR_default=dist/default/production
9 | CND_ARTIFACT_NAME_default=firmware.production.hex
10 | CND_ARTIFACT_PATH_default=dist/default/production/firmware.production.hex
11 | CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package
12 | CND_PACKAGE_NAME_default=firmware.tar
13 | CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/firmware.tar
14 |
--------------------------------------------------------------------------------
/firmware/nbproject/Package-default.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | #
4 | # Generated - do not edit!
5 | #
6 |
7 | # Macros
8 | TOP=`pwd`
9 | CND_CONF=default
10 | CND_DISTDIR=dist
11 | TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging
12 | TMPDIRNAME=tmp-packaging
13 | OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/firmware.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
14 | OUTPUT_BASENAME=firmware.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
15 | PACKAGE_TOP_DIR=firmware/
16 |
17 | # Functions
18 | function checkReturnCode
19 | {
20 | rc=$?
21 | if [ $rc != 0 ]
22 | then
23 | exit $rc
24 | fi
25 | }
26 | function makeDirectory
27 | # $1 directory path
28 | # $2 permission (optional)
29 | {
30 | mkdir -p "$1"
31 | checkReturnCode
32 | if [ "$2" != "" ]
33 | then
34 | chmod $2 "$1"
35 | checkReturnCode
36 | fi
37 | }
38 | function copyFileToTmpDir
39 | # $1 from-file path
40 | # $2 to-file path
41 | # $3 permission
42 | {
43 | cp "$1" "$2"
44 | checkReturnCode
45 | if [ "$3" != "" ]
46 | then
47 | chmod $3 "$2"
48 | checkReturnCode
49 | fi
50 | }
51 |
52 | # Setup
53 | cd "${TOP}"
54 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/package
55 | rm -rf ${TMPDIR}
56 | mkdir -p ${TMPDIR}
57 |
58 | # Copy files and create directories and links
59 | cd "${TOP}"
60 | makeDirectory ${TMPDIR}/firmware/bin
61 | copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
62 |
63 |
64 | # Generate tar file
65 | cd "${TOP}"
66 | rm -f ${CND_DISTDIR}/${CND_CONF}/package/firmware.tar
67 | cd ${TMPDIR}
68 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/firmware.tar *
69 | checkReturnCode
70 |
71 | # Cleanup
72 | cd "${TOP}"
73 | rm -rf ${TMPDIR}
74 |
--------------------------------------------------------------------------------
/firmware/nbproject/private/SuppressibleMessageMemo.properties:
--------------------------------------------------------------------------------
1 | #
2 | #Wed Aug 02 17:17:55 PDT 2017
3 | pk3/CHECK_4_HIGH_VOLTAGE_VPP=true
4 | realice/CHECK_4_HIGH_VOLTAGE_VPP=true
5 |
--------------------------------------------------------------------------------
/firmware/nbproject/private/configurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Makefile
4 | 0
5 |
6 |
7 | :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>900A:=<rev>0002:=<man>Microchip Technology Inc.:=<prod>PICkit 3:=<sn>BUR170342000:=<drv>x:=<xpt>h:=end
8 | C:\Program Files (x86)\Microchip\xc8\v1.42\bin
9 |
10 | place holder 1
11 | place holder 2
12 |
13 |
14 |
15 |
16 | true
17 | 0
18 | 0
19 | 0
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/firmware/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.microchip.mplab.nbide.embedded.makeproject
4 |
5 |
6 | firmware
7 | fbd3c666-d6a0-49f2-80bf-b63e4b6a4d55
8 | 0
9 | c
10 |
11 | h
12 |
13 | ISO-8859-1
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/firmware/pt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. Neither the name of the Institute nor the names of its contributors
14 | * may be used to endorse or promote products derived from this software
15 | * without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 | * SUCH DAMAGE.
28 | *
29 | * This file is part of the Contiki operating system.
30 | *
31 | * Author: Adam Dunkels
32 | *
33 | * $Id: pt.h,v 1.7 2006/10/02 07:52:56 adam Exp $
34 | */
35 |
36 | /**
37 | * \addtogroup pt
38 | * @{
39 | */
40 |
41 | /**
42 | * \file
43 | * Protothreads implementation.
44 | * \author
45 | * Adam Dunkels
46 | *
47 | */
48 |
49 | #ifndef __PT_H__
50 | #define __PT_H__
51 |
52 | #include "lc.h"
53 |
54 | struct pt {
55 | lc_t lc;
56 | };
57 |
58 | #define PT_WAITING 0
59 | #define PT_YIELDED 1
60 | #define PT_EXITED 2
61 | #define PT_ENDED 3
62 |
63 | /**
64 | * \name Initialization
65 | * @{
66 | */
67 |
68 | /**
69 | * Initialize a protothread.
70 | *
71 | * Initializes a protothread. Initialization must be done prior to
72 | * starting to execute the protothread.
73 | *
74 | * \param pt A pointer to the protothread control structure.
75 | *
76 | * \sa PT_SPAWN()
77 | *
78 | * \hideinitializer
79 | */
80 | #define PT_INIT(pt) LC_INIT((pt)->lc)
81 |
82 | /** @} */
83 |
84 | /**
85 | * \name Declaration and definition
86 | * @{
87 | */
88 |
89 | /**
90 | * Declaration of a protothread.
91 | *
92 | * This macro is used to declare a protothread. All protothreads must
93 | * be declared with this macro.
94 | *
95 | * \param name_args The name and arguments of the C function
96 | * implementing the protothread.
97 | *
98 | * \hideinitializer
99 | */
100 | #define PT_THREAD(name_args) char name_args
101 |
102 | /**
103 | * Declare the start of a protothread inside the C function
104 | * implementing the protothread.
105 | *
106 | * This macro is used to declare the starting point of a
107 | * protothread. It should be placed at the start of the function in
108 | * which the protothread runs. All C statements above the PT_BEGIN()
109 | * invokation will be executed each time the protothread is scheduled.
110 | *
111 | * \param pt A pointer to the protothread control structure.
112 | *
113 | * \hideinitializer
114 | */
115 | #define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc)
116 |
117 | /**
118 | * Declare the end of a protothread.
119 | *
120 | * This macro is used for declaring that a protothread ends. It must
121 | * always be used together with a matching PT_BEGIN() macro.
122 | *
123 | * \param pt A pointer to the protothread control structure.
124 | *
125 | * \hideinitializer
126 | */
127 | #define PT_END(pt) LC_END((pt)->lc); PT_YIELD_FLAG = 0; \
128 | PT_INIT(pt); return PT_ENDED; }
129 |
130 | /** @} */
131 |
132 | /**
133 | * \name Blocked wait
134 | * @{
135 | */
136 |
137 | /**
138 | * Block and wait until condition is true.
139 | *
140 | * This macro blocks the protothread until the specified condition is
141 | * true.
142 | *
143 | * \param pt A pointer to the protothread control structure.
144 | * \param condition The condition.
145 | *
146 | * \hideinitializer
147 | */
148 | #define PT_WAIT_UNTIL(pt, condition) \
149 | do { \
150 | LC_SET((pt)->lc); \
151 | if(!(condition)) { \
152 | return PT_WAITING; \
153 | } \
154 | } while(0)
155 |
156 | /**
157 | * Block and wait while condition is true.
158 | *
159 | * This function blocks and waits while condition is true. See
160 | * PT_WAIT_UNTIL().
161 | *
162 | * \param pt A pointer to the protothread control structure.
163 | * \param cond The condition.
164 | *
165 | * \hideinitializer
166 | */
167 | #define PT_WAIT_WHILE(pt, cond) PT_WAIT_UNTIL((pt), !(cond))
168 |
169 | /** @} */
170 |
171 | /**
172 | * \name Hierarchical protothreads
173 | * @{
174 | */
175 |
176 | /**
177 | * Block and wait until a child protothread completes.
178 | *
179 | * This macro schedules a child protothread. The current protothread
180 | * will block until the child protothread completes.
181 | *
182 | * \note The child protothread must be manually initialized with the
183 | * PT_INIT() function before this function is used.
184 | *
185 | * \param pt A pointer to the protothread control structure.
186 | * \param thread The child protothread with arguments
187 | *
188 | * \sa PT_SPAWN()
189 | *
190 | * \hideinitializer
191 | */
192 | #define PT_WAIT_THREAD(pt, thread) PT_WAIT_WHILE((pt), PT_SCHEDULE(thread))
193 |
194 | /**
195 | * Spawn a child protothread and wait until it exits.
196 | *
197 | * This macro spawns a child protothread and waits until it exits. The
198 | * macro can only be used within a protothread.
199 | *
200 | * \param pt A pointer to the protothread control structure.
201 | * \param child A pointer to the child protothread's control structure.
202 | * \param thread The child protothread with arguments
203 | *
204 | * \hideinitializer
205 | */
206 | #define PT_SPAWN(pt, child, thread) \
207 | do { \
208 | PT_INIT((child)); \
209 | PT_WAIT_THREAD((pt), (thread)); \
210 | } while(0)
211 |
212 | /** @} */
213 |
214 | /**
215 | * \name Exiting and restarting
216 | * @{
217 | */
218 |
219 | /**
220 | * Restart the protothread.
221 | *
222 | * This macro will block and cause the running protothread to restart
223 | * its execution at the place of the PT_BEGIN() call.
224 | *
225 | * \param pt A pointer to the protothread control structure.
226 | *
227 | * \hideinitializer
228 | */
229 | #define PT_RESTART(pt) \
230 | do { \
231 | PT_INIT(pt); \
232 | return PT_WAITING; \
233 | } while(0)
234 |
235 | /**
236 | * Exit the protothread.
237 | *
238 | * This macro causes the protothread to exit. If the protothread was
239 | * spawned by another protothread, the parent protothread will become
240 | * unblocked and can continue to run.
241 | *
242 | * \param pt A pointer to the protothread control structure.
243 | *
244 | * \hideinitializer
245 | */
246 | #define PT_EXIT(pt) \
247 | do { \
248 | PT_INIT(pt); \
249 | return PT_EXITED; \
250 | } while(0)
251 |
252 | /** @} */
253 |
254 | /**
255 | * \name Calling a protothread
256 | * @{
257 | */
258 |
259 | /**
260 | * Schedule a protothread.
261 | *
262 | * This function shedules a protothread. The return value of the
263 | * function is non-zero if the protothread is running or zero if the
264 | * protothread has exited.
265 | *
266 | * \param f The call to the C function implementing the protothread to
267 | * be scheduled
268 | *
269 | * \hideinitializer
270 | */
271 | #define PT_SCHEDULE(f) ((f) < PT_EXITED)
272 |
273 | /** @} */
274 |
275 | /**
276 | * \name Yielding from a protothread
277 | * @{
278 | */
279 |
280 | /**
281 | * Yield from the current protothread.
282 | *
283 | * This function will yield the protothread, thereby allowing other
284 | * processing to take place in the system.
285 | *
286 | * \param pt A pointer to the protothread control structure.
287 | *
288 | * \hideinitializer
289 | */
290 | #define PT_YIELD(pt) \
291 | do { \
292 | PT_YIELD_FLAG = 0; \
293 | LC_SET((pt)->lc); \
294 | if(PT_YIELD_FLAG == 0) { \
295 | return PT_YIELDED; \
296 | } \
297 | } while(0)
298 |
299 | /**
300 | * \brief Yield from the protothread until a condition occurs.
301 | * \param pt A pointer to the protothread control structure.
302 | * \param cond The condition.
303 | *
304 | * This function will yield the protothread, until the
305 | * specified condition evaluates to true.
306 | *
307 | *
308 | * \hideinitializer
309 | */
310 | #define PT_YIELD_UNTIL(pt, cond) \
311 | do { \
312 | PT_YIELD_FLAG = 0; \
313 | LC_SET((pt)->lc); \
314 | if((PT_YIELD_FLAG == 0) || !(cond)) { \
315 | return PT_YIELDED; \
316 | } \
317 | } while(0)
318 |
319 | /** @} */
320 |
321 | #endif /* __PT_H__ */
322 |
323 | /** @} */
324 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [build-system]
2 | requires = ["setuptools >= 40.6.0", "wheel"]
3 | build-backend = "setuptools.build_meta"
4 |
--------------------------------------------------------------------------------
/python/tinyfpgaa/__init__.py:
--------------------------------------------------------------------------------
1 | from .tinyfpgaa import *
2 |
--------------------------------------------------------------------------------
/python/tinyfpgaa/tinyproga.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import traceback
3 | import argparse
4 | import serial
5 | from serial.tools.list_ports import comports
6 | import tinyfpgaa
7 |
8 | def main():
9 | parser = argparse.ArgumentParser()
10 | parser.add_argument("-q", action="store_true", help="Silent mode.")
11 | parser.add_argument("-p", type=str, help="Manually specify serial device.")
12 | parser.add_argument("-b", action="store_true", help="Input is bitstream file.")
13 | parser.add_argument("jed", type=str, help="JEDEC or bitstream file to program.")
14 | args = parser.parse_args()
15 |
16 | if not args.p:
17 | for port in comports():
18 | if "1209:2101" in port[2]:
19 | a_port = port[0]
20 | break
21 | else:
22 | print("TinyFPGA A not detected! Is it plugged in?")
23 | sys.exit(1)
24 | else:
25 | a_port = args.p
26 |
27 | with serial.Serial(a_port, 12000000, timeout=10, writeTimeout=5) as ser:
28 | async_serial = tinyfpgaa.SyncSerial(ser)
29 | pins = tinyfpgaa.JtagTinyFpgaProgrammer(async_serial)
30 | jtag = tinyfpgaa.Jtag(pins)
31 | programmer = tinyfpgaa.JtagCustomProgrammer(jtag)
32 |
33 | if not args.q:
34 | if args.b:
35 | print("Parsing bitstream file...")
36 | else:
37 | print("Parsing JEDEC file...")
38 |
39 | if args.b:
40 | input_file = tinyfpgaa.BitstreamFile(open(args.jed, 'rb'))
41 | else:
42 | input_file = tinyfpgaa.JedecFile(open(args.jed, 'r'))
43 |
44 | try:
45 | if not args.q:
46 | print("Programming TinyFPGA A on {}...".format(a_port))
47 | programmer.program(input_file)
48 | except:
49 | print("Programming Failed!")
50 | traceback.print_exc()
51 | sys.exit(2)
52 |
53 | print("Programming finished without error.")
54 |
55 | if __name__ == "__main__":
56 | main()
57 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | name=tinyfpgaa
3 | version = 0.10.0
4 | author = William D. Jones
5 | author_email = thor0505@comcast.net
6 | description = Python package for interfacing with the TinyFPGA A Programmer.
7 | url = https://github.com/tinyfpga/TinyFPGA-A-Programmer
8 | classifiers =
9 | Programming Language :: Python :: 3
10 | Operating System :: OS Independent
11 |
12 | [options]
13 | packages = tinyfpgaa
14 | # https://stackoverflow.com/a/67238346
15 | # Required to support editable installs.
16 | package_dir =
17 | = python
18 | python_requires = >= 3.7
19 |
20 | [options.entry_points]
21 | console_scripts =
22 | tinyproga=tinyfpgaa.tinyproga:main
23 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | # Stub for PIP < 21.1:
2 | # https://github.com/pypa/setuptools/issues/1688#issuecomment-902784345
3 | import setuptools
4 |
5 | if __name__ == "__main__":
6 | setuptools.setup()
7 |
--------------------------------------------------------------------------------