Compare commits
11 Commits
master
...
feature/mo
Author | SHA1 | Date | |
---|---|---|---|
3348cbd48a | |||
b635fce45d | |||
4381f66b26 | |||
2090dfdca6 | |||
da09f40443 | |||
ff315ae20e | |||
06b5a0e720 | |||
a5eab1427d | |||
5f89b3efd2 | |||
3a8b22fc4a | |||
a236588ebb |
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,3 +4,6 @@ bin
|
||||
*.sublime-workspace
|
||||
node_modules
|
||||
src/secret.h
|
||||
/kicad/Stairs.kicad_pcb-bak
|
||||
/kicad/Stairs.bak
|
||||
kicad/output/*
|
422
kicad/Stairs-cache.lib
Normal file
422
kicad/Stairs-cache.lib
Normal file
@ -0,0 +1,422 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# AMS1117-5.0_AMS1117-5.0
|
||||
#
|
||||
DEF AMS1117-5.0_AMS1117-5.0 U 0 40 Y Y 1 L N
|
||||
F0 "U" -400 220 50 H V L BNN
|
||||
F1 "AMS1117-5.0_AMS1117-5.0" -401 -321 50 H V L BNN
|
||||
F2 "SOT229P700X180-4N" 0 0 50 H I L BNN
|
||||
F3 "Sot223/Pkg 1-Amp 5-Volt Low Drop Out Voltage Regulatator" 0 0 50 H I L BNN
|
||||
F4 "Unavailable" 0 0 50 H I L BNN
|
||||
F5 "Advanced Monolithic Systems" 0 0 50 H I L BNN
|
||||
F6 "None" 0 0 50 H I L BNN
|
||||
F7 "None" 0 0 50 H I L BNN
|
||||
F8 "AMS1117-5.0" 0 0 50 H I L BNN
|
||||
DRAW
|
||||
S -400 200 400 -200 0 1 0 f
|
||||
X ADJ/GND 1 600 -100 200 L 40 40 0 0 W
|
||||
X VOUT 2 600 100 200 L 40 40 0 0 O
|
||||
X VIN 3 -600 100 200 R 40 40 0 0 I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Connector_Generic_Conn_01x02
|
||||
#
|
||||
DEF Connector_Generic_Conn_01x02 J 0 40 Y N 1 F N
|
||||
F0 "J" 0 100 50 H V C CNN
|
||||
F1 "Connector_Generic_Conn_01x02" 0 -200 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_1x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 -95 0 -105 1 1 6 N
|
||||
S -50 5 0 -5 1 1 6 N
|
||||
S -50 50 50 -150 1 1 10 f
|
||||
X Pin_1 1 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_2 2 -200 -100 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Connector_Generic_Conn_01x04
|
||||
#
|
||||
DEF Connector_Generic_Conn_01x04 J 0 40 Y N 1 F N
|
||||
F0 "J" 0 200 50 H V C CNN
|
||||
F1 "Connector_Generic_Conn_01x04" 0 -300 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_1x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 -195 0 -205 1 1 6 N
|
||||
S -50 -95 0 -105 1 1 6 N
|
||||
S -50 5 0 -5 1 1 6 N
|
||||
S -50 105 0 95 1 1 6 N
|
||||
S -50 150 50 -250 1 1 10 f
|
||||
X Pin_1 1 -200 100 150 R 50 50 1 1 P
|
||||
X Pin_2 2 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_3 3 -200 -100 150 R 50 50 1 1 P
|
||||
X Pin_4 4 -200 -200 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Connector_Generic_Conn_01x06
|
||||
#
|
||||
DEF Connector_Generic_Conn_01x06 J 0 40 Y N 1 F N
|
||||
F0 "J" 0 300 50 H V C CNN
|
||||
F1 "Connector_Generic_Conn_01x06" 0 -400 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_1x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 -295 0 -305 1 1 6 N
|
||||
S -50 -195 0 -205 1 1 6 N
|
||||
S -50 -95 0 -105 1 1 6 N
|
||||
S -50 5 0 -5 1 1 6 N
|
||||
S -50 105 0 95 1 1 6 N
|
||||
S -50 205 0 195 1 1 6 N
|
||||
S -50 250 50 -350 1 1 10 f
|
||||
X Pin_1 1 -200 200 150 R 50 50 1 1 P
|
||||
X Pin_2 2 -200 100 150 R 50 50 1 1 P
|
||||
X Pin_3 3 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_4 4 -200 -100 150 R 50 50 1 1 P
|
||||
X Pin_5 5 -200 -200 150 R 50 50 1 1 P
|
||||
X Pin_6 6 -200 -300 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Connector_Generic_Conn_02x03_Odd_Even
|
||||
#
|
||||
DEF Connector_Generic_Conn_02x03_Odd_Even J 0 40 Y N 1 F N
|
||||
F0 "J" 50 200 50 H V C CNN
|
||||
F1 "Connector_Generic_Conn_02x03_Odd_Even" 50 -200 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_2x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 -95 0 -105 1 1 6 N
|
||||
S -50 5 0 -5 1 1 6 N
|
||||
S -50 105 0 95 1 1 6 N
|
||||
S -50 150 150 -150 1 1 10 f
|
||||
S 150 -95 100 -105 1 1 6 N
|
||||
S 150 5 100 -5 1 1 6 N
|
||||
S 150 105 100 95 1 1 6 N
|
||||
X Pin_1 1 -200 100 150 R 50 50 1 1 P
|
||||
X Pin_2 2 300 100 150 L 50 50 1 1 P
|
||||
X Pin_3 3 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_4 4 300 0 150 L 50 50 1 1 P
|
||||
X Pin_5 5 -200 -100 150 R 50 50 1 1 P
|
||||
X Pin_6 6 300 -100 150 L 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Device_C
|
||||
#
|
||||
DEF Device_C C 0 10 N Y 1 F N
|
||||
F0 "C" 25 100 50 H V L CNN
|
||||
F1 "Device_C" 25 -100 50 H V L CNN
|
||||
F2 "" 38 -150 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
C_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 20 -80 -30 80 -30 N
|
||||
P 2 0 1 20 -80 30 80 30 N
|
||||
X ~ 1 0 150 110 D 50 50 1 1 P
|
||||
X ~ 2 0 -150 110 U 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Device_Crystal_Small
|
||||
#
|
||||
DEF Device_Crystal_Small Y 0 40 N N 1 F N
|
||||
F0 "Y" 0 100 50 H V C CNN
|
||||
F1 "Device_Crystal_Small" 0 -100 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Crystal*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -30 -60 30 60 0 1 0 N
|
||||
P 2 0 1 15 -50 -30 -50 30 N
|
||||
P 2 0 1 15 50 -30 50 30 N
|
||||
X 1 1 -100 0 50 R 50 50 1 1 P
|
||||
X 2 2 100 0 50 L 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Device_LED
|
||||
#
|
||||
DEF Device_LED D 0 40 N N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "Device_LED" 0 -100 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
LED*
|
||||
LED_SMD:*
|
||||
LED_THT:*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 8 -50 -50 -50 50 N
|
||||
P 2 0 1 0 -50 0 50 0 N
|
||||
P 4 0 1 8 50 -50 50 50 -50 0 50 -50 N
|
||||
P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N
|
||||
P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N
|
||||
X K 1 -150 0 100 R 50 50 1 1 P
|
||||
X A 2 150 0 100 L 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Device_R
|
||||
#
|
||||
DEF Device_R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 50 V V C CNN
|
||||
F1 "Device_R" 0 0 50 V V C CNN
|
||||
F2 "" -70 0 50 V I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
R_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 -100 40 100 0 1 10 N
|
||||
X ~ 1 0 150 50 D 50 50 1 1 P
|
||||
X ~ 2 0 -150 50 U 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# MAX485_MAX485
|
||||
#
|
||||
DEF MAX485_MAX485 U 0 40 Y Y 1 L N
|
||||
F0 "U" -401 301 50 H V L BNN
|
||||
F1 "MAX485_MAX485" -401 -301 50 H V L BNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "Maxim Integrated" 0 0 50 H I L BNN
|
||||
F4 "None" 0 0 50 H I L BNN
|
||||
F5 "Unavailable" 0 0 50 H I L BNN
|
||||
F6 "None" 0 0 50 H I L BNN
|
||||
F7 "MAX485" 0 0 50 H I L BNN
|
||||
$FPLIST
|
||||
DIL08
|
||||
SO08
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -400 300 400 -200 0 1 0 f
|
||||
X RO 1 -600 200 200 R 40 40 0 0 B
|
||||
X RE 2 -600 100 200 R 40 40 0 0 B I
|
||||
X DE 3 -600 0 200 R 40 40 0 0 B
|
||||
X DI 4 -600 -100 200 R 40 40 0 0 B
|
||||
X GND 5 600 -100 200 L 40 40 0 0 W
|
||||
X A 6 600 0 200 L 40 40 0 0 B
|
||||
X B 7 600 100 200 L 40 40 0 0 B
|
||||
X VCC 8 600 200 200 L 40 40 0 0 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# MCU_Microchip_ATmega_ATmega328-AU
|
||||
#
|
||||
DEF MCU_Microchip_ATmega_ATmega328-AU U 0 20 Y Y 1 F N
|
||||
F0 "U" -500 1450 50 H V L BNN
|
||||
F1 "MCU_Microchip_ATmega_ATmega328-AU" 100 -1450 50 H V L TNN
|
||||
F2 "Package_QFP:TQFP-32_7x7mm_P0.8mm" 0 0 50 H I C CIN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
ALIAS ATmega48PA-AU ATmega88A-AU ATmega88PA-AU ATmega168A-AU ATmega168PA-AU ATmega328-AU ATmega328P-AU
|
||||
$FPLIST
|
||||
TQFP*7x7mm*P0.8mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -500 -1400 500 1400 0 1 10 f
|
||||
X PD3 1 600 -800 100 L 50 50 1 1 T
|
||||
X PD6 10 600 -1100 100 L 50 50 1 1 T
|
||||
X PD7 11 600 -1200 100 L 50 50 1 1 T
|
||||
X PB0 12 600 1200 100 L 50 50 1 1 T
|
||||
X PB1 13 600 1100 100 L 50 50 1 1 T
|
||||
X PB2 14 600 1000 100 L 50 50 1 1 T
|
||||
X PB3 15 600 900 100 L 50 50 1 1 T
|
||||
X PB4 16 600 800 100 L 50 50 1 1 T
|
||||
X PB5 17 600 700 100 L 50 50 1 1 T
|
||||
X AVCC 18 100 1500 100 D 50 50 1 1 W
|
||||
X ADC6 19 -600 1000 100 R 50 50 1 1 I
|
||||
X PD4 2 600 -900 100 L 50 50 1 1 T
|
||||
X AREF 20 -600 1200 100 R 50 50 1 1 P
|
||||
X GND 21 0 -1500 100 U 50 50 1 1 P N
|
||||
X ADC7 22 -600 900 100 R 50 50 1 1 I
|
||||
X PC0 23 600 300 100 L 50 50 1 1 T
|
||||
X PC1 24 600 200 100 L 50 50 1 1 T
|
||||
X PC2 25 600 100 100 L 50 50 1 1 T
|
||||
X PC3 26 600 0 100 L 50 50 1 1 T
|
||||
X PC4 27 600 -100 100 L 50 50 1 1 T
|
||||
X PC5 28 600 -200 100 L 50 50 1 1 T
|
||||
X ~RESET~/PC6 29 600 -300 100 L 50 50 1 1 T
|
||||
X GND 3 0 -1500 100 U 50 50 1 1 W
|
||||
X PD0 30 600 -500 100 L 50 50 1 1 T
|
||||
X PD1 31 600 -600 100 L 50 50 1 1 T
|
||||
X PD2 32 600 -700 100 L 50 50 1 1 T
|
||||
X VCC 4 0 1500 100 D 50 50 1 1 W
|
||||
X GND 5 0 -1500 100 U 50 50 1 1 P N
|
||||
X VCC 6 0 1500 100 D 50 50 1 1 P N
|
||||
X XTAL1/PB6 7 600 600 100 L 50 50 1 1 T
|
||||
X XTAL2/PB7 8 600 500 100 L 50 50 1 1 T
|
||||
X PD5 9 600 -1000 100 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# PCA9685-TSSOP_PCA9685-TSSOP
|
||||
#
|
||||
DEF PCA9685-TSSOP_PCA9685-TSSOP U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 -100 50 H V C CNN
|
||||
F1 "PCA9685-TSSOP_PCA9685-TSSOP" 0 100 50 H V C CNN
|
||||
F2 "MODULE" 0 0 50 H I C CNN
|
||||
F3 "DOCUMENTATION" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
S -450 -850 450 850 1 0 0 f
|
||||
X A0 1 -750 650 300 R 50 50 1 1 I
|
||||
X LED4 10 -750 -250 300 R 50 50 1 1 O
|
||||
X LED5 11 -750 -350 300 R 50 50 1 1 O
|
||||
X LED6 12 -750 -450 300 R 50 50 1 1 O
|
||||
X LED7 13 -750 -550 300 R 50 50 1 1 O
|
||||
X GND 14 -750 -650 300 R 50 50 1 1 I
|
||||
X LED8 15 750 -650 300 L 50 50 1 1 O
|
||||
X LED9 16 750 -550 300 L 50 50 1 1 O
|
||||
X LED10 17 750 -450 300 L 50 50 1 1 O
|
||||
X LED11 18 750 -350 300 L 50 50 1 1 O
|
||||
X LED12 19 750 -250 300 L 50 50 1 1 O
|
||||
X A1 2 -750 550 300 R 50 50 1 1 I
|
||||
X LED13 20 750 -150 300 L 50 50 1 1 O
|
||||
X LED14 21 750 -50 300 L 50 50 1 1 O
|
||||
X LED15 22 750 50 300 L 50 50 1 1 O
|
||||
X OE 23 750 150 300 L 50 50 1 1 I
|
||||
X A5 24 750 250 300 L 50 50 1 1 I
|
||||
X EXTCLK 25 750 350 300 L 50 50 1 1 I
|
||||
X SCL 26 750 450 300 L 50 50 1 1 I
|
||||
X SDA 27 750 550 300 L 50 50 1 1 B
|
||||
X VCC 28 750 650 300 L 50 50 1 1 I
|
||||
X A2 3 -750 450 300 R 50 50 1 1 I
|
||||
X A3 4 -750 350 300 R 50 50 1 1 I
|
||||
X A4 5 -750 250 300 R 50 50 1 1 I
|
||||
X LED0 6 -750 150 300 R 50 50 1 1 O
|
||||
X LED1 7 -750 50 300 R 50 50 1 1 O
|
||||
X LED2 8 -750 -50 300 R 50 50 1 1 O
|
||||
X LED3 9 -750 -150 300 R 50 50 1 1 O
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Switch_SW_Push
|
||||
#
|
||||
DEF Switch_SW_Push SW 0 40 N N 1 F N
|
||||
F0 "SW" 50 100 50 H V L CNN
|
||||
F1 "Switch_SW_Push" 0 -60 50 H V C CNN
|
||||
F2 "" 0 200 50 H I C CNN
|
||||
F3 "" 0 200 50 H I C CNN
|
||||
DRAW
|
||||
C -80 0 20 0 1 0 N
|
||||
C 80 0 20 0 1 0 N
|
||||
P 2 0 1 0 0 50 0 120 N
|
||||
P 2 0 1 0 100 50 -100 50 N
|
||||
X 1 1 -200 0 100 R 50 50 0 1 P
|
||||
X 2 2 200 0 100 L 50 50 0 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Transistor_FET_IRLB8721PBF
|
||||
#
|
||||
DEF Transistor_FET_IRLB8721PBF Q 0 0 Y N 1 F N
|
||||
F0 "Q" 250 75 50 H V L CNN
|
||||
F1 "Transistor_FET_IRLB8721PBF" 250 0 50 H V L CNN
|
||||
F2 "Package_TO_SOT_THT:TO-220-3_Vertical" 250 -75 50 H I L CIN
|
||||
F3 "" 0 0 50 H I L CNN
|
||||
ALIAS IRF3205 IRF540N IRF740 IRLB8721PBF IRLZ34N IRLZ44N
|
||||
$FPLIST
|
||||
TO?220*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
C 65 0 111 0 1 10 N
|
||||
C 100 -70 11 0 1 0 F
|
||||
C 100 70 11 0 1 0 F
|
||||
P 2 0 1 0 10 0 -100 0 N
|
||||
P 2 0 1 0 30 -70 100 -70 N
|
||||
P 2 0 1 10 30 -50 30 -90 N
|
||||
P 2 0 1 0 30 0 100 0 N
|
||||
P 2 0 1 10 30 20 30 -20 N
|
||||
P 2 0 1 0 30 70 100 70 N
|
||||
P 2 0 1 10 30 90 30 50 N
|
||||
P 2 0 1 0 100 -70 100 -100 N
|
||||
P 2 0 1 0 100 -70 100 0 N
|
||||
P 2 0 1 0 100 100 100 70 N
|
||||
P 3 0 1 10 10 75 10 -75 10 -75 N
|
||||
P 4 0 1 0 40 0 80 15 80 -15 40 0 F
|
||||
P 4 0 1 0 100 -70 130 -70 130 70 100 70 N
|
||||
P 4 0 1 0 110 20 115 15 145 15 150 10 N
|
||||
P 4 0 1 0 130 15 115 -10 145 -10 130 15 N
|
||||
X G 1 -200 0 100 R 50 50 1 1 I
|
||||
X D 2 100 200 100 D 50 50 1 1 P
|
||||
X S 3 100 -200 100 U 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_+12V
|
||||
#
|
||||
DEF power_+12V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -150 50 H I C CNN
|
||||
F1 "power_+12V" 0 140 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 2 0 1 0 -30 50 0 100 N
|
||||
P 2 0 1 0 0 0 0 100 N
|
||||
P 2 0 1 0 0 100 30 50 N
|
||||
X +12V 1 0 0 0 U 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_+5V
|
||||
#
|
||||
DEF power_+5V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -150 50 H I C CNN
|
||||
F1 "power_+5V" 0 140 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 2 0 1 0 -30 50 0 100 N
|
||||
P 2 0 1 0 0 0 0 100 N
|
||||
P 2 0 1 0 0 100 30 50 N
|
||||
X +5V 1 0 0 0 U 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_GND
|
||||
#
|
||||
DEF power_GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -250 50 H I C CNN
|
||||
F1 "power_GND" 0 -150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
|
||||
X GND 1 0 0 0 D 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_PWR_FLAG
|
||||
#
|
||||
DEF power_PWR_FLAG #FLG 0 0 N N 1 F P
|
||||
F0 "#FLG" 0 75 50 H I C CNN
|
||||
F1 "power_PWR_FLAG" 0 150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
|
||||
X pwr 1 0 0 0 U 50 50 0 0 w
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
2480
kicad/Stairs.kicad_pcb
Normal file
2480
kicad/Stairs.kicad_pcb
Normal file
File diff suppressed because it is too large
Load Diff
665
kicad/Stairs.net
Normal file
665
kicad/Stairs.net
Normal file
@ -0,0 +1,665 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source P:\Electronics\Stairs\kicad\Stairs.sch)
|
||||
(date "25-11-2018 22:16:46")
|
||||
(tool "Eeschema (5.0.1)-3")
|
||||
(sheet (number 1) (name /) (tstamps /)
|
||||
(title_block
|
||||
(title "Stairs submodule")
|
||||
(company "Mark van Renswoude")
|
||||
(rev 1)
|
||||
(date 2018-09-02)
|
||||
(source Stairs.sch)
|
||||
(comment (number 1) (value ""))
|
||||
(comment (number 2) (value ""))
|
||||
(comment (number 3) (value ""))
|
||||
(comment (number 4) (value "")))))
|
||||
(components
|
||||
(comp (ref PCA9685)
|
||||
(value PCA9685-TSSOP)
|
||||
(footprint Housings_SSOP:TSSOP-28_4.4x9.7mm_Pitch0.65mm)
|
||||
(datasheet DOCUMENTATION)
|
||||
(libsource (lib PCA9685-TSSOP) (part PCA9685-TSSOP) (description ""))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AD5C2))
|
||||
(comp (ref U2)
|
||||
(value MAX485)
|
||||
(footprint MAX485-SO8:SO-8)
|
||||
(datasheet "Maxim Integrated")
|
||||
(fields
|
||||
(field (name Field4) None)
|
||||
(field (name Field5) Unavailable)
|
||||
(field (name Field6) None)
|
||||
(field (name Field7) MAX485))
|
||||
(libsource (lib MAX485) (part MAX485) (description ""))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AD72A))
|
||||
(comp (ref P6)
|
||||
(value PWR_IN)
|
||||
(footprint Terminal_Blocks:TerminalBlock_bornier-2_P5.08mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AD8CA))
|
||||
(comp (ref P5)
|
||||
(value PWR_OUT)
|
||||
(footprint Terminal_Blocks:TerminalBlock_bornier-2_P5.08mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8ADA74))
|
||||
(comp (ref P3)
|
||||
(value SENSOR)
|
||||
(footprint Terminal_Blocks:TerminalBlock_bornier-6_P5.08mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x06) (description "Generic connector, single row, 01x06, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AE6A5))
|
||||
(comp (ref P1)
|
||||
(value DATA_IN)
|
||||
(footprint Terminal_Blocks:TerminalBlock_bornier-2_P5.08mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AE987))
|
||||
(comp (ref P2)
|
||||
(value DATA_OUT)
|
||||
(footprint Terminal_Blocks:TerminalBlock_bornier-2_P5.08mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AE9DD))
|
||||
(comp (ref AMS1117)
|
||||
(value AMS1117-5)
|
||||
(footprint AMS1117-5.0:SOT229P700X180-4N)
|
||||
(datasheet AMS1117-5.0)
|
||||
(fields
|
||||
(field (name Field4) None)
|
||||
(field (name Field5) Unavailable)
|
||||
(field (name Field6) "Sot223/Pkg 1-Amp 3.3-Volt Low Drop Out Voltage Regulatator")
|
||||
(field (name Field7) "Advanced Monolithic Systems")
|
||||
(field (name Field8) None))
|
||||
(libsource (lib AMS1117-5.0) (part AMS1117-5.0) (description ""))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8AFB24))
|
||||
(comp (ref C3)
|
||||
(value 10µF)
|
||||
(footprint Capacitors_Tantalum_SMD:CP_Tantalum_Case-D_EIA-7343-31_Reflow)
|
||||
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8B090B))
|
||||
(comp (ref C4)
|
||||
(value 100nF)
|
||||
(footprint Capacitors_SMD:C_1206)
|
||||
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8B1267))
|
||||
(comp (ref C2)
|
||||
(value 33pF)
|
||||
(footprint Capacitors_SMD:C_1206)
|
||||
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8B93C9))
|
||||
(comp (ref C1)
|
||||
(value 33pF)
|
||||
(footprint Capacitors_SMD:C_1206)
|
||||
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8B9824))
|
||||
(comp (ref XTAL1)
|
||||
(value "16 Mhz")
|
||||
(footprint Crystals:Crystal_HC49-U_Vertical)
|
||||
(libsource (lib Device) (part Crystal_Small) (description "Two pin crystal, small symbol"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8B9A62))
|
||||
(comp (ref R1)
|
||||
(value 4.7K)
|
||||
(footprint Resistors_SMD:R_0603)
|
||||
(libsource (lib Device) (part R) (description Resistor))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8C2380))
|
||||
(comp (ref P7)
|
||||
(value SSD1306)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x04_Pitch2.54mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x04) (description "Generic connector, single row, 01x04, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8C32B0))
|
||||
(comp (ref Q1)
|
||||
(value IRLB8721PBF)
|
||||
(footprint TO_SOT_Packages_THT:TO-220-3_Vertical)
|
||||
(libsource (lib Transistor_FET) (part IRLB8721PBF) (description "62A Id, 30V Vds, N-Channel MOSFET, TO-220"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8C8EA8))
|
||||
(comp (ref R2)
|
||||
(value 150)
|
||||
(footprint Resistors_SMD:R_0603)
|
||||
(libsource (lib Device) (part R) (description Resistor))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8CAD1E))
|
||||
(comp (ref R3)
|
||||
(value 150)
|
||||
(footprint Resistors_SMD:R_0603)
|
||||
(libsource (lib Device) (part R) (description Resistor))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8CAE68))
|
||||
(comp (ref Q2)
|
||||
(value IRLB8721PBF)
|
||||
(footprint TO_SOT_Packages_THT:TO-220-3_Vertical)
|
||||
(libsource (lib Transistor_FET) (part IRLB8721PBF) (description "62A Id, 30V Vds, N-Channel MOSFET, TO-220"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8CB00E))
|
||||
(comp (ref P4)
|
||||
(value LED)
|
||||
(footprint Terminal_Blocks:TerminalBlock_bornier-4_P5.08mm)
|
||||
(libsource (lib Connector_Generic) (part Conn_01x04) (description "Generic connector, single row, 01x04, script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8CBF27))
|
||||
(comp (ref R4)
|
||||
(value 10K)
|
||||
(footprint Resistors_SMD:R_0603)
|
||||
(libsource (lib Device) (part R) (description Resistor))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B8C6BF9))
|
||||
(comp (ref R5)
|
||||
(value 10K)
|
||||
(footprint Resistors_SMD:R_0603)
|
||||
(libsource (lib Device) (part R) (description Resistor))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5B925FBE))
|
||||
(comp (ref J1)
|
||||
(value PROG)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_2x03_Pitch2.54mm)
|
||||
(datasheet ~)
|
||||
(libsource (lib Connector_Generic) (part Conn_02x03_Odd_Even) (description "Generic connector, double row, 02x03, odd/even pin numbering scheme (row 1 odd numbers, row 2 even numbers), script generated (kicad-library-utils/schlib/autogen/connector/)"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5BEBD38C))
|
||||
(comp (ref SW1)
|
||||
(value Button)
|
||||
(footprint SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_:SW4-SMD-5.2X5.2X1.5MM)
|
||||
(libsource (lib Switch) (part SW_Push) (description "Push button switch, generic, two pins"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5BF329CF))
|
||||
(comp (ref U1)
|
||||
(value ATmega328-AU)
|
||||
(footprint Housings_QFP:TQFP-32_7x7mm_Pitch0.8mm)
|
||||
(datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdf)
|
||||
(libsource (lib MCU_Microchip_ATmega) (part ATmega328-AU) (description "20MHz, 32kB Flash, 2kB SRAM, 1kB EEPROM, TQFP-32"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5BF96964))
|
||||
(comp (ref R6)
|
||||
(value 4.7K)
|
||||
(footprint Resistors_SMD:R_0603)
|
||||
(libsource (lib Device) (part R) (description Resistor))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5C0CFA3C))
|
||||
(comp (ref C5)
|
||||
(value 100nF)
|
||||
(footprint Capacitors_SMD:C_1206)
|
||||
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5C0DFCEB))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(footprint LEDs:LED_D5.0mm)
|
||||
(datasheet ~)
|
||||
(libsource (lib Device) (part LED) (description "Light emitting diode"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5BFAB89C))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(footprint LEDs:LED_D5.0mm)
|
||||
(datasheet ~)
|
||||
(libsource (lib Device) (part LED) (description "Light emitting diode"))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 5BFABDA6)))
|
||||
(libparts
|
||||
(libpart (lib AMS1117-5.0) (part AMS1117-5.0)
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) AMS1117-5.0)
|
||||
(field (name Footprint) SOT229P700X180-4N)
|
||||
(field (name Datasheet) "Sot223/Pkg 1-Amp 5-Volt Low Drop Out Voltage Regulatator")
|
||||
(field (name Field4) Unavailable)
|
||||
(field (name Field5) "Advanced Monolithic Systems")
|
||||
(field (name Field6) None)
|
||||
(field (name Field7) None)
|
||||
(field (name Field8) AMS1117-5.0))
|
||||
(pins
|
||||
(pin (num 1) (name ADJ/GND) (type power_in))
|
||||
(pin (num 2) (name VOUT) (type output))
|
||||
(pin (num 3) (name VIN) (type input))))
|
||||
(libpart (lib Connector_Generic) (part Conn_01x02)
|
||||
(description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp Connector*:*_1x??_*))
|
||||
(fields
|
||||
(field (name Reference) J)
|
||||
(field (name Value) Conn_01x02))
|
||||
(pins
|
||||
(pin (num 1) (name Pin_1) (type passive))
|
||||
(pin (num 2) (name Pin_2) (type passive))))
|
||||
(libpart (lib Connector_Generic) (part Conn_01x04)
|
||||
(description "Generic connector, single row, 01x04, script generated (kicad-library-utils/schlib/autogen/connector/)")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp Connector*:*_1x??_*))
|
||||
(fields
|
||||
(field (name Reference) J)
|
||||
(field (name Value) Conn_01x04))
|
||||
(pins
|
||||
(pin (num 1) (name Pin_1) (type passive))
|
||||
(pin (num 2) (name Pin_2) (type passive))
|
||||
(pin (num 3) (name Pin_3) (type passive))
|
||||
(pin (num 4) (name Pin_4) (type passive))))
|
||||
(libpart (lib Connector_Generic) (part Conn_01x06)
|
||||
(description "Generic connector, single row, 01x06, script generated (kicad-library-utils/schlib/autogen/connector/)")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp Connector*:*_1x??_*))
|
||||
(fields
|
||||
(field (name Reference) J)
|
||||
(field (name Value) Conn_01x06))
|
||||
(pins
|
||||
(pin (num 1) (name Pin_1) (type passive))
|
||||
(pin (num 2) (name Pin_2) (type passive))
|
||||
(pin (num 3) (name Pin_3) (type passive))
|
||||
(pin (num 4) (name Pin_4) (type passive))
|
||||
(pin (num 5) (name Pin_5) (type passive))
|
||||
(pin (num 6) (name Pin_6) (type passive))))
|
||||
(libpart (lib Connector_Generic) (part Conn_02x03_Odd_Even)
|
||||
(description "Generic connector, double row, 02x03, odd/even pin numbering scheme (row 1 odd numbers, row 2 even numbers), script generated (kicad-library-utils/schlib/autogen/connector/)")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp Connector*:*_2x??_*))
|
||||
(fields
|
||||
(field (name Reference) J)
|
||||
(field (name Value) Conn_02x03_Odd_Even))
|
||||
(pins
|
||||
(pin (num 1) (name Pin_1) (type passive))
|
||||
(pin (num 2) (name Pin_2) (type passive))
|
||||
(pin (num 3) (name Pin_3) (type passive))
|
||||
(pin (num 4) (name Pin_4) (type passive))
|
||||
(pin (num 5) (name Pin_5) (type passive))
|
||||
(pin (num 6) (name Pin_6) (type passive))))
|
||||
(libpart (lib Device) (part C)
|
||||
(description "Unpolarized capacitor")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp C_*))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib Device) (part Crystal_Small)
|
||||
(description "Two pin crystal, small symbol")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp Crystal*))
|
||||
(fields
|
||||
(field (name Reference) Y)
|
||||
(field (name Value) Crystal_Small))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib Device) (part LED)
|
||||
(description "Light emitting diode")
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp LED*)
|
||||
(fp LED_SMD:*)
|
||||
(fp LED_THT:*))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED))
|
||||
(pins
|
||||
(pin (num 1) (name K) (type passive))
|
||||
(pin (num 2) (name A) (type passive))))
|
||||
(libpart (lib Device) (part R)
|
||||
(description Resistor)
|
||||
(docs ~)
|
||||
(footprints
|
||||
(fp R_*))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib MAX485) (part MAX485)
|
||||
(footprints
|
||||
(fp DIL08)
|
||||
(fp SO08))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) MAX485)
|
||||
(field (name Datasheet) "Maxim Integrated")
|
||||
(field (name Field4) None)
|
||||
(field (name Field5) Unavailable)
|
||||
(field (name Field6) None)
|
||||
(field (name Field7) MAX485))
|
||||
(pins
|
||||
(pin (num 1) (name RO) (type BiDi))
|
||||
(pin (num 2) (name RE) (type BiDi))
|
||||
(pin (num 3) (name DE) (type BiDi))
|
||||
(pin (num 4) (name DI) (type BiDi))
|
||||
(pin (num 5) (name GND) (type power_in))
|
||||
(pin (num 6) (name A) (type BiDi))
|
||||
(pin (num 7) (name B) (type BiDi))
|
||||
(pin (num 8) (name VCC) (type power_in))))
|
||||
(libpart (lib MCU_Microchip_ATmega) (part ATmega48A-AU)
|
||||
(aliases
|
||||
(alias ATmega48PA-AU)
|
||||
(alias ATmega88A-AU)
|
||||
(alias ATmega88PA-AU)
|
||||
(alias ATmega168A-AU)
|
||||
(alias ATmega168PA-AU)
|
||||
(alias ATmega328-AU)
|
||||
(alias ATmega328P-AU))
|
||||
(description "20MHz, 4kB Flash, 512B SRAM, 256B EEPROM, TQFP-32")
|
||||
(docs http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A_88A_168A-Data-Sheet-40002007A.pdf)
|
||||
(footprints
|
||||
(fp TQFP*7x7mm*P0.8mm*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) ATmega48A-AU)
|
||||
(field (name Footprint) Package_QFP:TQFP-32_7x7mm_P0.8mm))
|
||||
(pins
|
||||
(pin (num 1) (name PD3) (type 3state))
|
||||
(pin (num 2) (name PD4) (type 3state))
|
||||
(pin (num 3) (name GND) (type power_in))
|
||||
(pin (num 4) (name VCC) (type power_in))
|
||||
(pin (num 5) (name GND) (type passive))
|
||||
(pin (num 6) (name VCC) (type passive))
|
||||
(pin (num 7) (name XTAL1/PB6) (type 3state))
|
||||
(pin (num 8) (name XTAL2/PB7) (type 3state))
|
||||
(pin (num 9) (name PD5) (type 3state))
|
||||
(pin (num 10) (name PD6) (type 3state))
|
||||
(pin (num 11) (name PD7) (type 3state))
|
||||
(pin (num 12) (name PB0) (type 3state))
|
||||
(pin (num 13) (name PB1) (type 3state))
|
||||
(pin (num 14) (name PB2) (type 3state))
|
||||
(pin (num 15) (name PB3) (type 3state))
|
||||
(pin (num 16) (name PB4) (type 3state))
|
||||
(pin (num 17) (name PB5) (type 3state))
|
||||
(pin (num 18) (name AVCC) (type power_in))
|
||||
(pin (num 19) (name ADC6) (type input))
|
||||
(pin (num 20) (name AREF) (type passive))
|
||||
(pin (num 21) (name GND) (type passive))
|
||||
(pin (num 22) (name ADC7) (type input))
|
||||
(pin (num 23) (name PC0) (type 3state))
|
||||
(pin (num 24) (name PC1) (type 3state))
|
||||
(pin (num 25) (name PC2) (type 3state))
|
||||
(pin (num 26) (name PC3) (type 3state))
|
||||
(pin (num 27) (name PC4) (type 3state))
|
||||
(pin (num 28) (name PC5) (type 3state))
|
||||
(pin (num 29) (name ~RESET~/PC6) (type 3state))
|
||||
(pin (num 30) (name PD0) (type 3state))
|
||||
(pin (num 31) (name PD1) (type 3state))
|
||||
(pin (num 32) (name PD2) (type 3state))))
|
||||
(libpart (lib PCA9685-TSSOP) (part PCA9685-TSSOP)
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) PCA9685-TSSOP)
|
||||
(field (name Footprint) MODULE)
|
||||
(field (name Datasheet) DOCUMENTATION))
|
||||
(pins
|
||||
(pin (num 1) (name A0) (type input))
|
||||
(pin (num 2) (name A1) (type input))
|
||||
(pin (num 3) (name A2) (type input))
|
||||
(pin (num 4) (name A3) (type input))
|
||||
(pin (num 5) (name A4) (type input))
|
||||
(pin (num 6) (name LED0) (type output))
|
||||
(pin (num 7) (name LED1) (type output))
|
||||
(pin (num 8) (name LED2) (type output))
|
||||
(pin (num 9) (name LED3) (type output))
|
||||
(pin (num 10) (name LED4) (type output))
|
||||
(pin (num 11) (name LED5) (type output))
|
||||
(pin (num 12) (name LED6) (type output))
|
||||
(pin (num 13) (name LED7) (type output))
|
||||
(pin (num 14) (name GND) (type input))
|
||||
(pin (num 15) (name LED8) (type output))
|
||||
(pin (num 16) (name LED9) (type output))
|
||||
(pin (num 17) (name LED10) (type output))
|
||||
(pin (num 18) (name LED11) (type output))
|
||||
(pin (num 19) (name LED12) (type output))
|
||||
(pin (num 20) (name LED13) (type output))
|
||||
(pin (num 21) (name LED14) (type output))
|
||||
(pin (num 22) (name LED15) (type output))
|
||||
(pin (num 23) (name OE) (type input))
|
||||
(pin (num 24) (name A5) (type input))
|
||||
(pin (num 25) (name EXTCLK) (type input))
|
||||
(pin (num 26) (name SCL) (type input))
|
||||
(pin (num 27) (name SDA) (type BiDi))
|
||||
(pin (num 28) (name VCC) (type input))))
|
||||
(libpart (lib Switch) (part SW_Push)
|
||||
(description "Push button switch, generic, two pins")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_Push))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib Transistor_FET) (part BUZ11)
|
||||
(aliases
|
||||
(alias IRF3205)
|
||||
(alias IRF540N)
|
||||
(alias IRF740)
|
||||
(alias IRLB8721PBF)
|
||||
(alias IRLZ34N)
|
||||
(alias IRLZ44N))
|
||||
(description "30A Id, 50V Vds, N-Channel Power MOSFET, TO-220")
|
||||
(docs http://www.fairchildsemi.com/ds/BU/BUZ11.pdf)
|
||||
(footprints
|
||||
(fp TO?220*))
|
||||
(fields
|
||||
(field (name Reference) Q)
|
||||
(field (name Value) BUZ11)
|
||||
(field (name Footprint) Package_TO_SOT_THT:TO-220-3_Vertical))
|
||||
(pins
|
||||
(pin (num 1) (name G) (type input))
|
||||
(pin (num 2) (name D) (type passive))
|
||||
(pin (num 3) (name S) (type passive)))))
|
||||
(libraries
|
||||
(library (logical AMS1117-5.0)
|
||||
(uri P:\Electronics\Stairs\kicad/libs/AMS1117-5.0.lib))
|
||||
(library (logical Connector_Generic)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library/Connector_Generic.lib"))
|
||||
(library (logical Device)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library/Device.lib"))
|
||||
(library (logical MAX485)
|
||||
(uri P:\Electronics\Stairs\kicad/libs/MAX485.lib))
|
||||
(library (logical MCU_Microchip_ATmega)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library/MCU_Microchip_ATmega.lib"))
|
||||
(library (logical PCA9685-TSSOP)
|
||||
(uri P:\Electronics\Stairs\kicad/libs/PCA9685-TSSOP.lib))
|
||||
(library (logical Switch)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library/Switch.lib"))
|
||||
(library (logical Transistor_FET)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library/Transistor_FET.lib")))
|
||||
(nets
|
||||
(net (code 1) (name "Net-(Q1-Pad1)")
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref Q1) (pin 1)))
|
||||
(net (code 2) (name "Net-(P3-Pad3)")
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref P3) (pin 3)))
|
||||
(net (code 3) (name "Net-(P3-Pad6)")
|
||||
(node (ref P3) (pin 6))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 4) (name GND)
|
||||
(node (ref C5) (pin 2))
|
||||
(node (ref U1) (pin 5))
|
||||
(node (ref C4) (pin 1))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref U1) (pin 3))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref U1) (pin 21))
|
||||
(node (ref P7) (pin 4))
|
||||
(node (ref Q1) (pin 3))
|
||||
(node (ref Q2) (pin 3))
|
||||
(node (ref AMS1117) (pin 1))
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref PCA9685) (pin 14))
|
||||
(node (ref P3) (pin 5))
|
||||
(node (ref P3) (pin 2))
|
||||
(node (ref P5) (pin 2))
|
||||
(node (ref P6) (pin 1))
|
||||
(node (ref U2) (pin 5))
|
||||
(node (ref J1) (pin 6))
|
||||
(node (ref R4) (pin 2)))
|
||||
(net (code 5) (name +5V)
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref AMS1117) (pin 2))
|
||||
(node (ref J1) (pin 2))
|
||||
(node (ref C4) (pin 2))
|
||||
(node (ref R6) (pin 1))
|
||||
(node (ref U1) (pin 6))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref P7) (pin 3))
|
||||
(node (ref U2) (pin 8))
|
||||
(node (ref P3) (pin 1))
|
||||
(node (ref P3) (pin 4))
|
||||
(node (ref PCA9685) (pin 28))
|
||||
(node (ref U1) (pin 18))
|
||||
(node (ref R5) (pin 2)))
|
||||
(net (code 6) (name "Net-(SW1-Pad1)")
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref U1) (pin 12)))
|
||||
(net (code 7) (name RST)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref R5) (pin 1))
|
||||
(node (ref J1) (pin 5)))
|
||||
(net (code 8) (name /PD)
|
||||
(node (ref PCA9685) (pin 2))
|
||||
(node (ref PCA9685) (pin 4))
|
||||
(node (ref R4) (pin 1))
|
||||
(node (ref PCA9685) (pin 23))
|
||||
(node (ref PCA9685) (pin 24))
|
||||
(node (ref PCA9685) (pin 3))
|
||||
(node (ref PCA9685) (pin 5))
|
||||
(node (ref PCA9685) (pin 1)))
|
||||
(net (code 9) (name +12V)
|
||||
(node (ref AMS1117) (pin 3))
|
||||
(node (ref P6) (pin 2))
|
||||
(node (ref P4) (pin 2))
|
||||
(node (ref P4) (pin 4))
|
||||
(node (ref P5) (pin 1)))
|
||||
(net (code 10) (name "Net-(U1-Pad9)")
|
||||
(node (ref U1) (pin 9)))
|
||||
(net (code 11) (name "Net-(U1-Pad2)")
|
||||
(node (ref U1) (pin 2)))
|
||||
(net (code 12) (name "Net-(U1-Pad14)")
|
||||
(node (ref U1) (pin 14)))
|
||||
(net (code 13) (name "Net-(U1-Pad13)")
|
||||
(node (ref U1) (pin 13)))
|
||||
(net (code 14) (name "Net-(D1-Pad2)")
|
||||
(node (ref PCA9685) (pin 8))
|
||||
(node (ref D1) (pin 2)))
|
||||
(net (code 15) (name "Net-(D2-Pad2)")
|
||||
(node (ref D2) (pin 2))
|
||||
(node (ref PCA9685) (pin 9)))
|
||||
(net (code 16) (name "Net-(U1-Pad11)")
|
||||
(node (ref U1) (pin 11)))
|
||||
(net (code 17) (name "Net-(U1-Pad22)")
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 18) (name "Net-(U1-Pad19)")
|
||||
(node (ref U1) (pin 19)))
|
||||
(net (code 19) (name "Net-(C5-Pad1)")
|
||||
(node (ref C5) (pin 1))
|
||||
(node (ref U1) (pin 20)))
|
||||
(net (code 20) (name "Net-(C1-Pad1)")
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref XTAL1) (pin 2)))
|
||||
(net (code 21) (name SCL)
|
||||
(node (ref U1) (pin 28))
|
||||
(node (ref R6) (pin 2))
|
||||
(node (ref P7) (pin 2))
|
||||
(node (ref PCA9685) (pin 26)))
|
||||
(net (code 22) (name SDA)
|
||||
(node (ref P7) (pin 1))
|
||||
(node (ref PCA9685) (pin 27))
|
||||
(node (ref U1) (pin 27))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 23) (name "Net-(U1-Pad26)")
|
||||
(node (ref U1) (pin 26)))
|
||||
(net (code 24) (name "Net-(U1-Pad23)")
|
||||
(node (ref U1) (pin 23)))
|
||||
(net (code 25) (name SCK)
|
||||
(node (ref U1) (pin 17))
|
||||
(node (ref J1) (pin 3)))
|
||||
(net (code 26) (name MISO)
|
||||
(node (ref U1) (pin 16))
|
||||
(node (ref J1) (pin 1)))
|
||||
(net (code 27) (name MOSI)
|
||||
(node (ref U1) (pin 15))
|
||||
(node (ref J1) (pin 4)))
|
||||
(net (code 28) (name "Net-(U1-Pad10)")
|
||||
(node (ref U1) (pin 10)))
|
||||
(net (code 29) (name "Net-(U1-Pad1)")
|
||||
(node (ref U1) (pin 1)))
|
||||
(net (code 30) (name "Net-(C2-Pad1)")
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref XTAL1) (pin 1))
|
||||
(node (ref U1) (pin 8)))
|
||||
(net (code 31) (name "Net-(PCA9685-Pad20)")
|
||||
(node (ref PCA9685) (pin 20)))
|
||||
(net (code 32) (name "Net-(PCA9685-Pad6)")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref PCA9685) (pin 6)))
|
||||
(net (code 33) (name "Net-(PCA9685-Pad25)")
|
||||
(node (ref PCA9685) (pin 25)))
|
||||
(net (code 34) (name "Net-(PCA9685-Pad22)")
|
||||
(node (ref PCA9685) (pin 22)))
|
||||
(net (code 35) (name "Net-(PCA9685-Pad21)")
|
||||
(node (ref PCA9685) (pin 21)))
|
||||
(net (code 36) (name "Net-(PCA9685-Pad7)")
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref PCA9685) (pin 7)))
|
||||
(net (code 37) (name "Net-(PCA9685-Pad19)")
|
||||
(node (ref PCA9685) (pin 19)))
|
||||
(net (code 38) (name "Net-(PCA9685-Pad18)")
|
||||
(node (ref PCA9685) (pin 18)))
|
||||
(net (code 39) (name "Net-(PCA9685-Pad17)")
|
||||
(node (ref PCA9685) (pin 17)))
|
||||
(net (code 40) (name "Net-(PCA9685-Pad16)")
|
||||
(node (ref PCA9685) (pin 16)))
|
||||
(net (code 41) (name "Net-(PCA9685-Pad15)")
|
||||
(node (ref PCA9685) (pin 15)))
|
||||
(net (code 42) (name "Net-(PCA9685-Pad13)")
|
||||
(node (ref PCA9685) (pin 13)))
|
||||
(net (code 43) (name "Net-(PCA9685-Pad12)")
|
||||
(node (ref PCA9685) (pin 12)))
|
||||
(net (code 44) (name "Net-(PCA9685-Pad11)")
|
||||
(node (ref PCA9685) (pin 11)))
|
||||
(net (code 45) (name "Net-(PCA9685-Pad10)")
|
||||
(node (ref PCA9685) (pin 10)))
|
||||
(net (code 46) (name "Net-(U1-Pad32)")
|
||||
(node (ref U2) (pin 3))
|
||||
(node (ref U2) (pin 2))
|
||||
(node (ref U1) (pin 32)))
|
||||
(net (code 47) (name "Net-(U1-Pad30)")
|
||||
(node (ref U1) (pin 30))
|
||||
(node (ref U2) (pin 1)))
|
||||
(net (code 48) (name "Net-(Q2-Pad1)")
|
||||
(node (ref Q2) (pin 1))
|
||||
(node (ref R3) (pin 2)))
|
||||
(net (code 49) (name "Net-(P4-Pad1)")
|
||||
(node (ref P4) (pin 1))
|
||||
(node (ref Q2) (pin 2)))
|
||||
(net (code 50) (name "Net-(P4-Pad3)")
|
||||
(node (ref P4) (pin 3))
|
||||
(node (ref Q1) (pin 2)))
|
||||
(net (code 51) (name "Net-(P1-Pad1)")
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref U2) (pin 7)))
|
||||
(net (code 52) (name "Net-(P1-Pad2)")
|
||||
(node (ref U2) (pin 6))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref P2) (pin 1)))
|
||||
(net (code 53) (name "Net-(U1-Pad31)")
|
||||
(node (ref U2) (pin 4))
|
||||
(node (ref U1) (pin 31)))))
|
40
kicad/Stairs.pro
Normal file
40
kicad/Stairs.pro
Normal file
@ -0,0 +1,40 @@
|
||||
update=25-11-2018 18:30:03
|
||||
version=1
|
||||
last_client=kicad
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
UseCmpFile=1
|
||||
PadDrill=0.600000000000
|
||||
PadDrillOvalY=0.600000000000
|
||||
PadSizeH=1.500000000000
|
||||
PadSizeV=1.500000000000
|
||||
PcbTextSizeV=1.500000000000
|
||||
PcbTextSizeH=1.500000000000
|
||||
PcbTextThickness=0.300000000000
|
||||
ModuleTextSizeV=1.000000000000
|
||||
ModuleTextSizeH=1.000000000000
|
||||
ModuleTextSizeThickness=0.150000000000
|
||||
SolderMaskClearance=0.000000000000
|
||||
SolderMaskMinWidth=0.000000000000
|
||||
DrawSegmentWidth=0.200000000000
|
||||
BoardOutlineThickness=0.100000000000
|
||||
ModuleOutlineThickness=0.150000000000
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[general]
|
||||
version=1
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
[schematic_editor]
|
||||
version=1
|
||||
PageLayoutDescrFile=
|
||||
PlotDirectoryName=
|
||||
SubpartIdSeparator=0
|
||||
SubpartFirstId=65
|
||||
NetFmtName=
|
||||
SpiceAjustPassiveValues=0
|
||||
LabSize=50
|
||||
ERC_TestSimilarLabels=1
|
1086
kicad/Stairs.sch
Normal file
1086
kicad/Stairs.sch
Normal file
File diff suppressed because it is too large
Load Diff
6
kicad/fp-lib-table
Normal file
6
kicad/fp-lib-table
Normal file
@ -0,0 +1,6 @@
|
||||
(fp_lib_table
|
||||
(lib (name AMS1117-5.0)(type Legacy)(uri ${KIPRJMOD}/libs/AMS1117-5.0.mod)(options "")(descr ""))
|
||||
(lib (name MAX485)(type Legacy)(uri ${KIPRJMOD}/libs/MAX485.mod)(options "")(descr ""))
|
||||
(lib (name SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_)(type Legacy)(uri ${KIPRJMOD}/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.mod)(options "")(descr ""))
|
||||
(lib (name MAX485-SO8)(type KiCad)(uri ${KIPRJMOD}/libs/MAX485-SO8.pretty)(options "")(descr ""))
|
||||
)
|
29
kicad/libs/AMS1117-5.0.bck
Normal file
29
kicad/libs/AMS1117-5.0.bck
Normal file
@ -0,0 +1,29 @@
|
||||
EESchema-LIBRARY Version 2.3
|
||||
#encoding utf-8
|
||||
#(c) SnapEDA 2016 (snapeda.com)
|
||||
#This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA) with Design Exception 1.0
|
||||
#
|
||||
# AMS1117-5.0
|
||||
#
|
||||
DEF AMS1117-5.0 U 0 40 Y Y 1 L N
|
||||
F0 "U" -400 220 50 H V L BNN
|
||||
F1 "AMS1117-5.0" -401 -321 50 H V L BNN
|
||||
F2 "SOT229P700X180-4N" 0 0 50 H I L BNN
|
||||
F3 "Sot223/Pkg 1-Amp 5-Volt Low Drop Out Voltage Regulatator" 0 0 50 H I L BNN
|
||||
F4 "Unavailable" 0 0 50 H I L BNN
|
||||
F5 "Advanced Monolithic Systems" 0 0 50 H I L BNN
|
||||
F6 "None" 0 0 50 H I L BNN
|
||||
F7 "None" 0 0 50 H I L BNN
|
||||
F8 "AMS1117-5.0" 0 0 50 H I L BNN
|
||||
DRAW
|
||||
P 2 0 0 10 -400 200 400 200 N
|
||||
P 2 0 0 10 400 200 400 -200 N
|
||||
P 2 0 0 10 400 -200 -400 -200 N
|
||||
P 2 0 0 10 -400 -200 -400 200 N
|
||||
X VIN 3 -600 100 200 R 40 40 0 0 I
|
||||
X VOUT 2 600 100 200 L 40 40 0 0 O
|
||||
X ADJ/GND 1 600 -100 200 L 40 40 0 0 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# End Library
|
3
kicad/libs/AMS1117-5.0.dcm
Normal file
3
kicad/libs/AMS1117-5.0.dcm
Normal file
@ -0,0 +1,3 @@
|
||||
EESchema-DOCLIB Version 2.0
|
||||
#
|
||||
#End Doc Library
|
24
kicad/libs/AMS1117-5.0.lib
Normal file
24
kicad/libs/AMS1117-5.0.lib
Normal file
@ -0,0 +1,24 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# AMS1117-5.0
|
||||
#
|
||||
DEF AMS1117-5.0 U 0 40 Y Y 1 L N
|
||||
F0 "U" -400 220 50 H V L BNN
|
||||
F1 "AMS1117-5.0" -401 -321 50 H V L BNN
|
||||
F2 "SOT229P700X180-4N" 0 0 50 H I L BNN
|
||||
F3 "Sot223/Pkg 1-Amp 5-Volt Low Drop Out Voltage Regulatator" 0 0 50 H I L BNN
|
||||
F4 "Unavailable" 0 0 50 H I L BNN
|
||||
F5 "Advanced Monolithic Systems" 0 0 50 H I L BNN
|
||||
F6 "None" 0 0 50 H I L BNN
|
||||
F7 "None" 0 0 50 H I L BNN
|
||||
F8 "AMS1117-5.0" 0 0 50 H I L BNN
|
||||
DRAW
|
||||
S -400 200 400 -200 0 1 0 f
|
||||
X ADJ/GND 1 600 -100 200 L 40 40 0 0 W
|
||||
X VOUT 2 600 100 200 L 40 40 0 0 O
|
||||
X VIN 3 -600 100 200 R 40 40 0 0 I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
73
kicad/libs/AMS1117-5.0.mod
Normal file
73
kicad/libs/AMS1117-5.0.mod
Normal file
@ -0,0 +1,73 @@
|
||||
PCBNEW-LibModule-V1
|
||||
# encoding utf-8
|
||||
Units mm
|
||||
$INDEX
|
||||
SOT229P700X180-4N
|
||||
$EndINDEX
|
||||
$MODULE SOT229P700X180-4N
|
||||
Po 0 0 0 15 00000000 00000000 ~~
|
||||
Li SOT229P700X180-4N
|
||||
Cd
|
||||
Sc 00000000
|
||||
At SMD
|
||||
Op 0 0 0
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
T0 -1.15242 -5.14581 1.00211 1.00211 0 0.05 N V 21 "SOT229P700X180-4N"
|
||||
T1 -0.516467 5.54073 1.00285 1.00285 0 0.05 N V 21 "VAL**"
|
||||
DS -3.36 1.86 -3.36 -1.86 0.127 24
|
||||
DS -3.36 -1.86 3.36 -1.86 0.127 24
|
||||
DS 3.36 -1.86 3.36 1.86 0.127 24
|
||||
DS 3.36 1.86 -3.36 1.86 0.127 24
|
||||
DS -3.36 1.86 -3.36 -1.86 0.127 21
|
||||
DS 3.36 1.86 3.36 -1.86 0.127 21
|
||||
DS -3.36 1.86 -3.1 1.86 0.127 21
|
||||
DS 3.11 1.86 3.36 1.86 0.127 21
|
||||
DS 3.36 -1.86 1.87 -1.86 0.127 21
|
||||
DS -1.76 -1.86 -3.36 -1.86 0.127 21
|
||||
DC -2.29 4.373 -2.19 4.373 0.2 21
|
||||
DS -3.61 -2.11 -3.61 2.11 0.05 26
|
||||
DS -3.61 2.11 -3.01 2.11 0.05 26
|
||||
DS -3.01 2.11 -3.01 4.25 0.05 26
|
||||
DS -3.01 4.25 3.01 4.25 0.05 26
|
||||
DS 3.01 4.25 3.01 2.11 0.05 26
|
||||
DS 3.01 2.11 3.61 2.11 0.05 26
|
||||
DS 3.61 2.11 3.61 -2.11 0.05 26
|
||||
DS 3.61 -2.11 1.87 -2.11 0.05 26
|
||||
DS 1.87 -2.11 1.87 -4.25 0.05 26
|
||||
DS 1.87 -4.25 -1.87 -4.25 0.05 26
|
||||
DS -1.87 -4.25 -1.87 -2.11 0.05 26
|
||||
DS -1.87 -2.11 -3.61 -2.11 0.05 26
|
||||
$PAD
|
||||
Sh "1" R 0.93 1.31 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -2.29 3.345
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "2" R 0.93 1.31 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 0 3.345
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "3" R 0.93 1.31 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 2.29 3.345
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "4" R 3.24 1.31 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 0 -3.345
|
||||
$EndPAD
|
||||
$EndMODULE SOT229P700X180-4N
|
43
kicad/libs/MAX485-SO8.pretty/SO-8.kicad_mod
Normal file
43
kicad/libs/MAX485-SO8.pretty/SO-8.kicad_mod
Normal file
@ -0,0 +1,43 @@
|
||||
(module SO-8 (layer F.Cu) (tedit 5BFB111F)
|
||||
(descr "8-Lead Plastic Small Outline, 5.3x6.2mm Body (http://www.ti.com.cn/cn/lit/ds/symlink/tl7705a.pdf)")
|
||||
(tags "SOIC 1.27")
|
||||
(attr smd)
|
||||
(fp_text reference REF** (at 0 -4.13) (layer F.SilkS)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value SO-8 (at 0 4.13) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_line (start -2.75 -2.55) (end -3.7 -2.55) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 3.205) (end 2.75 3.205) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 -3.205) (end 2.75 -3.205) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 3.205) (end -2.75 2.455) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start 2.75 3.205) (end 2.75 2.455) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start 2.75 -3.205) (end 2.75 -2.455) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 -3.205) (end -2.75 -2.55) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -3.9 3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -3.9 -3.35) (end 3.9 -3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 3.9 -3.35) (end 3.9 3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -3.9 -3.35) (end -3.9 3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -2.65 -2.1) (end -1.65 -3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start -2.65 3.1) (end -2.65 -2.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start 2.65 3.1) (end -2.65 3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start 2.65 -3.1) (end 2.65 3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start -1.65 -3.1) (end 2.65 -3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_text user %R (at 0 0) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(pad 8 smd rect (at 3.2 -1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 7 smd rect (at 3.2 -0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 6 smd rect (at 3.2 0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 5 smd rect (at 3.2 1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 4 smd rect (at -3.2 1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 3 smd rect (at -3.2 0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 2 smd rect (at -3.2 -0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 1 smd rect (at -3.2 -1.9) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(model ${KISYS3DMOD}/Housings_SOIC.3dshapes/SO-8_5.3x6.2mm_Pitch1.27mm.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
@ -0,0 +1,43 @@
|
||||
(module Housings_SOIC:SO-8_5.3x6.2mm_Pitch1.27mm (layer F.Cu) (tedit 59920130)
|
||||
(descr "8-Lead Plastic Small Outline, 5.3x6.2mm Body (http://www.ti.com.cn/cn/lit/ds/symlink/tl7705a.pdf)")
|
||||
(tags "SOIC 1.27")
|
||||
(attr smd)
|
||||
(fp_text reference REF** (at 0 -4.13) (layer F.SilkS)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value SO-8_5.3x6.2mm_Pitch1.27mm (at 0 4.13) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_line (start -2.75 -2.55) (end -4.5 -2.55) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 3.205) (end 2.75 3.205) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 -3.205) (end 2.75 -3.205) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 3.205) (end -2.75 2.455) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start 2.75 3.205) (end 2.75 2.455) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start 2.75 -3.205) (end 2.75 -2.455) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -2.75 -3.205) (end -2.75 -2.55) (layer F.SilkS) (width 0.15))
|
||||
(fp_line (start -4.83 3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -4.83 -3.35) (end 4.83 -3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 4.83 -3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -4.83 -3.35) (end -4.83 3.35) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -2.65 -2.1) (end -1.65 -3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start -2.65 3.1) (end -2.65 -2.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start 2.65 3.1) (end -2.65 3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start 2.65 -3.1) (end 2.65 3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start -1.65 -3.1) (end 2.65 -3.1) (layer F.Fab) (width 0.15))
|
||||
(fp_text user %R (at 0 0) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(pad 8 smd rect (at 3.7 -1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 7 smd rect (at 3.7 -0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 6 smd rect (at 3.7 0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 5 smd rect (at 3.7 1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 4 smd rect (at -3.7 1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 3 smd rect (at -3.7 0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 2 smd rect (at -3.7 -0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(pad 1 smd rect (at -3.7 -1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
|
||||
(model ${KISYS3DMOD}/Housings_SOIC.3dshapes/SO-8_5.3x6.2mm_Pitch1.27mm.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
3
kicad/libs/MAX485.bck
Normal file
3
kicad/libs/MAX485.bck
Normal file
@ -0,0 +1,3 @@
|
||||
EESchema-DOCLIB Version 2.0
|
||||
#
|
||||
#End Doc Library
|
3
kicad/libs/MAX485.dcm
Normal file
3
kicad/libs/MAX485.dcm
Normal file
@ -0,0 +1,3 @@
|
||||
EESchema-DOCLIB Version 2.0
|
||||
#
|
||||
#End Doc Library
|
32
kicad/libs/MAX485.lib
Normal file
32
kicad/libs/MAX485.lib
Normal file
@ -0,0 +1,32 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# MAX485
|
||||
#
|
||||
DEF MAX485 U 0 40 Y Y 1 L N
|
||||
F0 "U" -401 301 50 H V L BNN
|
||||
F1 "MAX485" -401 -301 50 H V L BNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "Maxim Integrated" 0 0 50 H I L BNN
|
||||
F4 "None" 0 0 50 H I L BNN
|
||||
F5 "Unavailable" 0 0 50 H I L BNN
|
||||
F6 "None" 0 0 50 H I L BNN
|
||||
F7 "MAX485" 0 0 50 H I L BNN
|
||||
$FPLIST
|
||||
DIL08
|
||||
SO08
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -400 300 400 -200 0 1 0 f
|
||||
X RO 1 -600 200 200 R 40 40 0 0 B
|
||||
X RE 2 -600 100 200 R 40 40 0 0 B I
|
||||
X DE 3 -600 0 200 R 40 40 0 0 B
|
||||
X DI 4 -600 -100 200 R 40 40 0 0 B
|
||||
X GND 5 600 -100 200 L 40 40 0 0 W
|
||||
X A 6 600 0 200 L 40 40 0 0 B
|
||||
X B 7 600 100 200 L 40 40 0 0 B
|
||||
X VCC 8 600 200 200 L 40 40 0 0 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
214
kicad/libs/MAX485.mod
Normal file
214
kicad/libs/MAX485.mod
Normal file
@ -0,0 +1,214 @@
|
||||
PCBNEW-LibModule-V1
|
||||
# encoding utf-8
|
||||
Units mm
|
||||
$INDEX
|
||||
DIL08
|
||||
SO08
|
||||
$EndINDEX
|
||||
$MODULE DIL08
|
||||
Po 0 0 0 15 00000000 00000000 ~~
|
||||
Li DIL08
|
||||
Cd <b>Dual In Line</b>
|
||||
Sc 00000000
|
||||
At STD
|
||||
Op 0 0 0
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
T0 -6.35758 1.27152 1.00119 1.00119 900 0.05 N V 21 "DIL08"
|
||||
T1 5.00698e-06 -2.00279e-06 1.00244 1.00244 0 0.05 N V 21 "VAL**"
|
||||
DS 5.08 -5.08 -5.08 -5.08 0.1524 21
|
||||
DS -5.08 5.08 5.08 5.08 0.1524 21
|
||||
DS 5.08 -5.08 5.08 -2.54 0.1524 21
|
||||
DS -5.08 -5.08 -5.08 -2.54 0.1524 21
|
||||
DS -5.08 5.08 -5.08 2.54 0.1524 21
|
||||
DA -5.08 0 -5.08 -1.016 1800 0.1524 21
|
||||
DS -5.08 -2.54 5.08 -2.54 0.1524 21
|
||||
DS -5.08 -2.54 -5.08 -1.016 0.2032 21
|
||||
DS 5.08 -2.54 5.08 2.54 0.1524 21
|
||||
DS -5.08 2.54 5.08 2.54 0.1524 21
|
||||
DS -5.08 2.54 -5.08 1.016 0.1524 21
|
||||
DS 5.08 2.54 5.08 5.08 0.1524 21
|
||||
$PAD
|
||||
Sh "1" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po -3.81 3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "2" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po -1.27 3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "3" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po 1.27 3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "4" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po 3.81 3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "5" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po 3.81 -3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "6" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po 1.27 -3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "7" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po -1.27 -3.81
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "8" C 1.6002 1.6002 0 0 0
|
||||
Dr 0.8128 0 0
|
||||
At STD N 00C0FFFF
|
||||
.SolderMask 0
|
||||
Ne 0 ""
|
||||
Po -3.81 -3.81
|
||||
$EndPAD
|
||||
$EndMODULE DIL08
|
||||
$MODULE SO08
|
||||
Po 0 0 0 15 00000000 00000000 ~~
|
||||
Li SO08
|
||||
Cd <b>Small Outline Package</b> Fits JEDEC packages (narrow SOIC-8)
|
||||
Sc 00000000
|
||||
At SMD
|
||||
Op 0 0 0
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
T0 -0.45744 -0.203305 0.320166 0.320166 0 0.05 N V 21 "SO08"
|
||||
T1 -0.254561 0.432759 0.32071 0.32071 0 0.05 N V 21 "VAL**"
|
||||
DS -2.362 1.803 2.362 1.803 0.1524 24
|
||||
DS 2.362 -1.803 -2.362 -1.803 0.1524 24
|
||||
DC -1.8034 0.9906 -1.6598 0.9906 0.2032 21
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl -2.08797 1.8542
|
||||
Dl -1.7272 1.8542
|
||||
Dl -1.7272 2.87731
|
||||
Dl -2.08797 2.87731
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl -0.813844 1.8542
|
||||
Dl -0.4572 1.8542
|
||||
Dl -0.4572 2.87389
|
||||
Dl -0.813844 2.87389
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl 0.458097 1.8542
|
||||
Dl 0.8128 1.8542
|
||||
Dl 0.8128 2.87584
|
||||
Dl 0.458097 2.87584
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl 1.72892 1.8542
|
||||
Dl 2.0828 1.8542
|
||||
Dl 2.0828 2.87306
|
||||
Dl 1.72892 2.87306
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl -2.08675 -2.8702
|
||||
Dl -1.7272 -2.8702
|
||||
Dl -1.7272 -1.85772
|
||||
Dl -2.08675 -1.85772
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl -0.813701 -2.8702
|
||||
Dl -0.4572 -2.8702
|
||||
Dl -0.4572 -1.85626
|
||||
Dl -0.813701 -1.85626
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl 0.458322 -2.8702
|
||||
Dl 0.8128 -2.8702
|
||||
Dl 0.8128 -1.85875
|
||||
Dl 0.458322 -1.85875
|
||||
DP 0 0 0 0 4 0 24
|
||||
Dl 1.73057 -2.8702
|
||||
Dl 2.0828 -2.8702
|
||||
Dl 2.0828 -1.85782
|
||||
Dl 1.73057 -1.85782
|
||||
$PAD
|
||||
Sh "1" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -1.905 2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "2" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -0.635 2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "3" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 0.635 2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "4" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 1.905 2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "5" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 1.905 -2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "6" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 0.635 -2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "7" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -0.635 -2.6162
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "8" R 0.6096 2.2098 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -1.905 -2.6162
|
||||
$EndPAD
|
||||
$EndMODULE SO08
|
43
kicad/libs/PCA9685-TSSOP.bck
Normal file
43
kicad/libs/PCA9685-TSSOP.bck
Normal file
@ -0,0 +1,43 @@
|
||||
EESchema-LIBRARY Version 2.2 Date: 04/05/2014-04:12:59
|
||||
#
|
||||
# PCA9685-TSSOP
|
||||
#
|
||||
DEF PCA9685-TSSOP U 0 40 Y Y 1 0 N
|
||||
F0 "U" 0 -100 50 H V C C
|
||||
F1 "PCA9685-TSSOP" 0 100 50 H V C C
|
||||
F2 "MODULE" 0 0 50 H I C C
|
||||
F3 "DOCUMENTATION" 0 0 50 H I C C
|
||||
DRAW
|
||||
S -450 -850 450 850 1 0 0 N
|
||||
X A0 1 -750 650 300 R 50 50 1 1 I
|
||||
X A1 2 -750 550 300 R 50 50 1 1 I
|
||||
X A2 3 -750 450 300 R 50 50 1 1 I
|
||||
X A3 4 -750 350 300 R 50 50 1 1 I
|
||||
X A4 5 -750 250 300 R 50 50 1 1 I
|
||||
X LED0 6 -750 150 300 R 50 50 1 1 O
|
||||
X LED1 7 -750 50 300 R 50 50 1 1 O
|
||||
X LED2 8 -750 -50 300 R 50 50 1 1 O
|
||||
X LED3 9 -750 -150 300 R 50 50 1 1 O
|
||||
X LED4 10 -750 -250 300 R 50 50 1 1 O
|
||||
X LED5 11 -750 -350 300 R 50 50 1 1 O
|
||||
X LED6 12 -750 -450 300 R 50 50 1 1 O
|
||||
X LED7 13 -750 -550 300 R 50 50 1 1 O
|
||||
X GND 14 -750 -650 300 R 50 50 1 1 I
|
||||
X LED8 15 750 -650 300 L 50 50 1 1 O
|
||||
X LED9 16 750 -550 300 L 50 50 1 1 O
|
||||
X LED10 17 750 -450 300 L 50 50 1 1 O
|
||||
X LED11 18 750 -350 300 L 50 50 1 1 O
|
||||
X LED12 19 750 -250 300 L 50 50 1 1 O
|
||||
X LED13 20 750 -150 300 L 50 50 1 1 O
|
||||
X LED14 21 750 -50 300 L 50 50 1 1 O
|
||||
X LED15 22 750 50 300 L 50 50 1 1 O
|
||||
X OE 23 750 150 300 L 50 50 1 1 I
|
||||
X A5 24 750 250 300 L 50 50 1 1 I
|
||||
X EXTCLK 25 750 350 300 L 50 50 1 1 I
|
||||
X SCL 26 750 450 300 L 50 50 1 1 I
|
||||
X SDA 27 750 550 300 L 50 50 1 1 B
|
||||
X VCC 28 750 650 300 L 50 50 1 1 I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
3
kicad/libs/PCA9685-TSSOP.dcm
Normal file
3
kicad/libs/PCA9685-TSSOP.dcm
Normal file
@ -0,0 +1,3 @@
|
||||
EESchema-DOCLIB Version 2.0
|
||||
#
|
||||
#End Doc Library
|
44
kicad/libs/PCA9685-TSSOP.lib
Normal file
44
kicad/libs/PCA9685-TSSOP.lib
Normal file
@ -0,0 +1,44 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# PCA9685-TSSOP
|
||||
#
|
||||
DEF PCA9685-TSSOP U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 -100 50 H V C CNN
|
||||
F1 "PCA9685-TSSOP" 0 100 50 H V C CNN
|
||||
F2 "MODULE" 0 0 50 H I C CNN
|
||||
F3 "DOCUMENTATION" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
S -450 -850 450 850 1 0 0 f
|
||||
X A0 1 -750 650 300 R 50 50 1 1 I
|
||||
X LED4 10 -750 -250 300 R 50 50 1 1 O
|
||||
X LED5 11 -750 -350 300 R 50 50 1 1 O
|
||||
X LED6 12 -750 -450 300 R 50 50 1 1 O
|
||||
X LED7 13 -750 -550 300 R 50 50 1 1 O
|
||||
X GND 14 -750 -650 300 R 50 50 1 1 I
|
||||
X LED8 15 750 -650 300 L 50 50 1 1 O
|
||||
X LED9 16 750 -550 300 L 50 50 1 1 O
|
||||
X LED10 17 750 -450 300 L 50 50 1 1 O
|
||||
X LED11 18 750 -350 300 L 50 50 1 1 O
|
||||
X LED12 19 750 -250 300 L 50 50 1 1 O
|
||||
X A1 2 -750 550 300 R 50 50 1 1 I
|
||||
X LED13 20 750 -150 300 L 50 50 1 1 O
|
||||
X LED14 21 750 -50 300 L 50 50 1 1 O
|
||||
X LED15 22 750 50 300 L 50 50 1 1 O
|
||||
X OE 23 750 150 300 L 50 50 1 1 I
|
||||
X A5 24 750 250 300 L 50 50 1 1 I
|
||||
X EXTCLK 25 750 350 300 L 50 50 1 1 I
|
||||
X SCL 26 750 450 300 L 50 50 1 1 I
|
||||
X SDA 27 750 550 300 L 50 50 1 1 B
|
||||
X VCC 28 750 650 300 L 50 50 1 1 I
|
||||
X A2 3 -750 450 300 R 50 50 1 1 I
|
||||
X A3 4 -750 350 300 R 50 50 1 1 I
|
||||
X A4 5 -750 250 300 R 50 50 1 1 I
|
||||
X LED0 6 -750 150 300 R 50 50 1 1 O
|
||||
X LED1 7 -750 50 300 R 50 50 1 1 O
|
||||
X LED2 8 -750 -50 300 R 50 50 1 1 O
|
||||
X LED3 9 -750 -150 300 R 50 50 1 1 O
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
47
kicad/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.lib
Normal file
47
kicad/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.lib
Normal file
@ -0,0 +1,47 @@
|
||||
EESchema-LIBRARY Version 2.3
|
||||
#encoding utf-8
|
||||
#(c) SnapEDA 2016 (snapeda.com)
|
||||
#This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA) with Design Exception 1.0
|
||||
#
|
||||
# SMD-BUTTON(4P-5.2X5.2X1.5MM-SKQGAKE010)
|
||||
#
|
||||
DEF SMD-BUTTON(4P-5.2X5.2X1.5MM-SKQGAKE010) SW 0 40 Y Y 1 L N
|
||||
F0 "SW" -201 201 50 H V L BNN
|
||||
F1 "SMD-BUTTON(4P-5.2X5.2X1.5MM-SKQGAKE010)" -200 -250 50 H V L BNN
|
||||
F2 "SW4-SMD-5.2X5.2X1.5MM" 0 0 50 H I L BNN
|
||||
F3 "None" 0 0 50 H I L BNN
|
||||
F4 "SKQGAKE010" 0 0 50 H I L BNN
|
||||
F5 "None" 0 0 50 H I L BNN
|
||||
F6 "Unavailable" 0 0 50 H I L BNN
|
||||
F7 "ALPS" 0 0 50 H I L BNN
|
||||
F8 "Switch Tactile N.O. SPST Button Gull Wing 0.05A 12VDC 3.43N SMD T/R" 0 0 50 H I L BNN
|
||||
DRAW
|
||||
P 2 0 0 10 -200 200 200 200 N
|
||||
P 2 0 0 10 200 200 200 100 N
|
||||
P 2 0 0 10 200 100 200 -100 N
|
||||
P 2 0 0 10 200 -100 200 -200 N
|
||||
P 2 0 0 10 200 -200 -200 -200 N
|
||||
P 2 0 0 10 -200 -200 -200 -100 N
|
||||
P 2 0 0 10 -200 -100 -200 100 N
|
||||
P 2 0 0 10 -200 100 -200 200 N
|
||||
P 2 0 0 6 -200 100 0 100 N
|
||||
P 2 0 0 6 0 100 200 100 N
|
||||
P 2 0 0 6 0 100 0 50 N
|
||||
P 2 0 0 6 0 50 -50 -30 N
|
||||
P 2 0 0 6 0 -50 0 -100 N
|
||||
P 2 0 0 6 0 -100 200 -100 N
|
||||
P 2 0 0 6 0 -100 -200 -100 N
|
||||
P 2 0 0 6 -250 100 -200 100 N
|
||||
P 2 0 0 6 -250 -100 -200 -100 N
|
||||
P 2 0 0 6 250 -100 200 -100 N
|
||||
P 2 0 0 6 250 100 200 100 N
|
||||
C -50 -30 6 0 0 0 N
|
||||
C 0 -50 6 0 0 0 N
|
||||
X A0 1 -350 100 100 R 40 40 0 0 B
|
||||
X A1 2 350 100 100 L 40 40 0 0 B
|
||||
X B0 3 -350 -100 100 R 40 40 0 0 B
|
||||
X B1 4 350 -100 100 L 40 40 0 0 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# End Library
|
67
kicad/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.mod
Normal file
67
kicad/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.mod
Normal file
@ -0,0 +1,67 @@
|
||||
PCBNEW-LibModule-V1
|
||||
# encoding utf-8
|
||||
Units mm
|
||||
$INDEX
|
||||
SW4-SMD-5.2X5.2X1.5MM
|
||||
$EndINDEX
|
||||
$MODULE SW4-SMD-5.2X5.2X1.5MM
|
||||
Po 0 0 0 15 00000000 00000000 ~~
|
||||
Li SW4-SMD-5.2X5.2X1.5MM
|
||||
Cd
|
||||
Sc 00000000
|
||||
At SMD
|
||||
Op 0 0 0
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
T0 -0.523383 -3.25313 0.701862 0.701862 0 0.05 N V 21 "SW4-SMD-5.2X5.2X1.5MM"
|
||||
T1 -0.112861 -0.218191 0.501589 0.501589 0 0.05 N V 21 "VAL**"
|
||||
DS 2.6 1.46863 1.46863 2.6 0.127 24
|
||||
DS 1.5 2.6 -1.1 2.6 0.127 21
|
||||
DS -1.1 2.6 -1.45982 2.6 0.127 21
|
||||
DS -1.45982 2.6 -2.6 1.45982 0.127 24
|
||||
DS -2.6 -1.39584 -1.39584 -2.6 0.127 24
|
||||
DS -1.4 -2.6 1.5 -2.6 0.127 21
|
||||
DS 1.43381 -2.6 2.6 -1.43381 0.127 24
|
||||
DP 0 0 0 0 4 0 26
|
||||
Dl -2.50464 -2.6
|
||||
Dl 2.6 -2.6
|
||||
Dl 2.6 2.60484
|
||||
Dl -2.50464 2.60484
|
||||
DS -1.4 -2.6 -2.4 -1.6 0.127 21
|
||||
DS 1.5 -2.6 2.4 -1.7 0.127 21
|
||||
DS 1.5 2.6 2.4 1.7 0.127 21
|
||||
DS -1.45982 2.6 -1.5 2.6 0.127 21
|
||||
DS -1.5 2.6 -2.4 1.7 0.127 21
|
||||
$PAD
|
||||
Sh "1" R 1 0.7 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -3 -1.85
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "2" R 1 0.7 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 3 -1.85
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "3" R 1 0.7 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po -3 1.85
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "4" R 1 0.7 0 0 0
|
||||
At SMD N 00888000
|
||||
.SolderMask 0
|
||||
.SolderPaste 0
|
||||
Ne 0 ""
|
||||
Po 3 1.85
|
||||
$EndPAD
|
||||
$EndMODULE SW4-SMD-5.2X5.2X1.5MM
|
6
kicad/sym-lib-table
Normal file
6
kicad/sym-lib-table
Normal file
@ -0,0 +1,6 @@
|
||||
(sym_lib_table
|
||||
(lib (name PCA9685-TSSOP)(type Legacy)(uri ${KIPRJMOD}/libs/PCA9685-TSSOP.lib)(options "")(descr ""))
|
||||
(lib (name MAX485)(type Legacy)(uri ${KIPRJMOD}/libs/MAX485.lib)(options "")(descr ""))
|
||||
(lib (name AMS1117-5.0)(type Legacy)(uri ${KIPRJMOD}/libs/AMS1117-5.0.lib)(options "")(descr ""))
|
||||
(lib (name SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_)(type Legacy)(uri ${KIPRJMOD}/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.lib)(options "")(descr ""))
|
||||
)
|
1
module/build.bat
Normal file
1
module/build.bat
Normal file
@ -0,0 +1 @@
|
||||
@pio run
|
7
module/fuses.bat
Normal file
7
module/fuses.bat
Normal file
@ -0,0 +1,7 @@
|
||||
@Echo Off
|
||||
REM Internal 8 Mhz oscillator, no clock division
|
||||
REM http://www.engbedded.com/fusecalc/
|
||||
REM avrdude -c usbtiny -p m328p -e -U lfuse:w:0xE2:m -U hfuse:w:0xd9:m -U efuse:w:0x07:m
|
||||
|
||||
REM External 8+ Mhz oscillator, no clock division
|
||||
avrdude -c usbtiny -p m328p -e -U lfuse:w:0xcf:m -U hfuse:w:0xd9:m -U efuse:w:0x07:m
|
283
module/mockmaster/mockmaster.ino
Normal file
283
module/mockmaster/mockmaster.ino
Normal file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#include <RS485_non_blocking.h>
|
||||
#include <SoftwareSerial.h>
|
||||
#define SERIAL_COMMANDS_DEBUG
|
||||
#include <SerialCommands.h>
|
||||
#include "protocol.h"
|
||||
|
||||
|
||||
const uint8_t PinRS485Receive = 2;
|
||||
const uint8_t PinRS485Transmit = 3;
|
||||
const uint8_t PinRS485WriteEnable = 4;
|
||||
|
||||
const uint32_t RS485BaudRate = 76800;
|
||||
|
||||
|
||||
/*
|
||||
* RS485 communication
|
||||
*/
|
||||
SoftwareSerial rs485(PinRS485Receive, PinRS485Transmit);
|
||||
|
||||
size_t doWrite(const byte what)
|
||||
{
|
||||
return rs485.write (what);
|
||||
}
|
||||
|
||||
int doAvailable()
|
||||
{
|
||||
return rs485.available ();
|
||||
}
|
||||
|
||||
int doRead()
|
||||
{
|
||||
return rs485.read ();
|
||||
}
|
||||
|
||||
RS485 comm(doRead, doAvailable, doWrite, 20);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Serial communication (user input)
|
||||
*/
|
||||
SerialCommand cmdPing("ping", handlePingCommand);
|
||||
SerialCommand cmdDisplay("display", handleDisplayCommand);
|
||||
SerialCommand cmdLink("link", handleLinkCommand);
|
||||
SerialCommand cmdLinkAssign("assign", handleLinkAssignCommand);
|
||||
SerialCommand cmdLinkStop("stop", handleLinkStopCommand);
|
||||
SerialCommand cmdSetPWM("setPWM", handlesetPWMCommand);
|
||||
SerialCommand cmdGetSensors("getSensors", handlegetSensorsCommand);
|
||||
|
||||
|
||||
char commandBuffer[32];
|
||||
SerialCommands serialCommands(&Serial, commandBuffer, sizeof(commandBuffer), "\r\n", " ");
|
||||
|
||||
void cmdUnrecognized(SerialCommands* sender, const char* cmd)
|
||||
{
|
||||
sender->GetSerial()->print("ERROR: Unrecognized command [");
|
||||
sender->GetSerial()->print(cmd);
|
||||
sender->GetSerial()->println("]");
|
||||
}
|
||||
|
||||
|
||||
bool inLink = false;
|
||||
|
||||
|
||||
void showCommands()
|
||||
{
|
||||
Serial.println("");
|
||||
Serial.println("Available commands:");
|
||||
Serial.println(" ping [moduleIndex]");
|
||||
Serial.println(" display");
|
||||
Serial.println(" link");
|
||||
Serial.println(" setPWM [moduleIndex] [flags] [value1] [value2]");
|
||||
Serial.println(" getSensors [moduleIndex]");
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(PinRS485WriteEnable, OUTPUT);
|
||||
|
||||
rs485.begin(RS485BaudRate);
|
||||
comm.begin();
|
||||
|
||||
Serial.begin(115200);
|
||||
serialCommands.AddCommand(&cmdPing);
|
||||
serialCommands.AddCommand(&cmdDisplay);
|
||||
serialCommands.AddCommand(&cmdLink);
|
||||
serialCommands.AddCommand(&cmdLinkAssign);
|
||||
serialCommands.AddCommand(&cmdLinkStop);
|
||||
serialCommands.AddCommand(&cmdSetPWM);
|
||||
serialCommands.AddCommand(&cmdGetSensors);
|
||||
serialCommands.SetDefaultHandler(&cmdUnrecognized);
|
||||
|
||||
Serial.println("Stairs module Mock Master ready");
|
||||
showCommands();
|
||||
}
|
||||
|
||||
|
||||
void loop ()
|
||||
{
|
||||
serialCommands.ReadSerial();
|
||||
|
||||
if (comm.update())
|
||||
handleCommMessage();
|
||||
}
|
||||
|
||||
|
||||
void sendCommMessage(const byte* data, size_t len)
|
||||
{
|
||||
Serial.print("Raw out: ");
|
||||
byte* ptr = data;
|
||||
for (size_t i = 0; i < len; i++, ptr++)
|
||||
{
|
||||
Serial.print(*ptr, HEX);
|
||||
Serial.print(' ');
|
||||
}
|
||||
Serial.println("");
|
||||
|
||||
|
||||
digitalWrite(PinRS485WriteEnable, HIGH);
|
||||
comm.sendMsg(data, len);
|
||||
digitalWrite(PinRS485WriteEnable, LOW);
|
||||
}
|
||||
|
||||
|
||||
void handlePingCommand(SerialCommands* sender)
|
||||
{
|
||||
if (inLink) return;
|
||||
|
||||
int moduleIndex = atoi(sender->Next());
|
||||
|
||||
sender->GetSerial()->println("> Ping");
|
||||
const byte msg[] = { CommandPing, moduleIndex };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handleDisplayCommand(SerialCommands* sender)
|
||||
{
|
||||
if (inLink) return;
|
||||
|
||||
sender->GetSerial()->println("> DisplayModuleIndex");
|
||||
const byte msg[] = { CommandDisplayModuleIndex };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handleLinkCommand(SerialCommands* sender)
|
||||
{
|
||||
if (inLink) return;
|
||||
|
||||
sender->GetSerial()->println("> Link");
|
||||
const byte msg[] = { CommandStartLink };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
|
||||
sender->GetSerial()->println("");
|
||||
sender->GetSerial()->println("Available commands:");
|
||||
sender->GetSerial()->println(" assign [moduleIndex]");
|
||||
sender->GetSerial()->println(" stop");
|
||||
sender->GetSerial()->println("");
|
||||
|
||||
inLink = true;
|
||||
}
|
||||
|
||||
|
||||
void handleLinkAssignCommand(SerialCommands* sender)
|
||||
{
|
||||
if (!inLink) return;
|
||||
|
||||
int moduleIndex = atoi(sender->Next());
|
||||
|
||||
sender->GetSerial()->println("> LinkRequest response");
|
||||
const byte msg[] = { ResponseRequestLink, moduleIndex };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handleLinkStopCommand(SerialCommands* sender)
|
||||
{
|
||||
if (!inLink) return;
|
||||
|
||||
sender->GetSerial()->println("> StopLink");
|
||||
const byte msg[] = { CommandStopLink };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
|
||||
inLink = false;
|
||||
showCommands();
|
||||
}
|
||||
|
||||
|
||||
void handlesetPWMCommand(SerialCommands* sender)
|
||||
{
|
||||
if (inLink) return;
|
||||
|
||||
int moduleIndex = atoi(sender->Next());
|
||||
int flags = atoi(sender->Next());
|
||||
int value1 = atoi(sender->Next());
|
||||
int value2 = atoi(sender->Next());
|
||||
|
||||
sender->GetSerial()->println("> SetPWM");
|
||||
const byte msg[] = { CommandSetPWM, moduleIndex, flags, lowByte(value1), highByte(value1), lowByte(value2), highByte(value2) };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handlegetSensorsCommand(SerialCommands* sender)
|
||||
{
|
||||
if (inLink) return;
|
||||
|
||||
int moduleIndex = atoi(sender->Next());
|
||||
|
||||
sender->GetSerial()->println("> GetSensors");
|
||||
const byte msg[] = { CommandGetSensors, moduleIndex };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handleCommMessage()
|
||||
{
|
||||
uint8_t* data = comm.getData();
|
||||
uint8_t length = comm.getLength();
|
||||
|
||||
Serial.print("Raw in: ");
|
||||
byte* ptr = data;
|
||||
for (size_t i = 0; i < length; i++, ptr++)
|
||||
{
|
||||
Serial.print(*ptr, HEX);
|
||||
Serial.print(' ');
|
||||
}
|
||||
Serial.println("");
|
||||
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
uint8_t command = *data; data++; length--;
|
||||
switch (command)
|
||||
{
|
||||
case ResponsePing:
|
||||
if (length > 0)
|
||||
Serial.println("< Ping response, module index = " + String(*data));
|
||||
else
|
||||
Serial.println("< Ping response, module index = <missing>");
|
||||
|
||||
break;
|
||||
|
||||
case CommandRequestLink:
|
||||
Serial.println("< Request link");
|
||||
break;
|
||||
|
||||
case ResponseSetPWM:
|
||||
Serial.println("< Set PWM response, module index = " + String(*data));
|
||||
break;
|
||||
|
||||
case ResponseGetSensors:
|
||||
Serial.println("< Get sensors response, module index = " + String(*data)); data++; length--;
|
||||
if (length >= 2)
|
||||
{
|
||||
Serial.println(" Sensor 1 value: " + String(*reinterpret_cast<uint16_t*>(data))); data+=2; length-=2;
|
||||
}
|
||||
else
|
||||
Serial.println(" Sensor 1 value: <missing>");
|
||||
|
||||
if (length >= 2)
|
||||
{
|
||||
Serial.println(" Sensor 2 value: " + String(*reinterpret_cast<uint16_t*>(data))); data+=2; length-=2;
|
||||
}
|
||||
else
|
||||
Serial.println(" Sensor 2 value: <missing>");
|
||||
|
||||
break;
|
||||
|
||||
case ResponseUhmWhat:
|
||||
Serial.println("< Uhm, what? module index = " + String(*data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
155
module/mockmaster/protocol.h
Normal file
155
module/mockmaster/protocol.h
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __protocol
|
||||
#define __protocol
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/*
|
||||
* There are three classes of messages, these masks provide a way to identify
|
||||
* unknown messages if the protocol ever changes.
|
||||
*
|
||||
* MaskBroadcastCommand: commands which do not expect a response
|
||||
* MaskModuleCommand: commands which do expect a command. respond with ResponseUhmWhat to satisfy the response requirement.
|
||||
* MaskResponse: responses to commands
|
||||
*/
|
||||
const uint8_t MaskMessageType = 0b11000000;
|
||||
|
||||
const uint8_t MaskBroadcastCommand = 0b10000000;
|
||||
const uint8_t MaskModuleCommand = 0b11000000;
|
||||
const uint8_t MaskResponse = 0b01000000;
|
||||
|
||||
const uint8_t ResponseUhmWhat = 0x00 | MaskResponse;
|
||||
|
||||
|
||||
/*
|
||||
* Ping:
|
||||
* Aimed at a specific module, which must respond with a
|
||||
* ResponsePing message.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandPing
|
||||
* [1] Module index
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponsePing
|
||||
* [1] Module index
|
||||
*/
|
||||
const uint8_t BasePing = 0x01;
|
||||
const uint8_t CommandPing = BasePing | MaskModuleCommand;
|
||||
const uint8_t ResponsePing = BasePing | MaskResponse;
|
||||
|
||||
|
||||
/*
|
||||
* Display module index:
|
||||
* Broadcast to all modules which should turn on their display
|
||||
* and show the current settings. No response is expected.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandDisplayModuleIndex
|
||||
*/
|
||||
const uint8_t CommandDisplayModuleIndex = 0x02 | MaskBroadcastCommand;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Start linking:
|
||||
* Broadcast to all modules which should change to link mode.
|
||||
* During link mode the master will disable all other communication,
|
||||
* allowing the module to respond at will in response to user input.
|
||||
*
|
||||
* Each module should send a CommandRequestLink message when user input
|
||||
* is provided.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandStartLink
|
||||
*
|
||||
* Response (eventually):
|
||||
* See CommandRequestLink
|
||||
*/
|
||||
const uint8_t CommandStartLink = 0x10 | MaskBroadcastCommand;
|
||||
|
||||
|
||||
/*
|
||||
* Request link:
|
||||
* Sent by a module when user input is provided to link this module
|
||||
* as the next in line. All other modules should disable sending this
|
||||
* message until the currently requesting module receives a response.
|
||||
*
|
||||
* The master must respond with the new module index, which the
|
||||
* module must apply and store immediately.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandRequestLink
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponseRequestLink
|
||||
* [1] New module index
|
||||
*/
|
||||
const uint8_t BaseRequestLink = 0x11;
|
||||
const uint8_t CommandRequestLink = BaseRequestLink | MaskBroadcastCommand;
|
||||
const uint8_t ResponseRequestLink = BaseRequestLink | MaskResponse;
|
||||
|
||||
|
||||
/*
|
||||
* Stop linking:
|
||||
* Broadcast to all modules when the master takes back control
|
||||
* over the communication line. No response is expected.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandStopLink
|
||||
*/
|
||||
const uint8_t CommandStopLink = 0x12 | MaskBroadcastCommand;
|
||||
|
||||
|
||||
/*
|
||||
* Set PWM value:
|
||||
* Aimed at a specific module, which must apply the specified
|
||||
* PWM values to the LED strips and respond with a
|
||||
* ResponseSetPWM message.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandSetPWM
|
||||
* [1] Module index
|
||||
* [2] Flags, see below
|
||||
* [3,4] PWM value for step 1 (0-4095, uint16_t)
|
||||
* [5,6] PWM value for step 2 (0-4095, uint16_t)
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponseSetPWM
|
||||
* [1] Module index
|
||||
*/
|
||||
const uint8_t BaseSetPWM = 0x20;
|
||||
const uint8_t CommandSetPWM = BaseSetPWM | MaskModuleCommand;
|
||||
const uint8_t ResponseSetPWM = BaseSetPWM | MaskResponse;
|
||||
|
||||
// If included, the on-board verification LEDs should light up with
|
||||
// the specified PWM values as well. Otherwise they should be off.
|
||||
const uint8_t SetPWMFlagModuleLEDs = 0x01;
|
||||
|
||||
|
||||
/*
|
||||
* Get sensor values:
|
||||
* Aimed at a specific module, which must response with a
|
||||
* ResponseGetSensors message containing the current sensor states.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandGetSensors
|
||||
* [1] Module index
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponseGetSensors
|
||||
* [1] Module index
|
||||
* [2] Analog (0-255) or digital (0, 255) value for sensor 1
|
||||
* [3] Analog (0-255) or digital (0, 255) value for sensor 2
|
||||
*/
|
||||
const uint8_t BaseGetSensors = 0x30;
|
||||
const uint8_t CommandGetSensors = BaseGetSensors | MaskModuleCommand;
|
||||
const uint8_t ResponseGetSensors = BaseGetSensors | MaskResponse;
|
||||
|
||||
#endif
|
24
module/platformio.ini
Normal file
24
module/platformio.ini
Normal file
@ -0,0 +1,24 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; http://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
env_default = board
|
||||
|
||||
[env:board]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = 328p8m
|
||||
board_build.f_cpu = 16000000L
|
||||
upload_speed = 115200
|
||||
upload_protocol = usbtiny
|
||||
|
||||
lib_deps =
|
||||
Adafruit GFX Library
|
||||
Adafruit PWM Servo Driver Library
|
BIN
module/res/CommIcon.psd
Normal file
BIN
module/res/CommIcon.psd
Normal file
Binary file not shown.
BIN
module/res/WaitCursor.psd
Normal file
BIN
module/res/WaitCursor.psd
Normal file
Binary file not shown.
50
module/src/config.h
Normal file
50
module/src/config.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __config
|
||||
#define __config
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// Baud rate for the RS485 communication
|
||||
// At 16 Mhz we pick a baud rate with a very acceptable 0.2% error rate
|
||||
// Source: http://www.robotroom.com/Asynchronous-Serial-Communication-2.html
|
||||
const uint32_t CommBaudRate = 76800;
|
||||
|
||||
// Arduino pin number connected to the MAX485's Receiver and Driver Output Enable pins
|
||||
const uint8_t CommWriteEnablePin = 2;
|
||||
|
||||
// How long since the last packet before the communication icon shows
|
||||
// as 'off'. Note that if a module is not configured for sensors and
|
||||
// the light doesn't change either there will be no communication,
|
||||
// so no need to panic immediately.
|
||||
const uint32_t CommIdleTimeout = 1000;
|
||||
|
||||
|
||||
// How long the display should stay on once it's idle and showing the
|
||||
// current step numbers.
|
||||
const uint32_t DisplayIdleTimeout = 5000;
|
||||
|
||||
|
||||
// I2C address of the PCA9685 PWM driver
|
||||
const uint8_t PWMDriverAddress = 0x40;
|
||||
|
||||
// Frequency of the PCA9685 PWM driver
|
||||
const uint16_t PWMDriverFrequency = 1600;
|
||||
|
||||
|
||||
// Arduino analog pin number connected to the sensors
|
||||
const uint8_t PinSensor1 = 1;
|
||||
const uint8_t PinSensor2 = 2;
|
||||
|
||||
// Arduino digital pin number connected to the push button.
|
||||
const uint8_t PinButton = 8;
|
||||
|
||||
// Debounce time for the push button. Since it is not used for fast operations, this can be relatively high.
|
||||
const uint32_t ButtonDebounceTime = 500;
|
||||
|
||||
#endif
|
257
module/src/display.cpp
Normal file
257
module/src/display.cpp
Normal file
@ -0,0 +1,257 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#include "display.h"
|
||||
#include <Fonts/FreeSans12pt7b.h>
|
||||
#include "config.h"
|
||||
#include "icons.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
const uint8_t WaitAnimationInterval = 150;
|
||||
|
||||
|
||||
void Display::init()
|
||||
{
|
||||
mDisplay = new Adafruit_SSD1306(128, 32, &Wire, -1);
|
||||
mDisplay->begin(SSD1306_SWITCHCAPVCC, 0x3C);
|
||||
}
|
||||
|
||||
|
||||
void Display::update()
|
||||
{
|
||||
// TODO invalidate when comm state changes
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case State::WaitingForComm:
|
||||
drawWaitingForComm();
|
||||
break;
|
||||
|
||||
case State::Linking:
|
||||
case State::LinkingRequest:
|
||||
drawLinking();
|
||||
break;
|
||||
|
||||
case State::LinkingSet:
|
||||
drawModuleIndex();
|
||||
break;
|
||||
|
||||
case State::DisplayModuleIndex:
|
||||
if (mLastDrawnState == state && currentTime - mLastStateChange >= DisplayIdleTimeout)
|
||||
{
|
||||
state = State::DisplayOff;
|
||||
off();
|
||||
}
|
||||
else
|
||||
drawModuleIndex();
|
||||
|
||||
break;
|
||||
|
||||
case State::DisplayOff:
|
||||
off();
|
||||
break;
|
||||
}
|
||||
|
||||
setLastDrawnState();
|
||||
}
|
||||
|
||||
|
||||
void Display::drawWaitingForComm()
|
||||
{
|
||||
if (mLastDrawnState == State::WaitingForComm && currentTime - mLastWaiting < WaitAnimationInterval)
|
||||
return;
|
||||
|
||||
checkOn();
|
||||
mDisplay->clearDisplay();
|
||||
drawTitle("Waiting for signal");
|
||||
|
||||
uint8_t xOffset = (mWaitAnimationStep == 1 || mWaitAnimationStep == 2) ? WaitCursorSegmentWidth : 0;
|
||||
uint8_t yOffset = (mWaitAnimationStep == 2 || mWaitAnimationStep == 3) ? WaitCursorSegmentHeight : 0;
|
||||
drawRotatedBitmap(xOffset, mDisplay->height() - (WaitCursorSegmentHeight * 2) + yOffset, WaitCursorSegment, WaitCursorSegmentWidth, WaitCursorSegmentHeight, mWaitAnimationStep);
|
||||
|
||||
mDisplay->display();
|
||||
|
||||
mWaitAnimationStep++;
|
||||
if (mWaitAnimationStep > 3)
|
||||
mWaitAnimationStep = 0;
|
||||
|
||||
mLastWaiting = currentTime;
|
||||
}
|
||||
|
||||
|
||||
void Display::drawModuleIndex()
|
||||
{
|
||||
uint8_t moduleIndex = settings.getModuleIndex();
|
||||
if (mLastDrawnState == State::DisplayModuleIndex && mLastModuleIndex == moduleIndex)
|
||||
return;
|
||||
|
||||
checkOn();
|
||||
mDisplay->clearDisplay();
|
||||
drawTitle("Steps");
|
||||
drawCommIcon();
|
||||
|
||||
mDisplay->setFont(&FreeSans12pt7b);
|
||||
mDisplay->setCursor(0, mDisplay->height() - 1);
|
||||
|
||||
if (moduleIndex == ModuleIndexUndefined)
|
||||
{
|
||||
mDisplay->print("Not set");
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t firstStep = (moduleIndex * 2) + 1;
|
||||
mDisplay->print(firstStep);
|
||||
mDisplay->print(" - ");
|
||||
mDisplay->print(firstStep + 1);
|
||||
}
|
||||
|
||||
mDisplay->display();
|
||||
}
|
||||
|
||||
|
||||
void Display::drawLinking()
|
||||
{
|
||||
if (mLastDrawnState == State::Linking)
|
||||
return;
|
||||
|
||||
checkOn();
|
||||
mDisplay->clearDisplay();
|
||||
drawTitle("Steps");
|
||||
drawCommIcon();
|
||||
|
||||
mDisplay->setFont(&FreeSans12pt7b);
|
||||
mDisplay->setCursor(0, mDisplay->height() - 1);
|
||||
mDisplay->print("Click to set");
|
||||
mDisplay->display();
|
||||
}
|
||||
|
||||
|
||||
void Display::setLastDrawnState()
|
||||
{
|
||||
if (state != mLastDrawnState)
|
||||
{
|
||||
mLastDrawnState = state;
|
||||
mLastStateChange = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Display::off()
|
||||
{
|
||||
if (mLastDrawnState != State::DisplayOff)
|
||||
{
|
||||
// I've had trouble waking the display up again, so just clear it for now
|
||||
mDisplay->ssd1306_command(SSD1306_DISPLAYOFF);
|
||||
mDisplay->ssd1306_command(SSD1306_CHARGEPUMP);
|
||||
mDisplay->ssd1306_command(0x10); // disable charge pump
|
||||
//mDisplay->clearDisplay();
|
||||
//mDisplay->display();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Display::checkOn()
|
||||
{
|
||||
if (mLastDrawnState == State::DisplayOff)
|
||||
{
|
||||
mDisplay->ssd1306_command(SSD1306_CHARGEPUMP);
|
||||
mDisplay->ssd1306_command(0x14); // enable charge pump
|
||||
|
||||
mDisplay->ssd1306_command(SSD1306_DISPLAYON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Display::drawTitle(const char* title)
|
||||
{
|
||||
mDisplay->setTextSize(1);
|
||||
mDisplay->setTextColor(WHITE);
|
||||
|
||||
mDisplay->setFont(NULL);
|
||||
mDisplay->setCursor(0, 0);
|
||||
mDisplay->print(title);
|
||||
}
|
||||
|
||||
|
||||
void Display::drawCommIcon()
|
||||
{
|
||||
mDisplay->drawBitmap(mDisplay->width() - IconCommWidth, 0,
|
||||
currentTime - comm.getPacketStartTime() <= CommIdleTimeout ? IconCommOn : IconCommOff,
|
||||
IconCommWidth, IconCommHeight, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef void (*WritePixelProc)(Adafruit_SSD1306* display, int8_t boundsX, int8_t boundsY, int8_t boundsW, int8_t boundsH, int8_t relativeX, int8_t relativeY);
|
||||
|
||||
|
||||
void writePixel0(Adafruit_SSD1306* display, int8_t boundsX, int8_t boundsY, int8_t boundsW, int8_t boundsH, int8_t relativeX, int8_t relativeY)
|
||||
{
|
||||
display->writePixel(boundsX + relativeX, boundsY + relativeY, 1);
|
||||
}
|
||||
|
||||
void writePixel90(Adafruit_SSD1306* display, int8_t boundsX, int8_t boundsY, int8_t boundsW, int8_t boundsH, int8_t relativeX, int8_t relativeY)
|
||||
{
|
||||
display->writePixel(boundsX + boundsW - relativeY, boundsY + relativeX, 1);
|
||||
}
|
||||
|
||||
void writePixel180(Adafruit_SSD1306* display, int8_t boundsX, int8_t boundsY, int8_t boundsW, int8_t boundsH, int8_t relativeX, int8_t relativeY)
|
||||
{
|
||||
display->writePixel(boundsX + boundsW - relativeX, boundsY + boundsH - relativeY, 1);
|
||||
}
|
||||
|
||||
void writePixel270(Adafruit_SSD1306* display, int8_t boundsX, int8_t boundsY, int8_t boundsW, int8_t boundsH, int8_t relativeX, int8_t relativeY)
|
||||
{
|
||||
display->writePixel(boundsX + relativeY, boundsY + boundsH - relativeX, 1);
|
||||
}
|
||||
|
||||
|
||||
void Display::drawRotatedBitmap(int8_t x, int8_t y, const uint8_t bitmap[], int8_t w, int8_t h, uint8_t rotation)
|
||||
{
|
||||
int16_t byteWidth = (w + 7) / 8;
|
||||
int8_t byte = 0;
|
||||
|
||||
mDisplay->startWrite();
|
||||
|
||||
WritePixelProc writePixel;
|
||||
switch (rotation)
|
||||
{
|
||||
case 1: // 90 degrees
|
||||
writePixel = writePixel90;
|
||||
break;
|
||||
|
||||
case 2: // 180 degrees
|
||||
writePixel = writePixel180;
|
||||
break;
|
||||
|
||||
case 3: // 270 degrees
|
||||
writePixel = writePixel270;
|
||||
break;
|
||||
|
||||
default: // 0 degrees
|
||||
writePixel = writePixel0;
|
||||
break;
|
||||
}
|
||||
|
||||
for(int8_t relativeY = 0; relativeY < h; relativeY++)
|
||||
{
|
||||
for(int8_t relativeX = 0; relativeX < w; relativeX++)
|
||||
{
|
||||
if(relativeX & 7)
|
||||
byte <<= 1;
|
||||
else
|
||||
byte = pgm_read_byte(&bitmap[relativeY * byteWidth + relativeX / 8]);
|
||||
|
||||
if (byte & 0x80)
|
||||
writePixel(mDisplay, x, y, w, h, relativeX, relativeY);
|
||||
}
|
||||
}
|
||||
|
||||
mDisplay->endWrite();
|
||||
}
|
||||
|
||||
|
44
module/src/display.h
Normal file
44
module/src/display.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __display
|
||||
#define __display
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include "lib/Adafruit_SSD1306.h"
|
||||
#include "state.h"
|
||||
|
||||
|
||||
class Display
|
||||
{
|
||||
private:
|
||||
Adafruit_SSD1306* mDisplay;
|
||||
State mLastDrawnState = State::DisplayOff;
|
||||
uint32_t mLastStateChange;
|
||||
uint8_t mLastModuleIndex;
|
||||
uint32_t mLastWaiting;
|
||||
uint8_t mWaitAnimationStep = 0;
|
||||
|
||||
void drawRotatedBitmap(int8_t x, int8_t y, const uint8_t bitmap[], int8_t w, int8_t h, uint8_t rotation);
|
||||
|
||||
void checkOn();
|
||||
void drawTitle(const char* title);
|
||||
void drawCommIcon();
|
||||
|
||||
void drawWaitingForComm();
|
||||
void drawModuleIndex();
|
||||
void drawLinking();
|
||||
void off();
|
||||
|
||||
void setLastDrawnState();
|
||||
public:
|
||||
void init();
|
||||
void update();
|
||||
};
|
||||
|
||||
#endif
|
32
module/src/global.cpp
Normal file
32
module/src/global.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#include "global.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
int serialRead()
|
||||
{
|
||||
return Serial.read();
|
||||
}
|
||||
|
||||
int serialAvailable()
|
||||
{
|
||||
return Serial.available();
|
||||
}
|
||||
|
||||
size_t serialWrite(const byte what)
|
||||
{
|
||||
return Serial.write(what);
|
||||
}
|
||||
|
||||
|
||||
Settings settings;
|
||||
Display display;
|
||||
RS485 comm(serialRead, serialAvailable, serialWrite, 20);
|
||||
Adafruit_PWMServoDriver pwmDriver(PWMDriverAddress);
|
||||
State state = State::WaitingForComm;
|
||||
uint32_t currentTime;
|
23
module/src/global.h
Normal file
23
module/src/global.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __global
|
||||
#define __global
|
||||
|
||||
#include "lib/RS485_non_blocking.h"
|
||||
#include "Adafruit_PWMServoDriver.h"
|
||||
#include "settings.h"
|
||||
#include "display.h"
|
||||
#include "state.h"
|
||||
|
||||
extern Settings settings;
|
||||
extern Display display;
|
||||
extern RS485 comm;
|
||||
extern Adafruit_PWMServoDriver pwmDriver;
|
||||
extern State state;
|
||||
extern uint32_t currentTime;
|
||||
|
||||
#endif
|
28
module/src/icons.h
Normal file
28
module/src/icons.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
|
||||
// http://javl.github.io/image2cpp/
|
||||
// Draw mode: horizontal
|
||||
const uint8_t IconCommWidth = 12;
|
||||
const uint8_t IconCommHeight = 8;
|
||||
|
||||
const uint8_t PROGMEM IconCommOff[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM IconCommOn[] = {
|
||||
0x40, 0x20, 0x40, 0x20, 0x90, 0x90, 0xa6, 0x50, 0xa6, 0x50, 0x90, 0x90, 0x40, 0x20, 0x40, 0x20
|
||||
};
|
||||
|
||||
|
||||
const uint8_t WaitCursorSegmentWidth = 10;
|
||||
const uint8_t WaitCursorSegmentHeight = 10;
|
||||
|
||||
const uint8_t PROGMEM WaitCursorSegment[] = {
|
||||
0x07, 0x80, 0x1f, 0x80, 0x3e, 0x00, 0x78, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xc0, 0x00,
|
||||
0xc0, 0x00, 0x00, 0x00
|
||||
};
|
1109
module/src/lib/Adafruit_SSD1306.cpp
Normal file
1109
module/src/lib/Adafruit_SSD1306.cpp
Normal file
File diff suppressed because it is too large
Load Diff
185
module/src/lib/Adafruit_SSD1306.h
Normal file
185
module/src/lib/Adafruit_SSD1306.h
Normal file
@ -0,0 +1,185 @@
|
||||
/*!
|
||||
* @file Adafruit_SSD1306.h
|
||||
*
|
||||
* This is part of for Adafruit's SSD1306 library for monochrome
|
||||
* OLED displays: http://www.adafruit.com/category/63_98
|
||||
*
|
||||
* These displays use I2C or SPI to communicate. I2C requires 2 pins
|
||||
* (SCL+SDA) and optionally a RESET pin. SPI requires 4 pins (MOSI, SCK,
|
||||
* select, data/command) and optionally a reset pin. Hardware SPI or
|
||||
* 'bitbang' software SPI are both supported.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Written by Limor Fried/Ladyada for Adafruit Industries, with
|
||||
* contributions from the open source community.
|
||||
*
|
||||
* BSD license, all text above, and the splash screen header file,
|
||||
* must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Modifications for Stairs project:
|
||||
- Removed the Adafruit splash screen. I'm not going to show it anyways, so all it
|
||||
does is take up valuable program space.
|
||||
*/
|
||||
|
||||
#ifndef _Adafruit_SSD1306_H_
|
||||
#define _Adafruit_SSD1306_H_
|
||||
|
||||
// ONE of the following three lines must be #defined:
|
||||
//#define SSD1306_128_64 ///< DEPRECTAED: old way to specify 128x64 screen
|
||||
#define SSD1306_128_32 ///< DEPRECATED: old way to specify 128x32 screen
|
||||
//#define SSD1306_96_16 ///< DEPRECATED: old way to specify 96x16 screen
|
||||
// This establishes the screen dimensions in old Adafruit_SSD1306 sketches
|
||||
// (NEW CODE SHOULD IGNORE THIS, USE THE CONSTRUCTORS THAT ACCEPT WIDTH
|
||||
// AND HEIGHT ARGUMENTS).
|
||||
|
||||
#if defined(ARDUINO_STM32_FEATHER)
|
||||
typedef class HardwareSPI SPIClass;
|
||||
#endif
|
||||
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
|
||||
#if defined(__AVR__)
|
||||
typedef volatile uint8_t PortReg;
|
||||
typedef uint8_t PortMask;
|
||||
#define HAVE_PORTREG
|
||||
#elif defined(__SAM3X8E__)
|
||||
typedef volatile RwReg PortReg;
|
||||
typedef uint32_t PortMask;
|
||||
#define HAVE_PORTREG
|
||||
#elif defined(__arm__) || defined(ARDUINO_FEATHER52)
|
||||
typedef volatile uint32_t PortReg;
|
||||
typedef uint32_t PortMask;
|
||||
#define HAVE_PORTREG
|
||||
#endif
|
||||
|
||||
#define BLACK 0 ///< Draw 'off' pixels
|
||||
#define WHITE 1 ///< Draw 'on' pixels
|
||||
#define INVERSE 2 ///< Invert pixels
|
||||
|
||||
#define SSD1306_MEMORYMODE 0x20 ///< See datasheet
|
||||
#define SSD1306_COLUMNADDR 0x21 ///< See datasheet
|
||||
#define SSD1306_PAGEADDR 0x22 ///< See datasheet
|
||||
#define SSD1306_SETCONTRAST 0x81 ///< See datasheet
|
||||
#define SSD1306_CHARGEPUMP 0x8D ///< See datasheet
|
||||
#define SSD1306_SEGREMAP 0xA0 ///< See datasheet
|
||||
#define SSD1306_DISPLAYALLON_RESUME 0xA4 ///< See datasheet
|
||||
#define SSD1306_DISPLAYALLON 0xA5 ///< Not currently used
|
||||
#define SSD1306_NORMALDISPLAY 0xA6 ///< See datasheet
|
||||
#define SSD1306_INVERTDISPLAY 0xA7 ///< See datasheet
|
||||
#define SSD1306_SETMULTIPLEX 0xA8 ///< See datasheet
|
||||
#define SSD1306_DISPLAYOFF 0xAE ///< See datasheet
|
||||
#define SSD1306_DISPLAYON 0xAF ///< See datasheet
|
||||
#define SSD1306_COMSCANINC 0xC0 ///< Not currently used
|
||||
#define SSD1306_COMSCANDEC 0xC8 ///< See datasheet
|
||||
#define SSD1306_SETDISPLAYOFFSET 0xD3 ///< See datasheet
|
||||
#define SSD1306_SETDISPLAYCLOCKDIV 0xD5 ///< See datasheet
|
||||
#define SSD1306_SETPRECHARGE 0xD9 ///< See datasheet
|
||||
#define SSD1306_SETCOMPINS 0xDA ///< See datasheet
|
||||
#define SSD1306_SETVCOMDETECT 0xDB ///< See datasheet
|
||||
|
||||
#define SSD1306_SETLOWCOLUMN 0x00 ///< Not currently used
|
||||
#define SSD1306_SETHIGHCOLUMN 0x10 ///< Not currently used
|
||||
#define SSD1306_SETSTARTLINE 0x40 ///< See datasheet
|
||||
|
||||
#define SSD1306_EXTERNALVCC 0x01 ///< External display voltage source
|
||||
#define SSD1306_SWITCHCAPVCC 0x02 ///< Gen. display voltage from 3.3V
|
||||
|
||||
#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26 ///< Init rt scroll
|
||||
#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27 ///< Init left scroll
|
||||
#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29 ///< Init diag scroll
|
||||
#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A ///< Init diag scroll
|
||||
#define SSD1306_DEACTIVATE_SCROLL 0x2E ///< Stop scroll
|
||||
#define SSD1306_ACTIVATE_SCROLL 0x2F ///< Start scroll
|
||||
#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3 ///< Set scroll range
|
||||
|
||||
// Deprecated size stuff for backwards compatibility with old sketches
|
||||
#if defined SSD1306_128_64
|
||||
#define SSD1306_LCDWIDTH 128 ///< DEPRECATED: width w/SSD1306_128_64 defined
|
||||
#define SSD1306_LCDHEIGHT 64 ///< DEPRECATED: height w/SSD1306_128_64 defined
|
||||
#endif
|
||||
#if defined SSD1306_128_32
|
||||
#define SSD1306_LCDWIDTH 128 ///< DEPRECATED: width w/SSD1306_128_32 defined
|
||||
#define SSD1306_LCDHEIGHT 32 ///< DEPRECATED: height w/SSD1306_128_32 defined
|
||||
#endif
|
||||
#if defined SSD1306_96_16
|
||||
#define SSD1306_LCDWIDTH 96 ///< DEPRECATED: width w/SSD1306_96_16 defined
|
||||
#define SSD1306_LCDHEIGHT 16 ///< DEPRECATED: height w/SSD1306_96_16 defined
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@brief Class that stores state and functions for interacting with
|
||||
SSD1306 OLED displays.
|
||||
*/
|
||||
class Adafruit_SSD1306 : public Adafruit_GFX {
|
||||
public:
|
||||
// NEW CONSTRUCTORS -- recommended for new projects
|
||||
Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi=&Wire, int8_t rst_pin=-1,
|
||||
uint32_t clkDuring=400000UL, uint32_t clkAfter=100000UL);
|
||||
Adafruit_SSD1306(uint8_t w, uint8_t h, int8_t mosi_pin, int8_t sclk_pin,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
|
||||
Adafruit_SSD1306(uint8_t w, uint8_t h, SPIClass *spi,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin, uint32_t bitrate=8000000UL);
|
||||
|
||||
// DEPRECATED CONSTRUCTORS - for back compatibility, avoid in new projects
|
||||
Adafruit_SSD1306(int8_t mosi_pin, int8_t sclk_pin, int8_t dc_pin,
|
||||
int8_t rst_pin, int8_t cs_pin);
|
||||
Adafruit_SSD1306(int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
|
||||
Adafruit_SSD1306(int8_t rst_pin = -1);
|
||||
|
||||
~Adafruit_SSD1306(void);
|
||||
|
||||
boolean begin(uint8_t switchvcc=SSD1306_SWITCHCAPVCC,
|
||||
uint8_t i2caddr=0, boolean reset=true,
|
||||
boolean periphBegin=true);
|
||||
void display(void);
|
||||
void clearDisplay(void);
|
||||
void invertDisplay(boolean i);
|
||||
void dim(boolean dim);
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
void startscrollright(uint8_t start, uint8_t stop);
|
||||
void startscrollleft(uint8_t start, uint8_t stop);
|
||||
void startscrolldiagright(uint8_t start, uint8_t stop);
|
||||
void startscrolldiagleft(uint8_t start, uint8_t stop);
|
||||
void stopscroll(void);
|
||||
void ssd1306_command(uint8_t c);
|
||||
boolean getPixel(int16_t x, int16_t y);
|
||||
uint8_t *getBuffer(void);
|
||||
|
||||
private:
|
||||
inline void SPIwrite(uint8_t d) __attribute__((always_inline));
|
||||
void drawFastHLineInternal(int16_t x, int16_t y, int16_t w,
|
||||
uint16_t color);
|
||||
void drawFastVLineInternal(int16_t x, int16_t y, int16_t h,
|
||||
uint16_t color);
|
||||
void ssd1306_command1(uint8_t c);
|
||||
void ssd1306_commandList(const uint8_t *c, uint8_t n);
|
||||
|
||||
SPIClass *spi;
|
||||
TwoWire *wire;
|
||||
uint8_t *buffer;
|
||||
int8_t i2caddr, vccstate, page_end;
|
||||
int8_t mosiPin , clkPin , dcPin , csPin, rstPin;
|
||||
#ifdef HAVE_PORTREG
|
||||
PortReg *mosiPort , *clkPort , *dcPort , *csPort;
|
||||
PortMask mosiPinMask, clkPinMask, dcPinMask, csPinMask;
|
||||
#endif
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPISettings spiSettings;
|
||||
#endif
|
||||
#if ARDUINO >= 157
|
||||
uint32_t wireClk; // Wire speed for SSD1306 transfers
|
||||
uint32_t restoreClk; // Wire speed following SSD1306 transfers
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _Adafruit_SSD1306_H_
|
232
module/src/lib/RS485_non_blocking.cpp
Normal file
232
module/src/lib/RS485_non_blocking.cpp
Normal file
@ -0,0 +1,232 @@
|
||||
/*
|
||||
RS485 protocol library - non-blocking.
|
||||
|
||||
Devised and written by Nick Gammon.
|
||||
Date: 4 December 2012
|
||||
Version: 1.0
|
||||
|
||||
Can send from 1 to 255 bytes from one node to another with:
|
||||
|
||||
* Packet start indicator (STX)
|
||||
* Each data byte is doubled and inverted to check validity
|
||||
* Packet end indicator (ETX)
|
||||
* Packet CRC (checksum)
|
||||
|
||||
|
||||
To allow flexibility with hardware (eg. Serial, SoftwareSerial, I2C)
|
||||
you provide three "callback" functions which send or receive data. Examples are:
|
||||
|
||||
size_t fWrite (const byte what)
|
||||
{
|
||||
return Serial.write (what);
|
||||
}
|
||||
|
||||
int fAvailable ()
|
||||
{
|
||||
return Serial.available ();
|
||||
}
|
||||
|
||||
int fRead ()
|
||||
{
|
||||
return Serial.read ();
|
||||
}
|
||||
|
||||
|
||||
PERMISSION TO DISTRIBUTE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
LIMITATION OF LIABILITY
|
||||
|
||||
The software is provided "as is", without warranty of any kind, express or implied,
|
||||
including but not limited to the warranties of merchantability, fitness for a particular
|
||||
purpose and noninfringement. In no event shall the authors or copyright holders be liable
|
||||
for any claim, damages or other liability, whether in an action of contract,
|
||||
tort or otherwise, arising from, out of or in connection with the software
|
||||
or the use or other dealings in the software.
|
||||
|
||||
*/
|
||||
|
||||
#include "RS485_non_blocking.h"
|
||||
|
||||
// allocate the requested buffer size
|
||||
void RS485::begin ()
|
||||
{
|
||||
data_ = (byte *) malloc (bufferSize_);
|
||||
reset ();
|
||||
errorCount_ = 0;
|
||||
} // end of RS485::begin
|
||||
|
||||
// get rid of the buffer
|
||||
void RS485::stop ()
|
||||
{
|
||||
reset ();
|
||||
free (data_);
|
||||
data_ = NULL;
|
||||
} // end of RS485::stop
|
||||
|
||||
// called after an error to return to "not in a packet"
|
||||
void RS485::reset ()
|
||||
{
|
||||
haveSTX_ = false;
|
||||
available_ = false;
|
||||
inputPos_ = 0;
|
||||
startTime_ = 0;
|
||||
} // end of RS485::reset
|
||||
|
||||
// calculate 8-bit CRC
|
||||
byte RS485::crc8 (const byte *addr, byte len)
|
||||
{
|
||||
byte crc = 0;
|
||||
while (len--)
|
||||
{
|
||||
byte inbyte = *addr++;
|
||||
for (byte i = 8; i; i--)
|
||||
{
|
||||
byte mix = (crc ^ inbyte) & 0x01;
|
||||
crc >>= 1;
|
||||
if (mix)
|
||||
crc ^= 0x8C;
|
||||
inbyte >>= 1;
|
||||
} // end of for
|
||||
} // end of while
|
||||
return crc;
|
||||
} // end of RS485::crc8
|
||||
|
||||
// send a byte complemented, repeated
|
||||
// only values sent would be (in hex):
|
||||
// 0F, 1E, 2D, 3C, 4B, 5A, 69, 78, 87, 96, A5, B4, C3, D2, E1, F0
|
||||
void RS485::sendComplemented (const byte what)
|
||||
{
|
||||
byte c;
|
||||
|
||||
// first nibble
|
||||
c = what >> 4;
|
||||
fWriteCallback_ ((c << 4) | (c ^ 0x0F));
|
||||
|
||||
// second nibble
|
||||
c = what & 0x0F;
|
||||
fWriteCallback_ ((c << 4) | (c ^ 0x0F));
|
||||
|
||||
} // end of RS485::sendComplemented
|
||||
|
||||
// send a message of "length" bytes (max 255) to other end
|
||||
// put STX at start, ETX at end, and add CRC
|
||||
void RS485::sendMsg (const byte * data, const byte length)
|
||||
{
|
||||
// no callback? Can't send
|
||||
if (fWriteCallback_ == NULL)
|
||||
return;
|
||||
|
||||
fWriteCallback_ (STX); // STX
|
||||
for (byte i = 0; i < length; i++)
|
||||
sendComplemented (data [i]);
|
||||
fWriteCallback_ (ETX); // ETX
|
||||
sendComplemented (crc8 (data, length));
|
||||
} // end of RS485::sendMsg
|
||||
|
||||
// called periodically from main loop to process data and
|
||||
// assemble the finished packet in 'data_'
|
||||
|
||||
// returns true if packet received.
|
||||
|
||||
// You could implement a timeout by seeing if isPacketStarted() returns
|
||||
// true, and if too much time has passed since getPacketStartTime() time.
|
||||
|
||||
bool RS485::update ()
|
||||
{
|
||||
// no data? can't go ahead (eg. begin() not called)
|
||||
if (data_ == NULL)
|
||||
return false;
|
||||
|
||||
// no callbacks? Can't read
|
||||
if (fAvailableCallback_ == NULL || fReadCallback_ == NULL)
|
||||
return false;
|
||||
|
||||
while (fAvailableCallback_ () > 0)
|
||||
{
|
||||
byte inByte = fReadCallback_ ();
|
||||
|
||||
switch (inByte)
|
||||
{
|
||||
|
||||
case STX: // start of text
|
||||
haveSTX_ = true;
|
||||
haveETX_ = false;
|
||||
inputPos_ = 0;
|
||||
firstNibble_ = true;
|
||||
startTime_ = millis ();
|
||||
break;
|
||||
|
||||
case ETX: // end of text (now expect the CRC check)
|
||||
haveETX_ = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
// wait until packet officially starts
|
||||
if (!haveSTX_)
|
||||
break;
|
||||
|
||||
// check byte is in valid form (4 bits followed by 4 bits complemented)
|
||||
if ((inByte >> 4) != ((inByte & 0x0F) ^ 0x0F) )
|
||||
{
|
||||
reset ();
|
||||
errorCount_++;
|
||||
break; // bad character
|
||||
} // end if bad byte
|
||||
|
||||
// convert back
|
||||
inByte >>= 4;
|
||||
|
||||
// high-order nibble?
|
||||
if (firstNibble_)
|
||||
{
|
||||
currentByte_ = inByte;
|
||||
firstNibble_ = false;
|
||||
break;
|
||||
} // end of first nibble
|
||||
|
||||
// low-order nibble
|
||||
currentByte_ <<= 4;
|
||||
currentByte_ |= inByte;
|
||||
firstNibble_ = true;
|
||||
|
||||
// if we have the ETX this must be the CRC
|
||||
if (haveETX_)
|
||||
{
|
||||
if (crc8 (data_, inputPos_) != currentByte_)
|
||||
{
|
||||
reset ();
|
||||
errorCount_++;
|
||||
break; // bad crc
|
||||
} // end of bad CRC
|
||||
|
||||
available_ = true;
|
||||
return true; // show data ready
|
||||
} // end if have ETX already
|
||||
|
||||
// keep adding if not full
|
||||
if (inputPos_ < bufferSize_)
|
||||
data_ [inputPos_++] = currentByte_;
|
||||
else
|
||||
{
|
||||
reset (); // overflow, start again
|
||||
errorCount_++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
} // end of while incoming data
|
||||
|
||||
return false; // not ready yet
|
||||
} // end of RS485::update
|
||||
|
107
module/src/lib/RS485_non_blocking.h
Normal file
107
module/src/lib/RS485_non_blocking.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
RS485 protocol library - non-blocking.
|
||||
|
||||
Devised and written by Nick Gammon.
|
||||
Date: 4 December 2012
|
||||
Version: 1.0
|
||||
|
||||
Licence: Released for public use.
|
||||
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
class RS485
|
||||
{
|
||||
|
||||
typedef size_t (*WriteCallback) (const byte what); // send a byte to serial port
|
||||
typedef int (*AvailableCallback) (); // return number of bytes available
|
||||
typedef int (*ReadCallback) (); // read a byte from serial port
|
||||
|
||||
enum {
|
||||
STX = '\2', // start of text
|
||||
ETX = '\3' // end of text
|
||||
}; // end of enum
|
||||
|
||||
// callback functions to do reading/writing
|
||||
ReadCallback fReadCallback_;
|
||||
AvailableCallback fAvailableCallback_;
|
||||
WriteCallback fWriteCallback_;
|
||||
|
||||
// where we save incoming stuff
|
||||
byte * data_;
|
||||
|
||||
// how much data is in the buffer
|
||||
const int bufferSize_;
|
||||
|
||||
// this is true once we have valid data in buf
|
||||
bool available_;
|
||||
|
||||
// an STX (start of text) signals a packet start
|
||||
bool haveSTX_;
|
||||
|
||||
// count of errors
|
||||
unsigned long errorCount_;
|
||||
|
||||
// variables below are set when we get an STX
|
||||
bool haveETX_;
|
||||
byte inputPos_;
|
||||
byte currentByte_;
|
||||
bool firstNibble_;
|
||||
unsigned long startTime_;
|
||||
|
||||
// helper private functions
|
||||
byte crc8 (const byte *addr, byte len);
|
||||
void sendComplemented (const byte what);
|
||||
|
||||
public:
|
||||
|
||||
// constructor
|
||||
RS485 (ReadCallback fReadCallback,
|
||||
AvailableCallback fAvailableCallback,
|
||||
WriteCallback fWriteCallback,
|
||||
const byte bufferSize) :
|
||||
fReadCallback_ (fReadCallback),
|
||||
fAvailableCallback_ (fAvailableCallback),
|
||||
fWriteCallback_ (fWriteCallback),
|
||||
data_ (NULL),
|
||||
bufferSize_ (bufferSize)
|
||||
{}
|
||||
|
||||
// destructor - frees memory used
|
||||
~RS485 () { stop (); }
|
||||
|
||||
// allocate memory for buf_
|
||||
void begin ();
|
||||
|
||||
// free memory in buf_
|
||||
void stop ();
|
||||
|
||||
// handle incoming data, return true if packet ready
|
||||
bool update ();
|
||||
|
||||
// reset to no incoming data (eg. after a timeout)
|
||||
void reset ();
|
||||
|
||||
// send data
|
||||
void sendMsg (const byte * data, const byte length);
|
||||
|
||||
// returns true if packet available
|
||||
bool available () const { return available_; };
|
||||
|
||||
// once available, returns the address of the current message
|
||||
byte * getData () const { return data_; }
|
||||
byte getLength () const { return inputPos_; }
|
||||
|
||||
// return how many errors we have had
|
||||
unsigned long getErrorCount () const { return errorCount_; }
|
||||
|
||||
// return when last packet started
|
||||
unsigned long getPacketStartTime () const { return startTime_; }
|
||||
|
||||
// return true if a packet has started to be received
|
||||
bool isPacketStarted () const { return haveSTX_; }
|
||||
|
||||
}; // end of class RS485
|
||||
|
226
module/src/main.cpp
Normal file
226
module/src/main.cpp
Normal file
@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include "global.h"
|
||||
#include "config.h"
|
||||
#include "display.h"
|
||||
#include "protocol.h"
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
settings.init();
|
||||
|
||||
// Set up I2C devices: the SSD1306 OLED display and PCA9685 LED PWM driver
|
||||
Wire.begin();
|
||||
display.init();
|
||||
|
||||
pwmDriver.begin();
|
||||
pwmDriver.setPWMFreq(PWMDriverFrequency);
|
||||
|
||||
// At 16 Mhz we pick a baud rate with a very acceptable 0.2% error rate
|
||||
// Source: http://www.robotroom.com/Asynchronous-Serial-Communication-2.html
|
||||
Serial.begin(CommBaudRate);
|
||||
pinMode(CommWriteEnablePin, OUTPUT);
|
||||
comm.begin();
|
||||
|
||||
pinMode(PinButton, INPUT_PULLUP);
|
||||
|
||||
pinMode(5, OUTPUT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Forward declarations
|
||||
void handleCommMessage();
|
||||
void handlePing(uint8_t* data, uint8_t length);
|
||||
void handleDisplayModuleIndex(uint8_t* data, uint8_t length);
|
||||
void handleStartLink(uint8_t* data, uint8_t length);
|
||||
void handleRequestLinkResponse(uint8_t* data, uint8_t length);
|
||||
void handleStopLink(uint8_t* data, uint8_t length);
|
||||
void handleSetPWM(uint8_t* data, uint8_t length);
|
||||
void handleGetSensors(uint8_t* data, uint8_t length);
|
||||
|
||||
void checkButtonPress();
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
currentTime = millis();
|
||||
|
||||
if (comm.update())
|
||||
handleCommMessage();
|
||||
|
||||
checkButtonPress();
|
||||
display.update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void sendCommMessage(const uint8_t* data, uint8_t size)
|
||||
{
|
||||
digitalWrite(CommWriteEnablePin, HIGH);
|
||||
comm.sendMsg(data, size);
|
||||
|
||||
|
||||
// Wait for the hardware buffer to clear before turning
|
||||
// off the write enable pin, or we'll cut off the message too early
|
||||
// Straight from: http://www.gammon.com.au/forum/?id=11428
|
||||
|
||||
while (!(UCSR0A & (1 << UDRE0))) // Wait for empty transmit buffer
|
||||
UCSR0A |= 1 << TXC0; // mark transmission not complete
|
||||
|
||||
while (!(UCSR0A & (1 << TXC0))); // Wait for the transmission to complete
|
||||
|
||||
|
||||
digitalWrite(CommWriteEnablePin, LOW);
|
||||
}
|
||||
|
||||
|
||||
void handleCommMessage()
|
||||
{
|
||||
uint8_t* data = comm.getData();
|
||||
uint8_t length = comm.getLength();
|
||||
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
if (state == State::WaitingForComm)
|
||||
state = State::DisplayModuleIndex;
|
||||
|
||||
uint8_t command = *data; data++; length--;
|
||||
uint8_t moduleIndex = ModuleIndexUndefined;
|
||||
|
||||
if ((command & MaskMessageType) == MaskModuleCommand)
|
||||
{
|
||||
if (!settings.hasModuleIndex())
|
||||
// We're not linked yet
|
||||
return;
|
||||
|
||||
moduleIndex = *data; data++; length--;
|
||||
|
||||
if (settings.getModuleIndex() != moduleIndex)
|
||||
// This message is meant for another module
|
||||
return;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case CommandPing: handlePing(data, length); break;
|
||||
case CommandDisplayModuleIndex: handleDisplayModuleIndex(data, length); break;
|
||||
case CommandStartLink: handleStartLink(data, length); break;
|
||||
case ResponseRequestLink: handleRequestLinkResponse(data, length); break;
|
||||
case CommandStopLink: handleStopLink(data, length); break;
|
||||
case CommandSetPWM: handleSetPWM(data, length); break;
|
||||
case CommandGetSensors: handleGetSensors(data, length); break;
|
||||
|
||||
default:
|
||||
if ((command & MaskMessageType) == MaskModuleCommand)
|
||||
{
|
||||
// Sender expects a response from us
|
||||
const uint8_t msg[] = { ResponseUhmWhat, moduleIndex };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void handlePing(uint8_t* data, uint8_t length)
|
||||
{
|
||||
const uint8_t msg[] = { ResponsePing, settings.getModuleIndex() };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handleDisplayModuleIndex(uint8_t* data, uint8_t length)
|
||||
{
|
||||
if (state == State::DisplayOff)
|
||||
state = State::DisplayModuleIndex;
|
||||
}
|
||||
|
||||
|
||||
void handleStartLink(uint8_t* data, uint8_t length)
|
||||
{
|
||||
state = State::Linking;
|
||||
}
|
||||
|
||||
|
||||
void handleRequestLinkResponse(uint8_t* data, uint8_t length)
|
||||
{
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
if (state != State::LinkingRequest)
|
||||
return;
|
||||
|
||||
settings.setModuleIndex(*data);
|
||||
state = State::LinkingSet;
|
||||
}
|
||||
|
||||
|
||||
void handleStopLink(uint8_t* data, uint8_t length)
|
||||
{
|
||||
if (state == State::Linking || state == State::LinkingRequest || state == State::LinkingSet)
|
||||
state = State::DisplayModuleIndex;
|
||||
}
|
||||
|
||||
|
||||
void handleSetPWM(uint8_t* data, uint8_t length)
|
||||
{
|
||||
if (length < 5)
|
||||
return;
|
||||
|
||||
uint8_t flags = *data; data++;
|
||||
uint16_t value1 = *(reinterpret_cast<uint16_t*>(data)); data += 2;
|
||||
uint16_t value2 = *(reinterpret_cast<uint16_t*>(data)); data += 2;
|
||||
|
||||
pwmDriver.setPin(0, value1);
|
||||
pwmDriver.setPin(1, value2);
|
||||
|
||||
if ((flags & SetPWMFlagModuleLEDs) == SetPWMFlagModuleLEDs)
|
||||
{
|
||||
pwmDriver.setPin(2, value1);
|
||||
pwmDriver.setPin(3, value2);
|
||||
}
|
||||
else
|
||||
{
|
||||
pwmDriver.setPin(2, 0);
|
||||
pwmDriver.setPin(3, 0);
|
||||
}
|
||||
|
||||
const uint8_t msg[] = { ResponseSetPWM, settings.getModuleIndex() };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
void handleGetSensors(uint8_t* data, uint8_t length)
|
||||
{
|
||||
uint16_t value1 = analogRead(PinSensor1);
|
||||
uint16_t value2 = analogRead(PinSensor2);
|
||||
|
||||
const uint8_t msg[] = { ResponseGetSensors, settings.getModuleIndex(), lowByte(value1), highByte(value1), lowByte(value2), highByte(value2) };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
}
|
||||
|
||||
|
||||
uint32_t lastButtonPress = 0;
|
||||
|
||||
void checkButtonPress()
|
||||
{
|
||||
if ((state == State::Linking || state == State::LinkingRequest) &&
|
||||
digitalRead(PinButton) == HIGH &&
|
||||
currentTime - lastButtonPress >= ButtonDebounceTime)
|
||||
{
|
||||
state = State::LinkingRequest;
|
||||
|
||||
const uint8_t msg[] = { CommandRequestLink };
|
||||
sendCommMessage(msg, sizeof(msg));
|
||||
|
||||
lastButtonPress = currentTime;
|
||||
}
|
||||
}
|
155
module/src/protocol.h
Normal file
155
module/src/protocol.h
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __protocol
|
||||
#define __protocol
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/*
|
||||
* There are three classes of messages, these masks provide a way to identify
|
||||
* unknown messages if the protocol ever changes.
|
||||
*
|
||||
* MaskBroadcastCommand: commands which do not expect a response
|
||||
* MaskModuleCommand: commands which do expect a command. respond with ResponseUhmWhat to satisfy the response requirement.
|
||||
* MaskResponse: responses to commands
|
||||
*/
|
||||
const uint8_t MaskMessageType = 0b11000000;
|
||||
|
||||
const uint8_t MaskBroadcastCommand = 0b10000000;
|
||||
const uint8_t MaskModuleCommand = 0b11000000;
|
||||
const uint8_t MaskResponse = 0b01000000;
|
||||
|
||||
const uint8_t ResponseUhmWhat = 0x00 | MaskResponse;
|
||||
|
||||
|
||||
/*
|
||||
* Ping:
|
||||
* Aimed at a specific module, which must respond with a
|
||||
* ResponsePing message.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandPing
|
||||
* [1] Module index
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponsePing
|
||||
* [1] Module index
|
||||
*/
|
||||
const uint8_t BasePing = 0x01;
|
||||
const uint8_t CommandPing = BasePing | MaskModuleCommand;
|
||||
const uint8_t ResponsePing = BasePing | MaskResponse;
|
||||
|
||||
|
||||
/*
|
||||
* Display module index:
|
||||
* Broadcast to all modules which should turn on their display
|
||||
* and show the current settings. No response is expected.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandDisplayModuleIndex
|
||||
*/
|
||||
const uint8_t CommandDisplayModuleIndex = 0x02 | MaskBroadcastCommand;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Start linking:
|
||||
* Broadcast to all modules which should change to link mode.
|
||||
* During link mode the master will disable all other communication,
|
||||
* allowing the module to respond at will in response to user input.
|
||||
*
|
||||
* Each module should send a CommandRequestLink message when user input
|
||||
* is provided.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandStartLink
|
||||
*
|
||||
* Response (eventually):
|
||||
* See CommandRequestLink
|
||||
*/
|
||||
const uint8_t CommandStartLink = 0x10 | MaskBroadcastCommand;
|
||||
|
||||
|
||||
/*
|
||||
* Request link:
|
||||
* Sent by a module when user input is provided to link this module
|
||||
* as the next in line. All other modules should disable sending this
|
||||
* message until the currently requesting module receives a response.
|
||||
*
|
||||
* The master must respond with the new module index, which the
|
||||
* module must apply and store immediately.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandRequestLink
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponseRequestLink
|
||||
* [1] New module index
|
||||
*/
|
||||
const uint8_t BaseRequestLink = 0x11;
|
||||
const uint8_t CommandRequestLink = BaseRequestLink | MaskBroadcastCommand;
|
||||
const uint8_t ResponseRequestLink = BaseRequestLink | MaskResponse;
|
||||
|
||||
|
||||
/*
|
||||
* Stop linking:
|
||||
* Broadcast to all modules when the master takes back control
|
||||
* over the communication line. No response is expected.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandStopLink
|
||||
*/
|
||||
const uint8_t CommandStopLink = 0x12 | MaskBroadcastCommand;
|
||||
|
||||
|
||||
/*
|
||||
* Set PWM value:
|
||||
* Aimed at a specific module, which must apply the specified
|
||||
* PWM values to the LED strips and respond with a
|
||||
* ResponseSetPWM message.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandSetPWM
|
||||
* [1] Module index
|
||||
* [2] Flags, see below
|
||||
* [3,4] PWM value for step 1 (0-4095, uint16_t)
|
||||
* [5,6] PWM value for step 2 (0-4095, uint16_t)
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponseSetPWM
|
||||
* [1] Module index
|
||||
*/
|
||||
const uint8_t BaseSetPWM = 0x20;
|
||||
const uint8_t CommandSetPWM = BaseSetPWM | MaskModuleCommand;
|
||||
const uint8_t ResponseSetPWM = BaseSetPWM | MaskResponse;
|
||||
|
||||
// If included, the on-board verification LEDs should light up with
|
||||
// the specified PWM values as well. Otherwise they should be off.
|
||||
const uint8_t SetPWMFlagModuleLEDs = 0x01;
|
||||
|
||||
|
||||
/*
|
||||
* Get sensor values:
|
||||
* Aimed at a specific module, which must response with a
|
||||
* ResponseGetSensors message containing the current sensor states.
|
||||
*
|
||||
* Request:
|
||||
* [0] CommandGetSensors
|
||||
* [1] Module index
|
||||
*
|
||||
* Response:
|
||||
* [0] ResponseGetSensors
|
||||
* [1] Module index
|
||||
* [2,3] Analog (0-1023) or digital (0, 1023) value for sensor 1 (uint16_t)
|
||||
* [4,5] Analog (0-1024) or digital (0, 1023) value for sensor 2 (uint16_t)
|
||||
*/
|
||||
const uint8_t BaseGetSensors = 0x30;
|
||||
const uint8_t CommandGetSensors = BaseGetSensors | MaskModuleCommand;
|
||||
const uint8_t ResponseGetSensors = BaseGetSensors | MaskResponse;
|
||||
|
||||
#endif
|
58
module/src/settings.cpp
Normal file
58
module/src/settings.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#include "settings.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
|
||||
// First byte is 0xAA to recognize uninitialised EEPROM
|
||||
const uint8_t EEPROMHeader = 0xAA;
|
||||
const uint8_t EEPROMCurrentVersion = 1;
|
||||
|
||||
const uint8_t EEPROMAddressHeader = 0;
|
||||
const uint8_t EEPROMAddressVersion = 1;
|
||||
const uint8_t EEPROMAddressModuleIndex = 2;
|
||||
|
||||
|
||||
void Settings::init()
|
||||
{
|
||||
if (EEPROM.read(EEPROMAddressHeader) != EEPROMHeader)
|
||||
{
|
||||
EEPROM.put(EEPROMAddressHeader, EEPROMHeader);
|
||||
EEPROM.put(EEPROMAddressVersion, EEPROMCurrentVersion);
|
||||
EEPROM.put(EEPROMAddressModuleIndex, mModuleIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t version = EEPROM.read(EEPROMAddressVersion);
|
||||
if (version >= 1)
|
||||
{
|
||||
mModuleIndex = EEPROM.read(EEPROMAddressModuleIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Settings::hasModuleIndex()
|
||||
{
|
||||
return mModuleIndex != ModuleIndexUndefined;
|
||||
}
|
||||
|
||||
|
||||
uint8_t Settings::getModuleIndex(void)
|
||||
{
|
||||
return mModuleIndex;
|
||||
}
|
||||
|
||||
|
||||
void Settings::setModuleIndex(uint8_t index)
|
||||
{
|
||||
if (index == mModuleIndex)
|
||||
return;
|
||||
|
||||
mModuleIndex = index;
|
||||
EEPROM.put(EEPROMAddressModuleIndex, mModuleIndex);
|
||||
}
|
29
module/src/settings.h
Normal file
29
module/src/settings.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __settings
|
||||
#define __settings
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
const uint8_t ModuleIndexUndefined = 0xff;
|
||||
|
||||
|
||||
class Settings
|
||||
{
|
||||
private:
|
||||
uint8_t mModuleIndex = ModuleIndexUndefined;
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
||||
bool hasModuleIndex();
|
||||
uint8_t getModuleIndex();
|
||||
void setModuleIndex(uint8_t index);
|
||||
};
|
||||
|
||||
#endif
|
20
module/src/state.h
Normal file
20
module/src/state.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Stairs lighting
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* https://git.x2software.net/pub/Stairs
|
||||
*/
|
||||
#ifndef __state
|
||||
#define __state
|
||||
|
||||
enum struct State: uint8_t
|
||||
{
|
||||
WaitingForComm,
|
||||
Linking,
|
||||
LinkingRequest,
|
||||
LinkingSet,
|
||||
DisplayModuleIndex,
|
||||
DisplayOff
|
||||
};
|
||||
|
||||
#endif
|
1
module/upload.bat
Normal file
1
module/upload.bat
Normal file
@ -0,0 +1 @@
|
||||
@pio run -t program
|
@ -2,12 +2,12 @@
|
||||
#define __assets_version
|
||||
|
||||
const uint8_t VersionMajor = 2;
|
||||
const uint8_t VersionMinor = 1;
|
||||
const uint8_t VersionMinor = 2;
|
||||
const uint8_t VersionPatch = 0;
|
||||
const uint8_t VersionMetadata = 0;
|
||||
const char VersionBranch[] = "master";
|
||||
const char VersionSemVer[] = "2.1.0";
|
||||
const char VersionFullSemVer[] = "2.1.0";
|
||||
const char VersionBranch[] = "develop";
|
||||
const char VersionSemVer[] = "2.2.0-unstable.1";
|
||||
const char VersionFullSemVer[] = "2.2.0-unstable.1";
|
||||
const char VersionCommitDate[] = "2018-04-29";
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user