Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea2f90fad1 | ||
|
|
cd0cec1a2d | ||
|
|
2e458079f4 | ||
|
|
947d212be5 | ||
|
|
920be74a58 | ||
|
|
0cd683c50b | ||
|
|
d1665f8708 | ||
|
|
ae8c8e330a | ||
|
|
d9b479b6f3 | ||
|
|
898b5aa298 | ||
|
|
96c655ca70 | ||
|
|
43da92f0ba | ||
|
|
4f4967aa3f | ||
|
|
e0a06c5c06 | ||
|
|
415762ed35 | ||
|
|
06c5bb588f | ||
|
|
26ef67b84b | ||
|
|
f1d55e4d25 | ||
|
|
cd0ce4f146 | ||
|
|
7317398606 | ||
|
|
47b4963872 | ||
|
|
7aa4d1fac4 | ||
|
|
38e3a51845 | ||
|
|
ddfd08dbe6 | ||
|
|
f1763bff6f | ||
|
|
468da24907 | ||
|
|
772aded4b6 | ||
|
|
c0dc9e015e | ||
|
|
fa0b7e49c4 | ||
|
|
b7c37ad74b | ||
|
|
93006b2b58 | ||
|
|
2433a6c53c | ||
|
|
88632c6b1d | ||
|
|
1168d1faaa | ||
|
|
1a8be495c3 |
No files matched your search
@@ -1,10 +0,0 @@
|
||||
.idea
|
||||
.vscode
|
||||
build
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
KiCad/RP2040-Decoder-Rev_0_2-backups
|
||||
KiCad/*.bak
|
||||
KiCad/fp-info-cache
|
||||
KiCad/_autosave-*
|
||||
KiCad/*.kicad_prl
|
||||
@@ -1,53 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
# Pull in SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(RP2040-Decoder C CXX ASM)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(PICO_DECODER_PATH ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# Initialize the SDK
|
||||
pico_sdk_init()
|
||||
|
||||
add_compile_options(-Wall
|
||||
-Wno-format # int != int32 _t as far as the compiler is concerned because gcc has int32_t as long int
|
||||
-Wno-unused-function # we have some for the docs that aren't called
|
||||
-Wno-maybe-uninitialized
|
||||
)
|
||||
|
||||
add_executable(
|
||||
RP2040-Decoder
|
||||
core0.c
|
||||
core0.h
|
||||
core1.c
|
||||
core1.h
|
||||
shared.c
|
||||
shared.h)
|
||||
|
||||
# Multiplier to lengthen XOSC startup delay to accommodate slow-starting oscillator
|
||||
target_compile_definitions(
|
||||
RP2040-Decoder PUBLIC
|
||||
PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64
|
||||
)
|
||||
|
||||
# Add pico_multicore which is required for multicore functionality
|
||||
target_link_libraries(
|
||||
RP2040-Decoder
|
||||
pico_stdlib
|
||||
hardware_pwm
|
||||
hardware_adc
|
||||
hardware_flash
|
||||
pico_multicore
|
||||
)
|
||||
|
||||
# disable usb stack
|
||||
pico_enable_stdio_usb(RP2040-Decoder 0)
|
||||
|
||||
# disable uart output (to enable put a 1 instead of the 0)
|
||||
pico_enable_stdio_uart(RP2040-Decoder 0)
|
||||
|
||||
# create map/bin/hex file etc.
|
||||
#pico_add_extra_outputs(RP2040-Decoder)
|
||||
@@ -1,616 +0,0 @@
|
||||
#pragma once
|
||||
#define CV_ARRAY_SIZE 512
|
||||
// All CVs are 8-bit numbers ranging from (0 - 255)dec ≙ (0b00000000 - 0b11111111)bin ≙ (0x00 - 0xFF)hex
|
||||
// Note : CV_1 ≙ index 0, CV_2 ≙ index 1, CV_3 ≙ index 2, ...
|
||||
|
||||
uint8_t CV_ARRAY_DEFAULT [CV_ARRAY_SIZE] = {
|
||||
0b00000011, //CV_1 - Basic address - CV_1 = 0 and CV_1 > 127 are not valid - Default = 3
|
||||
0b00001000, //CV_2 - V_min - Default = 8
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 0 == Fastest dec/acc rate; 255 == slowest;
|
||||
0b00000000, //CV_3 - Acceleration rate - CV_3*CV_175 = Time for one discrete speed step change in ms
|
||||
0b00000000, //CV_4 - Deceleration rate - CV_4*CV_175 = Time for one discrete speed step change in ms
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
0b01100100, //CV_5 - V_max - Default = 100*16
|
||||
0b00111111, //CV_6 - V_mid - Default = 63*16
|
||||
0b00000001, //CV_7 - Version no. (read-only)
|
||||
0b00001101, //CV_8 - Manufacturer (13 = Public Domain & Do-It-Yourself Decoders) (read-only)
|
||||
0b10010110, //CV_9 - PWM frequency in Hz = CV_9*100+10000 - Default = (150*100+10000)Hz = 25kHz
|
||||
0b00000001, //CV_10 -
|
||||
0b11111111, //CV_11 - Packet timeout in seconds
|
||||
0b00000100, //CV_12 - Permitted operating modes
|
||||
0b00000000, //CV_13 -
|
||||
0b00000000, //CV_14 -
|
||||
0b00000000, //CV_15 -
|
||||
0b00000000, //CV_16 -
|
||||
0b11000011, //CV_17 - Extended/Long 14-Bit address (Bits 8 to 13)
|
||||
0b11101000, //CV_18 - Extended/Long 14-Bit address (Bits 0 to 7)
|
||||
0b00000000, //CV_19 -
|
||||
0b00000000, //CV_20 -
|
||||
0b00000000, //CV_21 -
|
||||
0b00000000, //CV_22 -
|
||||
0b00000000, //CV_23 -
|
||||
0b00000000, //CV_24 -
|
||||
0b00000000, //CV_25 -
|
||||
0b00000000, //CV_26 -
|
||||
0b00000000, //CV_27 -
|
||||
0b00000000, //CV_28 -
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Bit_1, Bit_2, Bit_3, Bit_4, Bit_6 are currently not in use and therefore irrelevant.
|
||||
//Bit_0 is used to reverse direction i.e. 0 = normal; 1 = reverse
|
||||
//Bit_5 switches between basic and extended address i.e. 0 = basic address 1 = extended address
|
||||
0b00000000, //CV_29 - Decoder Configuration
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
0b00000000, //CV_30 -
|
||||
0b00010000, //CV_31 - Extended CV pointer Bits 8-15
|
||||
0b00000000, //CV_32 - Extended CV pointer Bits 0-7
|
||||
0b00000000, //CV_33 -
|
||||
0b00000000, //CV_34 -
|
||||
0b00000000, //CV_35 -
|
||||
0b00000000, //CV_36 -
|
||||
0b00000000, //CV_37 -
|
||||
0b00000000, //CV_38 -
|
||||
0b00000000, //CV_39 -
|
||||
0b00000000, //CV_40 -
|
||||
0b00000000, //CV_41 -
|
||||
0b00000000, //CV_42 -
|
||||
0b00000000, //CV_43 -
|
||||
0b00000000, //CV_44 -
|
||||
0b00000000, //CV_45 -
|
||||
0b00000000, //CV_46 -
|
||||
// Speed controller - Configuration ////////////////////////////////////////////////////////////////////////////////
|
||||
0b00110010, //CV_47 - Feed-forward gain k_ff ≙ CV_47/10000 Default = 50 -> 0.005 //
|
||||
0b00001010, //CV_48 - PID Control low pass filter time constant (tau) in ms //
|
||||
0b00000101, //CV_49 - PID Control sampling time t in ms //
|
||||
0b00011001, //CV_50 - PID Control I_Factor ≙ CV_50/10 Default = 25 -> 2.5 //
|
||||
0b00110010, //CV_51 - PID Control D_Factor ≙ CV_51/10000 Default = 50 -> 0.005 //
|
||||
0b01100100, //CV_52 - PID Integral Limit positive ≙ CV_52*10 Default = 100 -> +1000 //
|
||||
0b01100100, //CV_53 - PID Integral Limit negative ≙ CV_53*(-10) Default = 100 -> -1000 //
|
||||
0b00000111, //CV_54 - k_p @ x0 - High Byte (Bits 8-15) divided by 100 //
|
||||
0b11010000, //CV_55 - k_p @ x0 - Low Byte (Bits 0-7) Default = 2000 -> 20 //
|
||||
0b00000000, //CV_56 - k_p @ x1 - High Byte (Bits 8-15) divided by 100 //
|
||||
0b11111010, //CV_57 - k_p @ x1 - Low Byte (Bits 0-7) Default = 250 -> 2.5 //
|
||||
0b00000000, //CV_58 - k_p @ x2 - High Byte (Bits 8-15) divided by 100 //
|
||||
0b10010110, //CV_59 - k_p @ x2 - Low Byte (Bits 0-7) Default = 150 -> 1.5 //
|
||||
0b00001101, //CV_60 - x_1 shift in % ≙ CV_60/255 //
|
||||
// V_EMF Measurement Configuration //////////////////////////////////////////////////////////////////////////////////
|
||||
0b01100100, //CV_61 - V_EMF Total amount of Measurement Iterations - Default = 100 iterations //
|
||||
0b01100100, //CV_62 - V_EMF Delay before Measuring - Default = 100us //
|
||||
// CV_63 and CV_64 are used to determine how many elements of the sorted measurement array will be discarded //
|
||||
// For Example: CV_63 = x and CV_64 = y //
|
||||
// -> The x smallest values will be discarded. //
|
||||
// -> The y largest values will be discarded. //
|
||||
0b00001111, //CV_63 - l_side_arr_cutoff - Default = 15 //
|
||||
0b00001111, //CV_64 - r_side_arr_cutoff - Default = 15 //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
0b00000000, //CV_65 - Values > 0 indicate that flash is still in factory condition
|
||||
0b00000000, //CV_66 -
|
||||
0b00000000, //CV_67 -
|
||||
0b00000000, //CV_68 -
|
||||
0b00000000, //CV_69 -
|
||||
0b00000000, //CV_70 -
|
||||
0b00000000, //CV_71 -
|
||||
0b00000000, //CV_72 -
|
||||
0b00000000, //CV_73 -
|
||||
0b00000000, //CV_74 -
|
||||
0b00000000, //CV_75 -
|
||||
0b00000000, //CV_76 -
|
||||
0b00000000, //CV_77 -
|
||||
0b00000000, //CV_78 -
|
||||
0b00000000, //CV_79 -
|
||||
0b00000000, //CV_80 -
|
||||
0b00000000, //CV_81 -
|
||||
0b00000000, //CV_82 -
|
||||
0b00000000, //CV_83 -
|
||||
0b00000000, //CV_84 -
|
||||
0b00000000, //CV_85 -
|
||||
0b00000000, //CV_86 -
|
||||
0b00000000, //CV_87 -
|
||||
0b00000000, //CV_88 -
|
||||
0b00000000, //CV_89 -
|
||||
0b00000000, //CV_90 -
|
||||
0b00000000, //CV_91 -
|
||||
0b00000000, //CV_92 -
|
||||
0b00000000, //CV_93 -
|
||||
0b00000000, //CV_94 -
|
||||
0b00000000, //CV_95 -
|
||||
0b00000000, //CV_96 -
|
||||
0b00000000, //CV_97 -
|
||||
0b00000000, //CV_98 -
|
||||
0b00000000, //CV_99 -
|
||||
0b00000000, //CV_100 -
|
||||
0b00000000, //CV_101 -
|
||||
0b00000000, //CV_102 -
|
||||
0b00000000, //CV_103 -
|
||||
0b00000000, //CV_104 -
|
||||
0b00000000, //CV_105 -
|
||||
0b00000000, //CV_106 -
|
||||
0b00000000, //CV_107 -
|
||||
0b00000000, //CV_108 -
|
||||
0b00000000, //CV_109 -
|
||||
0b00000000, //CV_110 -
|
||||
0b00000000, //CV_111 -
|
||||
///// PWM - Configuration //////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This Config can cause conflicts when GPIOs controlled by the same slice are enabled at the same time.
|
||||
0b00000000, //CV_112 - GPIO 24-31 enable PWM
|
||||
0b00000000, //CV_113 - GPIO 16-23 enable PWM
|
||||
0b00000000, //CV_114 - GPIO 8-15 enable PWM
|
||||
0b00000000, //CV_115 - GPIO 0-7 enable PWM
|
||||
//Slice 0
|
||||
0b00000000, //CV_116 - Wrap Bits 8-15
|
||||
0b00000000, //CV_117 - Wrap Bits 0-7
|
||||
0b00000000, //CV_118 - Clock Divider
|
||||
0b00000000, //CV_119 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_120 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_121 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_122 - Channel B Level Bits 0-7
|
||||
//Slice 1
|
||||
0b00000000, //CV_123 - Wrap Bits 8-15
|
||||
0b00000000, //CV_124 - Wrap Bits 0-7
|
||||
0b00000000, //CV_125 - Clock Divider
|
||||
0b00000000, //CV_126 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_127 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_128 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_129 - Channel B Level Bits 0-7
|
||||
//Slice 2
|
||||
0b00000000, //CV_130 - Wrap Bits 8-15
|
||||
0b00000000, //CV_131 - Wrap Bits 0-7
|
||||
0b00000000, //CV_132 - Clock Divider
|
||||
0b00000000, //CV_133 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_134 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_135 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_136 - Channel B Level Bits 0-7
|
||||
//Slice 3
|
||||
0b00000000, //CV_137 - Wrap Bits 8-15
|
||||
0b00000000, //CV_138 - Wrap Bits 0-7
|
||||
0b00000000, //CV_139 - Clock Divider
|
||||
0b00000000, //CV_140 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_141 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_142 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_143 - Channel B Level Bits 0-7
|
||||
//Slice 4
|
||||
0b00000000, //CV_144 - Wrap Bits 8-15
|
||||
0b00000000, //CV_145 - Wrap Bits 0-7
|
||||
0b00000000, //CV_146 - Clock Divider
|
||||
0b00000000, //CV_147 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_148 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_149 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_150 - Channel B Level Bits 0-7
|
||||
//Slice 5
|
||||
0b00000000, //CV_151 - Wrap Bits 8-15
|
||||
0b00000000, //CV_152 - Wrap Bits 0-7
|
||||
0b00000000, //CV_153 - Clock Divider
|
||||
0b00000000, //CV_154 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_155 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_156 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_157 - Channel B Level Bits 0-7
|
||||
//Slice 6
|
||||
0b00000000, //CV_158 - Wrap Bits 8-15
|
||||
0b00000000, //CV_159 - Wrap Bits 0-7
|
||||
0b00000000, //CV_160 - Clock Divider
|
||||
0b00000000, //CV_161 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_162 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_163 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_164 - Channel B Level Bits 0-7
|
||||
//Slice 7
|
||||
0b00000000, //CV_165 - Wrap Bits 8-15
|
||||
0b00000000, //CV_166 - Wrap Bits 0-7
|
||||
0b00000000, //CV_167 - Clock Divider
|
||||
0b00000000, //CV_168 - Channel A Level Bits 8-15
|
||||
0b00000000, //CV_169 - Channel A Level Bits 0-7
|
||||
0b00000000, //CV_170 - Channel B Level Bits 8-15
|
||||
0b00000000, //CV_171 - Channel B Level Bits 0-7
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Offset adjustment for ADC //
|
||||
//If CV_172 = 0xFF = 255 there will be a measurement procedure on startup //
|
||||
0b11111111, //CV_172 - ADC offset Default: 255 (triggers new measurement!) //
|
||||
0b01111111, //CV_173 - ADC offset measurement cycles Default: 127 //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
0b00000001, //CV_174 - Additional motor-PWM clock divider.
|
||||
0b00000111, //CV_175 - speed_helper timer delay - can be used to adjust accel/decel rate
|
||||
0b00000000, //CV_176 - Base-PWM forward bits 8-15
|
||||
0b00000000, //CV_177 - Base-PWM forward bits 0-7
|
||||
0b00000000, //CV_178 - Base-PWM reverse bits 15-8
|
||||
0b00000000, //CV_179 - Base-PWM reverse bits 0-7
|
||||
0b00000000, //CV_180 -
|
||||
0b00000000, //CV_181 -
|
||||
0b00000000, //CV_182 -
|
||||
0b00000000, //CV_183 -
|
||||
0b00000000, //CV_184 -
|
||||
0b00000000, //CV_185 -
|
||||
0b00000000, //CV_186 -
|
||||
0b00000000, //CV_187 -
|
||||
0b00000000, //CV_188 -
|
||||
0b00000000, //CV_189 -
|
||||
0b00000000, //CV_190 -
|
||||
0b00000000, //CV_191 -
|
||||
0b00000000, //CV_192 -
|
||||
0b00000000, //CV_193 -
|
||||
0b00000000, //CV_194 -
|
||||
0b00000000, //CV_195 -
|
||||
0b00000000, //CV_196 -
|
||||
0b00000000, //CV_197 -
|
||||
0b00000000, //CV_198 -
|
||||
0b00000000, //CV_199 -
|
||||
0b00000000, //CV_200 -
|
||||
0b00000000, //CV_201 -
|
||||
0b00000000, //CV_202 -
|
||||
0b00000000, //CV_203 -
|
||||
0b00000000, //CV_204 -
|
||||
0b00000000, //CV_205 -
|
||||
0b00000000, //CV_206 -
|
||||
0b00000000, //CV_207 -
|
||||
0b00000000, //CV_208 -
|
||||
0b00000000, //CV_209 -
|
||||
0b00000000, //CV_210 -
|
||||
0b00000000, //CV_211 -
|
||||
0b00000000, //CV_212 -
|
||||
0b00000000, //CV_213 -
|
||||
0b00000000, //CV_214 -
|
||||
0b00000000, //CV_215 -
|
||||
0b00000000, //CV_216 -
|
||||
0b00000000, //CV_217 -
|
||||
0b00000000, //CV_218 -
|
||||
0b00000000, //CV_219 -
|
||||
0b00000000, //CV_220 -
|
||||
0b00000000, //CV_221 -
|
||||
0b00000000, //CV_222 -
|
||||
0b00000000, //CV_223 -
|
||||
0b00000000, //CV_224 -
|
||||
0b00000000, //CV_225 -
|
||||
0b00000000, //CV_226 -
|
||||
0b00000000, //CV_227 -
|
||||
0b00000000, //CV_228 -
|
||||
0b00000000, //CV_229 -
|
||||
0b00000000, //CV_230 -
|
||||
0b00000000, //CV_231 -
|
||||
0b00000000, //CV_232 -
|
||||
0b00000000, //CV_233 -
|
||||
0b00000000, //CV_234 -
|
||||
0b00000000, //CV_235 -
|
||||
0b00000000, //CV_236 -
|
||||
0b00000000, //CV_237 -
|
||||
0b00000000, //CV_238 -
|
||||
0b00000000, //CV_239 -
|
||||
0b00000000, //CV_240 -
|
||||
0b00000000, //CV_241 -
|
||||
0b00000000, //CV_242 -
|
||||
0b00000000, //CV_243 -
|
||||
0b00000000, //CV_244 -
|
||||
0b00000000, //CV_245 -
|
||||
0b00000000, //CV_246 -
|
||||
0b00000000, //CV_247 -
|
||||
0b00000000, //CV_248 -
|
||||
0b00000000, //CV_249 -
|
||||
0b00000000, //CV_250 -
|
||||
0b00000000, //CV_251 -
|
||||
0b00000000, //CV_252 -
|
||||
0b00000000, //CV_253 -
|
||||
0b00000000, //CV_254 -
|
||||
0b00000000, //CV_255 -
|
||||
0b00000000, //CV_256 -
|
||||
//FUNCTION MAPPING CVS:
|
||||
// 31 30 29 28 - 27 26 25 24 -- 23 22 21 20 - 19 18 17 16 -- 15 14 13 12 - 11 10 9 8 -- 7 6 5 4 - 3 2 1 0 <- GPIO
|
||||
// byte_3 -- byte_2 -- byte_1 -- byte_0
|
||||
// X X X X - X X X X -- X X X X - X X X X -- X X X X - X X X X -- X X X X - X X X X
|
||||
//F0 forward
|
||||
0b00000000, //CV_257 - byte 3
|
||||
0b00000000, //CV_258 - byte 2
|
||||
0b00000000, //CV_259 - byte 1
|
||||
0b00000000, //CV_260 - byte 0
|
||||
//F0 reverse
|
||||
0b00000000, //CV_261 - byte 3
|
||||
0b00000000, //CV_262 - byte 2
|
||||
0b00000000, //CV_263 - byte 1
|
||||
0b00000000, //CV_264 - byte 0
|
||||
//F1 forward
|
||||
0b00000000, //CV_265 - byte 3
|
||||
0b00000000, //CV_266 - byte 2
|
||||
0b00000000, //CV_267 - byte 1
|
||||
0b00000000, //CV_268 - byte 0
|
||||
//F1 reverse
|
||||
0b00000000, //CV_269 - byte 3
|
||||
0b00000000, //CV_270 - byte 2
|
||||
0b00000000, //CV_271 - byte 1
|
||||
0b00000000, //CV_272 - byte 0
|
||||
//F2 forward
|
||||
0b00000000, //CV_273 - byte 3
|
||||
0b00000000, //CV_274 - byte 2
|
||||
0b00000000, //CV_275 - byte 1
|
||||
0b00000000, //CV_276 - byte 0
|
||||
//F2 reverse
|
||||
0b00000000, //CV_277 - byte 3
|
||||
0b00000000, //CV_278 - byte 2
|
||||
0b00000000, //CV_279 - byte 1
|
||||
0b00000000, //CV_280 - byte 0
|
||||
//F3 forward
|
||||
0b00000000, //CV_281 - byte 3
|
||||
0b00000000, //CV_282 - byte 2
|
||||
0b00000000, //CV_283 - byte 1
|
||||
0b00000000, //CV_284 - byte 0
|
||||
//F3 reverse
|
||||
0b00000000, //CV_285 - byte 3
|
||||
0b00000000, //CV_286 - byte 2
|
||||
0b00000000, //CV_287 - byte 1
|
||||
0b00000000, //CV_288 - byte 0
|
||||
//F4 forward
|
||||
0b00000000, //CV_289 - byte 3
|
||||
0b00000000, //CV_290 - byte 2
|
||||
0b00000000, //CV_291 - byte 1
|
||||
0b00000000, //CV_292 - byte 0
|
||||
//F4 reverse
|
||||
0b00000000, //CV_293 - byte 3
|
||||
0b00000000, //CV_294 - byte 2
|
||||
0b00000000, //CV_295 - byte 1
|
||||
0b00000000, //CV_296 - byte 0
|
||||
//F5 forward
|
||||
0b00000000, //CV_297 - byte 3
|
||||
0b00000000, //CV_298 - byte 2
|
||||
0b00000000, //CV_299 - byte 1
|
||||
0b00000000, //CV_300 - byte 0
|
||||
//F5 reverse
|
||||
0b00000000, //CV_301 - byte 3
|
||||
0b00000000, //CV_302 - byte 2
|
||||
0b00000000, //CV_303 - byte 1
|
||||
0b00000000, //CV_304 - byte 0
|
||||
//F6 forward
|
||||
0b00000000, //CV_305 - byte 3
|
||||
0b00000000, //CV_306 - byte 2
|
||||
0b00000000, //CV_307 - byte 1
|
||||
0b00000000, //CV_308 - byte 0
|
||||
//F6 reverse
|
||||
0b00000000, //CV_309 - byte 3
|
||||
0b00000000, //CV_310 - byte 2
|
||||
0b00000000, //CV_311 - byte 1
|
||||
0b00000000, //CV_312 - byte 0
|
||||
//F7 forward
|
||||
0b00000000, //CV_313 - byte 3
|
||||
0b00000000, //CV_314 - byte 2
|
||||
0b00000000, //CV_315 - byte 1
|
||||
0b00000000, //CV_316 - byte 0
|
||||
//F7 reverse
|
||||
0b00000000, //CV_317 - byte 3
|
||||
0b00000000, //CV_318 - byte 2
|
||||
0b00000000, //CV_319 - byte 1
|
||||
0b00000000, //CV_320 - byte 0
|
||||
//F8 forward
|
||||
0b00000000, //CV_321 - byte 3
|
||||
0b00000000, //CV_322 - byte 2
|
||||
0b00000000, //CV_323 - byte 1
|
||||
0b00000000, //CV_324 - byte 0
|
||||
//F8 reverse
|
||||
0b00000000, //CV_325 - byte 3
|
||||
0b00000000, //CV_326 - byte 2
|
||||
0b00000000, //CV_327 - byte 1
|
||||
0b00000000, //CV_328 - byte 0
|
||||
//F9 forward
|
||||
0b00000000, //CV_329 - byte 3
|
||||
0b00000000, //CV_330 - byte 2
|
||||
0b00000000, //CV_331 - byte 1
|
||||
0b00000000, //CV_332 - byte 0
|
||||
//F9 reverse
|
||||
0b00000000, //CV_333 - byte 3
|
||||
0b00000000, //CV_334 - byte 2
|
||||
0b00000000, //CV_335 - byte 1
|
||||
0b00000000, //CV_336 - byte 0
|
||||
//F10 forward
|
||||
0b00000000, //CV_337 - byte 3
|
||||
0b00000000, //CV_338 - byte 2
|
||||
0b00000000, //CV_339 - byte 1
|
||||
0b00000000, //CV_340 - byte 0
|
||||
//F10 reverse
|
||||
0b00000000, //CV_341 - byte 3
|
||||
0b00000000, //CV_342 - byte 2
|
||||
0b00000000, //CV_343 - byte 1
|
||||
0b00000000, //CV_344 - byte 0
|
||||
//F11 forward
|
||||
0b00000000, //CV_345 - byte 3
|
||||
0b00000000, //CV_346 - byte 2
|
||||
0b00000000, //CV_347 - byte 1
|
||||
0b00000000, //CV_348 - byte 0
|
||||
//F11 reverse
|
||||
0b00000000, //CV_349 - byte 3
|
||||
0b00000000, //CV_350 - byte 2
|
||||
0b00000000, //CV_351 - byte 1
|
||||
0b00000000, //CV_352 - byte 0
|
||||
//F12 forward
|
||||
0b00000000, //CV_353 - byte 3
|
||||
0b00000000, //CV_354 - byte 2
|
||||
0b00000000, //CV_355 - byte 1
|
||||
0b00000000, //CV_356 - byte 0
|
||||
//F12 reverse
|
||||
0b00000000, //CV_357 - byte 3
|
||||
0b00000000, //CV_358 - byte 2
|
||||
0b00000000, //CV_359 - byte 1
|
||||
0b00000000, //CV_360 - byte 0
|
||||
//F13 forward
|
||||
0b00000000, //CV_361 - byte 3
|
||||
0b00000000, //CV_362 - byte 2
|
||||
0b00000000, //CV_363 - byte 1
|
||||
0b00000000, //CV_364 - byte 0
|
||||
//F13 reverse
|
||||
0b00000000, //CV_365 - byte 3
|
||||
0b00000000, //CV_366 - byte 2
|
||||
0b00000000, //CV_367 - byte 1
|
||||
0b00000000, //CV_368 - byte 0
|
||||
//F14 forward
|
||||
0b00000000, //CV_369 - byte 3
|
||||
0b00000000, //CV_370 - byte 2
|
||||
0b00000000, //CV_371 - byte 1
|
||||
0b00000000, //CV_372 - byte 0
|
||||
//F14 reverse
|
||||
0b00000000, //CV_373 - byte 3
|
||||
0b00000000, //CV_374 - byte 2
|
||||
0b00000000, //CV_375 - byte 1
|
||||
0b00000000, //CV_376 - byte 0
|
||||
//F15 forward
|
||||
0b00000000, //CV_377 - byte 3
|
||||
0b00000000, //CV_378 - byte 2
|
||||
0b00000000, //CV_379 - byte 1
|
||||
0b00000000, //CV_380 - byte 0
|
||||
//F15 reverse
|
||||
0b00000000, //CV_381 - byte 3
|
||||
0b00000000, //CV_382 - byte 2
|
||||
0b00000000, //CV_383 - byte 1
|
||||
0b00000000, //CV_384 - byte 0
|
||||
//F16 forward
|
||||
0b00000000, //CV_385 - byte 3
|
||||
0b00000000, //CV_386 - byte 2
|
||||
0b00000000, //CV_387 - byte 1
|
||||
0b00000000, //CV_388 - byte 0
|
||||
//F16 reverse
|
||||
0b00000000, //CV_389 - byte 3
|
||||
0b00000000, //CV_390 - byte 2
|
||||
0b00000000, //CV_391 - byte 1
|
||||
0b00000000, //CV_392 - byte 0
|
||||
//F17 forward
|
||||
0b00000000, //CV_393 - byte 3
|
||||
0b00000000, //CV_394 - byte 2
|
||||
0b00000000, //CV_395 - byte 1
|
||||
0b00000000, //CV_396 - byte 0
|
||||
//F17 reverse
|
||||
0b00000000, //CV_397 - byte 3
|
||||
0b00000000, //CV_398 - byte 2
|
||||
0b00000000, //CV_399 - byte 1
|
||||
0b00000000, //CV_400 - byte 0
|
||||
//F18 forward
|
||||
0b00000000, //CV_401 - byte 3
|
||||
0b00000000, //CV_402 - byte 2
|
||||
0b00000000, //CV_403 - byte 1
|
||||
0b00000000, //CV_404 - byte 0
|
||||
//F18 reverse
|
||||
0b00000000, //CV_405 - byte 3
|
||||
0b00000000, //CV_406 - byte 2
|
||||
0b00000000, //CV_407 - byte 1
|
||||
0b00000000, //CV_408 - byte 0
|
||||
//F19 forward
|
||||
0b00000000, //CV_409 - byte 3
|
||||
0b00000000, //CV_410 - byte 2
|
||||
0b00000000, //CV_411 - byte 1
|
||||
0b00000000, //CV_412 - byte 0
|
||||
//F19 reverse
|
||||
0b00000000, //CV_413 - byte 3
|
||||
0b00000000, //CV_414 - byte 2
|
||||
0b00000000, //CV_415 - byte 1
|
||||
0b00000000, //CV_416 - byte 0
|
||||
//F20 forward
|
||||
0b00000000, //CV_417 - byte 3
|
||||
0b00000000, //CV_418 - byte 2
|
||||
0b00000000, //CV_419 - byte 1
|
||||
0b00000000, //CV_420 - byte 0
|
||||
//F20 reverse
|
||||
0b00000000, //CV_421 - byte 3
|
||||
0b00000000, //CV_422 - byte 2
|
||||
0b00000000, //CV_423 - byte 1
|
||||
0b00000000, //CV_424 - byte 0
|
||||
//F21 forward
|
||||
0b00000000, //CV_425 - byte 3
|
||||
0b00000000, //CV_426 - byte 2
|
||||
0b00000000, //CV_427 - byte 1
|
||||
0b00000000, //CV_428 - byte 0
|
||||
//F21 reverse
|
||||
0b00000000, //CV_429 - byte 3
|
||||
0b00000000, //CV_430 - byte 2
|
||||
0b00000000, //CV_431 - byte 1
|
||||
0b00000000, //CV_432 - byte 0
|
||||
//F22 forward
|
||||
0b00000000, //CV_433 - byte 3
|
||||
0b00000000, //CV_434 - byte 2
|
||||
0b00000000, //CV_435 - byte 1
|
||||
0b00000000, //CV_436 - byte 0
|
||||
//F22 reverse
|
||||
0b00000000, //CV_437 - byte 3
|
||||
0b00000000, //CV_438 - byte 2
|
||||
0b00000000, //CV_439 - byte 1
|
||||
0b00000000, //CV_440 - byte 0
|
||||
//F23 forward
|
||||
0b00000000, //CV_441 - byte 3
|
||||
0b00000000, //CV_442 - byte 2
|
||||
0b00000000, //CV_443 - byte 1
|
||||
0b00000000, //CV_444 - byte 0
|
||||
//F23 reverse
|
||||
0b00000000, //CV_445 - byte 3
|
||||
0b00000000, //CV_446 - byte 2
|
||||
0b00000000, //CV_447 - byte 1
|
||||
0b00000000, //CV_448 - byte 0
|
||||
//F24 forward
|
||||
0b00000000, //CV_449 - byte 3
|
||||
0b00000000, //CV_450 - byte 2
|
||||
0b00000000, //CV_451 - byte 1
|
||||
0b00000000, //CV_452 - byte 0
|
||||
//F24 reverse
|
||||
0b00000000, //CV_453 - byte 3
|
||||
0b00000000, //CV_454 - byte 2
|
||||
0b00000000, //CV_455 - byte 1
|
||||
0b00000000, //CV_456 - byte 0
|
||||
//F25 forward
|
||||
0b00000000, //CV_457 - byte 3
|
||||
0b00000000, //CV_458 - byte 2
|
||||
0b00000000, //CV_459 - byte 1
|
||||
0b00000000, //CV_460 - byte 0
|
||||
//F25 reverse
|
||||
0b00000000, //CV_461 - byte 3
|
||||
0b00000000, //CV_462 - byte 2
|
||||
0b00000000, //CV_463 - byte 1
|
||||
0b00000000, //CV_464 - byte 0
|
||||
//F26 forward
|
||||
0b00000000, //CV_465 - byte 3
|
||||
0b00000000, //CV_466 - byte 2
|
||||
0b00000000, //CV_467 - byte 1
|
||||
0b00000000, //CV_468 - byte 0
|
||||
//F26 reverse
|
||||
0b00000000, //CV_469 - byte 3
|
||||
0b00000000, //CV_470 - byte 2
|
||||
0b00000000, //CV_471 - byte 1
|
||||
0b00000000, //CV_472 - byte 0
|
||||
//F27 forward
|
||||
0b00000000, //CV_473 - byte 3
|
||||
0b00000000, //CV_474 - byte 2
|
||||
0b00000000, //CV_475 - byte 1
|
||||
0b00000000, //CV_476 - byte 0
|
||||
//F27 reverse
|
||||
0b00000000, //CV_477 - byte 3
|
||||
0b00000000, //CV_478 - byte 2
|
||||
0b00000000, //CV_479 - byte 1
|
||||
0b00000000, //CV_480 - byte 0
|
||||
//F28 forward
|
||||
0b00000000, //CV_481 - byte 3
|
||||
0b00000000, //CV_482 - byte 2
|
||||
0b00000000, //CV_483 - byte 1
|
||||
0b00000000, //CV_484 - byte 0
|
||||
//F28 reverse
|
||||
0b00000000, //CV_485 - byte 3
|
||||
0b00000000, //CV_486 - byte 2
|
||||
0b00000000, //CV_487 - byte 1
|
||||
0b00000000, //CV_488 - byte 0
|
||||
//F29 forward
|
||||
0b00000000, //CV_489 - byte 3
|
||||
0b00000000, //CV_490 - byte 2
|
||||
0b00000000, //CV_491 - byte 1
|
||||
0b00000000, //CV_492 - byte 0
|
||||
//F29 reverse
|
||||
0b00000000, //CV_493 - byte 3
|
||||
0b00000000, //CV_494 - byte 2
|
||||
0b00000000, //CV_495 - byte 1
|
||||
0b00000000, //CV_496 - byte 0
|
||||
//F30 forward
|
||||
0b00000000, //CV_497 - byte 3
|
||||
0b00000000, //CV_498 - byte 2
|
||||
0b00000000, //CV_499 - byte 1
|
||||
0b00000000, //CV_500 - byte 0
|
||||
//F30 reverse
|
||||
0b00000000, //CV_501 - byte 3
|
||||
0b00000000, //CV_502 - byte 2
|
||||
0b00000000, //CV_503 - byte 1
|
||||
0b00000000, //CV_504 - byte 0
|
||||
//F31 forward
|
||||
0b00000000, //CV_505 - byte 3
|
||||
0b00000000, //CV_506 - byte 2
|
||||
0b00000000, //CV_507 - byte 1
|
||||
0b00000000, //CV_508 - byte 0
|
||||
//F31 reverse
|
||||
0b00000000, //CV_509 - byte 3
|
||||
0b00000000, //CV_510 - byte 2
|
||||
0b00000000, //CV_511 - byte 1
|
||||
0b00000000, //CV_512 - byte 0
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
(footprint "C_0603_1608Metric" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 621D1E9C)
|
||||
(descr "Capacitor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator")
|
||||
(tags "capacitor")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -1.43) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp d8b50c90-0233-4120-8eb7-fd37553c1dae)
|
||||
)
|
||||
(fp_text value "C_0603_1608Metric" (at 0 1.43) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 4e5feb93-e33a-49c0-b9c5-ae5884f54838)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
|
||||
(effects (font (size 0.4 0.4) (thickness 0.06)))
|
||||
(tstamp 579d7eba-875c-4a83-94cf-9a0ffb7d4ec6)
|
||||
)
|
||||
(fp_line (start -1.48 0.73) (end -1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp 40f7c129-7117-4932-921f-63d9649a8e3c))
|
||||
(fp_line (start 1.48 -0.73) (end 1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp 4cdf0691-68d0-4b9c-a08d-e458d11a6264))
|
||||
(fp_line (start -1.48 -0.73) (end 1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp bc329fd9-c699-40fd-809e-176f9fd0c1d5))
|
||||
(fp_line (start 1.48 0.73) (end -1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp c885676b-37fb-4c12-bfd6-27ae9c8dfd4f))
|
||||
(fp_line (start -0.8 -0.4) (end 0.8 -0.4) (layer "F.Fab") (width 0.1) (tstamp 06122ef5-5764-4a31-a1df-58f084862b1c))
|
||||
(fp_line (start 0.8 -0.4) (end 0.8 0.4) (layer "F.Fab") (width 0.1) (tstamp 1d2a7865-4bae-407b-82ca-a2578f9efb73))
|
||||
(fp_line (start 0.8 0.4) (end -0.8 0.4) (layer "F.Fab") (width 0.1) (tstamp 3fe6a869-68b8-4f26-8354-3cc1c9697594))
|
||||
(fp_line (start -0.8 0.4) (end -0.8 -0.4) (layer "F.Fab") (width 0.1) (tstamp 864e65e5-cec8-4833-ae53-dec6136866be))
|
||||
(pad "1" smd roundrect (at -0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 251ae9f1-97b4-42c7-a502-27edca1e9c60))
|
||||
(pad "2" smd roundrect (at 0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b3136c2f-02b9-49e1-a069-45a3c84854a1))
|
||||
(model "${KICAD6_3DMODEL_DIR}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
@@ -1,101 +0,0 @@
|
||||
(footprint "QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 61F5394A)
|
||||
(descr "QFN, 56 Pin (http://www.cypress.com/file/416486/download#page=40), generated with kicad-footprint-generator ipc_noLead_generator.py")
|
||||
(tags "QFN NoLead")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -4.82) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 1cb41492-bb93-4790-ad58-0f20773d1f59)
|
||||
)
|
||||
(fp_text value "QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm" (at 0 4.82) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp b083abe2-0457-4996-a931-50814a9c1d4b)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 7602d57d-0ec6-45eb-9694-c6ae1a760741)
|
||||
)
|
||||
(fp_line (start 3.61 -3.61) (end 3.61 -2.96) (layer "F.SilkS") (width 0.12) (tstamp 143843d9-5b2b-4149-9a31-87496276e62e))
|
||||
(fp_line (start 2.96 -3.61) (end 3.61 -3.61) (layer "F.SilkS") (width 0.12) (tstamp 1ce4caf8-c8bb-4fee-96d4-66c6c11818f1))
|
||||
(fp_line (start -3.61 3.61) (end -3.61 2.96) (layer "F.SilkS") (width 0.12) (tstamp 28e3cecb-5b2d-440e-975c-84c54fd48764))
|
||||
(fp_line (start -2.96 3.61) (end -3.61 3.61) (layer "F.SilkS") (width 0.12) (tstamp 33148282-40c9-4cda-b710-b4676c401c9e))
|
||||
(fp_line (start -2.96 -3.61) (end -3.61 -3.61) (layer "F.SilkS") (width 0.12) (tstamp 63b300c0-d2bd-467a-a60a-7afd101321d8))
|
||||
(fp_line (start 2.96 3.61) (end 3.61 3.61) (layer "F.SilkS") (width 0.12) (tstamp 75376d1a-b1cd-48ca-bb23-11e604649e2c))
|
||||
(fp_line (start 3.61 3.61) (end 3.61 2.96) (layer "F.SilkS") (width 0.12) (tstamp ae450cc7-7def-4688-a990-071728b5d6c1))
|
||||
(fp_line (start 4.12 4.12) (end 4.12 -4.12) (layer "F.CrtYd") (width 0.05) (tstamp 24d84152-bd16-42f0-b31c-da5c0075c0a9))
|
||||
(fp_line (start -4.12 4.12) (end 4.12 4.12) (layer "F.CrtYd") (width 0.05) (tstamp 4a43d0e8-6681-4990-bf2a-d86962571c6c))
|
||||
(fp_line (start 4.12 -4.12) (end -4.12 -4.12) (layer "F.CrtYd") (width 0.05) (tstamp cceb0992-d7b0-445b-8d5b-32d0d8fb8730))
|
||||
(fp_line (start -4.12 -4.12) (end -4.12 4.12) (layer "F.CrtYd") (width 0.05) (tstamp f00de455-d6a3-446a-aed3-4d3f2a1d79a7))
|
||||
(fp_line (start -3.5 -2.5) (end -2.5 -3.5) (layer "F.Fab") (width 0.1) (tstamp 6dd7f30c-e337-4ce2-8c91-e9492994a612))
|
||||
(fp_line (start 3.5 3.5) (end -3.5 3.5) (layer "F.Fab") (width 0.1) (tstamp 9478caeb-b727-455b-93f6-4a7ba6bf88ff))
|
||||
(fp_line (start -2.5 -3.5) (end 3.5 -3.5) (layer "F.Fab") (width 0.1) (tstamp 964fef0c-28c1-487d-979d-e51467c515ad))
|
||||
(fp_line (start 3.5 -3.5) (end 3.5 3.5) (layer "F.Fab") (width 0.1) (tstamp e31d6a06-a105-4ec5-90bf-40066b0d8ad4))
|
||||
(fp_line (start -3.5 3.5) (end -3.5 -2.5) (layer "F.Fab") (width 0.1) (tstamp fd3e7550-b460-4c66-9cde-67bd2357b67b))
|
||||
(pad "" smd roundrect (at 0.7 -0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp 14d0da6f-9850-487b-bd20-464b22ec06c3))
|
||||
(pad "" smd roundrect (at 0.7 0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp 429b569e-2ded-491e-b5a3-5fd6415c5df9))
|
||||
(pad "" smd roundrect (at -0.7 0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp 7d0b040a-02c1-46cc-86f8-9545b08e89b9))
|
||||
(pad "" smd roundrect (at -0.7 -0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp f7d7c5a0-f2af-4f33-92e7-dc77c486f00c))
|
||||
(pad "1" smd roundrect (at -3.4375 -2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c7b2dfb2-c297-4775-bd8d-089f60c7f5c8))
|
||||
(pad "2" smd roundrect (at -3.4375 -2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 96efaa14-69c7-43f1-99ef-d01236e1a38c))
|
||||
(pad "3" smd roundrect (at -3.4375 -1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 887a9c86-b2af-497c-a44d-ba6d3b6eee34))
|
||||
(pad "4" smd roundrect (at -3.4375 -1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a4c866ab-a81b-4914-a82c-4af5068226be))
|
||||
(pad "5" smd roundrect (at -3.4375 -1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 319c4bb4-77f6-475b-a1e8-482e167b57ca))
|
||||
(pad "6" smd roundrect (at -3.4375 -0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 44343f1b-3511-4672-8759-abd5eef10cae))
|
||||
(pad "7" smd roundrect (at -3.4375 -0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 67f19c8d-8979-4413-b403-af166a4bcc58))
|
||||
(pad "8" smd roundrect (at -3.4375 0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8e4d7d65-0971-4417-a795-e7ff376ffc5d))
|
||||
(pad "9" smd roundrect (at -3.4375 0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 7e33e4ab-fed5-4093-8dc7-44ccc10980e1))
|
||||
(pad "10" smd roundrect (at -3.4375 1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5e1c2358-e06a-4178-a65d-3bf67a4ad21c))
|
||||
(pad "11" smd roundrect (at -3.4375 1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6804eff7-f37b-4022-9c54-d351dccc84eb))
|
||||
(pad "12" smd roundrect (at -3.4375 1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5e8d90bc-2fe1-4989-a471-1cceb269bd73))
|
||||
(pad "13" smd roundrect (at -3.4375 2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0da88f34-3793-44c0-8143-7f0dea1a4314))
|
||||
(pad "14" smd roundrect (at -3.4375 2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 09963381-f1a7-4c31-9958-ca5cb9dc7851))
|
||||
(pad "15" smd roundrect (at -2.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp dba53c32-257a-4c9c-aea8-082fff066384))
|
||||
(pad "16" smd roundrect (at -2.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a3a33519-a8d7-4b84-be08-51a5335fe175))
|
||||
(pad "17" smd roundrect (at -1.8 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f17a8568-d5be-4c65-a695-e83f5cdf9445))
|
||||
(pad "18" smd roundrect (at -1.4 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5cdf8853-e1e4-4897-89a7-7b632a6efa32))
|
||||
(pad "19" smd roundrect (at -1 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d0d3c6ef-4125-4dc5-b5ad-5da5a2561954))
|
||||
(pad "20" smd roundrect (at -0.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 16009885-a147-43ed-872a-45cc04729c13))
|
||||
(pad "21" smd roundrect (at -0.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 3ad23e03-d2b3-45b0-96b4-e49fcc75a345))
|
||||
(pad "22" smd roundrect (at 0.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a990de91-5995-4cff-94bb-31570e219c84))
|
||||
(pad "23" smd roundrect (at 0.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 254019b0-e277-429d-a55f-a9d08453afdf))
|
||||
(pad "24" smd roundrect (at 1 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 15c23a20-506a-4d56-9a2a-d884b9d6198c))
|
||||
(pad "25" smd roundrect (at 1.4 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0be7c0f3-fc66-4a46-98fd-a6fddd642a97))
|
||||
(pad "26" smd roundrect (at 1.8 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e55551c2-9727-4f82-8965-442f2de0297a))
|
||||
(pad "27" smd roundrect (at 2.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 10390f88-05f9-4e11-a7da-0544f9016d20))
|
||||
(pad "28" smd roundrect (at 2.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c0ab3a28-2ebf-44f5-9999-a96d24c577ef))
|
||||
(pad "29" smd roundrect (at 3.4375 2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5549a141-bd37-4941-bf43-9377fe64f8b8))
|
||||
(pad "30" smd roundrect (at 3.4375 2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ddce157f-e5cf-4d3a-9d41-9b248cb3ff94))
|
||||
(pad "31" smd roundrect (at 3.4375 1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 9c2ce4c2-4359-4c69-b300-98ae259e675f))
|
||||
(pad "32" smd roundrect (at 3.4375 1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ebe8908f-cbd0-4002-aa82-aec841dec7a0))
|
||||
(pad "33" smd roundrect (at 3.4375 1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 807695a7-b8c4-48b1-895b-48a01f30d2ff))
|
||||
(pad "34" smd roundrect (at 3.4375 0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d9d74ddf-dbf5-42e7-b795-43c2a39794c3))
|
||||
(pad "35" smd roundrect (at 3.4375 0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 25f7a118-ae51-4579-b07d-4055183275f0))
|
||||
(pad "36" smd roundrect (at 3.4375 -0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 28d5738d-b02a-45dc-b853-c32eacab6460))
|
||||
(pad "37" smd roundrect (at 3.4375 -0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f945430f-d0c0-45b7-9474-d4928893c459))
|
||||
(pad "38" smd roundrect (at 3.4375 -1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 9343fc0a-33d3-4c32-83e4-d4375dedea11))
|
||||
(pad "39" smd roundrect (at 3.4375 -1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1018c1f0-8364-4603-9eb7-871c47a0edd9))
|
||||
(pad "40" smd roundrect (at 3.4375 -1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 57d9ae23-160d-46fc-8542-0761f66cbb54))
|
||||
(pad "41" smd roundrect (at 3.4375 -2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e768590b-fd92-4808-8b5c-c538a5d71353))
|
||||
(pad "42" smd roundrect (at 3.4375 -2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 36330616-c7ee-47cb-a9a2-2c08f9379b75))
|
||||
(pad "43" smd roundrect (at 2.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f8d40dea-ce23-49a3-959a-4c9beb32562e))
|
||||
(pad "44" smd roundrect (at 2.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1a44131e-010d-4427-99b4-adce439b4f96))
|
||||
(pad "45" smd roundrect (at 1.8 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5d93abe2-4532-4ea6-9697-91c5148b5895))
|
||||
(pad "46" smd roundrect (at 1.4 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ccd0074a-1ef0-4248-9305-14c53f69babc))
|
||||
(pad "47" smd roundrect (at 1 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 645e2e12-0daf-40c6-a7dd-ca600e9603e8))
|
||||
(pad "48" smd roundrect (at 0.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 83e08de6-7ccd-4d47-9971-4da79778fa87))
|
||||
(pad "49" smd roundrect (at 0.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e0b56605-8256-4030-b90e-875ee0e71a8d))
|
||||
(pad "50" smd roundrect (at -0.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 08f03e47-fe87-40d7-900f-6d6289046a31))
|
||||
(pad "51" smd roundrect (at -0.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 838fcb00-5128-4f30-9cee-70ba20819dc6))
|
||||
(pad "52" smd roundrect (at -1 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 688210ff-9853-432c-a726-b0b425cde226))
|
||||
(pad "53" smd roundrect (at -1.4 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 247657c3-72e1-4b9b-a4c3-eadc80c2ec1a))
|
||||
(pad "54" smd roundrect (at -1.8 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d2bb7984-ebbb-4e51-b516-a37fe7852441))
|
||||
(pad "55" smd roundrect (at -2.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0e4964e6-9cba-4f92-89e6-e4cbbd69b948))
|
||||
(pad "56" smd roundrect (at -2.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ab8fa6cb-13a9-4f3f-b0ca-4d49ee4c0849))
|
||||
(pad "57" smd rect (at 0 0) (size 3.2 3.2) (layers "F.Cu" "F.Mask") (tstamp e9c5dcde-1025-4724-ab6b-fa143326a9b2))
|
||||
(model "${KICAD6_3DMODEL_DIR}/Package_DFN_QFN.3dshapes/QFN-56-1EP_7x7mm_P0.4mm_EP5.6x5.6mm.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
@@ -1,457 +0,0 @@
|
||||
{
|
||||
"board": {
|
||||
"design_settings": {
|
||||
"defaults": {
|
||||
"board_outline_line_width": 0.09999999999999999,
|
||||
"copper_line_width": 0.19999999999999998,
|
||||
"copper_text_italic": false,
|
||||
"copper_text_size_h": 1.5,
|
||||
"copper_text_size_v": 1.5,
|
||||
"copper_text_thickness": 0.3,
|
||||
"copper_text_upright": false,
|
||||
"courtyard_line_width": 0.049999999999999996,
|
||||
"dimension_precision": 4,
|
||||
"dimension_units": 3,
|
||||
"dimensions": {
|
||||
"arrow_length": 1270000,
|
||||
"extension_offset": 500000,
|
||||
"keep_text_aligned": true,
|
||||
"suppress_zeroes": false,
|
||||
"text_position": 0,
|
||||
"units_format": 1
|
||||
},
|
||||
"fab_line_width": 0.09999999999999999,
|
||||
"fab_text_italic": false,
|
||||
"fab_text_size_h": 1.0,
|
||||
"fab_text_size_v": 1.0,
|
||||
"fab_text_thickness": 0.15,
|
||||
"fab_text_upright": false,
|
||||
"other_line_width": 0.15,
|
||||
"other_text_italic": false,
|
||||
"other_text_size_h": 1.0,
|
||||
"other_text_size_v": 1.0,
|
||||
"other_text_thickness": 0.15,
|
||||
"other_text_upright": false,
|
||||
"pads": {
|
||||
"drill": 0.0,
|
||||
"height": 2.0,
|
||||
"width": 2.0
|
||||
},
|
||||
"silk_line_width": 0.15,
|
||||
"silk_text_italic": false,
|
||||
"silk_text_size_h": 1.0,
|
||||
"silk_text_size_v": 1.0,
|
||||
"silk_text_thickness": 0.15,
|
||||
"silk_text_upright": false,
|
||||
"zones": {
|
||||
"45_degree_only": false,
|
||||
"min_clearance": 0.19999999999999998
|
||||
}
|
||||
},
|
||||
"diff_pair_dimensions": [
|
||||
{
|
||||
"gap": 0.0,
|
||||
"via_gap": 0.0,
|
||||
"width": 0.0
|
||||
}
|
||||
],
|
||||
"drc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 2
|
||||
},
|
||||
"rule_severities": {
|
||||
"annular_width": "error",
|
||||
"clearance": "error",
|
||||
"copper_edge_clearance": "error",
|
||||
"courtyards_overlap": "warning",
|
||||
"diff_pair_gap_out_of_range": "error",
|
||||
"diff_pair_uncoupled_length_too_long": "error",
|
||||
"drill_out_of_range": "error",
|
||||
"duplicate_footprints": "warning",
|
||||
"extra_footprint": "warning",
|
||||
"footprint_type_mismatch": "error",
|
||||
"hole_clearance": "error",
|
||||
"hole_near_hole": "error",
|
||||
"invalid_outline": "error",
|
||||
"item_on_disabled_layer": "error",
|
||||
"items_not_allowed": "error",
|
||||
"length_out_of_range": "error",
|
||||
"malformed_courtyard": "error",
|
||||
"microvia_drill_out_of_range": "error",
|
||||
"missing_courtyard": "ignore",
|
||||
"missing_footprint": "warning",
|
||||
"net_conflict": "warning",
|
||||
"npth_inside_courtyard": "ignore",
|
||||
"padstack": "error",
|
||||
"pth_inside_courtyard": "ignore",
|
||||
"shorting_items": "error",
|
||||
"silk_over_copper": "warning",
|
||||
"silk_overlap": "warning",
|
||||
"skew_out_of_range": "error",
|
||||
"through_hole_pad_without_hole": "error",
|
||||
"too_many_vias": "error",
|
||||
"track_dangling": "warning",
|
||||
"track_width": "error",
|
||||
"tracks_crossing": "error",
|
||||
"unconnected_items": "error",
|
||||
"unresolved_variable": "error",
|
||||
"via_dangling": "warning",
|
||||
"zone_has_empty_net": "error",
|
||||
"zones_intersect": "error"
|
||||
},
|
||||
"rules": {
|
||||
"allow_blind_buried_vias": false,
|
||||
"allow_microvias": false,
|
||||
"max_error": 0.005,
|
||||
"min_clearance": 0.127,
|
||||
"min_copper_edge_clearance": 0.19999999999999998,
|
||||
"min_hole_clearance": 0.19999999999999998,
|
||||
"min_hole_to_hole": 0.254,
|
||||
"min_microvia_diameter": 0.19999999999999998,
|
||||
"min_microvia_drill": 0.09999999999999999,
|
||||
"min_silk_clearance": 0.0,
|
||||
"min_through_hole_diameter": 0.19999999999999998,
|
||||
"min_track_width": 0.127,
|
||||
"min_via_annular_width": 0.13,
|
||||
"min_via_diameter": 0.39999999999999997,
|
||||
"solder_mask_clearance": 0.0,
|
||||
"solder_mask_min_width": 0.0,
|
||||
"use_height_for_length_calcs": true
|
||||
},
|
||||
"track_widths": [
|
||||
0.0,
|
||||
0.127,
|
||||
0.2,
|
||||
0.25,
|
||||
0.4,
|
||||
0.5,
|
||||
0.6,
|
||||
0.75,
|
||||
0.8
|
||||
],
|
||||
"via_dimensions": [
|
||||
{
|
||||
"diameter": 0.0,
|
||||
"drill": 0.0
|
||||
},
|
||||
{
|
||||
"diameter": 0.56,
|
||||
"drill": 0.3
|
||||
},
|
||||
{
|
||||
"diameter": 0.6,
|
||||
"drill": 0.3
|
||||
},
|
||||
{
|
||||
"diameter": 0.75,
|
||||
"drill": 0.375
|
||||
},
|
||||
{
|
||||
"diameter": 0.8,
|
||||
"drill": 0.4
|
||||
}
|
||||
],
|
||||
"zones_allow_external_fillets": false,
|
||||
"zones_use_no_outline": true
|
||||
},
|
||||
"layer_presets": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
"equivalence_files": []
|
||||
},
|
||||
"erc": {
|
||||
"erc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"pin_map": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
]
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_label_syntax": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
"different_unit_footprint": "error",
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"extra_units": "error",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"lib_symbol_issues": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
"no_connect_dangling": "warning",
|
||||
"pin_not_connected": "error",
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"similar_labels": "warning",
|
||||
"unannotated": "error",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"pinned_footprint_libs": [],
|
||||
"pinned_symbol_libs": []
|
||||
},
|
||||
"meta": {
|
||||
"filename": "RP2040-Decoder.kicad_pro",
|
||||
"version": 1
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12.0,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
"diff_pair_width": 0.2,
|
||||
"line_style": 0,
|
||||
"microvia_diameter": 0.3,
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.25,
|
||||
"via_diameter": 0.8,
|
||||
"via_drill": 0.4,
|
||||
"wire_width": 6.0
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 2
|
||||
},
|
||||
"net_colors": null
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "",
|
||||
"specctra_dsn": "",
|
||||
"step": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"drawing": {
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
"intersheets_ref_own_page": false,
|
||||
"intersheets_ref_prefix": "",
|
||||
"intersheets_ref_short": false,
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.25,
|
||||
"pin_symbol_size": 0.0,
|
||||
"text_offset_ratio": 0.08
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "",
|
||||
"ngspice": {
|
||||
"fix_include_paths": true,
|
||||
"fix_passive_vals": false,
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"model_mode": 0,
|
||||
"workbook_filename": ""
|
||||
},
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "/home/gab/Documents/",
|
||||
"spice_adjust_passive_values": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"subpart_first_id": 65,
|
||||
"subpart_id_separator": 0
|
||||
},
|
||||
"sheets": [
|
||||
[
|
||||
"11d18738-0f49-4d63-b61c-22a93efd5959",
|
||||
""
|
||||
]
|
||||
],
|
||||
"text_variables": {}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
(footprint "R_0603_1608Metric" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 621D1EDA)
|
||||
(descr "Resistor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator")
|
||||
(tags "resistor")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -1.43) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 6df974b4-b819-4abf-a570-cfac24b90f22)
|
||||
)
|
||||
(fp_text value "R_0603_1608Metric" (at 0 1.43) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 43a2d3f9-8880-4891-bb65-e1f1adf1c2a5)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
|
||||
(effects (font (size 0.4 0.4) (thickness 0.06)))
|
||||
(tstamp 2dfd6efa-e1ab-4e55-ab2b-7f9e70f33afa)
|
||||
)
|
||||
(fp_line (start -1.48 -0.73) (end 1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp 24e272be-4051-4b9b-9127-1c7f22532469))
|
||||
(fp_line (start 1.48 -0.73) (end 1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp 2bbe1e5e-3213-443e-930c-a0ae97a345e1))
|
||||
(fp_line (start -1.48 0.73) (end -1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp 39fddbf8-ad85-4516-95fc-b7f57b1b5476))
|
||||
(fp_line (start 1.48 0.73) (end -1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp dc275714-5365-4c02-a2fb-5cbd77201d52))
|
||||
(fp_line (start 0.8 -0.4125) (end 0.8 0.4125) (layer "F.Fab") (width 0.1) (tstamp 0746adbb-419c-491f-ae91-c14351e88a28))
|
||||
(fp_line (start -0.8 -0.4125) (end 0.8 -0.4125) (layer "F.Fab") (width 0.1) (tstamp 30e382fb-e120-4499-bc15-156f98cd93e8))
|
||||
(fp_line (start 0.8 0.4125) (end -0.8 0.4125) (layer "F.Fab") (width 0.1) (tstamp 9ddd7cd8-091d-447c-bc2a-eed5612caf40))
|
||||
(fp_line (start -0.8 0.4125) (end -0.8 -0.4125) (layer "F.Fab") (width 0.1) (tstamp d04dd1a4-2178-41f5-9bb7-ad470915f47a))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 958f80d5-b7aa-4100-9f8f-c88ef419994d))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp dbf61a86-b574-45d2-ba89-95e1ee8fabb2))
|
||||
(model "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
@@ -1,57 +0,0 @@
|
||||
(footprint "SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 621D2936)
|
||||
(descr "SOIC, 8 Pin (http://www.allegromicro.com/~/media/Files/Datasheets/A4950-Datasheet.ashx#page=8), generated with kicad-footprint-generator ipc_gullwing_generator.py")
|
||||
(tags "SOIC SO")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at -0.2 -4.3) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 0d0f734b-55d5-4594-866a-ce6819cf8228)
|
||||
)
|
||||
(fp_text value "SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias" (at 0 3.4) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 22956637-17bd-4c2e-acb6-b78772616ce1)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
|
||||
(effects (font (size 0.98 0.98) (thickness 0.15)))
|
||||
(tstamp 114d50fb-c631-48ec-b90f-efb4be58d6c8)
|
||||
)
|
||||
(fp_line (start 1.55 2.56) (end 3.4 2.56) (layer "F.SilkS") (width 0.12) (tstamp 4215d5a7-1062-44a9-96e2-c894457eb6a9))
|
||||
(fp_line (start -1.55 -2.56) (end -3.4 -2.56) (layer "F.SilkS") (width 0.12) (tstamp 5e1b6593-5e9b-46a9-b77d-e8857a7019a7))
|
||||
(fp_line (start -1.55 2.56) (end -3.4 2.56) (layer "F.SilkS") (width 0.12) (tstamp d2f4f71b-dad4-477c-9332-cfa0b1762c3c))
|
||||
(fp_line (start 1.55 -2.56) (end 3.4 -2.56) (layer "F.SilkS") (width 0.12) (tstamp d8ebe137-f5d5-4c2e-b1be-05e2e860bfc2))
|
||||
(fp_line (start 3.7 2.7) (end 3.7 -2.7) (layer "F.CrtYd") (width 0.05) (tstamp 03434c57-aec9-4997-bdac-bd6bc0877cdd))
|
||||
(fp_line (start -3.7 -2.7) (end -3.7 2.7) (layer "F.CrtYd") (width 0.05) (tstamp 3b0dc4e4-bdc2-4b50-aa3f-9e14820b2751))
|
||||
(fp_line (start -3.7 2.7) (end 3.7 2.7) (layer "F.CrtYd") (width 0.05) (tstamp 839afce9-2060-4cb0-b78e-caadc6bdbef9))
|
||||
(fp_line (start 3.7 -2.7) (end -3.7 -2.7) (layer "F.CrtYd") (width 0.05) (tstamp e48a8fea-d898-4d03-99fa-28f365900862))
|
||||
(fp_line (start -1.95 -1.475) (end -0.975 -2.45) (layer "F.Fab") (width 0.1) (tstamp 27208f4d-f461-4f50-a941-8886d9234066))
|
||||
(fp_line (start -0.975 -2.45) (end 1.95 -2.45) (layer "F.Fab") (width 0.1) (tstamp 2c3326d8-8f3d-40cb-a7dd-fa99c40b6598))
|
||||
(fp_line (start 1.95 -2.45) (end 1.95 2.45) (layer "F.Fab") (width 0.1) (tstamp 5c93c3a4-8b42-477a-892d-3a4116ce4a83))
|
||||
(fp_line (start -1.95 2.45) (end -1.95 -1.475) (layer "F.Fab") (width 0.1) (tstamp 7b8850b8-629b-406b-a955-153bdfac67a7))
|
||||
(fp_line (start 1.95 2.45) (end -1.95 2.45) (layer "F.Fab") (width 0.1) (tstamp d594cbf2-5861-4bce-8ea6-54b69faa1bde))
|
||||
(pad "" smd roundrect (at -0.6 0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 02654062-e307-48a2-a672-ab6985eb502c))
|
||||
(pad "" smd roundrect (at -0.6 -0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 0eda8a60-9156-494c-b248-9f23876b9c97))
|
||||
(pad "" smd roundrect (at 0.6 0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 275e7eda-80dc-4dae-8d5a-d69839ef7060))
|
||||
(pad "" smd roundrect (at 0.6 -0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 2ff99c2d-e844-44d0-bfc9-4f54f1b985ca))
|
||||
(pad "1" smd roundrect (at -2.475 -1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8dcf9965-4b38-4f4e-969f-578bcad555e9))
|
||||
(pad "2" smd roundrect (at -2.475 -0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 425dcc81-ccb1-492a-ac99-b0bf1be89e2d))
|
||||
(pad "3" smd roundrect (at -2.475 0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 56d4d9c4-0452-47df-88a8-5979c8feb2db))
|
||||
(pad "4" smd roundrect (at -2.475 1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 53106e3f-8345-4981-a96d-68820362ebea))
|
||||
(pad "5" smd roundrect (at 2.475 1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ef1eddff-7709-4257-916a-36fa2baed22e))
|
||||
(pad "6" smd roundrect (at 2.475 0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b401095e-aca0-4b4a-8e85-319099d7598c))
|
||||
(pad "7" smd roundrect (at 2.475 -0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 4ab1bb28-4236-42fc-aa5d-09e01f4abe45))
|
||||
(pad "8" smd roundrect (at 2.475 -1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 61ad49d1-2f42-4f33-afdd-01be938e7e56))
|
||||
(pad "9" thru_hole circle (at 0.7 -1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp 1327a571-9408-4f2e-b3bb-b550b6d3a0be))
|
||||
(pad "9" thru_hole circle (at 0.7 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp 38ad4bee-e334-45b6-98b3-91580c43f314))
|
||||
(pad "9" smd rect (at 0 0) (size 2.41 3.3) (layers "F.Cu" "F.Mask") (tstamp 492dc4b9-8891-40fa-9726-31f4ba6ae3a0))
|
||||
(pad "9" smd rect (at 0 0) (size 1.9 2.9) (layers "B.Cu") (tstamp a267eaa8-2c1c-4f35-9bdd-c1551668d64b))
|
||||
(pad "9" thru_hole circle (at 0.7 1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp c6fc29d8-1848-4d54-9ceb-e114b4dd89d9))
|
||||
(pad "9" thru_hole circle (at -0.7 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp d63c1844-7ca4-4d96-92d7-088888b2e2e0))
|
||||
(pad "9" thru_hole circle (at -0.7 1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp dac580e0-d592-40c4-a6a3-32f4156ddde6))
|
||||
(pad "9" thru_hole circle (at -0.7 -1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp e44650f7-3103-408b-ac51-7088faf35d1a))
|
||||
(model "${KICAD6_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8_3.9x4.9mm_P1.27mm.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
@@ -1,50 +0,0 @@
|
||||
(footprint "SOIC-8_5.23x5.23mm_P1.27mm" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 621CE813)
|
||||
(descr "SOIC, 8 Pin (http://www.winbond.com/resource-files/w25q32jv%20revg%2003272018%20plus.pdf#page=68), generated with kicad-footprint-generator ipc_gullwing_generator.py")
|
||||
(tags "SOIC SO")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -3.56) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 892c99ea-5410-4a65-9ee4-bdc09fdc90ee)
|
||||
)
|
||||
(fp_text value "SOIC-8_5.23x5.23mm_P1.27mm" (at 0 3.56) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp c04ec0d1-7f0d-4019-91be-a6614badf406)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 77985a68-90d4-4d27-872a-c400b51090e9)
|
||||
)
|
||||
(fp_line (start -2.725 2.725) (end -2.725 2.465) (layer "F.SilkS") (width 0.12) (tstamp 00138a61-23f0-45f3-9f28-2bbd8494a1fc))
|
||||
(fp_line (start -2.725 -2.465) (end -4.4 -2.465) (layer "F.SilkS") (width 0.12) (tstamp 0ad895a6-0c83-484a-8b80-3635647eb60a))
|
||||
(fp_line (start 0 -2.725) (end -2.725 -2.725) (layer "F.SilkS") (width 0.12) (tstamp 0ef6c909-3192-40ee-a6d7-49ae09a79a2d))
|
||||
(fp_line (start -2.725 -2.725) (end -2.725 -2.465) (layer "F.SilkS") (width 0.12) (tstamp 1faa07e6-bd78-437e-b4e2-cd00c2b8018d))
|
||||
(fp_line (start 2.725 2.725) (end 2.725 2.465) (layer "F.SilkS") (width 0.12) (tstamp 3a26b0fd-8ddd-4bb6-8f59-5d8caaf547d2))
|
||||
(fp_line (start 0 2.725) (end 2.725 2.725) (layer "F.SilkS") (width 0.12) (tstamp 599161f8-efef-47ec-8f3f-69142e759f9f))
|
||||
(fp_line (start 0 2.725) (end -2.725 2.725) (layer "F.SilkS") (width 0.12) (tstamp 7563e6d6-e180-4d92-9939-ff14aba164c5))
|
||||
(fp_line (start 2.725 -2.725) (end 2.725 -2.465) (layer "F.SilkS") (width 0.12) (tstamp bd45a508-6e93-4f9b-948f-0868d234cca2))
|
||||
(fp_line (start 0 -2.725) (end 2.725 -2.725) (layer "F.SilkS") (width 0.12) (tstamp e0b94375-2281-4987-b4d4-78e8e535972c))
|
||||
(fp_line (start 4.65 -2.86) (end -4.65 -2.86) (layer "F.CrtYd") (width 0.05) (tstamp 15719beb-6925-433d-810a-8c40136a730d))
|
||||
(fp_line (start 4.65 2.86) (end 4.65 -2.86) (layer "F.CrtYd") (width 0.05) (tstamp 343b8478-4e57-4c34-a00f-f6c76028fbb0))
|
||||
(fp_line (start -4.65 2.86) (end 4.65 2.86) (layer "F.CrtYd") (width 0.05) (tstamp 48c8ef75-8bc0-4249-b6fc-f564812177b5))
|
||||
(fp_line (start -4.65 -2.86) (end -4.65 2.86) (layer "F.CrtYd") (width 0.05) (tstamp d364a3b0-54fd-4659-8dce-a730d0a819b4))
|
||||
(fp_line (start -2.615 2.615) (end -2.615 -1.615) (layer "F.Fab") (width 0.1) (tstamp 02b4b413-8363-4d1b-994e-188513d8ddc7))
|
||||
(fp_line (start 2.615 -2.615) (end 2.615 2.615) (layer "F.Fab") (width 0.1) (tstamp 0de79bc8-6e35-4f27-a959-67075a5c995d))
|
||||
(fp_line (start -1.615 -2.615) (end 2.615 -2.615) (layer "F.Fab") (width 0.1) (tstamp 6d79fd42-415e-413e-9d9a-317a78780624))
|
||||
(fp_line (start -2.615 -1.615) (end -1.615 -2.615) (layer "F.Fab") (width 0.1) (tstamp a9e3aef9-f101-4095-bdca-1439a0a3a462))
|
||||
(fp_line (start 2.615 2.615) (end -2.615 2.615) (layer "F.Fab") (width 0.1) (tstamp f6066510-5931-4b5c-bd2e-aa73c2658e09))
|
||||
(pad "1" smd roundrect (at -3.6 -1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 27b69982-b2ed-4600-967a-124075f92a47))
|
||||
(pad "2" smd roundrect (at -3.6 -0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6d25bce9-3e60-4ced-b5a9-08751e8b6fc4))
|
||||
(pad "3" smd roundrect (at -3.6 0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 20c0617b-b9fa-402b-acac-3d6d0fd080c9))
|
||||
(pad "4" smd roundrect (at -3.6 1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f866660d-6ba6-48d1-8140-3aea9f62e041))
|
||||
(pad "5" smd roundrect (at 3.6 1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 84c5eefd-df9f-4bf1-ada6-d7c8e324cafa))
|
||||
(pad "6" smd roundrect (at 3.6 0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8cae02d5-3e1a-460e-ab20-8d0d15978bd7))
|
||||
(pad "7" smd roundrect (at 3.6 -0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp bfac6452-2417-4786-863e-60ca15ff175c))
|
||||
(pad "8" smd roundrect (at 3.6 -1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp de3c0f07-7b33-4a21-a1da-0aaa6ffb3b32))
|
||||
(model "${KICAD6_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8_5.275x5.275mm_P1.27mm.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
@@ -1,3 +0,0 @@
|
||||
(fp_lib_table
|
||||
(lib (name "RP2040-Decoder_Additional_Footprints")(type "KiCad")(uri "${KIPRJMOD}")(options "")(descr ""))
|
||||
)
|
||||
@@ -1,3 +0,0 @@
|
||||
(sym_lib_table
|
||||
(lib (name "RP2040-Decoder_Additional_Symbols")(type "KiCad")(uri "${KIPRJMOD}/RP2040-Decoder_Additional_Symbols.kicad_sym")(options "")(descr ""))
|
||||
)
|
||||
@@ -1,227 +0,0 @@
|
||||
Software License:
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Gabriel Koppenstein
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Hardware License:
|
||||
|
||||
CERN Open Hardware Licence Version 2 - Permissive
|
||||
|
||||
|
||||
Preamble
|
||||
|
||||
CERN has developed this licence to promote collaboration among
|
||||
hardware designers and to provide a legal tool which supports the
|
||||
freedom to use, study, modify, share and distribute hardware designs
|
||||
and products based on those designs. Version 2 of the CERN Open
|
||||
Hardware Licence comes in three variants: this licence, CERN-OHL-P
|
||||
(permissive); and two reciprocal licences: CERN-OHL-W (weakly
|
||||
reciprocal) and CERN-OHL-S (strongly reciprocal).
|
||||
|
||||
The CERN-OHL-P is copyright CERN 2020. Anyone is welcome to use it, in
|
||||
unmodified form only.
|
||||
|
||||
Use of this Licence does not imply any endorsement by CERN of any
|
||||
Licensor or their designs nor does it imply any involvement by CERN in
|
||||
their development.
|
||||
|
||||
|
||||
1 Definitions
|
||||
|
||||
1.1 'Licence' means this CERN-OHL-P.
|
||||
|
||||
1.2 'Source' means information such as design materials or digital
|
||||
code which can be applied to Make or test a Product or to
|
||||
prepare a Product for use, Conveyance or sale, regardless of its
|
||||
medium or how it is expressed. It may include Notices.
|
||||
|
||||
1.3 'Covered Source' means Source that is explicitly made available
|
||||
under this Licence.
|
||||
|
||||
1.4 'Product' means any device, component, work or physical object,
|
||||
whether in finished or intermediate form, arising from the use,
|
||||
application or processing of Covered Source.
|
||||
|
||||
1.5 'Make' means to create or configure something, whether by
|
||||
manufacture, assembly, compiling, loading or applying Covered
|
||||
Source or another Product or otherwise.
|
||||
|
||||
1.6 'Notice' means copyright, acknowledgement and trademark notices,
|
||||
references to the location of any Notices, modification notices
|
||||
(subsection 3.3(b)) and all notices that refer to this Licence
|
||||
and to the disclaimer of warranties that are included in the
|
||||
Covered Source.
|
||||
|
||||
1.7 'Licensee' or 'You' means any person exercising rights under
|
||||
this Licence.
|
||||
|
||||
1.8 'Licensor' means a person who creates Source or modifies Covered
|
||||
Source and subsequently Conveys the resulting Covered Source
|
||||
under the terms and conditions of this Licence. A person may be
|
||||
a Licensee and a Licensor at the same time.
|
||||
|
||||
1.9 'Convey' means to communicate to the public or distribute.
|
||||
|
||||
|
||||
2 Applicability
|
||||
|
||||
2.1 This Licence governs the use, copying, modification, Conveying
|
||||
of Covered Source and Products, and the Making of Products. By
|
||||
exercising any right granted under this Licence, You irrevocably
|
||||
accept these terms and conditions.
|
||||
|
||||
2.2 This Licence is granted by the Licensor directly to You, and
|
||||
shall apply worldwide and without limitation in time.
|
||||
|
||||
2.3 You shall not attempt to restrict by contract or otherwise the
|
||||
rights granted under this Licence to other Licensees.
|
||||
|
||||
2.4 This Licence is not intended to restrict fair use, fair dealing,
|
||||
or any other similar right.
|
||||
|
||||
|
||||
3 Copying, Modifying and Conveying Covered Source
|
||||
|
||||
3.1 You may copy and Convey verbatim copies of Covered Source, in
|
||||
any medium, provided You retain all Notices.
|
||||
|
||||
3.2 You may modify Covered Source, other than Notices.
|
||||
|
||||
You may only delete Notices if they are no longer applicable to
|
||||
the corresponding Covered Source as modified by You and You may
|
||||
add additional Notices applicable to Your modifications.
|
||||
|
||||
3.3 You may Convey modified Covered Source (with the effect that You
|
||||
shall also become a Licensor) provided that You:
|
||||
|
||||
a) retain Notices as required in subsection 3.2; and
|
||||
|
||||
b) add a Notice to the modified Covered Source stating that You
|
||||
have modified it, with the date and brief description of how
|
||||
You have modified it.
|
||||
|
||||
3.4 You may Convey Covered Source or modified Covered Source under
|
||||
licence terms which differ from the terms of this Licence
|
||||
provided that You:
|
||||
|
||||
a) comply at all times with subsection 3.3; and
|
||||
|
||||
b) provide a copy of this Licence to anyone to whom You
|
||||
Convey Covered Source or modified Covered Source.
|
||||
|
||||
|
||||
4 Making and Conveying Products
|
||||
|
||||
You may Make Products, and/or Convey them, provided that You ensure
|
||||
that the recipient of the Product has access to any Notices applicable
|
||||
to the Product.
|
||||
|
||||
|
||||
5 DISCLAIMER AND LIABILITY
|
||||
|
||||
5.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
|
||||
are provided 'as is' and any express or implied warranties,
|
||||
including, but not limited to, implied warranties of
|
||||
merchantability, of satisfactory quality, non-infringement of
|
||||
third party rights, and fitness for a particular purpose or use
|
||||
are disclaimed in respect of any Source or Product to the
|
||||
maximum extent permitted by law. The Licensor makes no
|
||||
representation that any Source or Product does not or will not
|
||||
infringe any patent, copyright, trade secret or other
|
||||
proprietary right. The entire risk as to the use, quality, and
|
||||
performance of any Source or Product shall be with You and not
|
||||
the Licensor. This disclaimer of warranty is an essential part
|
||||
of this Licence and a condition for the grant of any rights
|
||||
granted under this Licence.
|
||||
|
||||
5.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
|
||||
the maximum extent permitted by law, have no liability for
|
||||
direct, indirect, special, incidental, consequential, exemplary,
|
||||
punitive or other damages of any character including, without
|
||||
limitation, procurement of substitute goods or services, loss of
|
||||
use, data or profits, or business interruption, however caused
|
||||
and on any theory of contract, warranty, tort (including
|
||||
negligence), product liability or otherwise, arising in any way
|
||||
in relation to the Covered Source, modified Covered Source
|
||||
and/or the Making or Conveyance of a Product, even if advised of
|
||||
the possibility of such damages, and You shall hold the
|
||||
Licensor(s) free and harmless from any liability, costs,
|
||||
damages, fees and expenses, including claims by third parties,
|
||||
in relation to such use.
|
||||
|
||||
|
||||
6 Patents
|
||||
|
||||
6.1 Subject to the terms and conditions of this Licence, each
|
||||
Licensor hereby grants to You a perpetual, worldwide,
|
||||
non-exclusive, no-charge, royalty-free, irrevocable (except as
|
||||
stated in this section 6, or where terminated by the Licensor
|
||||
for cause) patent licence to Make, have Made, use, offer to
|
||||
sell, sell, import, and otherwise transfer the Covered Source
|
||||
and Products, where such licence applies only to those patent
|
||||
claims licensable by such Licensor that are necessarily
|
||||
infringed by exercising rights under the Covered Source as
|
||||
Conveyed by that Licensor.
|
||||
|
||||
6.2 If You institute patent litigation against any entity (including
|
||||
a cross-claim or counterclaim in a lawsuit) alleging that the
|
||||
Covered Source or a Product constitutes direct or contributory
|
||||
patent infringement, or You seek any declaration that a patent
|
||||
licensed to You under this Licence is invalid or unenforceable
|
||||
then any rights granted to You under this Licence shall
|
||||
terminate as of the date such process is initiated.
|
||||
|
||||
|
||||
7 General
|
||||
|
||||
7.1 If any provisions of this Licence are or subsequently become
|
||||
invalid or unenforceable for any reason, the remaining
|
||||
provisions shall remain effective.
|
||||
|
||||
7.2 You shall not use any of the name (including acronyms and
|
||||
abbreviations), image, or logo by which the Licensor or CERN is
|
||||
known, except where needed to comply with section 3, or where
|
||||
the use is otherwise allowed by law. Any such permitted use
|
||||
shall be factual and shall not be made so as to suggest any kind
|
||||
of endorsement or implication of involvement by the Licensor or
|
||||
its personnel.
|
||||
|
||||
7.3 CERN may publish updated versions and variants of this Licence
|
||||
which it considers to be in the spirit of this version, but may
|
||||
differ in detail to address new problems or concerns. New
|
||||
versions will be published with a unique version number and a
|
||||
variant identifier specifying the variant. If the Licensor has
|
||||
specified that a given variant applies to the Covered Source
|
||||
without specifying a version, You may treat that Covered Source
|
||||
as being released under any version of the CERN-OHL with that
|
||||
variant. If no variant is specified, the Covered Source shall be
|
||||
treated as being released under CERN-OHL-S. The Licensor may
|
||||
also specify that the Covered Source is subject to a specific
|
||||
version of the CERN-OHL or any later version in which case You
|
||||
may apply this or any later version of CERN-OHL with the same
|
||||
variant identifier published by CERN.
|
||||
|
||||
7.4 This Licence shall not be enforceable except by a Licensor
|
||||
acting as such, and third party beneficiary rights are
|
||||
specifically excluded.
|
||||
@@ -1,42 +0,0 @@
|
||||
RP2040-Decoder
|
||||
===============
|
||||
|
||||
This Project is a DIY DCC Decoder for model railroad locomotives which aims to be cost effective.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- DCC digital signal decoding
|
||||
- Motor load/speed control
|
||||
- 4 Outputs to drive loads up to 400mA each
|
||||
- 6 GPIO for lighter loads or custom applications
|
||||
- Programmable on programming track
|
||||
- CV Function Mapping
|
||||
- Board size of 25x20 mm
|
||||
|
||||
Getting Started
|
||||
------------
|
||||
|
||||
|
||||
The ["Getting Started"](https://github.com/gab-k/RP2040-Decoder/wiki/Getting-started) page provides an overview of the steps required to use the decoder as well as brief instructions for all the necessary steps.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
- Software - MIT license
|
||||
- Hardware - CERN Open Hardware Licence Version 2 - Permissive
|
||||
- [LICENSE](https://github.com/1nct/RP2040-Decoder/blob/main/LICENSE)
|
||||
|
||||
------------
|
||||
Further details about the project can be found here: [RP2040-Decoder Wiki](https://github.com/GabrielKoppenstein/pico-decoder/wiki)
|
||||
|
||||
Note: The decoder is still in early development, there might (will) be bugs as its not tested that much yet.
|
||||
So suggestions on how to improve things and bug reports are always much appreciated.
|
||||
The wiki is also work in progress and will be updated to be as comprehensive as possible.
|
||||
|
||||
------------
|
||||
<p float="left">
|
||||
<img src="/docs/png/RP2040-Decoder-Rev_0_2_front.png" alt="PCB Front Side Image" title="Front" width="400"/>
|
||||
<img src="/docs/png/RP2040-Decoder-Rev_0_2_back.png" alt="PCB Back Side Image" title="Back" width="400"/>
|
||||
</p>
|
||||
|
||||
@@ -1,678 +0,0 @@
|
||||
//////////////////////////
|
||||
// RP2040-Decoder //
|
||||
// Gabriel Koppenstein //
|
||||
// core0.c //
|
||||
//////////////////////////
|
||||
|
||||
#include "core0.h"
|
||||
// XIP_BASE + FLASH_TARGET_OFFSET = "0x101FF000" <- This address need to be smaller than __flash_binary_end stored in RP2040-Decoder.elf.map
|
||||
const uint8_t *CV_ARRAY_FLASH = (const uint8_t *) (XIP_BASE + FLASH_TARGET_OFFSET);
|
||||
uint64_t input_bit_buffer = 0;
|
||||
uint16_t level_table[32] = {0};
|
||||
absolute_time_t falling_edge_time,rising_edge_time;
|
||||
|
||||
|
||||
// Function returns average of values deviating less than twice the standard deviation from original average
|
||||
float two_std_dev(const float arr[], uint32_t length){
|
||||
// Calculate arithmetic average
|
||||
float sum = 0;
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
sum += arr[i];
|
||||
}
|
||||
float x_avg = sum / (float)length;
|
||||
|
||||
// Calculate sample variance and sampled standard deviation
|
||||
sum = 0;
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
sum += (arr[i]-x_avg)*(arr[i]-x_avg);
|
||||
}
|
||||
float variance = sum / (float)(length-1);
|
||||
float std_dev = sqrtf(variance);
|
||||
|
||||
// Sum every element that is within two times the sampled standard deviation and compute new average
|
||||
sum = 0;
|
||||
uint32_t counter = 0;
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
float diff = fabsf(arr[i]-x_avg);
|
||||
if ( diff < std_dev*2.0f ){
|
||||
sum += arr[i];
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
return sum / (float)counter;
|
||||
}
|
||||
|
||||
|
||||
// Measures constant adc offset and programs the offset into flash
|
||||
void adc_offset_adjustment(uint32_t n){
|
||||
LOG(1, "adc_offset_adjustment\n");
|
||||
|
||||
float offsets_fwd[n];
|
||||
float offsets_rev[n];
|
||||
// Set PWM level to 0 just to be sure
|
||||
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
|
||||
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
|
||||
busy_wait_ms(1000);
|
||||
|
||||
// Measure n times in "reverse direction" (GPIO 28)
|
||||
adc_select_input(2);
|
||||
adc_run(true);
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
offsets_rev[i] = (float)adc_fifo_get_blocking();
|
||||
}
|
||||
adc_run(false);
|
||||
adc_fifo_drain();
|
||||
busy_wait_ms(1000);
|
||||
|
||||
// Measure n times in "forward direction" (GPIO 29)
|
||||
adc_select_input(3);
|
||||
adc_run(true);
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
offsets_fwd[i] = (float)adc_fifo_get_blocking();
|
||||
}
|
||||
adc_run(false);
|
||||
adc_fifo_drain();
|
||||
|
||||
// Find overall average discarding outliers in measurement
|
||||
float offset_avg_fwd = two_std_dev(offsets_fwd, n);
|
||||
float offset_avg_rev = two_std_dev(offsets_rev, n);
|
||||
float overall_avg = (offset_avg_fwd+offset_avg_rev)/2;
|
||||
uint8_t offset = (uint8_t)roundf(overall_avg);
|
||||
|
||||
LOG(1, "new adc offset CV[171] (%f): (uint8_t)%d\n", overall_avg, offset);
|
||||
|
||||
// Create temporary array -> change CV 172 in temp array -> erase flash -> write temp array to flash
|
||||
uint8_t CV_ARRAY_TEMP[CV_ARRAY_SIZE];
|
||||
memcpy(CV_ARRAY_TEMP, CV_ARRAY_FLASH, sizeof(CV_ARRAY_TEMP));
|
||||
CV_ARRAY_TEMP[171] = offset;
|
||||
flash_range_erase(FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE);
|
||||
flash_range_program(FLASH_TARGET_OFFSET, CV_ARRAY_TEMP, FLASH_PAGE_SIZE * 2);
|
||||
}
|
||||
|
||||
|
||||
// Confirmation after writing or verifying a CV
|
||||
// Works by creating a spike in current consumption, this is detected by the command station
|
||||
void acknowledge() {
|
||||
uint16_t max_lvl = _125M/(CV_ARRAY_FLASH[8]*100+10000);
|
||||
pwm_set_gpio_level(MOTOR_FWD_PIN, max_lvl);
|
||||
busy_wait_ms(3);
|
||||
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
|
||||
pwm_set_gpio_level(MOTOR_REV_PIN, max_lvl);
|
||||
busy_wait_ms(3);
|
||||
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
|
||||
}
|
||||
|
||||
|
||||
// When bit matches sent byte -> acknowledge()
|
||||
void verify_cv_bit(uint16_t cv_address,bool bit_val, uint8_t bit_pos) {
|
||||
uint8_t mask = 0b00000001;
|
||||
bool res = ( (CV_ARRAY_FLASH[cv_address] >> bit_pos) &mask ) == bit_val;
|
||||
if (res) {
|
||||
acknowledge();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// When byte matches sent byte -> acknowledge()
|
||||
void verify_cv_byte(uint16_t cv_address, uint8_t cv_data){
|
||||
if (CV_ARRAY_FLASH[cv_address] == cv_data) acknowledge();
|
||||
}
|
||||
|
||||
|
||||
// CV writing function first erases necessary amount of blocks in flash and then rewrites to flash
|
||||
void regular_cv_write(uint16_t cv_index, uint8_t cv_data){
|
||||
uint8_t CV_ARRAY_TEMP[CV_ARRAY_SIZE];
|
||||
memcpy(CV_ARRAY_TEMP, CV_ARRAY_FLASH, sizeof(CV_ARRAY_TEMP));
|
||||
CV_ARRAY_TEMP[cv_index] = cv_data;
|
||||
flash_range_erase(FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE);
|
||||
flash_range_program(FLASH_TARGET_OFFSET, CV_ARRAY_TEMP, FLASH_PAGE_SIZE * 2);
|
||||
acknowledge();
|
||||
}
|
||||
|
||||
|
||||
// There are some exceptions to writing CVs - e.g. writing to a read only CV is not valid - this gets handled here
|
||||
void write_cv_handler(uint16_t cv_index, uint8_t cv_data){
|
||||
switch (cv_index) {
|
||||
case 0: //CV_1
|
||||
// CV_1 => Value = 0 is not allowed
|
||||
if (cv_data == 0 || cv_data > 127)
|
||||
break;
|
||||
else
|
||||
regular_cv_write(cv_index,cv_data);
|
||||
break;
|
||||
case 6: //CV_7
|
||||
// Read only (CV_7 - Version no.)
|
||||
// ADC offset Adjustment (CV_7; Value = 7);
|
||||
if (cv_data == 7) {
|
||||
LOG(1, "trigger adc offset adjustment via cv7 => 7\n");
|
||||
adc_offset_adjustment(8192);
|
||||
}
|
||||
break;
|
||||
case 7: //CV_8
|
||||
// Read only (CV_8 - Manufacturer ID)
|
||||
// Reset all CVs to Default (CV_8; Value = 8)
|
||||
if (cv_data == 8){
|
||||
LOG(1, "reset of flash triggered via cv8 => 8\n");
|
||||
flash_range_erase(FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE);
|
||||
flash_range_program(FLASH_TARGET_OFFSET, CV_ARRAY_DEFAULT, FLASH_PAGE_SIZE * 2);
|
||||
}
|
||||
break;
|
||||
// CV_17 must have a value between 11000000->(192dec) and 11100111->(231dec) inclusive
|
||||
// CV_17 == 192 && CV_18 == 0 -> Address = 0 is also not valid and therefore shall not be set
|
||||
case 16: //CV_17
|
||||
if ( (cv_data < 192 || cv_data > 231) || (CV_ARRAY_FLASH[17] == 0 && cv_data == 192) )
|
||||
break;
|
||||
else
|
||||
regular_cv_write(cv_index,cv_data);
|
||||
break;
|
||||
case 17: //CV_18
|
||||
if(CV_ARRAY_FLASH[16] == 192 && cv_data == 0)
|
||||
break;
|
||||
else
|
||||
regular_cv_write(cv_index,cv_data);
|
||||
break;
|
||||
// CV_31 & CV_32 Index high byte isn't implemented and shall not be set
|
||||
case 30: //CV_31
|
||||
case 31: //CV_32
|
||||
break;
|
||||
// Regular CV write is carried out
|
||||
default:
|
||||
regular_cv_write(cv_index,cv_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CV Programming function resets core1 and evaluates the type of programming instruction (e.g. write byte)
|
||||
void program_mode(uint8_t number_of_bytes, const uint8_t * const byte_array) {
|
||||
//First check for valid programming command ("address" 112-127)
|
||||
if (byte_array[number_of_bytes - 1]<128 && byte_array[number_of_bytes - 1]>111) {
|
||||
uint8_t instruction_type_mask = 0b00001100;
|
||||
uint8_t instruction_type = instruction_type_mask & byte_array[number_of_bytes - 1];
|
||||
uint8_t cv_address_ms_bits_mask = 0b00000011;
|
||||
uint16_t cv_address_ms_bits = cv_address_ms_bits_mask & byte_array[number_of_bytes - 1];
|
||||
uint16_t cv_address = byte_array[number_of_bytes - 2] + (cv_address_ms_bits << 8);
|
||||
|
||||
// Before accessing flash, timers and interrupts need to be disabled and core1 needs to be shut down.
|
||||
if(pid_control_timer.pool)
|
||||
alarm_pool_destroy(pid_control_timer.pool);
|
||||
if(speed_helper_timer.pool)
|
||||
alarm_pool_destroy(speed_helper_timer.pool);
|
||||
|
||||
multicore_reset_core1();
|
||||
|
||||
uint32_t saved_interrupts = save_and_disable_interrupts();
|
||||
|
||||
// Verify CV bit instruction
|
||||
if (instruction_type == 0b000001000) {
|
||||
uint8_t bit_pos_mask = 0b00000111;
|
||||
uint8_t bit_pos = bit_pos_mask&byte_array[number_of_bytes - 3];
|
||||
uint8_t bit_val_mask = 0b00000001;
|
||||
uint8_t bit_val_uint = (byte_array[number_of_bytes - 3]>>3) & bit_val_mask;
|
||||
bool bit_val = bit_val_uint;
|
||||
verify_cv_bit(cv_address, bit_val, bit_pos);
|
||||
}
|
||||
|
||||
// Verify CV byte instruction
|
||||
else if (instruction_type == 0b000000100) {
|
||||
uint8_t cv_data = byte_array[number_of_bytes - 3];
|
||||
verify_cv_byte(cv_address, cv_data);
|
||||
}
|
||||
|
||||
// Write CV byte instruction
|
||||
else if (instruction_type == 0b000001100) {
|
||||
uint8_t cv_data = byte_array[number_of_bytes - 3];
|
||||
write_cv_handler(cv_address, cv_data);
|
||||
}
|
||||
|
||||
// Restore interrupts
|
||||
restore_interrupts(saved_interrupts);
|
||||
busy_wait_ms(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set outputs according to configuration (PWM on/off, PWM duty cycle/level, ...)
|
||||
void set_outputs(uint32_t functions_to_set_bitmask) {
|
||||
// Get outputs with pwm enabled and preset outputs_to_set_PWM variable with resulting GPIO Bitmask
|
||||
uint32_t PWM_enabled_outputs = get_32bit_CV(111);
|
||||
uint32_t outputs_to_set_PWM = PWM_enabled_outputs;
|
||||
|
||||
// Get enabled output configuration corresponding to set functions and direction
|
||||
uint32_t outputs_to_set = 0;
|
||||
uint32_t temp_mask = 1;
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
if (temp_mask & functions_to_set_bitmask ){
|
||||
outputs_to_set |= get_32bit_CV(i * 8 + 260 - 4 * get_direction(0));
|
||||
}
|
||||
temp_mask<<=1;
|
||||
}
|
||||
outputs_to_set_PWM &= outputs_to_set; // Outputs with PWM to be enabled
|
||||
outputs_to_set &= ~outputs_to_set_PWM; // Outputs without PWM to be enabled
|
||||
|
||||
// Set regular outputs without PWM, preventing illegal GPIO by masking with GPIO_ALLOWED_OUTPUTS
|
||||
gpio_put_masked(GPIO_ALLOWED_OUTPUTS, outputs_to_set);
|
||||
|
||||
// Set PWM enabled outputs to desired level
|
||||
temp_mask = 1;
|
||||
for (uint8_t i = 0; i < 32; ++i) {
|
||||
if(temp_mask & outputs_to_set_PWM){
|
||||
pwm_set_gpio_level(i, level_table[i]);
|
||||
pwm_gpio_to_channel(i);
|
||||
pwm_gpio_to_slice_num(i);
|
||||
}
|
||||
else if (temp_mask & PWM_enabled_outputs){
|
||||
pwm_set_gpio_level(i,0);
|
||||
}
|
||||
temp_mask<<=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update functions F0 - F31 when function command is received or in case of direction change
|
||||
void update_active_functions(uint32_t new_function_bitmask, uint8_t clr_bit_ind, bool direction_change) {
|
||||
static uint32_t active_functions;
|
||||
static uint32_t prev_active_func;
|
||||
|
||||
// Outputs depend on direction
|
||||
// In case of a direction change every output needs to be set according to configuration for the other direction
|
||||
if (direction_change) set_outputs(active_functions);
|
||||
|
||||
// In case of a change in active functions only the function group corresponding to the instruction is considered
|
||||
// Check for changes and set outputs accordingly
|
||||
else{
|
||||
new_function_bitmask &= ~(clr_bit_arr[clr_bit_ind]); // Clear every bit except bits corresponding to group of functions
|
||||
active_functions &= clr_bit_arr[clr_bit_ind]; // Clear bits corresponding to group of functions
|
||||
active_functions |= new_function_bitmask; // Write bits corresponding to group of functions
|
||||
uint32_t changes = active_functions ^ prev_active_func; // Checks for changes from previous state
|
||||
if(changes) set_outputs(active_functions);
|
||||
prev_active_func = active_functions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Bitwise XOR for all Bytes -> Successful result is: "0000 0000"
|
||||
bool error_detection(int8_t number_of_bytes, const uint8_t * const byte_array) {
|
||||
uint8_t xor_byte = 0;
|
||||
for (int i = 0; i < number_of_bytes; i++) {
|
||||
xor_byte = xor_byte ^ byte_array[i];
|
||||
}
|
||||
return (0 == xor_byte);
|
||||
}
|
||||
|
||||
|
||||
// Check for long address. Function returns true for long address.
|
||||
bool is_long_address(uint8_t number_of_bytes, const uint8_t * const byte_array) {
|
||||
if ((byte_array[number_of_bytes - 1]>>6) == 0b00000011) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// First checks for idle package and then evaluates address included in byte_array[]
|
||||
bool address_evaluation(uint8_t number_of_bytes,const uint8_t * const byte_array) {
|
||||
// Check for Idle Package
|
||||
if (byte_array[number_of_bytes - 1] == 255)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Long/extended address decoder configuration (CV_29 Bit5)
|
||||
bool CV_29_bit5 = (CV_ARRAY_FLASH[28]&0b00100000)>>5;
|
||||
uint16_t read_address;
|
||||
// Decoder configured to receive long/extended address
|
||||
if (CV_29_bit5){
|
||||
// Package received does contain a long address -> Check for accordance
|
||||
if (is_long_address(number_of_bytes, byte_array))
|
||||
{
|
||||
// start of transmission -> address_byte_1 -> address_byte_0 -> ... -> end of transmission
|
||||
uint16_t address_byte_1 = (byte_array[number_of_bytes - 1]) - 192; // Remove long address identifier bits
|
||||
uint16_t address_byte_0 = (byte_array[number_of_bytes - 2]);
|
||||
read_address = (address_byte_1 << 8) + address_byte_0;
|
||||
uint16_t long_address = get_16bit_CV(16) & 0x3FFF; // &Mask to remove long address identifier bits
|
||||
return (long_address == read_address);
|
||||
}
|
||||
// Package received does not contain a long address
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
// Short address decoder configuration (CV_29 Bit5)
|
||||
else
|
||||
{
|
||||
// Short Address Package
|
||||
// start of transmission -> address_byte_0 -> ... -> end of transmission
|
||||
read_address = (byte_array[number_of_bytes - 1]);
|
||||
return (CV_ARRAY_FLASH[0] == read_address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate the type of instruction
|
||||
void instruction_evaluation(uint8_t number_of_bytes,const uint8_t * const byte_array) {
|
||||
// start of transmission -> ... -> command_byte_n -> ... -> command_byte_0 -> ... -> end of transmission
|
||||
// The position of command bytes depend on whether the address is long or not
|
||||
uint8_t command_byte_n;
|
||||
uint8_t command_byte_start_index;
|
||||
if (is_long_address(number_of_bytes,byte_array)) {
|
||||
command_byte_start_index = number_of_bytes - 3;
|
||||
}
|
||||
else {
|
||||
command_byte_start_index = number_of_bytes - 2;
|
||||
}
|
||||
command_byte_n = byte_array[command_byte_start_index];
|
||||
|
||||
//0011-1111 (128 Speed Step Control) - 2 Byte length
|
||||
if (command_byte_n == 0b00111111){
|
||||
static bool prev_dir;
|
||||
uint32_t speed_step = byte_array[command_byte_start_index - 1];
|
||||
// LOG(1, "new speed %d", speed_step);
|
||||
multicore_fifo_push_blocking(speed_step);
|
||||
// LOG(1, " submitted to list\n");
|
||||
// In case of a direction change, functions need to be updated because functions might depend on direction state
|
||||
if (get_direction(0) != prev_dir) {
|
||||
update_active_functions(0,0,true);
|
||||
prev_dir = get_direction(0);
|
||||
}
|
||||
}
|
||||
|
||||
// 10XX-XXXX (Function Group Instruction)
|
||||
else if (command_byte_n >> 6 == 0b00000010){
|
||||
switch (command_byte_n >> 4) {
|
||||
case 0b00001011: // F5-F8
|
||||
update_active_functions((command_byte_n << 5),1,false);
|
||||
break;
|
||||
case 0b00001010: // F9-F12
|
||||
update_active_functions((command_byte_n << 9),2,false);
|
||||
break;
|
||||
default: // F0-F4
|
||||
update_active_functions(((command_byte_n << 1) + (command_byte_n >> 4)),0,false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Feature Expansion Instruction 110X-XXXX
|
||||
else if (command_byte_n >> 5 == 0b00000110) {
|
||||
switch (command_byte_n) {
|
||||
case 0b11011110: // F13-F20
|
||||
update_active_functions((byte_array[command_byte_start_index - 1] << 13),3,false);
|
||||
break;
|
||||
case 0b11011111: // F21-F28
|
||||
update_active_functions((byte_array[command_byte_start_index - 1] << 21),4,false);
|
||||
break;
|
||||
case 0b11011000: // F29-F31
|
||||
update_active_functions((byte_array[command_byte_start_index - 1] << 29),5,false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for reset package - When reset package is found stop the motor and disable all functions
|
||||
bool reset_package_check(uint8_t number_of_bytes,const uint8_t * const byte_array){
|
||||
if (byte_array[number_of_bytes-1] == 0b00000000 && byte_array[number_of_bytes-2] == 0b00000000){
|
||||
uint32_t speed_step = 1;
|
||||
multicore_fifo_push_blocking(speed_step); // Emergency Stop
|
||||
update_active_functions(0,0,0); // Disables all functions
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
// Checks for valid package - looking for correct preamble
|
||||
int8_t check_for_package() { //returns number of bytes if valid bit-pattern is found. Otherwise -1 is returned.
|
||||
uint64_t package3Masked = input_bit_buffer & PACKAGE_MASK_3_BYTES;
|
||||
if (package3Masked == PACKAGE_3_BYTES) return 3;
|
||||
uint64_t package4Masked = input_bit_buffer & PACKAGE_MASK_4_BYTES;
|
||||
if (package4Masked == PACKAGE_4_BYTES) return 4;
|
||||
uint64_t package5Masked = input_bit_buffer & PACKAGE_MASK_5_BYTES;
|
||||
if (package5Masked == PACKAGE_5_BYTES) return 5;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//start of transmission -> byte_n(address byte) -> ... -> byte_0(error detection byte) -> end of transmission
|
||||
void bits_to_byte_array(int8_t number_of_bytes,uint8_t byte_array[]) {
|
||||
for (uint8_t i = 0; i < number_of_bytes; i++) {
|
||||
byte_array[i] = input_bit_buffer >> (i * 9 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sequence of bits gets evaluated
|
||||
void evaluation(){
|
||||
static bool core1_launched = false;
|
||||
static bool reset_package_flag;
|
||||
int8_t number_of_bytes = check_for_package();
|
||||
// number_of_bytes contains the amount of bytes when the package is valid, otherwise -1
|
||||
if (number_of_bytes != -1) {
|
||||
// Split data into 8Bit array
|
||||
uint8_t byte_array[SIZE_BYTE_ARRAY] = {0};
|
||||
bits_to_byte_array(number_of_bytes,byte_array);
|
||||
// Check for errors
|
||||
if (error_detection(number_of_bytes,byte_array)) {
|
||||
// Check for matching address
|
||||
if (address_evaluation(number_of_bytes,byte_array)) {
|
||||
reset_package_flag = false;
|
||||
if (!core1_launched){
|
||||
multicore_launch_core1(core1_entry);
|
||||
// Wait for pid.direction pointer via multicore fifo also signalizing that core1 initialization is finished.
|
||||
get_direction((bool *) multicore_fifo_pop_blocking());
|
||||
core1_launched = true;
|
||||
}
|
||||
instruction_evaluation(number_of_bytes,byte_array);
|
||||
}
|
||||
// When previous packet was a reset package -> enter program mode
|
||||
else if (reset_package_flag) {
|
||||
program_mode(number_of_bytes,byte_array);
|
||||
}
|
||||
// Check for reset package and set flag when reset package is received
|
||||
else {
|
||||
reset_package_flag = reset_package_check(number_of_bytes,byte_array);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DCC-Signal (GPIO 21) rising edge interrupt
|
||||
void track_signal_rise(unsigned int gpio, long unsigned int events) {
|
||||
// Save current timer value
|
||||
rising_edge_time = get_absolute_time();
|
||||
// Disable rising edge interrupt and enable falling edge interrupt
|
||||
gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_RISE, false, &track_signal_rise);
|
||||
gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_FALL, true, &track_signal_fall);
|
||||
}
|
||||
|
||||
|
||||
// DCC-Signal (GPIO 21) falling edge interrupt
|
||||
void track_signal_fall(unsigned int gpio, long unsigned int events) {
|
||||
// Save current timer value
|
||||
falling_edge_time = get_absolute_time();
|
||||
// Time difference is equal to the time the signal was in a logical high state
|
||||
int64_t time_logical_high = absolute_time_diff_us(rising_edge_time,falling_edge_time);
|
||||
// When logical high was longer than 87us write 0 bit into buffer otherwise 1
|
||||
bool bit;
|
||||
if(time_logical_high > 87) bit = 0;
|
||||
else bit = 1;
|
||||
input_bit_buffer <<= 1;
|
||||
input_bit_buffer |= bit;
|
||||
// evaluate sequence of bits saved in buffer
|
||||
evaluation();
|
||||
// Disable falling edge interrupt and enable rising edge interrupt
|
||||
gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_FALL, false, &track_signal_fall);
|
||||
gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_RISE, true, &track_signal_rise);
|
||||
}
|
||||
|
||||
|
||||
// Output initialization function - Configures pwm frequency and clock divider according to CV_111 - CV_171
|
||||
void init_outputs(){
|
||||
gpio_init_mask(GPIO_ALLOWED_OUTPUTS);
|
||||
gpio_set_dir_out_masked(GPIO_ALLOWED_OUTPUTS); // Note: This might also disable UART on GPIO0 & GPIO1
|
||||
uint32_t PWM_enabled_outputs = get_32bit_CV(111) & GPIO_ALLOWED_OUTPUTS;
|
||||
uint32_t slice, channel;
|
||||
uint16_t wrap, level;
|
||||
uint8_t clock_divider;
|
||||
uint32_t mask = 1;
|
||||
for (uint8_t i = 0; i < 32; ++i) {
|
||||
if (PWM_enabled_outputs & mask){
|
||||
slice = pwm_gpio_to_slice_num(i);
|
||||
channel = pwm_gpio_to_channel(i); // Channel A = "0"; Channel B = "1"
|
||||
wrap = get_16bit_CV(115 + 7*slice);
|
||||
level = get_16bit_CV(118 + 7*slice + 2*channel);
|
||||
clock_divider = CV_ARRAY_FLASH[117+7*slice] + 1;
|
||||
gpio_set_function(i,GPIO_FUNC_PWM);
|
||||
pwm_set_wrap(slice,wrap);
|
||||
pwm_set_gpio_level(i,0);
|
||||
level_table[i] = level;
|
||||
pwm_set_clkdiv_int_frac(slice,clock_divider,0);
|
||||
pwm_set_enabled(slice,true);
|
||||
}
|
||||
mask<<=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Measures "base" pwm duty cycle needed to overcome friction
|
||||
uint16_t measure_base_pwm(bool direction, uint8_t iterations){
|
||||
uint gpio;
|
||||
if (direction) gpio = MOTOR_FWD_PIN;
|
||||
else gpio = MOTOR_REV_PIN;
|
||||
float level_arr[iterations];
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
uint16_t max_level = _125M/(CV_ARRAY_FLASH[8]*100+10000);
|
||||
uint16_t level = max_level/20;
|
||||
LOG(3, "iteration %d: maxlevel %d level %d\n", i, max_level, level);
|
||||
float measurement;
|
||||
do {
|
||||
pwm_set_gpio_level(gpio, level);
|
||||
busy_wait_ms(30);
|
||||
level += max_level/500;
|
||||
measurement = measure(CV_ARRAY_FLASH[60],
|
||||
CV_ARRAY_FLASH[61],
|
||||
CV_ARRAY_FLASH[62],
|
||||
CV_ARRAY_FLASH[63],
|
||||
direction);
|
||||
LOG(3, "level %d measurement %f loop-cond: %f\n", level, measurement, measurement-(float)CV_ARRAY_FLASH[171]);
|
||||
if (level > max_level) {
|
||||
// Abort measurement and write default value of 0 to flash
|
||||
LOG(1, "measure_base_pwm: abort measurement and return 0\n");
|
||||
return 0;
|
||||
}
|
||||
} while((measurement - (float)CV_ARRAY_FLASH[171]) < 5.0f);
|
||||
LOG(3, "level_arr[%d] = %f\n", i, level);
|
||||
level_arr[i] = (float)level;
|
||||
busy_wait_ms(100);
|
||||
}
|
||||
// Find and return overall average discarding outliers in measurement - multiply with 0.9
|
||||
float retVal = 0.9f*two_std_dev(level_arr,5);
|
||||
LOG(1, "measure_base_pwm: %d(%f)\n", (uint16_t)retVal, retVal);
|
||||
return (uint16_t)(retVal);
|
||||
}
|
||||
|
||||
|
||||
// Check for flash memory factory condition and adc offset setup
|
||||
// When factory condition is found the CV_ARRAY_DEFAULT will be written into flash
|
||||
// When ADC Setup is not configured run adc offset adjustment function and write adc offset into flash
|
||||
void cv_setup_check(){
|
||||
// Check for flash factory setting and set CV_FLASH_ARRAY to default values when factory condition ("0xFF") is found.
|
||||
if ( CV_ARRAY_FLASH[64] == 0xFF ){
|
||||
LOG(1, "found cv[64] equals to 0xff, reseting CVs (and CV[8] = 8)\n");
|
||||
uint8_t arr[4] = {125,8,7,124};
|
||||
program_mode(4,arr); //reset to CV_ARRAY_DEFAULT (write CV_8 = 8)
|
||||
}
|
||||
|
||||
// Check for adc offset setup
|
||||
if ( CV_ARRAY_FLASH[171] == 0xFF ){
|
||||
LOG(1, "found cv[171] equals to 0xff, adc offset adjstments (and cr[7] = 7)\n");
|
||||
uint8_t arr[4] = {125,7,6,124};
|
||||
program_mode(4,arr); //ADC offset adjustment (write CV_7 = 7)
|
||||
}
|
||||
|
||||
// Check for base PWM configuration - used for feed-forward
|
||||
// Forward Direction
|
||||
if (get_16bit_CV(175) == 0){
|
||||
LOG(1, "found cv[175] equals to 0, forward direction\n");
|
||||
uint16_t base_pwm_fwd = measure_base_pwm(true,10);
|
||||
uint8_t base_pwm_fwd_high_byte = base_pwm_fwd>>8;
|
||||
uint8_t base_pwm_fwd_low_byte = base_pwm_fwd&0x00FF;
|
||||
uint8_t arr0[4] = {125,base_pwm_fwd_high_byte,175,124};
|
||||
program_mode(4,arr0);
|
||||
uint8_t arr1[4] = {125,base_pwm_fwd_low_byte,176,124};
|
||||
program_mode(4,arr1);
|
||||
}
|
||||
// Reverse Direction
|
||||
if (get_16bit_CV(177) == 0){
|
||||
LOG(1, "found cv[177] equals to 0, reverse direction\n");
|
||||
uint16_t base_pwm_rev = measure_base_pwm(false,10);
|
||||
uint8_t base_pwm_rev_high_byte = base_pwm_rev>>8;
|
||||
uint8_t base_pwm_rev_low_byte = base_pwm_rev&0x00FF;
|
||||
uint8_t arr0[4] = {125,base_pwm_rev_high_byte,177,124};
|
||||
program_mode(4,arr0);
|
||||
uint8_t arr1[4] = {125,base_pwm_rev_low_byte,178,124};
|
||||
program_mode(4,arr1);
|
||||
}
|
||||
LOG(1, "int_lim_max %d\n", CV_ARRAY_FLASH[51]);
|
||||
LOG(1, "int_lim_min %d\n", CV_ARRAY_FLASH[52]);
|
||||
}
|
||||
|
||||
|
||||
// This function ensures that the direction pointer can only be written once.
|
||||
// After first initialization this function can be called with arbitrary input to get the current direction
|
||||
bool get_direction(bool *direction_ptr){
|
||||
static bool set_flag;
|
||||
static bool *dir_ptr;
|
||||
if(!set_flag) {
|
||||
dir_ptr = direction_ptr;
|
||||
set_flag = true;
|
||||
}
|
||||
return *dir_ptr;
|
||||
}
|
||||
|
||||
|
||||
// Motor PWM initialization
|
||||
void init_motor_pwm(uint8_t gpio) {
|
||||
uint16_t wrap_counter = (_125M/(CV_ARRAY_FLASH[8]*100+10000)) - 1;
|
||||
uint32_t slice_num = pwm_gpio_to_slice_num(gpio);
|
||||
pwm_set_clkdiv_int_frac(slice_num,CV_ARRAY_FLASH[173],0);
|
||||
pwm_set_wrap(slice_num, wrap_counter);
|
||||
pwm_set_gpio_level(gpio,0);
|
||||
pwm_set_enabled(slice_num, true);
|
||||
|
||||
LOG(2, "init motor(%d): wrapCounter %d clkdiv %d\n", gpio, wrap_counter, CV_ARRAY_FLASH[173]);
|
||||
}
|
||||
|
||||
|
||||
// Main initialization - GPIO Config / ADC Config
|
||||
void init_gpio_adc(){
|
||||
if(gpio_get_function(MOTOR_FWD_PIN) != 4){
|
||||
gpio_set_function(MOTOR_FWD_PIN, GPIO_FUNC_PWM);
|
||||
gpio_set_function(MOTOR_REV_PIN, GPIO_FUNC_PWM);
|
||||
adc_init();
|
||||
adc_gpio_init(FWD_V_EMF_ADC_PIN);
|
||||
adc_gpio_init(REV_V_EMF_ADC_PIN);
|
||||
adc_fifo_setup(true,false,0,false,false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
stdio_init_all();
|
||||
LOG(1, "\n\n======\ncore0 init\n");
|
||||
init_gpio_adc();
|
||||
LOG(1, "init motor pwms\n");
|
||||
init_motor_pwm(MOTOR_FWD_PIN);
|
||||
init_motor_pwm(MOTOR_REV_PIN);
|
||||
LOG(1, "check cvs\n");
|
||||
cv_setup_check();
|
||||
LOG(1, "init outputs\n");
|
||||
init_outputs();
|
||||
LOG(1, "init gpios\n");
|
||||
gpio_init(DCC_INPUT_PIN);
|
||||
gpio_set_dir(DCC_INPUT_PIN, GPIO_IN);
|
||||
gpio_pull_up(DCC_INPUT_PIN);
|
||||
gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_RISE, true, &track_signal_rise);
|
||||
LOG(1, "core0 done\n");
|
||||
while (1);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
//////////////////////////
|
||||
// RP2040-Decoder //
|
||||
// Gabriel Koppenstein //
|
||||
// core0.h //
|
||||
//////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "shared.h"
|
||||
#include "CV.h"
|
||||
#define SIZE_BYTE_ARRAY 5
|
||||
#define PACKAGE_3_BYTES 0b11111111110000000000000000000000000001
|
||||
#define PACKAGE_MASK_3_BYTES 0b11111111111000000001000000001000000001
|
||||
#define PACKAGE_4_BYTES 0b11111111110000000000000000000000000000000000001
|
||||
#define PACKAGE_MASK_4_BYTES 0b11111111111000000001000000001000000001000000001
|
||||
#define PACKAGE_5_BYTES 0b11111111110000000000000000000000000000000000000000000001
|
||||
#define PACKAGE_MASK_5_BYTES 0b11111111111000000001000000001000000001000000001000000001
|
||||
const uint32_t clr_bit_arr[6] = {
|
||||
0b11111111111111111111111111100000, // Clear Bits 0-4 (F0-F4)
|
||||
0b11111111111111111111111000011111, // Clear Bits 5-8 (F5-F8)
|
||||
0b11111111111111111110000111111111, // Clear Bits 9-12 (F9-F12)
|
||||
0b11111111111000000001111111111111, // Clear Bits 13-20 (F13-F20)
|
||||
0b11100000000111111111111111111111, // Clear Bits 21-28 (F21-F28)
|
||||
0b00011111111111111111111111111111, // Clear Bits 29-31 (F29-F31)
|
||||
};
|
||||
|
||||
float two_std_dev(const float arr[], uint32_t length);
|
||||
void adc_offset_adjustment(uint32_t length);
|
||||
void acknowledge();
|
||||
void verify_cv_bit(uint16_t cv_address,bool bit_val, uint8_t bit_pos);
|
||||
void verify_cv_byte(uint16_t cv_address, uint8_t cv_data);
|
||||
void regular_cv_write(uint16_t cv_index, uint8_t cv_data);
|
||||
void write_cv_handler(uint16_t cv_index, uint8_t cv_data);
|
||||
|
||||
|
||||
#define ProgramInstrVerifyBit 0b10
|
||||
#define ProgramInstrVerifyByte 0b01
|
||||
#define ProgramInstrWriteByte 0b11
|
||||
#define ProgramCmd(instr, adrmsbits) ((instr<<2) | (adrmsbits))
|
||||
|
||||
void program_mode(uint8_t number_of_bytes, const uint8_t byte_array[]);
|
||||
void set_outputs(uint32_t functions_to_set_bitmask);
|
||||
void update_active_functions(uint32_t byte, uint8_t clr_bit_ind,bool direction_change);
|
||||
bool error_detection(int8_t number_of_bytes, const uint8_t byte_array[]);
|
||||
bool is_long_address(uint8_t number_of_bytes, const uint8_t byte_array[]);
|
||||
bool address_evaluation(uint8_t number_of_bytes,const uint8_t byte_array[]);
|
||||
void instruction_evaluation(uint8_t number_of_bytes,const uint8_t byte_array[]);
|
||||
bool reset_package_check(uint8_t number_of_bytes,const uint8_t byte_array[]);
|
||||
int8_t check_for_package();
|
||||
void bits_to_byte_array(int8_t number_of_bytes,uint8_t byte_array[]);
|
||||
void evaluation();
|
||||
void track_signal_rise(unsigned int gpio, long unsigned int events);
|
||||
void track_signal_fall(unsigned int gpio, long unsigned int events);
|
||||
void init_outputs();
|
||||
uint16_t measure_base_pwm(bool direction, uint8_t iterations);
|
||||
void cv_setup_check();
|
||||
bool get_direction(bool *direction_ptr);
|
||||
void init_motor_pwm(uint8_t gpio);
|
||||
void init_gpio_adc();
|
||||
@@ -1,337 +0,0 @@
|
||||
//////////////////////////
|
||||
// RP2040-Decoder //
|
||||
// Gabriel Koppenstein //
|
||||
// core1.c //
|
||||
//////////////////////////
|
||||
|
||||
#include "core1.h"
|
||||
struct repeating_timer pid_control_timer,speed_helper_timer;
|
||||
|
||||
|
||||
// Update speed_step_target, end_target_index and direction on receiving data from core0
|
||||
void update_speed_dir(pid_params *pid, uint32_t speed_step_target){
|
||||
pid->speed_step_target = speed_step_target;
|
||||
// When CV_29 Bit 0 is set direction is reversed
|
||||
bool reverse_dir = CV_ARRAY_FLASH[28] & 0b00000001;
|
||||
// Forward
|
||||
if(speed_step_target > 127) {
|
||||
pid->direction = true^reverse_dir;
|
||||
if (pid->speed_step_target == 128)
|
||||
pid->end_target_index = 0;
|
||||
else
|
||||
pid->end_target_index = (pid->speed_step_target-129);
|
||||
}
|
||||
// Reverse
|
||||
else {
|
||||
pid->direction = false^reverse_dir;
|
||||
if (pid->speed_step_target == 0)
|
||||
pid->end_target_index = 0;
|
||||
else
|
||||
pid->end_target_index = (pid->speed_step_target-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function gets called every x milliseconds where x is CV_175.
|
||||
// The purpose of this function is to implement a time delay in acceleration or deceleration
|
||||
bool speed_helper(struct repeating_timer *t) {
|
||||
// pid->setpoint only gets adjusted when the speed_helper_counter is equal to the accel_rate/decel_rate
|
||||
// -> Time for 1 Speed Step := (speed_helper timer delay)*(accel_rate) or CV_175*CV_3 or CV_175*CV_4
|
||||
pid_params *pid = (pid_params *)(t->user_data);
|
||||
uint8_t accel_rate = CV_ARRAY_FLASH[2];
|
||||
uint8_t decel_rate = CV_ARRAY_FLASH[3];
|
||||
static bool prev_dir;
|
||||
static uint8_t speed_helper_counter;
|
||||
static uint8_t speed_table_index;
|
||||
|
||||
// Emergency Stop
|
||||
if (pid->speed_step_target == 129 || pid->speed_step_target==1) {
|
||||
speed_table_index = 0;
|
||||
speed_helper_counter = 0;
|
||||
pid->setpoint = pid->speed_table[speed_table_index];
|
||||
}
|
||||
|
||||
// Acceleration
|
||||
else if (pid->end_target_index > speed_table_index && speed_helper_counter == accel_rate) {
|
||||
if(!accel_rate) speed_table_index = pid->end_target_index; // directly accelerate to end target speed
|
||||
else speed_table_index++;
|
||||
pid->setpoint = pid->speed_table[speed_table_index];
|
||||
speed_helper_counter = 0;
|
||||
}
|
||||
|
||||
// Deceleration
|
||||
else if (pid->end_target_index < speed_table_index && speed_helper_counter == decel_rate) {
|
||||
if(!decel_rate) speed_table_index = pid->end_target_index; // directly decelerate to end target speed
|
||||
else speed_table_index--;
|
||||
pid->setpoint = pid->speed_table[speed_table_index];
|
||||
speed_helper_counter = 0;
|
||||
}
|
||||
|
||||
// Change of direction while decelerating -> jump to most recent speed_step without delay (other direction)
|
||||
else if (pid->direction != prev_dir){
|
||||
speed_table_index = pid->end_target_index;
|
||||
pid->setpoint = pid->speed_table[speed_table_index];
|
||||
speed_helper_counter = 0;
|
||||
}
|
||||
|
||||
// Acceleration/Deceleration "scheduled"
|
||||
else if (pid->end_target_index != speed_table_index) speed_helper_counter++;
|
||||
|
||||
// Target reached -> Reset Counter
|
||||
else speed_helper_counter = 0;
|
||||
|
||||
// Save prev speed_helper direction - not to be confused with pid->prev_direction
|
||||
prev_dir = pid->direction;
|
||||
|
||||
// return true to schedule the repeating timer again
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Helper function to adjust pwm level/duty cycle.
|
||||
void adjust_pwm_level(uint16_t level, pid_params *pid) {
|
||||
// Forward
|
||||
if (pid->direction) {
|
||||
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
|
||||
pwm_set_gpio_level(MOTOR_FWD_PIN, level);
|
||||
}
|
||||
// Reverse
|
||||
else {
|
||||
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
|
||||
pwm_set_gpio_level(MOTOR_REV_PIN, level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update feed-forward slope/gradient for both directions
|
||||
void update_m(pid_params *pid){
|
||||
pid->m_fwd = (pid->y_2_fwd-pid->y_1_fwd)/(pid->x_2_fwd-pid->x_1_fwd);
|
||||
pid->m_rev = (pid->y_2_rev-pid->y_1_rev)/(pid->x_2_rev-pid->x_1_rev);
|
||||
}
|
||||
|
||||
|
||||
// Update feedforward function value y_2 in both directions
|
||||
void update_y(pid_params *pid,float i){
|
||||
// Forward
|
||||
if(pid->direction) {
|
||||
pid->y_2_fwd += i*pid->k_ff;
|
||||
// Limit y_2_fwd
|
||||
if(pid->y_2_fwd > pid->max_output) pid->y_2_fwd = pid->max_output;
|
||||
else if(pid->y_2_fwd < pid->y_1_fwd) pid->y_2_fwd = pid->y_1_fwd;
|
||||
}
|
||||
// Reverse
|
||||
else{
|
||||
pid->y_2_rev += i*pid->k_ff;
|
||||
// Limit y_2_rev
|
||||
if(pid->y_2_rev > pid->max_output) pid->y_2_rev = pid->max_output;
|
||||
else if(pid->y_2_rev < pid->y_1_rev) pid->y_2_rev = pid->y_1_rev;
|
||||
}
|
||||
|
||||
update_m(pid);
|
||||
}
|
||||
|
||||
|
||||
// Returns feedforward value corresponding to current setpoint
|
||||
float get_ff_val(pid_params *pid){
|
||||
float val;
|
||||
// Forward
|
||||
if(pid->direction){
|
||||
val = pid->m_fwd*((float)pid->setpoint-pid->x_1_fwd)+pid->y_1_fwd;
|
||||
}
|
||||
// Reverse
|
||||
else{
|
||||
val = pid->m_rev*((float)pid->setpoint-pid->x_1_rev)+pid->y_1_rev;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
// Returns proportional gain value corresponding to current setpoint
|
||||
float get_kp(pid_params *pid){
|
||||
float sp = (float)pid->setpoint;
|
||||
if (sp < pid->k_p_x_1){
|
||||
return pid->k_p_m_1 * sp + pid->k_p_y_0;
|
||||
}
|
||||
else{
|
||||
return pid->k_p_m_2 * (sp - pid->k_p_x_1) + pid->k_p_y_1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PID controller function gets called every x milliseconds where x is CV_49 aka sampling time (pid->t)
|
||||
bool pid_control(struct repeating_timer *t){
|
||||
// Cast (void *) to (pid_params *)
|
||||
pid_params *pid = (pid_params *)(t->user_data);
|
||||
|
||||
// Acceleration from standstill or change in direction -> reset previous derivative, error and integral parts
|
||||
if((!pid->setpoint_prev && !pid->setpoint) || (pid->direction != pid->direction_prev)){
|
||||
pid->d_prev = 0.0f;
|
||||
pid->i_prev = 0.0f;
|
||||
pid->e_prev = 0.0f;
|
||||
}
|
||||
|
||||
// Get feed-forward and proportional gain values
|
||||
float feed_fwd = get_ff_val(pid);
|
||||
pid->k_p = get_kp(pid);
|
||||
|
||||
// Measure BEMF voltage and compute error
|
||||
pid->measurement = measure(pid->msr_total_iterations,
|
||||
pid->msr_delay_in_us,
|
||||
pid->l_side_arr_cutoff,
|
||||
pid->r_side_arr_cutoff,
|
||||
pid->direction);
|
||||
float e = (float)pid->setpoint - (pid->measurement - pid->adc_offset);
|
||||
|
||||
// Proportional part, integral part and derivative part (including digital low-pass-filter with time constant tau)
|
||||
float p = pid->k_p * e;
|
||||
float i = pid->ci_0*(e + pid->e_prev) + pid->i_prev;
|
||||
float d = pid->cd_0*(pid->measurement-pid->measurement_prev)+pid->cd_1*pid->d_prev;
|
||||
|
||||
// Check for limits on the integral part
|
||||
if (i > pid->int_lim_max)i = pid->int_lim_max;
|
||||
else if (i < pid->int_lim_min)i = pid->int_lim_min;
|
||||
|
||||
// Sum feed forward + all controller terms (p+i+d). Limit Output from 0% to 100% duty cycle
|
||||
float output = feed_fwd+p+i+d;
|
||||
if (output < 0 || !pid->setpoint) output = 0.0f;
|
||||
else if (output > pid->max_output) output = pid->max_output;
|
||||
|
||||
if(LOGLEVEL >= 1) {
|
||||
static int counter = 0;
|
||||
counter++;
|
||||
if(counter > 100) {
|
||||
LOG(1, "pid error(%f) output(%f)\n", e, output);
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Set PWM Level and discard results in adc fifo
|
||||
adjust_pwm_level((uint16_t)roundf(output),pid);
|
||||
adc_fifo_drain();
|
||||
|
||||
// Check for High or Low Integrator values -> Update x,y values of feedforward function
|
||||
if( (output < pid->max_output && output > pid->max_output/2) && ((i > pid->int_lim_max/2) || (i < pid->int_lim_min/2)) ) update_y(pid,i);
|
||||
|
||||
// Save previous error, integrator, differentiator, direction, setpoint and measured value also sum error to e_sum
|
||||
pid->e_prev = e;
|
||||
pid->i_prev = i;
|
||||
pid->d_prev = d;
|
||||
pid->direction_prev = pid->direction;
|
||||
pid->setpoint_prev = pid->setpoint;
|
||||
pid->measurement_prev = pid->measurement;
|
||||
|
||||
// return true to schedule the repeating timer again
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// PID controller and measurement parameter, and speed_table initialization
|
||||
void init_pid(pid_params *pid){
|
||||
// Measurement variables initialization
|
||||
pid->adc_offset = (float)CV_ARRAY_FLASH[171];
|
||||
pid->msr_total_iterations = CV_ARRAY_FLASH[60];
|
||||
pid->msr_delay_in_us = CV_ARRAY_FLASH[61];
|
||||
pid->l_side_arr_cutoff = CV_ARRAY_FLASH[62];
|
||||
pid->r_side_arr_cutoff = CV_ARRAY_FLASH[63];
|
||||
|
||||
// Speed table initialization
|
||||
// Calculate speed setpoint table according to V_min, V_max and V_mid CVs
|
||||
double v_min = (double)CV_ARRAY_FLASH[1];
|
||||
double v_mid = (double)CV_ARRAY_FLASH[5]*16;
|
||||
double v_max = (double)CV_ARRAY_FLASH[4]*16;
|
||||
|
||||
LOG(1, "speedtable min(%f) mid(%f) max(%f)\n", v_min, v_mid, v_max);
|
||||
|
||||
double delta_x = 63;
|
||||
double m_1 = (v_mid-v_min)/delta_x;
|
||||
double m_2 = (v_max-v_mid)/delta_x;
|
||||
pid->speed_table[0] = 0;
|
||||
for (uint8_t i = 1; i < 64; ++i) {
|
||||
pid->speed_table[i] = (uint16_t)lround(m_1*(i-1)+v_min);
|
||||
}
|
||||
for (uint8_t i = 64; i < 127; ++i) {
|
||||
pid->speed_table[i] = (uint16_t)lround(m_2*(i-63)+v_mid);
|
||||
}
|
||||
|
||||
// Controller constants initialization
|
||||
pid->k_i = (float)CV_ARRAY_FLASH[49]/10;
|
||||
pid->k_d = (float)CV_ARRAY_FLASH[50]/10000;
|
||||
pid->tau = (float)CV_ARRAY_FLASH[47]/1000;
|
||||
pid->t = (float)CV_ARRAY_FLASH[48]/1000;
|
||||
pid->ci_0 = (pid->k_i*pid->t)/2;
|
||||
pid->cd_0 = -(2*pid->k_d)/(2*pid->tau+pid->t);
|
||||
pid->cd_1 = (2*pid->tau-pid->t)/(2*pid->tau+pid->t);
|
||||
pid->int_lim_max = 10*(float)CV_ARRAY_FLASH[51];
|
||||
pid->int_lim_min = -10*(float)CV_ARRAY_FLASH[52];
|
||||
pid->k_ff = (float)CV_ARRAY_FLASH[46]/10000;
|
||||
pid->max_output = (float)(_125M/(CV_ARRAY_FLASH[8]*100+10000));
|
||||
pid->x_1_rev = 0.0f;
|
||||
pid->x_1_fwd = 0.0f;
|
||||
pid->y_1_fwd = (float)get_16bit_CV(175);
|
||||
pid->y_1_rev = (float)get_16bit_CV(177);
|
||||
pid->x_2_rev = (float)pid->speed_table[126];
|
||||
pid->x_2_fwd = (float)pid->speed_table[126];
|
||||
|
||||
// Controller variables initialization
|
||||
pid->y_2_fwd = pid->max_output;
|
||||
pid->y_2_rev = pid->max_output;
|
||||
pid->measurement = 0.0f;
|
||||
pid->measurement_prev = 0.0f;
|
||||
pid->e_prev = 0.0f;
|
||||
pid->i_prev = 0.0f;
|
||||
pid->d_prev = 0.0f;
|
||||
pid->direction = false;
|
||||
pid->direction_prev = false;
|
||||
pid->speed_step_target = 0;
|
||||
pid->setpoint = 0;
|
||||
|
||||
// Gain scheduling initialization
|
||||
pid->k_p_x_1_shift = (float)CV_ARRAY_FLASH[59] / 255.0f;
|
||||
pid->k_p_x_1 = (float)pid->speed_table[126] * pid->k_p_x_1_shift;
|
||||
pid->k_p_x_2 = (float)pid->speed_table[126] * (1.0f - pid->k_p_x_1_shift);
|
||||
pid->k_p_y_0 = (float)get_16bit_CV(53) / 100.0f;
|
||||
pid->k_p_y_1 = (float)get_16bit_CV(55) / 100.0f;
|
||||
pid->k_p_y_2 = (float)get_16bit_CV(57) / 100.0f;
|
||||
pid->k_p_m_1 = (pid->k_p_y_1 - pid->k_p_y_0) / pid->k_p_x_1;
|
||||
pid->k_p_m_2 = (pid->k_p_y_2 - pid->k_p_y_1) / pid->k_p_x_2;
|
||||
|
||||
update_m(pid);
|
||||
}
|
||||
|
||||
|
||||
void core1_entry() {
|
||||
LOG(1, "core1 init...\n");
|
||||
pid_params pid_parameters;
|
||||
pid_params *pid = &pid_parameters;
|
||||
init_pid(pid);
|
||||
alarm_pool_add_repeating_timer_ms(alarm_pool_create(0,1),
|
||||
CV_ARRAY_FLASH[48],
|
||||
pid_control,
|
||||
pid,
|
||||
&pid_control_timer);
|
||||
irq_set_priority(0,0x00); // 0x00 = highest priority
|
||||
alarm_pool_add_repeating_timer_ms(alarm_pool_create(1,1),
|
||||
CV_ARRAY_FLASH[174],
|
||||
speed_helper,
|
||||
pid,
|
||||
&speed_helper_timer);
|
||||
// Send direction pointer for access and to let core0 know that core1 is done with initialization,
|
||||
// Note: Pointer will be cast into uint32_t and then back into bool * on core0 (Both 32-Bit Datatype).
|
||||
// This is done only to accommodate the correct data type associated with multicore_fifo_push_blocking().
|
||||
multicore_fifo_push_blocking((uint32_t) &(pid->direction));
|
||||
uint64_t packet_timeout_threshold_in_us = CV_ARRAY_FLASH[10]*1000000;
|
||||
absolute_time_t time_last_update = get_absolute_time();
|
||||
// printf("core1 done\n");
|
||||
while (1){
|
||||
// Check for time difference between last packet and current time (Packet Timeout)
|
||||
absolute_time_t current_time = get_absolute_time();
|
||||
if (absolute_time_diff_us(time_last_update,current_time) > packet_timeout_threshold_in_us){
|
||||
update_speed_dir(pid,1 + 128*pid->direction); // Emergency stop on timeout
|
||||
}
|
||||
// If core0 sends new speed data to core1 speed_step_target and direction variables get updated
|
||||
if(multicore_fifo_rvalid()) {
|
||||
update_speed_dir(pid, multicore_fifo_pop_blocking());
|
||||
time_last_update = get_absolute_time();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
//////////////////////////
|
||||
// RP2040-Decoder //
|
||||
// Gabriel Koppenstein //
|
||||
// core1.h //
|
||||
//////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "shared.h"
|
||||
|
||||
typedef struct pid_params{
|
||||
// Controller variables - won't change after init
|
||||
float k_i; // Integral gain
|
||||
float k_d; // Derivative gain
|
||||
float t; // Sampling time
|
||||
float tau; // Low-pass-filter time constant
|
||||
float k_ff; // Feed-Forward gain
|
||||
float ci_0; // (k_i*t)/2
|
||||
float cd_0; // (k_d*2)/(2*tau+t)
|
||||
float cd_1; // (2*tau-t)/(2*tau+t)
|
||||
float int_lim_max; // max limit for integrator
|
||||
float int_lim_min; // min limit for integrator
|
||||
float max_output; // max possible pwm output value
|
||||
float k_p_x_1_shift;
|
||||
float k_p_x_1;
|
||||
float k_p_x_2;
|
||||
float k_p_y_0;
|
||||
float k_p_y_1;
|
||||
float k_p_y_2;
|
||||
float k_p_m_1;
|
||||
float k_p_m_2;
|
||||
// Controller variables - might change on runtime
|
||||
float k_p; // Proportional gain
|
||||
float e_prev; // Previous Error
|
||||
float i_prev; // Previous Integral Value
|
||||
float d_prev; // Previous Derivative Value
|
||||
float measurement_prev; // Previous Measurement
|
||||
float x_1_fwd; // Base Speed; forward direction
|
||||
float x_2_fwd; // High Speed; forward direction
|
||||
float y_1_fwd; // Base PWM; forward direction
|
||||
float y_2_fwd; // High PWM; forward direction
|
||||
float x_1_rev; // Base Speed; reverse direction
|
||||
float x_2_rev; // High Speed; reverse direction
|
||||
float y_1_rev; // Base PWM; reverse direction
|
||||
float y_2_rev; // High PWM; reverse direction
|
||||
float m_fwd; // Slope forward direction
|
||||
float m_rev; // Slope reverse direction
|
||||
uint16_t speed_table[127]; // Array with setpoint values corresponding to every speed step
|
||||
uint32_t speed_step_target; // End target speed step
|
||||
uint16_t end_target_index; // Index for speed table array corresponding to end target speed step
|
||||
uint32_t setpoint; // Current setpoint
|
||||
uint32_t setpoint_prev; // Previous setpoint
|
||||
bool direction; // Current Direction
|
||||
bool direction_prev; // Previous Direction
|
||||
// Measurement Variables
|
||||
float measurement; // Newest Measurement value
|
||||
float adc_offset; // ADC offset value
|
||||
uint8_t msr_delay_in_us; // Delay before VEMF Measurement
|
||||
uint8_t msr_total_iterations; // Amount of samples
|
||||
uint8_t l_side_arr_cutoff; // Discarded samples (left side)
|
||||
uint8_t r_side_arr_cutoff; // Discarded samples (right side)
|
||||
}pid_params;
|
||||
|
||||
void update_speed_dir(pid_params *pid, uint32_t speed_step_target);
|
||||
bool speed_helper(struct repeating_timer *t);
|
||||
void adjust_pwm_level(uint16_t level, pid_params *pid);
|
||||
void update_m(pid_params *pid);
|
||||
void update_y(pid_params *pid,float i);
|
||||
float get_ff_val(pid_params *pid);
|
||||
float get_kp(pid_params *pid);
|
||||
bool pid_control(struct repeating_timer *t);
|
||||
void init_pid(pid_params *pid);
|
||||
|
Before Width: | Height: | Size: 794 KiB |
|
Before Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 156 KiB |
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1570px" height="733px" viewBox="-0.5 -0.5 1570 733"><defs/><g><rect x="245" y="97" width="150" height="70" fill="#647687" stroke="#314354" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 148px; height: 1px; padding-top: 132px; margin-left: 246px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;" data-drawio-colors="color: #ffffff; "><div style="display: inline-block; font-size: 18px; font-family: Verdana; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Speed Helper</div></div></div></foreignObject><text x="320" y="137" fill="#ffffff" font-family="Verdana" font-size="18px" text-anchor="middle">Speed Helper</text></switch></g><path d="M 900 367 L 1043.63 367" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 1048.88 367 L 1041.88 370.5 L 1043.63 367 L 1041.88 363.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="590" y="332" width="150" height="70" fill="#647687" stroke="#314354" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 148px; height: 1px; padding-top: 367px; margin-left: 591px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;" data-drawio-colors="color: #ffffff; "><div style="display: inline-block; font-size: 18px; font-family: Verdana; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">PID Controller</div></div></div></foreignObject><text x="665" y="372" fill="#ffffff" font-family="Verdana" font-size="18px" text-anchor="middle">PID Controller</text></switch></g><path d="M 820 367 L 746.37 367" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 741.12 367 L 748.12 363.5 L 746.37 367 L 748.12 370.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="1050" y="332" width="150" height="70" fill="#647687" stroke="#314354" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 148px; height: 1px; padding-top: 367px; margin-left: 1051px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;" data-drawio-colors="color: #ffffff; "><div style="display: inline-block; font-size: 18px; font-family: Verdana; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Motor Driver</div></div></div></foreignObject><text x="1125" y="372" fill="#ffffff" font-family="Verdana" font-size="18px" text-anchor="middle">Motor Driver</text></switch></g><rect x="590" y="662" width="150" height="70" fill="#647687" stroke="#314354" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 148px; height: 1px; padding-top: 697px; margin-left: 591px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;" data-drawio-colors="color: #ffffff; "><div style="display: inline-block; font-size: 18px; font-family: Verdana; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">ADC</div></div></div></foreignObject><text x="665" y="702" fill="#ffffff" font-family="Verdana" font-size="18px" text-anchor="middle">ADC</text></switch></g><path d="M 741 383.5 L 741 350.5 L 781.99 350.5 L 781.99 339.5 L 819 367 L 781.99 394.5 L 781.99 383.5 Z" fill="rgb(255, 255, 255)" stroke="#647687" stroke-width="2" stroke-miterlimit="10" pointer-events="all"/><rect x="1305" y="332" width="150" height="70" fill="#647687" stroke="#314354" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignLine truncated
|
||||
|
Before Width: | Height: | Size: 22 KiB |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Do not edit this file with editors other than diagrams.net -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="2037px" height="1191px" viewBox="-0.5 -0.5 2037 1191" content="<mxfile host="app.diagrams.net" modified="2022-08-06T10:29:12.145Z" agent="5.0 (X11)" etag="IjcCWwMyXrMXf420IuKe" version="20.2.3" type="device"><diagram id="fYnpBcbPwy3h1yrhEr7x" name="Page-1">jLxXr6zKtgb2a+6jJXJ4JIcmNpk3cg5Nhl9vaq5zbF9ZlrylNWfPgoaiatQXRg32/6DccElLMtf6lBf9/yBQfv0Pyv8PgiAUhr2/QMv9rwXGEOhfS7U0+X/a/u8Gp3mK/zT+97S9yYv1f524TVO/NfP/bsymcSyy7X+1Jcsynf/7tHLq//dd56Qq/l8NTpb0/+/WoMm3+l8rhUP/d7tcNFX93zvD0H+OpEnWVcu0j/+53ziNxb8jQ/Lfy/zn1LVO8un8fzShwv+g3DJN279Pw8UVPRjX/47Yv++J/x9H/68uL8W4/f/5gparG+rO13ZnRj47xM1x0v+B/LvKkfT7f4biP53d7v+OzdvvGXxshr9BZI9i2Zp36LQkLXprWputmcb3eDpt2zS8J/TgAPt/DQw39dPyHs+LMtn77f9xBaZvKvDNbZrf1mSd/01t2VzF22f274bMf1uh/7aASyVb8j8o8+9PRJzH6n8QrvFZ83tCH6mamPc/w/FqwaveTxj4U9M5Jnp/czCSPxDDsPqFzl4gf50ozKpMVo946NfYYaEiZHtF8rEkeM+X22SO4bzfMGwZwtKIJpK1pFJmcLEJDpiXF+xwS/4Z1cF3aS9H/B6pcJlQDQUzmUxQuJ1EwZwg4oKi9PPvI+UiVY2K2b7k+ZegwAnUWrXuSLok/u+Up7TKzCwfcEz/19Qs9P8g7L6Ux0hseVY+O9WEb7uaQsRZ/h7i/VzTdP7v7Iw/Qsrq3r/YwOLehhAm7veP4vh3XLzfyWXfD9dB/B2HKVJFKOU/vQUdXuz3DDmoRfmvgVWOmzitC1+03UQPnKrNknybyzB8/p6AeX/SYEKaEj3evooIuBeCr+F8YKHhtCL1IYrkbfuUCPEuQPAt7+eCW7rgSVkFpSrwuzz4spcxcGZ13COdzgs41yCHmvy9n7r3X7lZZb4HB/g23G50cszpCAbIX8EYHr+AVmhxGUGn3ub639OWU3i3JK2UKPyvwTLd7N/zwvv7o0XBnYrgpCgwkIEFg6Erj+3f2c/DP+KjBv2yUAVxZO279t4hLG2qxLwSbeB3St8zrfJswgQMfXm6VPETifRE93/XYKVCFBwt3TzdTPG6/k/HqH3VGnG0qGVrMTc6l/mwxLGfsiwVDyUAE825K0IfbB8jRhLT29OAZ8udpyrN9xo4PHpg1kpLSd8/jSjaxdbWDjItCRIMQlUi+UJfNEog1vGsKXbuxlLWz9GXxwTlXHmE05w8p/bfCGCL8v2NGqXA13EYfLNYM58nw4axlqnadqd0LFvp/FFgGOs2+fd4K6exQhmmTdwZFZs3SCcMPyzATkZkjhhJeHXJCg+jdLMWteaGUGkU1T5FF2h6rzN8xZVAr1rDqTUMGddApp+TSOPO96QYm99yncGwmnyGOE5D9LChfjTC0ofht895mvx+DBYgC578Qh/u52OikKLY3/NonCAJyxK8jDP0fZqwFy3Za27cB7+yotTc7sU9NqKw3ioO1V1+b1SwZDFahZlypRgXcR76fk+3j/uGOEvYYLDR44dsYHDb0X9/YvrHO0rQvwXM10EYJIHraZAvM4wiYYCiZRlRBFiiLBls/8Y5tUpSXLC82K/UcMvBIhO6xJIBRKN2ScIb6+ynWAP5uichTxGMZWs0X8ldHj86ieNkbhPn0sXrSm5divIior+z09cgvkka8ks09cbybyUuxYK/sSFuAQha0P901JZyPf46VIJl8o6KSObzIr2oeqEEBQkBLdAkOpejCelFeoI4XKw0JQvXYtadgJeTDy5DDjB5fFdj9S+ai7ofy/wNpuoQ0ZZIJR/cASPociwLVCpREHvveXJt/cj45F1iQi29VUaybMAlXihh4xCVnY0qSGgjY40YG0HJjzUP5QG7DjIR6gPxP+ovLUUi8MDaSsyrQCxXgbdr5VSaTTlqtlqrwRmdkkoYR8amWDPTvYoMTOFWSsjvwnYrg8cRYJHzuIYlfrE9CWkyyenUIn+pS1GQU8U/KwCxnWwRisoHE+WxjBYk0x3QFvYbaV6kh2MWB5eHeN0WiV4gAPYp/Zq9HSJ4e5gsfnpsKw/P8LhWtx6P+YzmUcCXuqNjkDQIrTCU8AsQPdZddCkeMxklC+17ZZFChllIG0fIpY03TPhmElKiRR7BsR5DdqA6HwnJkAjA/kFBdRkh9ON86Z2Tm16vqfVYQuz5fhMEBC0Wb3A5fus6FEvrZWWItiOAuT8LoreIuFcQDbCPHjx5ZM9l8SXcoP1MHdh4UPELnsSiU2lSSu17Hh9OxDtCdHZG8XM7CHqYh1ZE3UxGfHRExbvu+g3hnAsNJcAM7xpn1chuoBBT0gfMdAXJNOHYNfL4ZQyw03YVwyqbJACherQNy/WnsqJ0EJnGNRxLR2tOuLOpNkjUj6FLctcKwcpKjyTKoeKHXvXms41KxpOHzkCRNZiq1MRweFm+YX13Nozj4/PklBQwGuHsWENJ1Lva2GMV5xJHD8F4b9wfyfVjGy281vttMrfIRRHq287YkgsXcahIiUck6PC8+W0FpVps5U7KJ2FtnLCnvTytdYHEW+T5lbFtDcXDElKAFeE/nAScW5EbgNjdzPE0LQHhHCtY93wtOeyn5OpXHD366MwAYqWxPz2eQnYycmY6VI+0N/ym7SF0/C0IVccAggy6ktGfa3EkRj98BpY94Pnh+S7Xt7wDzqCxUOf/GL8P/0vYdSfTixkedXnRO8R0vHVbMokUzMAXjIn83pkWo6t2TwAcXaeK2FNKcD4NeiUcSPnNsoKfbNM1uVwfdN61cPIplnbW++wIbzlZoatcql6C6wSIBIT5B30xTDLjCqMlpPI0Q31PgxxpECaDEPm0uaQLFs/wZGuThCeDrIv26u5fw0ZdMHZhZNsAQlrpIcyt78uS21LuKkgshUgUjDJNrFTvPyOAQrWSDyOFUNG9vU8FCyuYuTVNZ67uusb/Nyc6KUOmaNzIne53qcH+iZFbUOZ9VjJQyVTDuSuX4TuKKG+ArRYc0kze++iKO9OYRZGyp4W8IZcqYOZXwzVhZ9RAPkXNswhF96VaWBGIjhMUr8pOthNw26WuDE0nLUSekPWmHPXj/NciBRYInGdc+iORVPpSDARbmCr8TGZiSCy3VPTDBiM64u+dwv4lB/95Rcv8yQX5UTbO+nRdRTCc+uDrEJxnrOg/gZ0XkZbJVVRJ/WgRtcAxN+eVBC0/eFirCw9Ir3BPtAyOc9X14CnzID+OLloljNaEvoqjLlhP7o8mNIVNcIueTSsKZNL4biaBhIwEKSvdmVn4QirrRV8+/x6LS06HyWnb6JystfQBE86JwbDIHtjDqTNUkyoOiX5QJfJSx7N5MDs8SWq2+4BAkWSN7dd8QyuLZ1K0W6r3cBxjlEa22x+wlEDzWD23Cx3mRQxCSUBO8k9DduNTpcWJkBWwCsHcTszF8QpHf6YVZgW9DBuDR40RMwIpZGtKEeLfh5t9W/zW3POPziL8qrMQf79xC3K7jggjAqeV8JG1kmP6EsGQkBc3CiPzcZgvMwCRQgAiW9ER40fru+qqM8UGzty2HphsgEuaNlRKyMI/ThXeGbUdpYhXjKTZnBF+q0bE583KtyWdlok78QWtlPScsThA8zLAoQxktMn4JFPYKxiAcHIiAz99AbMhzDhra9TlKUgNBmaeOnFrv6h6Yra7H32CZV+EhUQsQshhJJaZgQLUkHJ9WTdiahWKbEe4oqvD1cEurWDTvxo3obbltGFJUhpHeShDeJZePmczubbz9s37FrWlf7LLtnPvO2TurChipsRfmOL2TZ4hoyG4DxCmtgwGZ3h/YAqTFYEJlIhJfTbtZVyCW9UYBcpfRwzW/GOi+v5YaRKeXySoARBmDsKaBhdnqx5GvD9H7sUMABLeGXOUmZ4+99wpi8HkHetzIAzPrl3TPAtgnfrNUTpQQuiNrjq8gYwHFY9o0EDQ1TCypmnNelhlN4HGVWRalE2wmpw+NeSoVXVxzItAgX9lKbrligu3DE+wKivGr9z3enZ/BAjikMq+d/QcgobaH/c1YjaC6SxxziujMOJoMp9rYujLwLkdc41NZJhBbXnvC7BVs72+Dd7e9tyLrAJMkhJPzqp8rZOMqd6SywWX5iJTsnZh0tXHXdPWfSGfOE4u8UTvoaXER4n791BF80WlKyUyQz/qqcWP4hAHQu408yO4H9YvrN/avQoVb+GK5IeTMS61wu6g+fnjO8VefJp8KDEvJJ8Nq3Ev7RWGt93iS/kD5tMPx26Mqiiunn24O0dhZUkhBrmEd7i/gNOgjpNEJRC6iQ8elrxxIE8qMPelnLeOAod1Htf3sE7RYBSJGDYqpnT2LTCvKal9FpFFG7U51GQ5zgMAfqQcGUhjvn23IWl1uJqO8zVyty0gq4tTy9cCU12wmMp/VdCN4DWvd4k+YqQAK1dZA9f7MvNiEufLURRWyurm5Vqhc9KtqIienvBYpSe+tn28yz9FYH/i1HgFYlEB6j0zjeIwLhvq3zDKhuTE3S/TW8xG+EynaD+1e0aDLhC0ju+qHV1yhgVwQtVgbkLine truncated
|
||||
|
Before Width: | Height: | Size: 521 KiB |
@@ -1,159 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<svg width="1369pt" height="657pt" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1369 657" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>gl2ps_renderer figure</title>
|
||||
<desc>
|
||||
Creator: GL2PS 1.4.2, (C) 1999-2020 C. Geuzaine
|
||||
For: Octave
|
||||
CreationDate: Mon Aug 1 18:41:06 2022
|
||||
</desc>
|
||||
<defs/>
|
||||
<polygon points="0,0 1369,0 1369,657 0,657" fill="#ffffff"/>
|
||||
<g>
|
||||
<polygon points="0,657 1369,657 1369,0 0,0" shape-rendering="crispEdges" fill="#ffffff"/>
|
||||
<clipPath id="cp001369657">
|
||||
<polygon points="0,657 1369,657 1369,0 0,0"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#cp001369657)">
|
||||
<polygon points="178.09,584.849 1239.78,584.849 1239.78,49.2852 178.09,49.2852" shape-rendering="crispEdges" fill="#ffffff"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,584.849 178.09,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,49.2852 178.09,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="390.427,584.849 390.427,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="390.427,49.2852 390.427,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="602.765,584.849 602.765,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="602.765,49.2852 602.765,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="815.103,584.849 815.103,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="815.103,49.2852 815.103,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1027.44,584.849 1027.44,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1027.44,49.2852 1027.44,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,584.849 1239.78,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,49.2852 1239.78,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(175.09,600.343) rotate(-0,3,-8)">
|
||||
<tspan y="-0" x="0 " fill="rgb(38,38,38)">0</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(381.427,600.343) rotate(-0,9,-8)">
|
||||
<tspan y="-0" x="0 6 12 " fill="rgb(38,38,38)">500</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(590.765,600.343) rotate(-0,12,-8)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1000</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(803.103,600.343) rotate(-0,12,-8)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1500</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1015.44,600.343) rotate(-0,12,-8)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2000</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1227.78,600.343) rotate(-0,12,-8)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2500</tspan>
|
||||
</text>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,584.849 188.704,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,584.849 1229.16,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,477.736 188.704,477.736" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,477.736 1229.16,477.736" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,370.624 188.704,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,370.624 1229.16,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,263.511 188.704,263.511" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,263.511 1229.16,263.511" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,156.398 188.704,156.398" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,156.398 1229.16,156.398" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,49.2852 188.704,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,49.2852 1229.16,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(167.091,588.849) rotate(-0,6,-4)">
|
||||
<tspan y="-0" x="0 " fill="rgb(38,38,38)">0</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,481.736) rotate(-0,24,-4)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1000</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,374.624) rotate(-0,24,-4)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2000</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,267.511) rotate(-0,24,-4)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">3000</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,160.398) rotate(-0,24,-4)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">4000</tspan>
|
||||
</text>
|
||||
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,53.285) rotate(-0,24,-4)">
|
||||
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">5000</tspan>
|
||||
</text>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,584.849 1239.78,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,49.2852 1239.78,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,584.849 178.09,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1239.78,584.849 1239.78,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="11" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(703.434,615.343) rotate(-0,5.5,-10)">
|
||||
<tspan y="-3" x="0 5 " fill="rgb(38,38,38)">sp</tspan>
|
||||
</text>
|
||||
<text font-size="11" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(105.591,317.067) rotate(-90,38.5,0)">
|
||||
<tspan y="-3" x="0 7 17 26 30 36 42 47 53 55 58 62 67 73 " fill="rgb(38,38,38)">PWM-Level (sp)</tspan>
|
||||
</text>
|
||||
<polyline stroke="#0071bc" stroke-linecap="butt" points="178.09,370.624 1041.03,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#d85218" stroke-linecap="butt" points="178.09,381.335 1041.03,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="175.09,370.624 181.09,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="178.09,367.624 178.09,373.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,368.502 180.211,372.745" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,372.745 180.211,368.502" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.03,49.2852 1044.03,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1041.03,46.2852 1041.03,52.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,47.1636 1043.15,51.4062" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,51.4062 1043.15,47.1636" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="175.09,381.335 181.09,381.335" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="178.09,378.335 178.09,384.335" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,379.213 180.211,383.456" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,383.456 180.211,379.213" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.03,49.2852 1044.03,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1041.03,46.2852 1041.03,52.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,47.1636 1043.15,51.4062" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,51.4062 1043.15,47.1636" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="9,7" stroke="#00ff00" stroke-linecap="butt" points="609.56,584.849 609.56,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
|
||||
</g>
|
||||
<clipPath id="cp001369657">
|
||||
<polygon points="0,657 1369,657 1369,0 0,0"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#cp001369657)">
|
||||
<polygon points="1103.73,159.161 1231.37,159.161 1231.37,57.6943 1103.73,57.6943" shape-rendering="crispEdges" fill="#ffffff"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,159.161 1231.37,159.161" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,57.6943 1231.37,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,159.161 1103.73,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1231.37,159.161 1231.37,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#0071bc" stroke-linecap="butt" points="1107.94,66.3989 1128.96,66.3989" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,70.8989) rotate(-0,-0,-4.5)">
|
||||
<tspan y="-1" x="0 3 8 11 18 23 26 " fill="rgb(0,0,0)">forward</tspan>
|
||||
</text>
|
||||
<polyline stroke="#d85218" stroke-linecap="butt" points="1107.94,79.5186 1128.96,79.5186" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,82.5184) rotate(-0,-0,-3)">
|
||||
<tspan y="-0" x="0 3 8 12 17 20 24 " fill="rgb(0,0,0)">reverse</tspan>
|
||||
</text>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1115.45,93.1377 1121.45,93.1377" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1118.45,90.1377 1118.45,96.1377" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,91.0166 1120.57,95.2593" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,95.2593 1120.57,91.0166" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,98.1379) rotate(-0,-0,-5)">
|
||||
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 41 46 " fill="rgb(0,0,0)">x1 | y1 (fwd)</tspan>
|
||||
</text>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1115.45,107.342 1121.45,107.342" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1118.45,104.342 1118.45,110.342" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,105.221 1120.57,109.464" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,109.464 1120.57,105.221" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,112.342) rotate(-0,-0,-5)">
|
||||
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 41 46 " fill="rgb(0,0,0)">x2 | y2 (fwd)</tspan>
|
||||
</text>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1115.45,121.547 1121.45,121.547" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1118.45,118.547 1118.45,124.547" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,119.426 1120.57,123.668" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,123.668 1120.57,119.426" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,126.547) rotate(-0,-0,-5)">
|
||||
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 39 43 " fill="rgb(0,0,0)">x1 | y1 (rev)</tspan>
|
||||
</text>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1115.45,135.752 1121.45,135.752" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1118.45,132.752 1118.45,138.752" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,133.63 1120.57,137.873" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,137.873 1120.57,133.63" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,140.752) rotate(-0,-0,-5)">
|
||||
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 39 43 " fill="rgb(0,0,0)">x2 | y2 (rev)</tspan>
|
||||
</text>
|
||||
<polyline stroke-dasharray="9,7" stroke="#00ff00" stroke-linecap="butt" points="1107.94,149.957 1128.96,149.957" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
|
||||
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,154.956) rotate(-0,-0,-5)">
|
||||
<tspan y="-2" x="0 5 10 12 17 21 24 31 36 41 44 46 49 54 57 62 66 71 76 78 83 85 89 " fill="rgb(0,0,0)">adjustment threshold y2</tspan>
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 147 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 146 KiB |
@@ -0,0 +1 @@
|
||||
<meta http-equiv="refresh" content="0;url=https://gab-k.github.io/RP2040-Decoder/sphinx/html/" />
|
||||
@@ -1,62 +0,0 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
)
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
FetchContent_Populate(pico_sdk)
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
||||
@@ -1,63 +0,0 @@
|
||||
//////////////////////////
|
||||
// RP2040-Decoder //
|
||||
// Gabriel Koppenstein //
|
||||
// shared.c //
|
||||
//////////////////////////
|
||||
|
||||
#include "shared.h"
|
||||
|
||||
// Functions in shared.c can be accessed by both cores
|
||||
|
||||
// Measures Back-EMF voltage (proportional to the rotational speed of the motor) on GPIO 28 and GPIO 29 respectively (depending on direction)
|
||||
float measure(uint8_t total_iterations,
|
||||
uint8_t measurement_delay_us,
|
||||
uint8_t l_side_arr_cutoff,
|
||||
uint8_t r_side_arr_cutoff,
|
||||
bool direction){
|
||||
uint32_t sum = 0;
|
||||
uint16_t adc_val[total_iterations];
|
||||
int32_t j = 0;
|
||||
uint16_t key;
|
||||
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
|
||||
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
|
||||
adc_select_input((!direction)+2);
|
||||
busy_wait_us(measurement_delay_us);
|
||||
adc_run(true);
|
||||
for (int32_t i = 0; i < total_iterations; ++i) {
|
||||
//Take adc value out of fifo when available, then do one step of insertion sort.
|
||||
adc_val[i] = adc_fifo_get_blocking();
|
||||
key = adc_val[i];
|
||||
j = i - 1;
|
||||
while (j >= 0 && adc_val[j] > key) {
|
||||
adc_val[j + 1] = adc_val[j];
|
||||
j--;
|
||||
}
|
||||
adc_val[j + 1] = key;
|
||||
}
|
||||
adc_run(false);
|
||||
//discard x entries beginning from the lowest entry of the array (counting up); x = msr.l_side_arr_cutoff
|
||||
//discard y entries beginning from the highest index of the array (counting down); y = msr.r_side_arr_cutoff
|
||||
for (int32_t i = l_side_arr_cutoff; i < total_iterations - r_side_arr_cutoff ; ++i) {
|
||||
sum += adc_val[i];
|
||||
}
|
||||
float res = (float)sum / (float)( total_iterations - (l_side_arr_cutoff + r_side_arr_cutoff) );
|
||||
// return true to keep the repeating timer active
|
||||
return res;
|
||||
}
|
||||
|
||||
// retrieve 4Bytes from CV_ARRAY_FLASH at once and return 32-Bit value
|
||||
uint32_t get_32bit_CV (uint16_t CV_start_index){
|
||||
uint8_t byte_3 = CV_ARRAY_FLASH[CV_start_index];
|
||||
uint8_t byte_2 = CV_ARRAY_FLASH[CV_start_index+1];
|
||||
uint8_t byte_1 = CV_ARRAY_FLASH[CV_start_index+2];
|
||||
uint8_t byte_0 = CV_ARRAY_FLASH[CV_start_index+3];
|
||||
return (byte_0) + (byte_1<<8) + (byte_2<<16) + (byte_3<<24);
|
||||
}
|
||||
|
||||
|
||||
// retrieve 2Bytes from CV_ARRAY_FLASH at once and return 16-Bit value
|
||||
uint16_t get_16bit_CV (uint16_t CV_start_index){
|
||||
uint8_t byte_1 = CV_ARRAY_FLASH[CV_start_index];
|
||||
uint8_t byte_0 = CV_ARRAY_FLASH[CV_start_index+1];
|
||||
return (byte_0) + (byte_1<<8);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
//////////////////////////
|
||||
// RP2040-Decoder //
|
||||
// Gabriel Koppenstein //
|
||||
// shared.h //
|
||||
//////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "string.h"
|
||||
#include "pico/float.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/multicore.h"
|
||||
#include "pico/printf.h"
|
||||
#include "hardware/pwm.h"
|
||||
#include "hardware/adc.h"
|
||||
#include "hardware/flash.h"
|
||||
#include "hardware/irq.h"
|
||||
|
||||
|
||||
// here you can enable printf debugging (needs extra soldering and you have to enable uart in the cmake configuration)
|
||||
// please note
|
||||
// - if it's disabled it will be compiled completely out
|
||||
// - be careful that printf debugging can change your timing behavior, for example in the pid controller limit the outputs
|
||||
// like already done (only print every 100th iteration for example!)
|
||||
// - also note that with logging enabled GPIO0/1 are DISABLED from decoder functions because they are used for uart to the
|
||||
// outside world (this is configure automatically for you below!)
|
||||
// - IMPORTANT: you have to enable uart in the cmakelists.txt to enable logging!
|
||||
#define LOGLEVEL 0
|
||||
#define LOG(level, ...) { if(level <= LOGLEVEL) {printf(__VA_ARGS__);}}
|
||||
|
||||
// Constant Value of 125 x 10⁶
|
||||
#define _125M 125000000
|
||||
|
||||
// GPIO used for DCC-Signal, Motor PWM or ADC
|
||||
#define DCC_INPUT_PIN 21u
|
||||
#define MOTOR_FWD_PIN 23u
|
||||
#define MOTOR_REV_PIN 22u
|
||||
#define FWD_V_EMF_ADC_PIN 28u
|
||||
#define REV_V_EMF_ADC_PIN 29u
|
||||
|
||||
// if logging is enabled do NOT use gpio0/1 for functions in the decoder
|
||||
#if LOGLEVEL != 0
|
||||
// GPIO used directly (GPIO 2-5 incl.) as outputs or to switch auxiliary output transistors (GPIO 24-27 incl.)
|
||||
#define GPIO_OUTPUT_PIN_MASK (1u<<24) | (1u<<25) | (1u<<26) | (1u<<27) | (1u<<5) | (1u<<4) | (1u<<3) | (1u<<2)
|
||||
#else
|
||||
// GPIO used directly (GPIO 0-5 incl.) as outputs or to switch auxiliary output transistors (GPIO 24-27 incl.)
|
||||
#define GPIO_OUTPUT_PIN_MASK (1u<<24) | (1u<<25) | (1u<<26) | (1u<<27) | (1u<<5) | (1u<<4) | (1u<<3) | (1u<<2) | (1u<<1) | (1u<<0)
|
||||
#endif
|
||||
|
||||
// GPIO pin mask to prevent setting illegal GPIOs (ADC, Motor, DCC Input Pin)
|
||||
#define GPIO_ILLEGAL_MASK (1u<<DCC_INPUT_PIN) | (1u<<MOTOR_FWD_PIN) | (1u<<MOTOR_REV_PIN) | (1u<<FWD_V_EMF_ADC_PIN) | (1u<<REV_V_EMF_ADC_PIN)
|
||||
|
||||
// GPIO pin mask with allowed outputs (AUX & GPIO (configured as outputs))
|
||||
#define GPIO_ALLOWED_OUTPUTS (GPIO_OUTPUT_PIN_MASK) & ~(GPIO_ILLEGAL_MASK)
|
||||
|
||||
// Offset from base address used for saving CV_ARRAY_FLASH
|
||||
#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES-FLASH_SECTOR_SIZE)
|
||||
|
||||
extern repeating_timer_t pid_control_timer;
|
||||
extern repeating_timer_t speed_helper_timer;
|
||||
extern const uint8_t *CV_ARRAY_FLASH;
|
||||
void core1_entry();
|
||||
float measure(uint8_t total_iterations,
|
||||
uint8_t measurement_delay_us,
|
||||
uint8_t l_side_arr_cutoff,
|
||||
uint8_t r_side_arr_cutoff,
|
||||
bool direction);
|
||||
uint32_t get_32bit_CV (uint16_t CV_start_index);
|
||||
uint16_t get_16bit_CV (uint16_t CV_start_index);
|
||||
|
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 630 KiB |
|
After Width: | Height: | Size: 7.1 MiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Do not edit this file with editors other than draw.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1571px" height="733px" viewBox="-0.5 -0.5 1571 733" content="<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0" version="25.0.3" scale="1" border="0">
 <diagram name="Page-1" id="EzXMAEqKDDRs-_LGy8zr">
 <mxGraphModel dx="1687" dy="920" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
 <root>
 <mxCell id="0" />
 <mxCell id="1" parent="0" />
 <mxCell id="4ED7IVWrFvjwATd2QOsb-28" value="Speed Helper" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" vertex="1" parent="1">
 <mxGeometry x="265" y="150" width="150" height="70" as="geometry" />
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-29" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;" edge="1" parent="1" target="4ED7IVWrFvjwATd2QOsb-31">
 <mxGeometry relative="1" as="geometry">
 <mxPoint x="920" y="420" as="sourcePoint" />
 </mxGeometry>
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-30" value="&lt;div&gt;&lt;b&gt;Motor Controller&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;PID MODE&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;or&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;STARTUP MODE&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" vertex="1" parent="1">
 <mxGeometry x="610" y="340" width="340" height="160" as="geometry" />
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-31" value="Motor Driver" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" vertex="1" parent="1">
 <mxGeometry x="1070" y="385" width="150" height="70" as="geometry" />
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-32" value="ADC" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" vertex="1" parent="1">
 <mxGeometry x="610" y="715" width="150" height="70" as="geometry" />
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-33" value="Motor" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" vertex="1" parent="1">
 <mxGeometry x="1325" y="385" width="150" height="70" as="geometry" />
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-34" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#647687;exitX=0.5;exitY=1;exitDx=0;exitDy=0;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;width=32;endSize=11.67;entryX=0.5;entryY=0;entryDx=0;entryDy=0;horizontal=0;" edge="1" parent="1" source="4ED7IVWrFvjwATd2QOsb-28" target="4ED7IVWrFvjwATd2QOsb-43">
 <mxGeometry width="50" height="50" relative="1" as="geometry">
 <mxPoint x="330" y="280" as="sourcePoint" />
 <mxPoint x="210" y="320" as="targetPoint" />
 <Array as="points" />
 </mxGeometry>
 </mxCeLine truncated
|
||||
|
After Width: | Height: | Size: 203 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Do not edit this file with editors other than draw.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="701px" height="845px" viewBox="-0.5 -0.5 701 845" content="<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0" version="25.0.3" scale="1" border="0">
 <diagram name="Page-1" id="EzXMAEqKDDRs-_LGy8zr">
 <mxGraphModel dx="1687" dy="920" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
 <root>
 <mxCell id="0" />
 <mxCell id="1" parent="0" />
 <mxCell id="4ED7IVWrFvjwATd2QOsb-36" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#647687;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;width=32;endSize=11.67;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" target="4ED7IVWrFvjwATd2QOsb-89" source="4ED7IVWrFvjwATd2QOsb-77">
 <mxGeometry width="50" height="50" relative="1" as="geometry">
 <mxPoint x="20" y="70" as="sourcePoint" />
 <mxPoint x="480" y="160" as="targetPoint" />
 <Array as="points">
 <mxPoint x="385" y="135" />
 </Array>
 </mxGeometry>
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-37" value="STARTUP_MODE" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=20;fontColor=default;rotation=270;" vertex="1" connectable="0" parent="4ED7IVWrFvjwATd2QOsb-36">
 <mxGeometry x="-0.3535" y="-3" relative="1" as="geometry">
 <mxPoint x="-3" y="7" as="offset" />
 </mxGeometry>
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-64" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#647687;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;width=32;endSize=11.67;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="4ED7IVWrFvjwATd2QOsb-89" target="4ED7IVWrFvjwATd2QOsb-102">
 <mxGeometry width="50" height="50" relative="1" as="geometry">
 <mxPoint x="1200" y="490" as="sourcePoint" />
 <mxPoint x="1315" y="490" as="targetPoint" />
 <Array as="points" />
 </mxGeometry>
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-65" value="K_FF*startup.level" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=20;fontColor=default;rotation=270;" vertex="1" connectable="0" parent="4ED7IVWrFvjwATd2QOsb-64">
 <mxGeometry x="-0.4316" y="7" relative="1" as="geometry">
 <mxPoint x="-7" y="27" as="offset" />
 </mxGeometry>
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-71" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#647687;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;width=32;endSize=11.67;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="4ED7IVWrFvjwATd2QOsb-89">
 <mxGeometry width="50" height="50" relative="1" as="geometry">
 <mxPoint x="340" y="20" as="sourcePoint" />
 <mxPoint x="320" y="505" as="targetPoint" />
 <Array as="points">
 <mxPoint x="615" y="20" />
 </Array>
 </mxGeometry>
 </mxCell>
 <mxCell id="4ED7IVWrFvjwATd2QOsb-72" value="MEASUREMENT &Line truncated
|
||||
|
After Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Do not edit this file with editors other than draw.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1043px" height="543px" viewBox="-0.5 -0.5 1043 543" content="<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0" version="24.9.0" scale="1" border="0">
 <diagram id="4yrCjKYynwCaxiwjl_Zd" name="Page-1">
 <mxGraphModel dx="1434" dy="734" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" background="none" math="0" shadow="0">
 <root>
 <mxCell id="0" />
 <mxCell id="1" parent="0" />
 <mxCell id="C1jbzQCqpV-uhOoT1oVn-1" value="&lt;div style=&quot;font-size: 20px&quot;&gt;&lt;font style=&quot;font-size: 20px&quot;&gt;RP2040&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 20px&quot;&gt;&lt;font style=&quot;font-size: 20px&quot;&gt;Microcontroller&lt;br&gt;&lt;/font&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#647687;fontColor=#ffffff;strokeColor=#314354;" parent="1" vertex="1">
 <mxGeometry x="560" y="340" width="200" height="200" as="geometry" />
 </mxCell>
 <mxCell id="C1jbzQCqpV-uhOoT1oVn-4" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;fontFamily=Helvetica;fontSize=11;fontColor=default;exitX=0.75;exitY=1;exitDx=0;exitDy=0;strokeColor=#647687;entryX=0.25;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;" parent="1" source="C1jbzQCqpV-uhOoT1oVn-1" target="C1jbzQCqpV-uhOoT1oVn-5" edge="1">
 <mxGeometry width="50" height="50" relative="1" as="geometry">
 <mxPoint x="595" y="450" as="sourcePoint" />
 <mxPoint x="485" y="440" as="targetPoint" />
 </mxGeometry>
 </mxCell>
 <mxCell id="C1jbzQCqpV-uhOoT1oVn-5" value="GPIO" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" parent="1" vertex="1">
 <mxGeometry x="680" y="600" width="120" height="60" as="geometry" />
 </mxCell>
 <mxCell id="UgZSE7u6rpuSXDGsVSFL-2" value="&lt;div&gt;Auxillary outputs&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" parent="1" vertex="1">
 <mxGeometry x="520" y="600" width="120" height="60" as="geometry" />
 </mxCell>
 <mxCell id="UgZSE7u6rpuSXDGsVSFL-5" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#647687;entryX=0.75;entryY=0;entryDx=0;entryDy=0;exitX=0.25;exitY=1;exitDx=0;exitDy=0;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;" parent="1" source="C1jbzQCqpV-uhOoT1oVn-1" target="UgZSE7u6rpuSXDGsVSFL-2" edge="1">
 <mxGeometry width="50" height="50" relative="1" as="geometry">
 <mxPoint x="645" y="440" as="sourcePoint" />
 <mxPoint x="695" y="390" as="targetPoint" />
 </mxGeometry>
 </mxCell>
 <mxCell id="UgZSE7u6rpuSXDGsVSFL-7" value="Motor Driver" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;" parent="1" vertex="1">
 <mxGeometry x="960" y="360" width="120" height="60" as="geometry" />
 </mxCell>
 <mxCell id="UgZSE7u6rpuSXDGsVSFL-9" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#647687;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.Line truncated
|
||||
|
After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 630 KiB |
|
After Width: | Height: | Size: 7.1 MiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 609 KiB After Width: | Height: | Size: 609 KiB |
|
After Width: | Height: | Size: 7.0 MiB |
|
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 630 KiB |
|
After Width: | Height: | Size: 6.9 MiB |
|
Before Width: | Height: | Size: 518 KiB After Width: | Height: | Size: 518 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 524 KiB After Width: | Height: | Size: 524 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Do not edit this file with editors other than draw.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="background: transparent; background-color: transparent; color-scheme: light;" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1930px" height="2823px" viewBox="-0.5 -0.5 1930 2823" content="<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0" version="26.0.3" scale="1" border="0">
 <diagram id="fYnpBcbPwy3h1yrhEr7x" name="Page-1">
 <mxGraphModel dx="6320" dy="5010" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" background="none" math="0" shadow="0">
 <root>
 <mxCell id="0" />
 <mxCell id="1" parent="0" />
 <mxCell id="K4uLP4tBgHA3zsCXKBI8-35" value="" style="line;strokeWidth=15;html=1;rounded=0;fontFamily=Helvetica;fontSize=100;fontColor=default;fillColor=none;gradientColor=none;direction=west;strokeColor=#0000FF;" parent="1" vertex="1">
 <mxGeometry x="1180" y="1337.75" width="100" height="15" as="geometry" />
 </mxCell>
 <mxCell id="No6-LZMIRZosWDj3bi_c-3" value="" style="line;strokeWidth=15;html=1;rounded=0;fontFamily=Helvetica;fontSize=100;fontColor=default;fillColor=none;gradientColor=none;direction=west;" vertex="1" parent="1">
 <mxGeometry x="1565" y="1335" width="435" height="15" as="geometry" />
 </mxCell>
 <mxCell id="No6-LZMIRZosWDj3bi_c-1" value="" style="shape=image;verticalLabelPosition=bottom;labelBackgroundColor=default;verticalAlign=top;aspect=fixed;imageAspect=0;image=data:image/png,iVBORw0KGgoAAAANSUhEUgAABiAAAANoCAYAAABJLCIrAAAABHNCSVQICAgIfAhkiAAAIABJREFUeJzs3Xt8HHW9P/7XJGmTFNIbm6Q0KZBSFOktbaGAFNFzTil45CIgogIe/Qm0pRRF5RwVFTyg54Ci0Ja2+P3JEQRBSwU9Uijn9z0gt0JL26QXQEovNGmSZuktzbVJ5vfH7uzO7Hxm5jOzM7szm9fzwZLduXw+n5mdbrKf93zeH+Wtt5pUEBERERERERERERER+ago3w0gIiIiIiIiIiIiIqLCwwAEERERERERERERERH5jgEIIiIiIiIiIiIiIiLyXQnAKSCIiIiIiIiIiIiIiMhfHAFBRERERERERERERES+YwCCiIiIiIiIiIiIiIh8xwAEERERERERERERERH5jgEIIiIiIiIiIiIiIiLyHQMQRERERERERERERETkOwYgiIiIiIiIiIiIiIjIdyWqmu8mEBERERERERERERFRoeEICCIiIiIiIiIiIiIi8h0DEERERERERERERERE5DsGIIiIiIiIiIiIiIiIyHcMQBARERERERERERERke9KAM5CTURERERERERERERE/uIICCIiIiIiIiIiIiIi8h0DEERERERERERERERE5DsGIIiIiIiIiIiIiIiIyHcMQBARERERERERERERke8YgCAiIiIiIiIiIiIiIt8xAEFERERERERERERERL4rUdV8N4GIiIiIiIiIiIiIiAoNR0AQEREREREREREREZHvGIAgIiIiIiIiIiIiIiLfMQBBRERERERERERERES+YwCCiIiIiIiIiIiIiIh8VwJwFmoiIiIiIiIiIiIiIvIXR0AQEREREREREREREZHvGIAgIiIiIiIiIiIiIiLfMQBBRERERERERERERES+YwCCiIiIiIiIiIiIiIh8xwAEERERERERERERERH5jgEIIiIiIiIiIiIiIiLyHQMQRERERERERERERETkuxJVzXcTiIiIiIiIiIiIiIio0HAEBBERERERERERERER+Y4BCCIiIiIiIiIiIiIi8h0DEERERERERERERERE5LsSgJNAEBERERERERERERGRvzgCgoiIiIiIiIiIiIiIfMcABBEREUXajh2NwuW9vUdx8OCe1OujR5vR1dliW5aq9kIdPGBYVqQclmpHWekR3fNOlJV2Su13/AjxdiPKu4WvM39qSor7U8syyxxR3m3aPpN+f+2nfpm+HKeynI5FtE60jeyyzPXa8Vtt67b9ovcodY5K+i3fQ6t99NuL3mc37ZPZVquvpKRfeH7cng9R/ceP6HQ87/p93Lw3+nOsP3fa8QRp2LCjvpZ39Gizr+UREREREYWd8sYbu5mDiYiIiCLrqaf+E6XDS1FeXobjjjsOpaWlKC0djuHDh2PYsBKUlAxDSUkxiouNj6KiIhQVFaG4qAhKURGKipTEMqUISpGS+qkoCooUJfVcURQoUADtuQIoSDxH4r/EOq2ByfWpl8l9hqIhetiUZyoAVU08U1Xjcm1BYhsVUAEVKlQ1ua2q6l6rUAdVDKrp14ODg6mfg4MqVHUw+XwwtWxgYMDw6O8fwMBAP/r6juHYsWPo7e1DX18vOjqOore3F729vbjyqu/k+jQREREREQWCIyCIiIgo+pRkZ2IiLmBc4TDflfVa+/1M1ZCJkvEgyotsb7eS3N98jYuvev1nlArVFJDk3WFEREREVEgYgCAiIqLIs+/gVgx3PQeH3YYAAw5UgGQvZsntVDU18AIKlNRoC0VJ/Muprp7opZVERERERKHEAAQREREVDn16lUT+FEBwh7HPVSUN3S53Bh0o1HJ1YRo+FGxCorqRWmoyEjFU07IRERERUeEryXcDiIiIiLKVyt+u68TT7ib23PvIHkFbPDtREYV3qkBGDxkyvqmwTfCmrUrOJWMYpVUgp4OIiIiICABKcpOSgIiIiCg4CrSAg16Wf+SoiEbfbQ7xdORbob4DXo8rD19knKeVcbmxmtpC1X0x43c0IiIiIioUHAFBREREhcPPTrtC7et1iachaDzD3smeu3z05huDD8aJp3WvVW1LRhyIiIiIqDAxAEFERESRJ85eogjW+qeQu40L+dhyj2ezoEh/nBg31I9o0F8R2sitIl2Eom3/Tm9tIyIiIiIKoRImGSUiIqJCku7GE/+N49fUDqIMTVHuao5y2/OPZ48yyeVqUlXVkHopsaerPE9ERERERKHGERBEREQUcVadv4pwfWZudSXzmWRfciF0ORfCMeQWz1gh8dTN72Enu6CnkpyEWnvuNHk1EREREVHUFOW7AURERETZUKDrFjZ19Dl35qmCZ6KX1vtFj+GckQVF8KDIy8Pb6DShtKpmfp7wWiMiIiKiwsEREERERBRpKtR0B5+po8+549hrV1/Uugij1t7c4ZkZUrKNHHrcP3MUhCEooRhHYlVV13mrhIiIiIgohBiAICIiouhTUv8T8Npj6LEtwRQTubrDi2dlKFMU6xEJUtmVvKRgclOkArS1cRJqIiIiIiocTMFEREREEad176mCXOsSk8BmlpMaTSGbusmqPfnDhEEaplEieVJxBamNBNdZ5twz2seNmhjBpSSfQ9UmoSYiIiIiKgwcAUFEREQRp6ZDEB5SMOnLMeRCsZ051k1Xdu46E9ltyTNA3nmalFrIXIpVuYlJqKM9pwwRERERkR2OgCAiIqLIUwEg2ZGXsdQFuyTtogrDYWjf28/RDeSG4Bpxe9lIbS9fqJr8MFF0S6qqOALine truncated
|
||||
|
After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,82 @@
|
||||
Getting started
|
||||
==================================
|
||||
|
||||
1. Where to get the board?
|
||||
----------------------------------
|
||||
|
||||
You can choose any PCB manufacturer. The PCB is designed to fit within the capabilities and constraints of JLCPCB.com.
|
||||
You have 3 options for board assembly from the most difficult to the easiest:
|
||||
|
||||
1. You can assemble the board yourself, but it's best not to do so if you're not familiar with soldering small components. You order the board with the necessary parts and solder the parts. The parts are available at LCSC.com, they supply parts to JLCPCB.com.
|
||||
2. Order the PCB from any PCB manufacturer and have only the top side assembled. This way You have to separately order the parts for the bottom part from LCSC.com (or any other supplier) and solder just the bottom part yourself. Soldering the back of the PCB by hand is not too difficult.
|
||||
3. Alternatively, you can order the board fully assembled both on the top and bottom side. This is the easiest, but the most expensive solution.
|
||||
|
||||
2. Production files?
|
||||
----------------------------------
|
||||
The latest release includes the production files for JLCPCB, which includes the Gerber files, BOM, and Pick and Place files. You can find the latest release `here <https://github.com/gab-k/RP2040-Decoder/releases>`_.
|
||||
|
||||
In order to manually export the production files (Gerber/BOM/Pick and Place), you need `KiCad <https://www.kicad.org/download/>`_ which is open source.
|
||||
In case you are ordering from JLCPCB it is recommended to use the `Fabrication-Toolkit KiCad plugin by bennymeg <https://github.com/bennymeg/Fabrication-Toolkit>`_
|
||||
|
||||
.. _building_the_software:
|
||||
|
||||
3. Building the software
|
||||
----------------------------------
|
||||
|
||||
If you got a RP2040-Decoder with USB the easiest way to get the RP2040-Decoder up and running is to just use the precompiled .uf2 file in the latest `release <https://github.com/gab-k/RP2040-Decoder/releases>`_ and skip to :ref:`flashing_the_software`.
|
||||
|
||||
However sometimes you might want to build by yourself, be it for debugging or to make your own modifications to the source code.
|
||||
The easiest way to do this is to just use `Visual Studio Code <https://code.visualstudio.com/>`_ and the `Raspberry Pi Pico extension <https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico>`_.
|
||||
The `official documentation <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension>`_ of the Pi Pico does a great job of explaining this in detail.
|
||||
|
||||
.. note::
|
||||
- Make sure to choose the correct board definition file in your CMakeLists.txt file ``RP2040-Decoder-board-USB`` for the USB Hardware or ``RP2040-Decoder-board-Legacy`` for the old legacy version without usb.
|
||||
- In VSCode open the "Software" subdirectory for the extension to detect you project automatically.
|
||||
|
||||
.. _flashing_the_software:
|
||||
|
||||
4. Flashing the software
|
||||
----------------------------------
|
||||
|
||||
For RP2040-Decoders with USB there is two ways of flashing the software:
|
||||
|
||||
1. Flashing via USB using the .uf2 file by copying it with your preferred file explorer.
|
||||
2. Using Serial Wire Debug (SWD)
|
||||
|
||||
2.1. Using another RP2040/RP2350-based board with `debugprobe software <https://github.com/raspberrypi/debugprobe>`_ on it. (Could be the RP2040-Decoder itself)
|
||||
|
||||
2.2. Using any other supported SWD debug interface
|
||||
|
||||
For RP2040-Decoders without USB the only way of flashing the software is via SWD
|
||||
|
||||
4.1. Flashing the software via .uf2 file
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
When first plugged in the RP2040 boots into Mass Storage Device mode. To flash the software, you need to drag the '.uf2' file onto the disk using any file explorer.
|
||||
This will write the file to the Flash and restart the RP2040.
|
||||
In case you want to repeat the flashing process, hold the button SW1 while re-plugging the decoder into your computer. The decoder should now show as a Mass Storage Device again.
|
||||
This procedure is also described in the `Raspberry Pi Pico Datasheet Chapter 4.1 <https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf#_programming_the_flash>`_
|
||||
|
||||
.. _flashing_the_software_swd:
|
||||
|
||||
4.2. Flashing the software via SWD
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Flashing via SWD is a little more complicated but also comes with great advantages in terms of debugging.
|
||||
The book on `Getting started with Raspberry Pi Pico-series <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf>`_ does a great job of explaining how debugging works.
|
||||
As already suggested in :ref:`building_the_software` it is recommended to use the `Visual Studio Code Extension <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension>`_.
|
||||
The most relevant sections in the book are `Chapter 4.3. Debug <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#_debug>`_ and `Appendix A: Debugprobe <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#debugprobe_section>`_
|
||||
|
||||
|
||||
5. Wiring
|
||||
----------------------------------
|
||||
|
||||
| Please refer to the hardware section for your board:
|
||||
| :ref:`Wiring USB Hardware Revision <wiring_USB>`
|
||||
| :ref:`Wiring Legacy Hardware Revision <wiring_Legacy>`
|
||||
|
||||
6. Resolving issues
|
||||
----------------------------------
|
||||
|
||||
If the decoder is not working as expected:
|
||||
|
||||
1. Follow the `Troubleshooting instructions <https://github.com/gab-k/RP2040-Decoder/wiki/Troubleshooting>`_
|
||||
2. If you still have trouble, create a new `discussion <https://github.com/gab-k/RP2040-Decoder/discussions>`_ or `issue <https://github.com/gab-k/RP2040-Decoder/issues>`_ and describe your question/issue.
|
||||
@@ -0,0 +1,128 @@
|
||||
Overview
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/Block_Diagram_Hardware.svg
|
||||
:alt: Block Diagram
|
||||
:align: center
|
||||
|
||||
Harware block diagram
|
||||
|
||||
The above block diagram gives a general overview regarding the operation of components. For better illustration it has been divided into four functional blocks. Furthermore, these functional blocks can be subdivided and will be explained below.
|
||||
|
||||
- **Input Stage**
|
||||
- DCC Signal Level Shift
|
||||
- Bridge Rectifier & Voltage Regulator
|
||||
- **Motor Driver**
|
||||
- Motor Driver
|
||||
- Back EMF measurement (ADC)
|
||||
- **General Purpose**
|
||||
- GPIO
|
||||
- Auxiliary output
|
||||
- **Microcontroller**
|
||||
- Flash memory
|
||||
- Crystal oscillator
|
||||
|
||||
Electrical Characteristics
|
||||
==============================
|
||||
.. table:: Electrical Characteristics & Absolute Maximum Ratings
|
||||
:widths: auto
|
||||
|
||||
===================================================== ============================= ========= ========= =====
|
||||
Parameter Symbol Minimum Maximum Unit
|
||||
===================================================== ============================= ========= ========= =====
|
||||
Absolute max. DCC Input Voltage difference V\ :sub:`DCC`\ 0 +24 V
|
||||
Absolute max. GPIO Voltage\ :sup:`(0)`\ V\ :sub:`PIN`\ -0.5 3.3+0.5 V
|
||||
Input Voltage High\ :sup:`(0)`\ V\ :sub:`IH`\ 2.145 3.6 V
|
||||
Input Voltage Low\ :sup:`(0)`\ V\ :sub:`IL`\ 0 1.155 V
|
||||
Total GPIO Current\ :sup:`(0)`\ I\ :sub:`IOVDD`\ 50 mA
|
||||
Absolute max. motor output current\ :sup:`(1)`\ I\ :sub:`MOTOR`\ 2.8 A
|
||||
Absolute max. auxiliary output current \ :sup:`(2)`\ I\ :sub:`AUX`\ 400 mA
|
||||
===================================================== ============================= ========= ========= =====
|
||||
|
||||
|
||||
(0): According to: `RP2040 Datasheet <https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf>`_ (assuming V\ :sub:`DD`\ = 3.3V)
|
||||
|
||||
(1): According to: `BDR6133 Datasheet <https://www.lcsc.com/datasheet/lcsc_datasheet_2409291808_Bardeen-Micro--BDR6133_C2687793.pdf>`_
|
||||
|
||||
(2): According to: `T2N7002BK Datasheet <https://toshiba.semicon-storage.com/info/T2N7002BK_datasheet_en_20191025.pdf?did=30376&prodName=T2N7002BK>`_
|
||||
|
||||
.. note:: Keep in mind that realistically these maximum ratings can't be reached in practice due to thermal limitations. For example the motor current can probably not exceed 1.5A for continuous operation.
|
||||
|
||||
Input Stage
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/Input_Stage.svg
|
||||
:alt: Input Stage
|
||||
:align: center
|
||||
|
||||
Input stage
|
||||
|
||||
D1 Rectifies the DCC square-wave into +V, the amplitude is not critical as long as it's within the 25V limit. The rectified voltage +V is then provided to the 3.3V voltage regulator (U1) and to the motor driver (U2).
|
||||
|
||||
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V\ :sub:`GS`\ > V\ :sub:`GS,th`\), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V\ :sub:`GS`\ doesn't exceed ±20V.
|
||||
|
||||
Motor Driver
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/Motor_Driver.svg
|
||||
:alt: Motor Driver
|
||||
:align: center
|
||||
|
||||
Motor driver
|
||||
|
||||
The Motor Driver is a special H-Bridge IC that is made for DC motors. To control the motor, it is necessary to measure the back-EMF voltage, which is directly related to the motor's speed. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B. The two resistors work together as a voltage divider.
|
||||
|
||||
Auxiliary Outputs
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/Aux_Outputs.svg
|
||||
:alt: Auxiliary Outputs
|
||||
:align: center
|
||||
|
||||
Auxiliary Outputs
|
||||
|
||||
Switching of loads can be done using four N-Channel MOSFETs (Q2 to Q5). The amount of current is somewhat dependend on either static R\ :sub:`DS(on)`\ losses and/or switching losses using PWM. They are switching on the low-side, which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
|
||||
|
||||
|
||||
GPIO
|
||||
==============================
|
||||
|
||||
To switch lighter loads, six GPIO soldering pads are connected to GPIO0 to GPIO5 pins. Although not yet set up in the software, they could be used as inputs as well (e.g. reed switch). GPIO0 and GPIO1 can also be used to facilitate stdio logging via UART, which can easily be set up in CMakeLists.txt.
|
||||
|
||||
|
||||
Microcontroller
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/Microcontroller.svg
|
||||
:alt: Microcontroller
|
||||
:align: center
|
||||
|
||||
Microcontroller, flash memory, crystal oscillator, ...
|
||||
|
||||
The Microcontroller needs a crystal oscillator for its clock. External flash memory holds the configuration variables and the program itself. R3 & C14 are used to filter ADC_AVDD (ADC Reference Voltage).
|
||||
|
||||
Complete Schematic
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/RP2040-Decoder.svg
|
||||
:alt: Complete Schematic
|
||||
:align: center
|
||||
|
||||
Complete Schematic
|
||||
|
||||
|
||||
.. _wiring_Legacy:
|
||||
|
||||
Wiring the Decoder
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/Legacy/Wiring_diagram.svg
|
||||
:align: center
|
||||
:width: 700
|
||||
:alt: Wiring Diagram
|
||||
|
||||
Wiring Diagram
|
||||
|
||||
The illustration above provides an example of a wiring configuration.
|
||||
It supports the connection of up to 4 transistor-switched outputs and 6 GPIOs for lighter loads or custom applications.
|
||||
When switching inductive loads, always include a free-wheeling diode to protect the circuit.
|
||||
@@ -0,0 +1,130 @@
|
||||
Overview
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/Block_Diagram_Hardware.svg
|
||||
:align: center
|
||||
:alt: Block Diagram
|
||||
|
||||
Harware block diagram
|
||||
|
||||
The above block diagram gives a general overview regarding the operation of components. For better illustration it has been divided into four functional blocks. Furthermore, these functional blocks can be subdivided and will be explained below.
|
||||
|
||||
- **Input Stage**
|
||||
- DCC Signal Level Shift
|
||||
- Bridge Rectifier & Voltage Regulator
|
||||
- **Motor Driver**
|
||||
- Motor Driver
|
||||
- Back EMF measurement (ADC)
|
||||
- **General Purpose**
|
||||
- GPIO
|
||||
- Auxiliary output
|
||||
- **Microcontroller**
|
||||
- Flash memory
|
||||
- Crystal oscillator
|
||||
- USB Connector
|
||||
|
||||
Electrical Characteristics
|
||||
==============================
|
||||
.. table:: Electrical Characteristics & Absolute Maximum Ratings
|
||||
:widths: auto
|
||||
|
||||
======================================================== ============================= ========= ========= =====
|
||||
Parameter Symbol Minimum Maximum Unit
|
||||
======================================================== ============================= ========= ========= =====
|
||||
Absolute max. DCC input voltage difference V\ :sub:`DCC`\ +24 V
|
||||
Absolute max. GPIO voltage\ :sup:`(0)`\ V\ :sub:`PIN`\ -0.5 3.3+0.5 V
|
||||
Input voltage high\ :sup:`(0)`\ V\ :sub:`IH`\ 2.145 3.6 V
|
||||
Input voltage low\ :sup:`(0)`\ V\ :sub:`IL`\ 0 1.155 V
|
||||
Total GPIO Current\ :sup:`(0)`\ I\ :sub:`IOVDD`\ 50 mA
|
||||
Absolute max. motor output current\ :sup:`(1)`\ I\ :sub:`MOTOR`\ 2.8 A
|
||||
Absolute max. auxiliary output current \ :sup:`(2)(3)`\ I\ :sub:`AUX`\ 1.4 A
|
||||
======================================================== ============================= ========= ========= =====
|
||||
|
||||
|
||||
(0): According to: `RP2040 Datasheet <https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf>`_ (assuming V\ :sub:`DD`\ = 3.3V)
|
||||
|
||||
(1): According to: `BDR6133 Datasheet <https://www.lcsc.com/datasheet/lcsc_datasheet_2409291808_Bardeen-Micro--BDR6133_C2687793.pdf>`_
|
||||
|
||||
(2): According to: `Si1308EDL Datasheet <https://www.vishay.com/docs/63399/si1308edl.pdf>`_
|
||||
|
||||
(3): T\ :sub:`Case`\ = 25°C, keep power dissipation, thermal resistance the corresponding temperature rise ΔT and switching losses in PWM mode in mind!
|
||||
|
||||
.. note:: Keep in mind that realistically these maximum ratings can't be reached in practice due to thermal limitations. For example the motor current can probably not exceed 1.5A for continuous operation.
|
||||
|
||||
|
||||
Input Stage
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/Input_Stage.svg
|
||||
:align: center
|
||||
:alt: Input Stage
|
||||
|
||||
Input stage
|
||||
|
||||
D2 Rectifies the DCC square-wave into VDC, the amplitude is not critical as long as it's within the 25V limit. The rectified voltage VDC is then provided to the 3.3V voltage regulator and to the motor driver. The shottky diode D1 and the bridge rectifier D2 ensure a logical "or" linkage of the VBUS supply voltages and the DCC input voltage, meaning that the decoder can be powered either by the DCC track signal or by the VBUS supply voltage which is supplied via USB connector.
|
||||
|
||||
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V\ :sub:`GS`\ > V\ :sub:`GS,th`\), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V\ :sub:`GS`\ doesn't exceed ±12V.
|
||||
|
||||
Motor Driver
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/Motor_Driver.svg
|
||||
:align: center
|
||||
:alt: Motor Driver
|
||||
|
||||
Motor driver
|
||||
|
||||
The Motor Driver is a special H-Bridge IC that is made for DC motors. To control the motor, it is necessary to measure the back-EMF voltage, which is directly related to the motor's speed. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B. The two resistors work together as a voltage divider.
|
||||
|
||||
Auxiliary Outputs
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/Aux_Outputs.svg
|
||||
:align: center
|
||||
:alt: Auxiliary Outputs
|
||||
|
||||
Auxiliary Outputs
|
||||
|
||||
Switching of loads can be done using four N-Channel MOSFETs (Q2 to Q5). The amount of current is somewhat dependend on either static R\ :sub:`DS(on)`\ losses and/or switching losses using PWM. They are switching on the low-side, which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
|
||||
|
||||
GPIO
|
||||
==============================
|
||||
|
||||
To switch lighter loads, six GPIO soldering pads are connected to GPIO0 to GPIO5 pins. Although not yet set up in the software, they could be used as inputs as well (e.g. reed switch). GPIO0 and GPIO1 can also be used to facilitate stdio logging via UART, which can easily be set up in CMakeLists.txt.
|
||||
|
||||
Microcontroller
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/Microcontroller.svg
|
||||
:align: center
|
||||
:alt: Microcontroller
|
||||
|
||||
Microcontroller, flash memory, crystal oscillator, USB connector, ...
|
||||
|
||||
The Microcontroller needs a crystal oscillator for its clock. External flash memory holds the configuration variables and the program itself. The USB connector can be used to flash the software onto the decoder and also for logging via stdio (can be enabled via CMakeLists.txt). D3 is used as a status LED. R11 & C13 are used to filter ADC_AVDD (ADC Reference Voltage).
|
||||
|
||||
Complete Schematic
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/RP2040-Decoder.svg
|
||||
:align: center
|
||||
:alt: Complete Schematic
|
||||
|
||||
Complete Schematic
|
||||
|
||||
|
||||
.. _wiring_USB:
|
||||
|
||||
Wiring the Decoder
|
||||
==============================
|
||||
|
||||
.. figure:: ../../../../svg/hw/USB/Wiring_diagram.svg
|
||||
:width: 700
|
||||
:alt: Wiring Diagram
|
||||
:align: center
|
||||
|
||||
Wiring Diagram
|
||||
|
||||
The illustration above provides an example of a wiring configuration.
|
||||
It supports the connection of up to 4 transistor-switched outputs and 6 GPIOs for lighter loads or custom applications.
|
||||
When switching inductive loads, always include a free-wheeling diode to protect the circuit.
|
||||
@@ -0,0 +1,18 @@
|
||||
Hardware
|
||||
======================
|
||||
|
||||
USB
|
||||
------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
USB/hw_description
|
||||
|
||||
Legacy
|
||||
------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
Legacy/hw_description
|
||||
@@ -0,0 +1,16 @@
|
||||
.. RP2040-Decoder documentation master file, created by
|
||||
sphinx-quickstart on Wed Nov 27 08:19:47 2024.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
RP2040-Decoder Documentation
|
||||
============================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:caption: Contents:
|
||||
|
||||
gs/getting_started
|
||||
hardware/index
|
||||
software/index
|
||||
other/index
|
||||
@@ -0,0 +1,126 @@
|
||||
Configuration Variables (CV)
|
||||
============================
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
- ``CV.h`` contains default values for every CV. When your board is still "factory new" these values are automatically written into flash. ``CV_65 == 255`` indicates a factory condition and resets all CVs to default.
|
||||
|
||||
- Index 0 in the CV array corresponds with ``CV_1``, index 1 corresponds with ``CV_2`` and so forth.
|
||||
|
||||
Reset all CVs
|
||||
------------------------
|
||||
|
||||
To reset all CVs to default, a value of ``8`` can be written to ``CV8``. Alternatively write a value of ``255`` to ``CV_65`` this will also reset all CVs to default, but only after power cycling the decoder.
|
||||
|
||||
Speed step configuration
|
||||
------------------------
|
||||
|
||||
.. figure:: ../../../svg/sw/speed_table.svg
|
||||
:alt: Speed Table
|
||||
:align: center
|
||||
|
||||
Speed Table
|
||||
|
||||
* :math:`v_{min} = CV_{2}`
|
||||
* :math:`v_{mid} = 16 \cdot CV_{6}`
|
||||
* :math:`v_{max} = 16 \cdot CV_{5}`
|
||||
|
||||
The figure above shows how the speed steps can be configured using the corresponding CVs. The red * represents :math:`v_{min}` which is always at speed step 1, the green * shows :math:`v_{mid}` at speed step 63, and the blue * shows :math:`v_{max}` at speed step 126.
|
||||
|
||||
CV List
|
||||
-------
|
||||
|
||||
:math:`CV_{1}` - Basic address
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Short DCC address
|
||||
|
||||
:math:`CV_{2}` - :math:`v_{min}`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Min motor voltage/speed is: :math:`v_{min} = CV_{2}`
|
||||
|
||||
:math:`CV_{3}` - Acceleration rate
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The time for one discrete acceleration time step can be calculated as :math:`CV_{3} \cdot CV_{175}`.
|
||||
|
||||
.. note:: Base speed steps are always 128/126 steps.
|
||||
|
||||
:math:`CV_{4}` - Deceleration rate
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The time for one discrete deceleration time step can be calculated as :math:`CV_{4} \cdot CV_{175}`.
|
||||
|
||||
.. note:: Base speed steps are always 128/126 steps.
|
||||
|
||||
:math:`CV_{5}` - :math:`v_{max}`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Max motor voltage/speed is calculated as: :math:`v_{max} = 16 \cdot CV_{5}`
|
||||
|
||||
:math:`CV_{6}` - :math:`v_{mid}`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Mid motor voltage/speed is calculated as: :math:`v_{mid} = 16 \cdot CV_{6}`
|
||||
|
||||
:math:`CV_{7}` - Version No. (Read-Only)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Writing a value of ``7`` triggers an ADC offset adjustment.
|
||||
|
||||
:math:`CV_{8}` - Manufacturer (Read-Only)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Default = ``13`` = Public Domain & Do-It-Yourself Decoders
|
||||
|
||||
Even though :math:`CV_{8}` is defined as a Read-only CV, writing a value of ``8`` resets all CV values to the default values in ``CV.h``.
|
||||
|
||||
:math:`CV_{9}` - Motor PWM Frequency
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:math:`f_{PWM_{MOTOR}} = (CV_9 \cdot 100 + 10000) \, Hz`
|
||||
|
||||
:math:`CV_{11}` - Packet timeout
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
If no package is received for :math:`x = CV_{11}` seconds the decoder will automatically stop the motor (Emergency Stop).
|
||||
|
||||
:math:`CV_{12}` - Permitted operating modes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Currently, DCC Digital mode is the only supported mode.
|
||||
|
||||
:math:`CV_{17}` & :math:`CV_{18}` - 14-Bit extended/long address
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Address is only used if bit5 of :math:`CV_{29}` has a value of ``1``.
|
||||
|
||||
.. image:: ../../../svg/sw/Long_address.svg
|
||||
:alt: Long Address
|
||||
:align: center
|
||||
|
||||
Bit15 and bit14 which correspond to bit7 and bit6 of :math:`CV_{17}` are always ``1``. :math:`CV_{17} = 192` & :math:`CV_{18} = 0` is also not a valid address.
|
||||
Otherwise, the valid value range of :math:`CV_{17}` ranges from ``192`` to ``231`` and ``0`` to ``255`` for :math:`CV_{18}` respectively.
|
||||
|
||||
:math:`CV_{29}` - Decoder Configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Bit0 is can be used to reverse motor direction, i.e., ``0`` = normal, ``1`` = reverse.
|
||||
Bit5 switches between basic and extended addressing modes, i.e., ``0`` = basic address, ``1`` = extended address.
|
||||
The other 6 bits are currently not in use and therefore irrelevant.
|
||||
|
||||
:math:`CV_{31}` & :math:`CV_{32}` - Extended CV pointer (Read-Only)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Not in use.
|
||||
|
||||
|
||||
:math:`CV_{116}` to :math:`CV_{171}` - PWM Slice configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.. image:: ../../../svg/sw/GPIO_slices.svg
|
||||
:alt: GPIO Slices
|
||||
:align: center
|
||||
|
||||
Every slice controls two independent output channels, duty cycle from 0% to 100% inclusive, and can be configured with several parameters:
|
||||
|
||||
* Wrap (16Bit): Sets the slice time period of x cycles - effectively determining the frequency
|
||||
* Clock Divider: Additional clock divider
|
||||
* Level Channel A / Level Channel B (16Bit each): Determining how many of the x cycles the signal is at a high level - effectively determining the duty cycle
|
||||
|
||||
To see which CVs correspond to which slice and channel, it is advisable to use ``CV.h`` as a reference.
|
||||
|
||||
The PWM frequency is calculated as follows: :math:`f_{PWM} = \frac{125 \, \text{MHz}}{(CV_{\text{clk_div}} + 1) \cdot (CV_{\text{wrap}} + 1)}`
|
||||
|
||||
The duty-cycle can be calculated as follows: :math:`D = \frac{CV_{\text{Level}}}{CV_{\text{wrap}} + 1}`
|
||||
|
||||
|
||||
A more detailed explanation regarding PWM can be found in the `RP2040-Datasheet - Chapter 4.5 <https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf>`_.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Debugging and Logging
|
||||
==================================
|
||||
|
||||
For logging and debugging you have to build the software yourself. This is explained here: :ref:`building_the_software`
|
||||
|
||||
.. _debugging_via_swd:
|
||||
|
||||
Debugging via SWD
|
||||
----------------------------------
|
||||
Please refer to :ref:`flashing_the_software_swd`.
|
||||
|
||||
|
||||
.. _logging:
|
||||
|
||||
Logging
|
||||
----------------------------------
|
||||
|
||||
Logging can be enabled in ``CMakeLists.txt``, and is available with two interfaces:
|
||||
|
||||
- Logging via UART RX/TX pins (GPIO0/GPIO1 by default)
|
||||
- Logging via USB CDC/ACM
|
||||
|
||||
Additionally you can make the decoder wait for input via serial port by setting LOG_WAIT to 1. For more details please see comments inside ``CMakeLists.txt``.
|
||||
@@ -0,0 +1,10 @@
|
||||
Other
|
||||
======================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
troubleshooting
|
||||
debug_logging
|
||||
CV_list
|
||||
@@ -0,0 +1,27 @@
|
||||
Troubleshooting
|
||||
================
|
||||
|
||||
To narrow down the issue when your decoder is not working as expected, you can do the following (in no particular order):
|
||||
|
||||
Enable logging and or debug via SWD
|
||||
------------------------------------
|
||||
Log messages can be enabled and output via either UART or USB please see :ref:`logging` for details.
|
||||
For more advanced users it might also be beneficial to :ref:`debug with SWD <debugging_via_swd>`
|
||||
|
||||
Checking the power supply:
|
||||
--------------------------------------
|
||||
|
||||
* **+3V3 to GND** should be 3.3V ± 1%
|
||||
* **VDC/+V to GND** should be somewhere in the range of at least 6V to 23V depending on your track voltage.
|
||||
|
||||
If you don't measure the correct voltages, try to `measure your track voltage <https://dccwiki.com/Measuring_Track_Voltage>`_
|
||||
|
||||
Check your motor:
|
||||
-----------------
|
||||
|
||||
Desolder your motor and try the motor with an appropriate power supply and DC voltage, to check if the motor is working or not.
|
||||
|
||||
CV Reset:
|
||||
------------
|
||||
|
||||
Try to reset the decoder by writing a value of ``8`` to ``CV8`` (beware, this will reset the complete CV memory!)
|
||||
@@ -0,0 +1,22 @@
|
||||
core0.h
|
||||
--------------
|
||||
.. doxygenfile:: core0.h
|
||||
:project: RP2040-Decoder
|
||||
|
||||
|
||||
core1.h
|
||||
--------------
|
||||
.. doxygenfile:: core1.h
|
||||
:project: RP2040-Decoder
|
||||
|
||||
|
||||
shared.h
|
||||
--------------
|
||||
.. doxygenfile:: shared.h
|
||||
:project: RP2040-Decoder
|
||||
|
||||
CV.h
|
||||
--------------
|
||||
.. doxygenfile:: CV.h
|
||||
:project: RP2040-Decoder
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Software
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:caption: Contents:
|
||||
|
||||
sw_description
|
||||
header_files
|
||||
@@ -0,0 +1,223 @@
|
||||
Software Description
|
||||
==============================
|
||||
|
||||
Overview
|
||||
------------------------------
|
||||
|
||||
Software files high level overview:
|
||||
|
||||
- **core0.c / core0.h**
|
||||
|
||||
- DCC package detection & decoding
|
||||
- Programming mode (Modify and read CVs on programming track)
|
||||
- ADC-Offset measurement
|
||||
|
||||
- **core1.c / core0.h**
|
||||
|
||||
- PID motor controller
|
||||
- Back-EMF voltage measurement
|
||||
|
||||
- **shared.c / shared.h** (used by both cores)
|
||||
|
||||
- Error handling
|
||||
- Helper functions for retrieving CV's
|
||||
|
||||
- **CV.h**
|
||||
|
||||
- Default configuration variables
|
||||
|
||||
- **CMakeLists.txt**
|
||||
|
||||
- CMake version, SDK version, C standard version
|
||||
- Board definitions
|
||||
- Compile/Build options
|
||||
- Sources files, header files
|
||||
- Debug logging configuration (via stdio using UART/USB)
|
||||
- Linked libraries
|
||||
|
||||
- **RP2040-Decoder-board-USB.h / RP2040-Decoder-board-Legacy.h**
|
||||
|
||||
- Flash Size
|
||||
- Pin definitions
|
||||
|
||||
- LED pin when available
|
||||
- UART_TX/UART_RX pins when used for logging
|
||||
- DCC input pin
|
||||
- Motor Control PWM pins
|
||||
- ADC pins
|
||||
|
||||
- **post_build.cmake**
|
||||
|
||||
- Post build script for checking whether the size of the binary is within the limits of the flash size minus one sector (used for storing CVs).
|
||||
|
||||
- **pico_sdk_import.cmake**
|
||||
|
||||
- Helps to locate and import the Pico SDK
|
||||
|
||||
The `Raspberry Pi Pico SDK <https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf>`_ is a dependency of the decoder software. The SDK provides abstraction to a higher level, so hopefully, in combination with the comments included in header and source files, the code is easy enough to understand.
|
||||
|
||||
Control Loop & Digital Controller
|
||||
------------------------------------
|
||||
|
||||
.. figure:: ../../../svg/sw/Block_Diagram_Control_Loop.svg
|
||||
:alt: Block Diagram - Control Loop
|
||||
:align: center
|
||||
|
||||
Control Loop - Block diagram
|
||||
|
||||
The block diagram above shows the (simplified) control loop. The actual digital controller block is explained below.
|
||||
|
||||
The *Speed Helper* block effectively sets the setpoint of the controller according to the CV configured acceleration and deceleration rates and actual target speedstep.
|
||||
|
||||
For feedback the back EMF voltage *V_EMF* is measured via voltage divider and ADC. *V_EMF* is proportional to the motor speed.
|
||||
|
||||
|
||||
While the central component is the PID controller, there is an additional block called `Feed-forward <https://en.wikipedia.org/wiki/Feed_forward_(control)>`_ that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the :c:func:`speed_helper()` function, which delays changing the setpoint according to the configured deceleration/acceleration rates.
|
||||
|
||||
.. figure:: ../../../svg/sw/Block_Diagram_Digital_Controller.svg
|
||||
:alt: Block Diagram - Digital Controller
|
||||
:align: center
|
||||
|
||||
Digital Controller - Block diagram
|
||||
|
||||
The controller is divided into two parts, depending on whether the motor is stationary or in motion.
|
||||
At all times either the startup controller or the PID controller is active.
|
||||
|
||||
The startup controller handles overcoming friction of the motor, and finding a base PWM level for overcoming friction.
|
||||
The base PWM level is equivalent to a certain PWM duty cycle.
|
||||
The base level gets saved and added to the output of the PID controller which handles motor control when the motor is in motion.
|
||||
This means the actual output of the PID controller is the sum of the PID output and the base PWM level. This is referred to as the :ref:`feed forward <feed_forward>` block.
|
||||
The benefit of doing this is that the PID controller does not have to work in the non linear friction region of the motor, improving control performance.
|
||||
|
||||
|
||||
Speed Table Initialization
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The speed table is a crucial component of the motor control system, as it translates the 128 speed steps received from the DCC controller into specific setpoints for the PID controller. This table is initialized once at startup in the :c:func:`init_controller` function. The shape of the speed curve can be configured using three CV values: `V_min` (CV2), `V_mid` (CV6), and `V_max` (CV5).
|
||||
|
||||
- **V_min (CV2):** Defines the starting voltage (setpoint) for the first speed step.
|
||||
- **V_mid (CV6):** Sets the voltage at the midpoint of the speed range (speed step 64).
|
||||
- **V_max (CV5):** Determines the maximum voltage at the highest speed step (126).
|
||||
|
||||
The speed table is calculated with two linear interpolations: one from `V_min` to `V_mid` and another from `V_mid` to `V_max`. This creates a two-segment linear speed curve, which allows for a non-linear relationship between the speed step and the motor voltage. For example, you can have a gentle acceleration at low speeds and a more aggressive one at higher speeds.
|
||||
|
||||
The :c:func:`speed_helper` function then uses this table to gradually adjust the setpoint based on the configured acceleration and deceleration rates.
|
||||
|
||||
|
||||
Startup Controller
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The startup controller is used when the motor is stationary to find the minimum PWM level required to overcome static friction. This process is not retained on a power cycle.
|
||||
|
||||
The initial PWM level for the startup sequence is determined as follows:
|
||||
|
||||
- If previous successful startup levels are saved in memory, the controller calculates their average, :math:`\bar{b}`, and sets the initial PWM level to :math:`\frac{2}{3} \cdot \bar{b}`.
|
||||
- If no previous levels are saved, the ramp-up starts from a PWM level of 0.
|
||||
|
||||
From this starting point, the controller progressively ramps up the duty cycle until motor movement is detected. The ramp-up is not smooth but occurs in steps, with the step size determined by the maximum PWM level (which is a function of the PWM frequency).
|
||||
|
||||
If the PWM level reaches its maximum without motor movement, the controller reduces the starting level by half and retries, preventing excessive power to a stalled motor.
|
||||
|
||||
Once movement is detected (via back-EMF voltage), the current PWM `level` is saved as a new base value for future startups. This value is also multiplied by `K_FF` (from CV47) and used as the feed-forward term for the PID controller.
|
||||
|
||||
|
||||
|
||||
PID Controller
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. figure:: ../../../svg/sw/Block_Diagram_PID.svg
|
||||
:alt: PID Controller figure
|
||||
:align: center
|
||||
|
||||
PID Controller
|
||||
|
||||
The block diagram above shows the PID controller in the s-domain. The derivative part contains an additional digital low-pass filter used to filter out high-frequency noise.
|
||||
|
||||
.. math::
|
||||
|
||||
\begin{align}
|
||||
\text{Output} &= E \cdot \left(K_P + \frac{K_I}{s} + \frac{K_D \cdot s}{s \tau + 1}\right) = P + I + D \\
|
||||
P &= E \cdot K_P \\
|
||||
I &= E \cdot \frac{K_I}{s} \\
|
||||
D &= E \cdot \frac{K_D \cdot s}{s \tau + 1}
|
||||
\end{align}
|
||||
|
||||
With :math:`T_s` being the sampling time / controller update rate / time step of the discrete system.
|
||||
And :math:`\tau` being the filter time constant of the digital filter
|
||||
|
||||
The continuous-time system representation can now be transformed into a discrete-time representation using `bilinear transform <https://en.wikipedia.org/wiki/Bilinear_transform>`_ :math:`s = \frac{2 \cdot (z - 1)}{T_s \cdot (z + 1)}`.
|
||||
|
||||
This results in the following difference equations which are then implemented in software:
|
||||
|
||||
.. math::
|
||||
|
||||
\begin{align}
|
||||
p_n &= K_P \cdot e_n \\
|
||||
i_n &= 0.5 \cdot K_I \cdot \left(e_n + e_{n-1}\right) + i_{n-1} \\
|
||||
d_n &= \frac{2 K_D \cdot \left(e_n - e_{n-1}\right) + \left(2 \tau - T_s\right) \cdot d_{n-1}}{2 \tau + T_s} \\
|
||||
\text{output}_n &= p_n + i_n + d_n
|
||||
\end{align}
|
||||
|
||||
|
||||
.. note::
|
||||
- Instead of using the derivative of error, the derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint.
|
||||
- The previously explained base PWM is added to the actual output as well, meaning the formula above only shows the actual PID control part without feed forward.
|
||||
|
||||
|
||||
Gain Scheduling
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. figure:: ../../../svg/sw/adaptive_kp.svg
|
||||
:alt: Gain Scheduling figure
|
||||
:align: center
|
||||
|
||||
Gain Scheduling
|
||||
|
||||
Another aspect to consider is the implementation of `gain scheduling <https://en.wikipedia.org/wiki/Gain_scheduling>`_. K\ :sub:`P` is a function of the current setpoint. Often it is favorable to have a higher proportional gain K\ :sub:`P` for slow speeds, achieving better control results. The illustration above shows the default setting for K\ :sub:`P`. CV_54 & CV_55 are used to set K\ :sub:`P` @ x\ :sub:`0`, CV_56 & CV_57 for K\ :sub:`P` @ x\ :sub:`1`, and CV_58 & CV_59 for K\ :sub:`P` @ x\ :sub:`2`. Additionally, CV_60 is used to shift x\ :sub:`1` from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).
|
||||
|
||||
The :c:func:`get_kp()` function implements this gain scheduling. It calculates the proportional gain `K_p` based on the current setpoint `sp`. The function uses two different linear equations to determine `K_p`, depending on whether the setpoint is above or below the `k_p_x_1` threshold. This creates a piecewise linear function for `K_p`, allowing for different gain characteristics at different speed ranges.
|
||||
|
||||
The parameters for these linear equations (`k_p_m_1`, `k_p_m_2`, `k_p_y_0`, `k_p_y_1`) are pre-calculated in the :c:func:`init_controller` function based on the corresponding CV values.
|
||||
|
||||
|
||||
.. _feed_forward:
|
||||
|
||||
Feed-forward
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As previously mentioned, to achieve better control, `Feed-forward <https://en.wikipedia.org/wiki/Feed_forward_(control)>`_ is used.
|
||||
In essence this means that the output of the PID controller is not only the sum of the proportional, integral, and derivative parts, but also the base PWM level.
|
||||
The base PWM level is set by the startup controller and is the PWM level at which the motor starts moving.
|
||||
|
||||
|
||||
Speed Helper
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The :c:func:`speed_helper` function is responsible for implementing smooth acceleration and deceleration. It is called by a repeating timer, with the interval configured by CV175. This function acts as a temporal filter for the speed setpoint.
|
||||
|
||||
Instead of instantly changing the motor's setpoint to the new target speed step, the :c:func:`speed_helper` function gradually increments or decrements the current setpoint based on the acceleration (CV3) and deceleration (CV4) rates. These CVs determine how many calls to :c:func:`speed_helper` are needed for a single speed step change. For example, if the acceleration rate is set to 5, the :c:func:`speed_helper` must be called 5 times before the setpoint is incremented to the next speed step. This creates a time-based acceleration/deceleration curve.
|
||||
|
||||
The function also handles direction changes. If a direction change is detected, it will immediately jump to the new target speed without any delay, ensuring a responsive change in direction.
|
||||
|
||||
|
||||
Back-EMF voltage measurement
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To provide a feedback signal proportional to the motor speed, the ADC is used to measure the `Back-EMF voltage <https://en.wikipedia.org/wiki/Counter-electromotive_force>`_. The measurement works by setting the PWM duty cycle to 0%, waiting for a certain delay time (CV_62), and then measuring x times (x = CV_61). The ADC input channel is selected based on the motor's direction (forward or reverse). While measuring, the array with measurement values is sorted using insertion sort. Afterwards, y elements (y = CV_63) from the left (lowest values) and z elements (z = CV_64) from the right (highest values) will be dismissed to mitigate the impact of potential outliers in measurement. The average value of the remaining values will be computed and fed back into the control algorithm. Considering default settings (100us delay, 100 samples, ~2µs sampling time), the complete measurement run, including averaging, takes about 0.3ms to 0.35ms, which effectively reduces the maximum possible duty cycle to about 93% to 94%.
|
||||
|
||||
DCC signal decoding
|
||||
------------------------------
|
||||
|
||||
The detection of the DCC signal works by looking at every rising and falling edge and calculating the time between them. When the time between rising and falling edge is greater than 87μs, then this is equivalent to "0"; otherwise, "1". This value then gets shifted into a 64-Bit variable.
|
||||
|
||||
Decoding is done after every falling edge. It starts with an error detection, which, when not passed, dismisses the received command. Then the address will be decoded and compared to the address stored in the configuration. If the address matches, the command/instruction will be decoded.
|
||||
|
||||
Only a few instructions are currently implemented; only 128 speed step instructions are supported.
|
||||
|
||||
**Implemented instructions:**
|
||||
|
||||
- ``0011-1111`` - (128 Speed Step Control) - 2 Byte length
|
||||
- ``10XX-XXXX`` - (Function Group Instruction) (F0 - F12)
|
||||
- ``110X-XXXX`` - Expansion Instruction (F13 - F31)
|
||||
|
||||
All DCC instructions can be found in Section 9.2, 9.2.1, and 9.2.1.1 of the `NMRA Communications Standard <https://www.nmra.org/index-nmra-standards-and-recommended-practices>`_.
|
||||
@@ -0,0 +1,123 @@
|
||||
/* Compatability shim for jQuery and underscores.js.
|
||||
*
|
||||
* Copyright Sphinx contributors
|
||||
* Released under the two clause BSD licence
|
||||
*/
|
||||
|
||||
/**
|
||||
* small helper function to urldecode strings
|
||||
*
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
|
||||
*/
|
||||
jQuery.urldecode = function(x) {
|
||||
if (!x) {
|
||||
return x
|
||||
}
|
||||
return decodeURIComponent(x.replace(/\+/g, ' '));
|
||||
};
|
||||
|
||||
/**
|
||||
* small helper function to urlencode strings
|
||||
*/
|
||||
jQuery.urlencode = encodeURIComponent;
|
||||
|
||||
/**
|
||||
* This function returns the parsed url parameters of the
|
||||
* current request. Multiple values per key are supported,
|
||||
* it will always return arrays of strings for the value parts.
|
||||
*/
|
||||
jQuery.getQueryParameters = function(s) {
|
||||
if (typeof s === 'undefined')
|
||||
s = document.location.search;
|
||||
var parts = s.substr(s.indexOf('?') + 1).split('&');
|
||||
var result = {};
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var tmp = parts[i].split('=', 2);
|
||||
var key = jQuery.urldecode(tmp[0]);
|
||||
var value = jQuery.urldecode(tmp[1]);
|
||||
if (key in result)
|
||||
result[key].push(value);
|
||||
else
|
||||
result[key] = [value];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* highlight a given string on a jquery object by wrapping it in
|
||||
* span elements with the given class name.
|
||||
*/
|
||||
jQuery.fn.highlightText = function(text, className) {
|
||||
function highlight(node, addItems) {
|
||||
if (node.nodeType === 3) {
|
||||
var val = node.nodeValue;
|
||||
var pos = val.toLowerCase().indexOf(text);
|
||||
if (pos >= 0 &&
|
||||
!jQuery(node.parentNode).hasClass(className) &&
|
||||
!jQuery(node.parentNode).hasClass("nohighlight")) {
|
||||
var span;
|
||||
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
|
||||
if (isInSVG) {
|
||||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
||||
} else {
|
||||
span = document.createElement("span");
|
||||
span.className = className;
|
||||
}
|
||||
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
||||
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
|
||||
document.createTextNode(val.substr(pos + text.length)),
|
||||
node.nextSibling));
|
||||
node.nodeValue = val.substr(0, pos);
|
||||
if (isInSVG) {
|
||||
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
var bbox = node.parentElement.getBBox();
|
||||
rect.x.baseVal.value = bbox.x;
|
||||
rect.y.baseVal.value = bbox.y;
|
||||
rect.width.baseVal.value = bbox.width;
|
||||
rect.height.baseVal.value = bbox.height;
|
||||
rect.setAttribute('class', className);
|
||||
addItems.push({
|
||||
"parent": node.parentNode,
|
||||
"target": rect});
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!jQuery(node).is("button, select, textarea")) {
|
||||
jQuery.each(node.childNodes, function() {
|
||||
highlight(this, addItems);
|
||||
});
|
||||
}
|
||||
}
|
||||
var addItems = [];
|
||||
var result = this.each(function() {
|
||||
highlight(this, addItems);
|
||||
});
|
||||
for (var i = 0; i < addItems.length; ++i) {
|
||||
jQuery(addItems[i].parent).before(addItems[i].target);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/*
|
||||
* backward compatibility for jQuery.browser
|
||||
* This will be supported until firefox bug is fixed.
|
||||
*/
|
||||
if (!jQuery.browser) {
|
||||
jQuery.uaMatch = function(ua) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
jQuery.browser = {};
|
||||
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
|
||||
}
|
||||
@@ -0,0 +1,906 @@
|
||||
/*
|
||||
* Sphinx stylesheet -- basic theme.
|
||||
*/
|
||||
|
||||
/* -- main layout ----------------------------------------------------------- */
|
||||
|
||||
div.clearer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
div.section::after {
|
||||
display: block;
|
||||
content: '';
|
||||
clear: left;
|
||||
}
|
||||
|
||||
/* -- relbar ---------------------------------------------------------------- */
|
||||
|
||||
div.related {
|
||||
width: 100%;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
div.related h3 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.related ul {
|
||||
margin: 0;
|
||||
padding: 0 0 0 10px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
div.related li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.related li.right {
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
/* -- sidebar --------------------------------------------------------------- */
|
||||
|
||||
div.sphinxsidebarwrapper {
|
||||
padding: 10px 5px 0 10px;
|
||||
}
|
||||
|
||||
div.sphinxsidebar {
|
||||
float: left;
|
||||
width: 230px;
|
||||
margin-left: -100%;
|
||||
font-size: 90%;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap : break-word;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul ul,
|
||||
div.sphinxsidebar ul.want-points {
|
||||
margin-left: 20px;
|
||||
list-style: square;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.sphinxsidebar form {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
div.sphinxsidebar input {
|
||||
border: 1px solid #98dbcc;
|
||||
font-family: sans-serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
div.sphinxsidebar #searchbox form.search {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.sphinxsidebar #searchbox input[type="text"] {
|
||||
float: left;
|
||||
width: 80%;
|
||||
padding: 0.25em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
div.sphinxsidebar #searchbox input[type="submit"] {
|
||||
float: left;
|
||||
width: 20%;
|
||||
border-left: none;
|
||||
padding: 0.25em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* -- search page ----------------------------------------------------------- */
|
||||
|
||||
ul.search {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
ul.search li {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
ul.search li a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.search li p.context {
|
||||
color: #888;
|
||||
margin: 2px 0 0 30px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
ul.keywordmatches li.goodmatch a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* -- index page ------------------------------------------------------------ */
|
||||
|
||||
table.contentstable {
|
||||
width: 90%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.contentstable p.biglink {
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
a.biglink {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
span.linkdescr {
|
||||
font-style: italic;
|
||||
padding-top: 5px;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
/* -- general index --------------------------------------------------------- */
|
||||
|
||||
table.indextable {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.indextable td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.indextable ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
table.indextable > tbody > tr > td > ul {
|
||||
padding-left: 0em;
|
||||
}
|
||||
|
||||
table.indextable tr.pcap {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
table.indextable tr.cap {
|
||||
margin-top: 10px;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
img.toggler {
|
||||
margin-right: 3px;
|
||||
margin-top: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.modindex-jumpbox {
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin: 1em 0 1em 0;
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
div.genindex-jumpbox {
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin: 1em 0 1em 0;
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
/* -- domain module index --------------------------------------------------- */
|
||||
|
||||
table.modindextable td {
|
||||
padding: 2px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
/* -- general body styles --------------------------------------------------- */
|
||||
|
||||
div.body {
|
||||
min-width: 360px;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
div.body p, div.body dd, div.body li, div.body blockquote {
|
||||
-moz-hyphens: auto;
|
||||
-ms-hyphens: auto;
|
||||
-webkit-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
a.headerlink {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #551A8B;
|
||||
}
|
||||
|
||||
h1:hover > a.headerlink,
|
||||
h2:hover > a.headerlink,
|
||||
h3:hover > a.headerlink,
|
||||
h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink,
|
||||
caption:hover > a.headerlink,
|
||||
p.caption:hover > a.headerlink,
|
||||
div.code-block-caption:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
div.body p.caption {
|
||||
text-align: inherit;
|
||||
}
|
||||
|
||||
div.body td {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
p.rubric {
|
||||
margin-top: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
img.align-left, figure.align-left, .figure.align-left, object.align-left {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
img.align-right, figure.align-right, .figure.align-right, object.align-right {
|
||||
clear: right;
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
img.align-center, figure.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
img.align-default, figure.align-default, .figure.align-default {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.align-default {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* -- sidebars -------------------------------------------------------------- */
|
||||
|
||||
div.sidebar,
|
||||
aside.sidebar {
|
||||
margin: 0 0 0.5em 1em;
|
||||
border: 1px solid #ddb;
|
||||
padding: 7px;
|
||||
background-color: #ffe;
|
||||
width: 40%;
|
||||
float: right;
|
||||
clear: right;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
p.sidebar-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
div.admonition, div.topic, blockquote {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px;
|
||||
margin: 10px 0 10px 0;
|
||||
}
|
||||
|
||||
p.topic-title {
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* -- admonitions ----------------------------------------------------------- */
|
||||
|
||||
div.admonition {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
div.admonition dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
p.admonition-title {
|
||||
margin: 0px 10px 5px 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.body p.centered {
|
||||
text-align: center;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
/* -- content of sidebars/topics/admonitions -------------------------------- */
|
||||
|
||||
div.sidebar > :last-child,
|
||||
aside.sidebar > :last-child,
|
||||
nav.contents > :last-child,
|
||||
aside.topic > :last-child,
|
||||
div.topic > :last-child,
|
||||
div.admonition > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.sidebar::after,
|
||||
aside.sidebar::after,
|
||||
nav.contents::after,
|
||||
aside.topic::after,
|
||||
div.topic::after,
|
||||
div.admonition::after,
|
||||
blockquote::after {
|
||||
display: block;
|
||||
content: '';
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -- tables ---------------------------------------------------------------- */
|
||||
|
||||
table.docutils {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-default {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table caption span.caption-number {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
table caption span.caption-text {
|
||||
}
|
||||
|
||||
table.docutils td, table.docutils th {
|
||||
padding: 1px 8px 1px 5px;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
table.citation td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
th > :first-child,
|
||||
td > :first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
th > :last-child,
|
||||
td > :last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
/* -- figures --------------------------------------------------------------- */
|
||||
|
||||
div.figure, figure {
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
div.figure p.caption, figcaption {
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
div.figure p.caption span.caption-number,
|
||||
figcaption span.caption-number {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.figure p.caption span.caption-text,
|
||||
figcaption span.caption-text {
|
||||
}
|
||||
|
||||
/* -- field list styles ----------------------------------------------------- */
|
||||
|
||||
table.field-list td, table.field-list th {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
.field-list ul {
|
||||
margin: 0;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.field-list p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.field-name {
|
||||
-moz-hyphens: manual;
|
||||
-ms-hyphens: manual;
|
||||
-webkit-hyphens: manual;
|
||||
hyphens: manual;
|
||||
}
|
||||
|
||||
/* -- hlist styles ---------------------------------------------------------- */
|
||||
|
||||
table.hlist {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
table.hlist td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -- object description styles --------------------------------------------- */
|
||||
|
||||
.sig {
|
||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||
}
|
||||
|
||||
.sig-name, code.descname {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sig-name {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
code.descname {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.sig-prename, code.descclassname {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.sig-paren {
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.sig-param.n {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* C++ specific styling */
|
||||
|
||||
.sig-inline.c-texpr,
|
||||
.sig-inline.cpp-texpr {
|
||||
font-family: unset;
|
||||
}
|
||||
|
||||
.sig.c .k, .sig.c .kt,
|
||||
.sig.cpp .k, .sig.cpp .kt {
|
||||
color: #0033B3;
|
||||
}
|
||||
|
||||
.sig.c .m,
|
||||
.sig.cpp .m {
|
||||
color: #1750EB;
|
||||
}
|
||||
|
||||
.sig.c .s, .sig.c .sc,
|
||||
.sig.cpp .s, .sig.cpp .sc {
|
||||
color: #067D17;
|
||||
}
|
||||
|
||||
|
||||
/* -- other body styles ----------------------------------------------------- */
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha;
|
||||
}
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha;
|
||||
}
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman;
|
||||
}
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman;
|
||||
}
|
||||
|
||||
:not(li) > ol > li:first-child > :first-child,
|
||||
:not(li) > ul > li:first-child > :first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
:not(li) > ol > li:last-child > :last-child,
|
||||
:not(li) > ul > li:last-child > :last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
ol.simple ol p,
|
||||
ol.simple ul p,
|
||||
ul.simple ol p,
|
||||
ul.simple ul p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
ol.simple > li:not(:first-child) > p,
|
||||
ul.simple > li:not(:first-child) > p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
ol.simple p,
|
||||
ul.simple p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
aside.footnote > span,
|
||||
div.citation > span {
|
||||
float: left;
|
||||
}
|
||||
aside.footnote > span:last-of-type,
|
||||
div.citation > span:last-of-type {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
aside.footnote > p {
|
||||
margin-left: 2em;
|
||||
}
|
||||
div.citation > p {
|
||||
margin-left: 4em;
|
||||
}
|
||||
aside.footnote > p:last-of-type,
|
||||
div.citation > p:last-of-type {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
aside.footnote > p:last-of-type:after,
|
||||
div.citation > p:last-of-type:after {
|
||||
content: "";
|
||||
clear: both;
|
||||
}
|
||||
|
||||
dl.field-list {
|
||||
display: grid;
|
||||
grid-template-columns: fit-content(30%) auto;
|
||||
}
|
||||
|
||||
dl.field-list > dt {
|
||||
font-weight: bold;
|
||||
word-break: break-word;
|
||||
padding-left: 0.5em;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
dl.field-list > dd {
|
||||
padding-left: 0.5em;
|
||||
margin-top: 0em;
|
||||
margin-left: 0em;
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
dd > :first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
dd ul, dd table {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 10px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.sig dd {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.sig dl {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
dl > dd:last-child,
|
||||
dl > dd:last-child > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt:target, span.highlighted {
|
||||
background-color: #fbe54e;
|
||||
}
|
||||
|
||||
rect.highlighted {
|
||||
fill: #fbe54e;
|
||||
}
|
||||
|
||||
dl.glossary dt {
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.versionmodified {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.system-message {
|
||||
background-color: #fda;
|
||||
padding: 5px;
|
||||
border: 3px solid red;
|
||||
}
|
||||
|
||||
.footnote:target {
|
||||
background-color: #ffa;
|
||||
}
|
||||
|
||||
.line-block {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.line-block .line-block {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
.guilabel, .menuselection {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.accelerator {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.classifier {
|
||||
font-style: oblique;
|
||||
}
|
||||
|
||||
.classifier:before {
|
||||
font-style: normal;
|
||||
margin: 0 0.5em;
|
||||
content: ":";
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
abbr, acronym {
|
||||
border-bottom: dotted 1px;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
/* -- code displays --------------------------------------------------------- */
|
||||
|
||||
pre {
|
||||
overflow: auto;
|
||||
overflow-y: hidden; /* fixes display issues on Chrome browsers */
|
||||
}
|
||||
|
||||
pre, div[class*="highlight-"] {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
span.pre {
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
-webkit-hyphens: none;
|
||||
hyphens: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div[class*="highlight-"] {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
td.linenos pre {
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
table.highlighttable {
|
||||
display: block;
|
||||
}
|
||||
|
||||
table.highlighttable tbody {
|
||||
display: block;
|
||||
}
|
||||
|
||||
table.highlighttable tr {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
table.highlighttable td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.highlighttable td.linenos {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
table.highlighttable td.code {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.highlight .hll {
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.highlight pre,
|
||||
table.highlighttable pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.code-block-caption + div {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div.code-block-caption {
|
||||
margin-top: 1em;
|
||||
padding: 2px 5px;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
div.code-block-caption code {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
table.highlighttable td.linenos,
|
||||
span.linenos,
|
||||
div.highlight span.gp { /* gp: Generic.Prompt */
|
||||
user-select: none;
|
||||
-webkit-user-select: text; /* Safari fallback only */
|
||||
-webkit-user-select: none; /* Chrome/Safari */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-ms-user-select: none; /* IE10+ */
|
||||
}
|
||||
|
||||
div.code-block-caption span.caption-number {
|
||||
padding: 0.1em 0.3em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.code-block-caption span.caption-text {
|
||||
}
|
||||
|
||||
div.literal-block-wrapper {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
code.xref, a code {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.viewcode-link {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.viewcode-back {
|
||||
float: right;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
div.viewcode-block:target {
|
||||
margin: -1px -10px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
/* -- math display ---------------------------------------------------------- */
|
||||
|
||||
img.math {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.body div.math p {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
span.eqno {
|
||||
float: right;
|
||||
}
|
||||
|
||||
span.eqno a.headerlink {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
div.math:hover a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* -- printout stylesheet --------------------------------------------------- */
|
||||
|
||||
@media print {
|
||||
div.document,
|
||||
div.documentwrapper,
|
||||
div.bodywrapper {
|
||||
margin: 0 !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.sphinxsidebar,
|
||||
div.related,
|
||||
div.footer,
|
||||
#top-link {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px}
|
||||
|
After Width: | Height: | Size: 434 KiB |