From 7b1d5ed152f356dbf5090164f35dc1678e0361b1 Mon Sep 17 00:00:00 2001 From: gab-k Date: Sun, 22 Dec 2024 11:39:03 +0100 Subject: [PATCH] Moved all software related files to Software folder; Now using flash safe execution functions of pico_flash (pico SDK) lib; Added error handling; Added RP2040-Decoder-board.h definition; Adapted CMakeLists.txt for use with vscode pi pico extension; --- CMakeLists.txt | 59 - Software/.gitignore | 1 + Software/CMakeLists.txt | 75 + CV.h => Software/CV.h | 2270 ++++++++--------- Software/RP2040-Decoder-board.h | 63 + core0.c => Software/core0.c | 177 +- core0.h => Software/core0.h | 2 + core1.c => Software/core1.c | 8 +- core1.h => Software/core1.h | 0 .../pico_sdk_import.cmake | 32 +- shared.c => Software/shared.c | 15 + shared.h => Software/shared.h | 21 +- 12 files changed, 1452 insertions(+), 1271 deletions(-) delete mode 100644 CMakeLists.txt create mode 100644 Software/.gitignore create mode 100644 Software/CMakeLists.txt rename CV.h => Software/CV.h (97%) create mode 100644 Software/RP2040-Decoder-board.h rename core0.c => Software/core0.c (82%) rename core0.h => Software/core0.h (99%) rename core1.c => Software/core1.c (98%) rename core1.h => Software/core1.h (100%) rename pico_sdk_import.cmake => Software/pico_sdk_import.cmake (68%) rename shared.c => Software/shared.c (93%) rename shared.h => Software/shared.h (90%) diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 198ee5a..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,59 +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}) - -# Stop the compiler from inling method calls making it easier to debug -set(PICO_DEOPTIMIZED_DEBUG 1) - -# 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) - -# Copy code to from flash to memory, then run from memory -pico_set_binary_type(RP2040-Decoder copy_to_ram) - -# create map/bin/hex file etc. -pico_add_extra_outputs(RP2040-Decoder) diff --git a/Software/.gitignore b/Software/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/Software/.gitignore @@ -0,0 +1 @@ +build diff --git a/Software/CMakeLists.txt b/Software/CMakeLists.txt new file mode 100644 index 0000000..9116ac2 --- /dev/null +++ b/Software/CMakeLists.txt @@ -0,0 +1,75 @@ +# Generated Cmake Pico project file + +cmake_minimum_required(VERSION 3.13) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Initialise pico_sdk from installed location +# (note this can come from environment, CMake cache etc) + +# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work == +if(WIN32) + set(USERHOME $ENV{USERPROFILE}) +else() + set(USERHOME $ENV{HOME}) +endif() +set(sdkVersion 2.1.0) +set(toolchainVersion 13_3_Rel1) +set(picotoolVersion 2.1.0) +set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake) +if (EXISTS ${picoVscode}) + include(${picoVscode}) +endif() +# ==================================================================================== +set(PICO_BOARD_HEADER_DIRS ${CMAKE_SOURCE_DIR}) +set(PICO_BOARD RP2040-Decoder-board CACHE STRING "Board type") + +# Pull in Raspberry Pi Pico SDK (must be before project) +include(pico_sdk_import.cmake) + +project(RP2040-Decoder C CXX ASM) + +# Initialise the Raspberry Pi Pico SDK +pico_sdk_init() + +add_compile_options(#-Wall + -O0 + -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 +add_executable( RP2040-Decoder + core0.c + core0.h + core1.c + core1.h + shared.c + shared.h ) + +pico_set_program_name(RP2040-Decoder "RP2040-Decoder") +pico_set_program_version(RP2040-Decoder "1.0") + +# Modify the below lines to enable/disable output over UART/USB +pico_enable_stdio_uart(RP2040-Decoder 0) +pico_enable_stdio_usb(RP2040-Decoder 1) + +# Add the standard library to the build +target_link_libraries( RP2040-Decoder + pico_stdlib + hardware_pwm + hardware_adc + hardware_flash + pico_multicore + pico_flash) + +# Add the standard include files to the build +target_include_directories(RP2040-Decoder PRIVATE + ${CMAKE_CURRENT_LIST_DIR} +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(RP2040-Decoder) + diff --git a/CV.h b/Software/CV.h similarity index 97% rename from CV.h rename to Software/CV.h index c542775..68659bd 100644 --- a/CV.h +++ b/Software/CV.h @@ -1,1135 +1,1135 @@ -#pragma once -#include "pico/stdlib.h" - -#define CV_ARRAY_SIZE 1024 -// 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, ... - -// Explicitly write CV_ARRAY_DEFAULT with into flash memory using __in_flash attribute macro -uint8_t __in_flash("Default_CV_values") 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) - // Writing a value of 8 to CV_8 resets all CV values to the default values in CV.h - 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 -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - 0b00000000, //CV_513 - - 0b00000000, //CV_514 - - 0b00000000, //CV_515 - - 0b00000000, //CV_516 - - 0b00000000, //CV_517 - - 0b00000000, //CV_518 - - 0b00000000, //CV_519 - - 0b00000000, //CV_520 - - 0b00000000, //CV_521 - - 0b00000000, //CV_522 - - 0b00000000, //CV_523 - - 0b00000000, //CV_524 - - 0b00000000, //CV_525 - - 0b00000000, //CV_526 - - 0b00000000, //CV_527 - - 0b00000000, //CV_528 - - 0b00000000, //CV_529 - - 0b00000000, //CV_530 - - 0b00000000, //CV_531 - - 0b00000000, //CV_532 - - 0b00000000, //CV_533 - - 0b00000000, //CV_534 - - 0b00000000, //CV_535 - - 0b00000000, //CV_536 - - 0b00000000, //CV_537 - - 0b00000000, //CV_538 - - 0b00000000, //CV_539 - - 0b00000000, //CV_540 - - 0b00000000, //CV_541 - - 0b00000000, //CV_542 - - 0b00000000, //CV_543 - - 0b00000000, //CV_544 - - 0b00000000, //CV_545 - - 0b00000000, //CV_546 - - 0b00000000, //CV_547 - - 0b00000000, //CV_548 - - 0b00000000, //CV_549 - - 0b00000000, //CV_550 - - 0b00000000, //CV_551 - - 0b00000000, //CV_552 - - 0b00000000, //CV_553 - - 0b00000000, //CV_554 - - 0b00000000, //CV_555 - - 0b00000000, //CV_556 - - 0b00000000, //CV_557 - - 0b00000000, //CV_558 - - 0b00000000, //CV_559 - - 0b00000000, //CV_560 - - 0b00000000, //CV_561 - - 0b00000000, //CV_562 - - 0b00000000, //CV_563 - - 0b00000000, //CV_564 - - 0b00000000, //CV_565 - - 0b00000000, //CV_566 - - 0b00000000, //CV_567 - - 0b00000000, //CV_568 - - 0b00000000, //CV_569 - - 0b00000000, //CV_570 - - 0b00000000, //CV_571 - - 0b00000000, //CV_572 - - 0b00000000, //CV_573 - - 0b00000000, //CV_574 - - 0b00000000, //CV_575 - - 0b00000000, //CV_576 - - 0b00000000, //CV_577 - - 0b00000000, //CV_578 - - 0b00000000, //CV_579 - - 0b00000000, //CV_580 - - 0b00000000, //CV_581 - - 0b00000000, //CV_582 - - 0b00000000, //CV_583 - - 0b00000000, //CV_584 - - 0b00000000, //CV_585 - - 0b00000000, //CV_586 - - 0b00000000, //CV_587 - - 0b00000000, //CV_588 - - 0b00000000, //CV_589 - - 0b00000000, //CV_590 - - 0b00000000, //CV_591 - - 0b00000000, //CV_592 - - 0b00000000, //CV_593 - - 0b00000000, //CV_594 - - 0b00000000, //CV_595 - - 0b00000000, //CV_596 - - 0b00000000, //CV_597 - - 0b00000000, //CV_598 - - 0b00000000, //CV_599 - - 0b00000000, //CV_600 - - 0b00000000, //CV_601 - - 0b00000000, //CV_602 - - 0b00000000, //CV_603 - - 0b00000000, //CV_604 - - 0b00000000, //CV_605 - - 0b00000000, //CV_606 - - 0b00000000, //CV_607 - - 0b00000000, //CV_608 - - 0b00000000, //CV_609 - - 0b00000000, //CV_610 - - 0b00000000, //CV_611 - - 0b00000000, //CV_612 - - 0b00000000, //CV_613 - - 0b00000000, //CV_614 - - 0b00000000, //CV_615 - - 0b00000000, //CV_616 - - 0b00000000, //CV_617 - - 0b00000000, //CV_618 - - 0b00000000, //CV_619 - - 0b00000000, //CV_620 - - 0b00000000, //CV_621 - - 0b00000000, //CV_622 - - 0b00000000, //CV_623 - - 0b00000000, //CV_624 - - 0b00000000, //CV_625 - - 0b00000000, //CV_626 - - 0b00000000, //CV_627 - - 0b00000000, //CV_628 - - 0b00000000, //CV_629 - - 0b00000000, //CV_630 - - 0b00000000, //CV_631 - - 0b00000000, //CV_632 - - 0b00000000, //CV_633 - - 0b00000000, //CV_634 - - 0b00000000, //CV_635 - - 0b00000000, //CV_636 - - 0b00000000, //CV_637 - - 0b00000000, //CV_638 - - 0b00000000, //CV_639 - - 0b00000000, //CV_640 - - 0b00000000, //CV_641 - - 0b00000000, //CV_642 - - 0b00000000, //CV_643 - - 0b00000000, //CV_644 - - 0b00000000, //CV_645 - - 0b00000000, //CV_646 - - 0b00000000, //CV_647 - - 0b00000000, //CV_648 - - 0b00000000, //CV_649 - - 0b00000000, //CV_650 - - 0b00000000, //CV_651 - - 0b00000000, //CV_652 - - 0b00000000, //CV_653 - - 0b00000000, //CV_654 - - 0b00000000, //CV_655 - - 0b00000000, //CV_656 - - 0b00000000, //CV_657 - - 0b00000000, //CV_658 - - 0b00000000, //CV_659 - - 0b00000000, //CV_660 - - 0b00000000, //CV_661 - - 0b00000000, //CV_662 - - 0b00000000, //CV_663 - - 0b00000000, //CV_664 - - 0b00000000, //CV_665 - - 0b00000000, //CV_666 - - 0b00000000, //CV_667 - - 0b00000000, //CV_668 - - 0b00000000, //CV_669 - - 0b00000000, //CV_670 - - 0b00000000, //CV_671 - - 0b00000000, //CV_672 - - 0b00000000, //CV_673 - - 0b00000000, //CV_674 - - 0b00000000, //CV_675 - - 0b00000000, //CV_676 - - 0b00000000, //CV_677 - - 0b00000000, //CV_678 - - 0b00000000, //CV_679 - - 0b00000000, //CV_680 - - 0b00000000, //CV_681 - - 0b00000000, //CV_682 - - 0b00000000, //CV_683 - - 0b00000000, //CV_684 - - 0b00000000, //CV_685 - - 0b00000000, //CV_686 - - 0b00000000, //CV_687 - - 0b00000000, //CV_688 - - 0b00000000, //CV_689 - - 0b00000000, //CV_690 - - 0b00000000, //CV_691 - - 0b00000000, //CV_692 - - 0b00000000, //CV_693 - - 0b00000000, //CV_694 - - 0b00000000, //CV_695 - - 0b00000000, //CV_696 - - 0b00000000, //CV_697 - - 0b00000000, //CV_698 - - 0b00000000, //CV_699 - - 0b00000000, //CV_700 - - 0b00000000, //CV_701 - - 0b00000000, //CV_702 - - 0b00000000, //CV_703 - - 0b00000000, //CV_704 - - 0b00000000, //CV_705 - - 0b00000000, //CV_706 - - 0b00000000, //CV_707 - - 0b00000000, //CV_708 - - 0b00000000, //CV_709 - - 0b00000000, //CV_710 - - 0b00000000, //CV_711 - - 0b00000000, //CV_712 - - 0b00000000, //CV_713 - - 0b00000000, //CV_714 - - 0b00000000, //CV_715 - - 0b00000000, //CV_716 - - 0b00000000, //CV_717 - - 0b00000000, //CV_718 - - 0b00000000, //CV_719 - - 0b00000000, //CV_720 - - 0b00000000, //CV_721 - - 0b00000000, //CV_722 - - 0b00000000, //CV_723 - - 0b00000000, //CV_724 - - 0b00000000, //CV_725 - - 0b00000000, //CV_726 - - 0b00000000, //CV_727 - - 0b00000000, //CV_728 - - 0b00000000, //CV_729 - - 0b00000000, //CV_730 - - 0b00000000, //CV_731 - - 0b00000000, //CV_732 - - 0b00000000, //CV_733 - - 0b00000000, //CV_734 - - 0b00000000, //CV_735 - - 0b00000000, //CV_736 - - 0b00000000, //CV_737 - - 0b00000000, //CV_738 - - 0b00000000, //CV_739 - - 0b00000000, //CV_740 - - 0b00000000, //CV_741 - - 0b00000000, //CV_742 - - 0b00000000, //CV_743 - - 0b00000000, //CV_744 - - 0b00000000, //CV_745 - - 0b00000000, //CV_746 - - 0b00000000, //CV_747 - - 0b00000000, //CV_748 - - 0b00000000, //CV_749 - - 0b00000000, //CV_750 - - 0b00000000, //CV_751 - - 0b00000000, //CV_752 - - 0b00000000, //CV_753 - - 0b00000000, //CV_754 - - 0b00000000, //CV_755 - - 0b00000000, //CV_756 - - 0b00000000, //CV_757 - - 0b00000000, //CV_758 - - 0b00000000, //CV_759 - - 0b00000000, //CV_760 - - 0b00000000, //CV_761 - - 0b00000000, //CV_762 - - 0b00000000, //CV_763 - - 0b00000000, //CV_764 - - 0b00000000, //CV_765 - - 0b00000000, //CV_766 - - 0b00000000, //CV_767 - - 0b00000000, //CV_768 - - 0b00000000, //CV_769 - - 0b00000000, //CV_770 - - 0b00000000, //CV_771 - - 0b00000000, //CV_772 - - 0b00000000, //CV_773 - - 0b00000000, //CV_774 - - 0b00000000, //CV_775 - - 0b00000000, //CV_776 - - 0b00000000, //CV_777 - - 0b00000000, //CV_778 - - 0b00000000, //CV_779 - - 0b00000000, //CV_780 - - 0b00000000, //CV_781 - - 0b00000000, //CV_782 - - 0b00000000, //CV_783 - - 0b00000000, //CV_784 - - 0b00000000, //CV_785 - - 0b00000000, //CV_786 - - 0b00000000, //CV_787 - - 0b00000000, //CV_788 - - 0b00000000, //CV_789 - - 0b00000000, //CV_790 - - 0b00000000, //CV_791 - - 0b00000000, //CV_792 - - 0b00000000, //CV_793 - - 0b00000000, //CV_794 - - 0b00000000, //CV_795 - - 0b00000000, //CV_796 - - 0b00000000, //CV_797 - - 0b00000000, //CV_798 - - 0b00000000, //CV_799 - - 0b00000000, //CV_800 - - 0b00000000, //CV_801 - - 0b00000000, //CV_802 - - 0b00000000, //CV_803 - - 0b00000000, //CV_804 - - 0b00000000, //CV_805 - - 0b00000000, //CV_806 - - 0b00000000, //CV_807 - - 0b00000000, //CV_808 - - 0b00000000, //CV_809 - - 0b00000000, //CV_810 - - 0b00000000, //CV_811 - - 0b00000000, //CV_812 - - 0b00000000, //CV_813 - - 0b00000000, //CV_814 - - 0b00000000, //CV_815 - - 0b00000000, //CV_816 - - 0b00000000, //CV_817 - - 0b00000000, //CV_818 - - 0b00000000, //CV_819 - - 0b00000000, //CV_820 - - 0b00000000, //CV_821 - - 0b00000000, //CV_822 - - 0b00000000, //CV_823 - - 0b00000000, //CV_824 - - 0b00000000, //CV_825 - - 0b00000000, //CV_826 - - 0b00000000, //CV_827 - - 0b00000000, //CV_828 - - 0b00000000, //CV_829 - - 0b00000000, //CV_830 - - 0b00000000, //CV_831 - - 0b00000000, //CV_832 - - 0b00000000, //CV_833 - - 0b00000000, //CV_834 - - 0b00000000, //CV_835 - - 0b00000000, //CV_836 - - 0b00000000, //CV_837 - - 0b00000000, //CV_838 - - 0b00000000, //CV_839 - - 0b00000000, //CV_840 - - 0b00000000, //CV_841 - - 0b00000000, //CV_842 - - 0b00000000, //CV_843 - - 0b00000000, //CV_844 - - 0b00000000, //CV_845 - - 0b00000000, //CV_846 - - 0b00000000, //CV_847 - - 0b00000000, //CV_848 - - 0b00000000, //CV_849 - - 0b00000000, //CV_850 - - 0b00000000, //CV_851 - - 0b00000000, //CV_852 - - 0b00000000, //CV_853 - - 0b00000000, //CV_854 - - 0b00000000, //CV_855 - - 0b00000000, //CV_856 - - 0b00000000, //CV_857 - - 0b00000000, //CV_858 - - 0b00000000, //CV_859 - - 0b00000000, //CV_860 - - 0b00000000, //CV_861 - - 0b00000000, //CV_862 - - 0b00000000, //CV_863 - - 0b00000000, //CV_864 - - 0b00000000, //CV_865 - - 0b00000000, //CV_866 - - 0b00000000, //CV_867 - - 0b00000000, //CV_868 - - 0b00000000, //CV_869 - - 0b00000000, //CV_870 - - 0b00000000, //CV_871 - - 0b00000000, //CV_872 - - 0b00000000, //CV_873 - - 0b00000000, //CV_874 - - 0b00000000, //CV_875 - - 0b00000000, //CV_876 - - 0b00000000, //CV_877 - - 0b00000000, //CV_878 - - 0b00000000, //CV_879 - - 0b00000000, //CV_880 - - 0b00000000, //CV_881 - - 0b00000000, //CV_882 - - 0b00000000, //CV_883 - - 0b00000000, //CV_884 - - 0b00000000, //CV_885 - - 0b00000000, //CV_886 - - 0b00000000, //CV_887 - - 0b00000000, //CV_888 - - 0b00000000, //CV_889 - - 0b00000000, //CV_890 - - 0b00000000, //CV_891 - - 0b00000000, //CV_892 - - 0b00000000, //CV_893 - - 0b00000000, //CV_894 - - 0b00000000, //CV_895 - - 0b00000000, //CV_896 - - 0b00000000, //CV_897 - - 0b00000000, //CV_898 - - 0b00000000, //CV_899 - - 0b00000000, //CV_900 - - 0b00000000, //CV_901 - - 0b00000000, //CV_902 - - 0b00000000, //CV_903 - - 0b00000000, //CV_904 - - 0b00000000, //CV_905 - - 0b00000000, //CV_906 - - 0b00000000, //CV_907 - - 0b00000000, //CV_908 - - 0b00000000, //CV_909 - - 0b00000000, //CV_910 - - 0b00000000, //CV_911 - - 0b00000000, //CV_912 - - 0b00000000, //CV_913 - - 0b00000000, //CV_914 - - 0b00000000, //CV_915 - - 0b00000000, //CV_916 - - 0b00000000, //CV_917 - - 0b00000000, //CV_918 - - 0b00000000, //CV_919 - - 0b00000000, //CV_920 - - 0b00000000, //CV_921 - - 0b00000000, //CV_922 - - 0b00000000, //CV_923 - - 0b00000000, //CV_924 - - 0b00000000, //CV_925 - - 0b00000000, //CV_926 - - 0b00000000, //CV_927 - - 0b00000000, //CV_928 - - 0b00000000, //CV_929 - - 0b00000000, //CV_930 - - 0b00000000, //CV_931 - - 0b00000000, //CV_932 - - 0b00000000, //CV_933 - - 0b00000000, //CV_934 - - 0b00000000, //CV_935 - - 0b00000000, //CV_936 - - 0b00000000, //CV_937 - - 0b00000000, //CV_938 - - 0b00000000, //CV_939 - - 0b00000000, //CV_940 - - 0b00000000, //CV_941 - - 0b00000000, //CV_942 - - 0b00000000, //CV_943 - - 0b00000000, //CV_944 - - 0b00000000, //CV_945 - - 0b00000000, //CV_946 - - 0b00000000, //CV_947 - - 0b00000000, //CV_948 - - 0b00000000, //CV_949 - - 0b00000000, //CV_950 - - 0b00000000, //CV_951 - - 0b00000000, //CV_952 - - 0b00000000, //CV_953 - - 0b00000000, //CV_954 - - 0b00000000, //CV_955 - - 0b00000000, //CV_956 - - 0b00000000, //CV_957 - - 0b00000000, //CV_958 - - 0b00000000, //CV_959 - - 0b00000000, //CV_960 - - 0b00000000, //CV_961 - - 0b00000000, //CV_962 - - 0b00000000, //CV_963 - - 0b00000000, //CV_964 - - 0b00000000, //CV_965 - - 0b00000000, //CV_966 - - 0b00000000, //CV_967 - - 0b00000000, //CV_968 - - 0b00000000, //CV_969 - - 0b00000000, //CV_970 - - 0b00000000, //CV_971 - - 0b00000000, //CV_972 - - 0b00000000, //CV_973 - - 0b00000000, //CV_974 - - 0b00000000, //CV_975 - - 0b00000000, //CV_976 - - 0b00000000, //CV_977 - - 0b00000000, //CV_978 - - 0b00000000, //CV_979 - - 0b00000000, //CV_980 - - 0b00000000, //CV_981 - - 0b00000000, //CV_982 - - 0b00000000, //CV_983 - - 0b00000000, //CV_984 - - 0b00000000, //CV_985 - - 0b00000000, //CV_986 - - 0b00000000, //CV_987 - - 0b00000000, //CV_988 - - 0b00000000, //CV_989 - - 0b00000000, //CV_990 - - 0b00000000, //CV_991 - - 0b00000000, //CV_992 - - 0b00000000, //CV_993 - - 0b00000000, //CV_994 - - 0b00000000, //CV_995 - - 0b00000000, //CV_996 - - 0b00000000, //CV_997 - - 0b00000000, //CV_998 - - 0b00000000, //CV_999 - - 0b00000000, //CV_1000 - - 0b00000000, //CV_1001 - - 0b00000000, //CV_1002 - - 0b00000000, //CV_1003 - - 0b00000000, //CV_1004 - - 0b00000000, //CV_1005 - - 0b00000000, //CV_1006 - - 0b00000000, //CV_1007 - - 0b00000000, //CV_1008 - - 0b00000000, //CV_1009 - - 0b00000000, //CV_1010 - - 0b00000000, //CV_1011 - - 0b00000000, //CV_1012 - - 0b00000000, //CV_1013 - - 0b00000000, //CV_1014 - - 0b00000000, //CV_1015 - - 0b00000000, //CV_1016 - - 0b00000000, //CV_1017 - - 0b00000000, //CV_1018 - - 0b00000000, //CV_1019 - - 0b00000000, //CV_1020 - - 0b00000000, //CV_1021 - - 0b00000000, //CV_1022 - - 0b00000000, //CV_1023 - - 0b00000000, //CV_1024 - -}; - - +#pragma once +#include "pico/stdlib.h" + +#define CV_ARRAY_SIZE 1024 +// 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, ... + +// Explicitly write CV_ARRAY_DEFAULT into flash memory using __in_flash attribute macro +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) + // Writing a value of 8 to CV_8 resets all CV values to the default values in CV.h + 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 +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 0b00000000, //CV_513 - + 0b00000000, //CV_514 - + 0b00000000, //CV_515 - + 0b00000000, //CV_516 - + 0b00000000, //CV_517 - + 0b00000000, //CV_518 - + 0b00000000, //CV_519 - + 0b00000000, //CV_520 - + 0b00000000, //CV_521 - + 0b00000000, //CV_522 - + 0b00000000, //CV_523 - + 0b00000000, //CV_524 - + 0b00000000, //CV_525 - + 0b00000000, //CV_526 - + 0b00000000, //CV_527 - + 0b00000000, //CV_528 - + 0b00000000, //CV_529 - + 0b00000000, //CV_530 - + 0b00000000, //CV_531 - + 0b00000000, //CV_532 - + 0b00000000, //CV_533 - + 0b00000000, //CV_534 - + 0b00000000, //CV_535 - + 0b00000000, //CV_536 - + 0b00000000, //CV_537 - + 0b00000000, //CV_538 - + 0b00000000, //CV_539 - + 0b00000000, //CV_540 - + 0b00000000, //CV_541 - + 0b00000000, //CV_542 - + 0b00000000, //CV_543 - + 0b00000000, //CV_544 - + 0b00000000, //CV_545 - + 0b00000000, //CV_546 - + 0b00000000, //CV_547 - + 0b00000000, //CV_548 - + 0b00000000, //CV_549 - + 0b00000000, //CV_550 - + 0b00000000, //CV_551 - + 0b00000000, //CV_552 - + 0b00000000, //CV_553 - + 0b00000000, //CV_554 - + 0b00000000, //CV_555 - + 0b00000000, //CV_556 - + 0b00000000, //CV_557 - + 0b00000000, //CV_558 - + 0b00000000, //CV_559 - + 0b00000000, //CV_560 - + 0b00000000, //CV_561 - + 0b00000000, //CV_562 - + 0b00000000, //CV_563 - + 0b00000000, //CV_564 - + 0b00000000, //CV_565 - + 0b00000000, //CV_566 - + 0b00000000, //CV_567 - + 0b00000000, //CV_568 - + 0b00000000, //CV_569 - + 0b00000000, //CV_570 - + 0b00000000, //CV_571 - + 0b00000000, //CV_572 - + 0b00000000, //CV_573 - + 0b00000000, //CV_574 - + 0b00000000, //CV_575 - + 0b00000000, //CV_576 - + 0b00000000, //CV_577 - + 0b00000000, //CV_578 - + 0b00000000, //CV_579 - + 0b00000000, //CV_580 - + 0b00000000, //CV_581 - + 0b00000000, //CV_582 - + 0b00000000, //CV_583 - + 0b00000000, //CV_584 - + 0b00000000, //CV_585 - + 0b00000000, //CV_586 - + 0b00000000, //CV_587 - + 0b00000000, //CV_588 - + 0b00000000, //CV_589 - + 0b00000000, //CV_590 - + 0b00000000, //CV_591 - + 0b00000000, //CV_592 - + 0b00000000, //CV_593 - + 0b00000000, //CV_594 - + 0b00000000, //CV_595 - + 0b00000000, //CV_596 - + 0b00000000, //CV_597 - + 0b00000000, //CV_598 - + 0b00000000, //CV_599 - + 0b00000000, //CV_600 - + 0b00000000, //CV_601 - + 0b00000000, //CV_602 - + 0b00000000, //CV_603 - + 0b00000000, //CV_604 - + 0b00000000, //CV_605 - + 0b00000000, //CV_606 - + 0b00000000, //CV_607 - + 0b00000000, //CV_608 - + 0b00000000, //CV_609 - + 0b00000000, //CV_610 - + 0b00000000, //CV_611 - + 0b00000000, //CV_612 - + 0b00000000, //CV_613 - + 0b00000000, //CV_614 - + 0b00000000, //CV_615 - + 0b00000000, //CV_616 - + 0b00000000, //CV_617 - + 0b00000000, //CV_618 - + 0b00000000, //CV_619 - + 0b00000000, //CV_620 - + 0b00000000, //CV_621 - + 0b00000000, //CV_622 - + 0b00000000, //CV_623 - + 0b00000000, //CV_624 - + 0b00000000, //CV_625 - + 0b00000000, //CV_626 - + 0b00000000, //CV_627 - + 0b00000000, //CV_628 - + 0b00000000, //CV_629 - + 0b00000000, //CV_630 - + 0b00000000, //CV_631 - + 0b00000000, //CV_632 - + 0b00000000, //CV_633 - + 0b00000000, //CV_634 - + 0b00000000, //CV_635 - + 0b00000000, //CV_636 - + 0b00000000, //CV_637 - + 0b00000000, //CV_638 - + 0b00000000, //CV_639 - + 0b00000000, //CV_640 - + 0b00000000, //CV_641 - + 0b00000000, //CV_642 - + 0b00000000, //CV_643 - + 0b00000000, //CV_644 - + 0b00000000, //CV_645 - + 0b00000000, //CV_646 - + 0b00000000, //CV_647 - + 0b00000000, //CV_648 - + 0b00000000, //CV_649 - + 0b00000000, //CV_650 - + 0b00000000, //CV_651 - + 0b00000000, //CV_652 - + 0b00000000, //CV_653 - + 0b00000000, //CV_654 - + 0b00000000, //CV_655 - + 0b00000000, //CV_656 - + 0b00000000, //CV_657 - + 0b00000000, //CV_658 - + 0b00000000, //CV_659 - + 0b00000000, //CV_660 - + 0b00000000, //CV_661 - + 0b00000000, //CV_662 - + 0b00000000, //CV_663 - + 0b00000000, //CV_664 - + 0b00000000, //CV_665 - + 0b00000000, //CV_666 - + 0b00000000, //CV_667 - + 0b00000000, //CV_668 - + 0b00000000, //CV_669 - + 0b00000000, //CV_670 - + 0b00000000, //CV_671 - + 0b00000000, //CV_672 - + 0b00000000, //CV_673 - + 0b00000000, //CV_674 - + 0b00000000, //CV_675 - + 0b00000000, //CV_676 - + 0b00000000, //CV_677 - + 0b00000000, //CV_678 - + 0b00000000, //CV_679 - + 0b00000000, //CV_680 - + 0b00000000, //CV_681 - + 0b00000000, //CV_682 - + 0b00000000, //CV_683 - + 0b00000000, //CV_684 - + 0b00000000, //CV_685 - + 0b00000000, //CV_686 - + 0b00000000, //CV_687 - + 0b00000000, //CV_688 - + 0b00000000, //CV_689 - + 0b00000000, //CV_690 - + 0b00000000, //CV_691 - + 0b00000000, //CV_692 - + 0b00000000, //CV_693 - + 0b00000000, //CV_694 - + 0b00000000, //CV_695 - + 0b00000000, //CV_696 - + 0b00000000, //CV_697 - + 0b00000000, //CV_698 - + 0b00000000, //CV_699 - + 0b00000000, //CV_700 - + 0b00000000, //CV_701 - + 0b00000000, //CV_702 - + 0b00000000, //CV_703 - + 0b00000000, //CV_704 - + 0b00000000, //CV_705 - + 0b00000000, //CV_706 - + 0b00000000, //CV_707 - + 0b00000000, //CV_708 - + 0b00000000, //CV_709 - + 0b00000000, //CV_710 - + 0b00000000, //CV_711 - + 0b00000000, //CV_712 - + 0b00000000, //CV_713 - + 0b00000000, //CV_714 - + 0b00000000, //CV_715 - + 0b00000000, //CV_716 - + 0b00000000, //CV_717 - + 0b00000000, //CV_718 - + 0b00000000, //CV_719 - + 0b00000000, //CV_720 - + 0b00000000, //CV_721 - + 0b00000000, //CV_722 - + 0b00000000, //CV_723 - + 0b00000000, //CV_724 - + 0b00000000, //CV_725 - + 0b00000000, //CV_726 - + 0b00000000, //CV_727 - + 0b00000000, //CV_728 - + 0b00000000, //CV_729 - + 0b00000000, //CV_730 - + 0b00000000, //CV_731 - + 0b00000000, //CV_732 - + 0b00000000, //CV_733 - + 0b00000000, //CV_734 - + 0b00000000, //CV_735 - + 0b00000000, //CV_736 - + 0b00000000, //CV_737 - + 0b00000000, //CV_738 - + 0b00000000, //CV_739 - + 0b00000000, //CV_740 - + 0b00000000, //CV_741 - + 0b00000000, //CV_742 - + 0b00000000, //CV_743 - + 0b00000000, //CV_744 - + 0b00000000, //CV_745 - + 0b00000000, //CV_746 - + 0b00000000, //CV_747 - + 0b00000000, //CV_748 - + 0b00000000, //CV_749 - + 0b00000000, //CV_750 - + 0b00000000, //CV_751 - + 0b00000000, //CV_752 - + 0b00000000, //CV_753 - + 0b00000000, //CV_754 - + 0b00000000, //CV_755 - + 0b00000000, //CV_756 - + 0b00000000, //CV_757 - + 0b00000000, //CV_758 - + 0b00000000, //CV_759 - + 0b00000000, //CV_760 - + 0b00000000, //CV_761 - + 0b00000000, //CV_762 - + 0b00000000, //CV_763 - + 0b00000000, //CV_764 - + 0b00000000, //CV_765 - + 0b00000000, //CV_766 - + 0b00000000, //CV_767 - + 0b00000000, //CV_768 - + 0b00000000, //CV_769 - + 0b00000000, //CV_770 - + 0b00000000, //CV_771 - + 0b00000000, //CV_772 - + 0b00000000, //CV_773 - + 0b00000000, //CV_774 - + 0b00000000, //CV_775 - + 0b00000000, //CV_776 - + 0b00000000, //CV_777 - + 0b00000000, //CV_778 - + 0b00000000, //CV_779 - + 0b00000000, //CV_780 - + 0b00000000, //CV_781 - + 0b00000000, //CV_782 - + 0b00000000, //CV_783 - + 0b00000000, //CV_784 - + 0b00000000, //CV_785 - + 0b00000000, //CV_786 - + 0b00000000, //CV_787 - + 0b00000000, //CV_788 - + 0b00000000, //CV_789 - + 0b00000000, //CV_790 - + 0b00000000, //CV_791 - + 0b00000000, //CV_792 - + 0b00000000, //CV_793 - + 0b00000000, //CV_794 - + 0b00000000, //CV_795 - + 0b00000000, //CV_796 - + 0b00000000, //CV_797 - + 0b00000000, //CV_798 - + 0b00000000, //CV_799 - + 0b00000000, //CV_800 - + 0b00000000, //CV_801 - + 0b00000000, //CV_802 - + 0b00000000, //CV_803 - + 0b00000000, //CV_804 - + 0b00000000, //CV_805 - + 0b00000000, //CV_806 - + 0b00000000, //CV_807 - + 0b00000000, //CV_808 - + 0b00000000, //CV_809 - + 0b00000000, //CV_810 - + 0b00000000, //CV_811 - + 0b00000000, //CV_812 - + 0b00000000, //CV_813 - + 0b00000000, //CV_814 - + 0b00000000, //CV_815 - + 0b00000000, //CV_816 - + 0b00000000, //CV_817 - + 0b00000000, //CV_818 - + 0b00000000, //CV_819 - + 0b00000000, //CV_820 - + 0b00000000, //CV_821 - + 0b00000000, //CV_822 - + 0b00000000, //CV_823 - + 0b00000000, //CV_824 - + 0b00000000, //CV_825 - + 0b00000000, //CV_826 - + 0b00000000, //CV_827 - + 0b00000000, //CV_828 - + 0b00000000, //CV_829 - + 0b00000000, //CV_830 - + 0b00000000, //CV_831 - + 0b00000000, //CV_832 - + 0b00000000, //CV_833 - + 0b00000000, //CV_834 - + 0b00000000, //CV_835 - + 0b00000000, //CV_836 - + 0b00000000, //CV_837 - + 0b00000000, //CV_838 - + 0b00000000, //CV_839 - + 0b00000000, //CV_840 - + 0b00000000, //CV_841 - + 0b00000000, //CV_842 - + 0b00000000, //CV_843 - + 0b00000000, //CV_844 - + 0b00000000, //CV_845 - + 0b00000000, //CV_846 - + 0b00000000, //CV_847 - + 0b00000000, //CV_848 - + 0b00000000, //CV_849 - + 0b00000000, //CV_850 - + 0b00000000, //CV_851 - + 0b00000000, //CV_852 - + 0b00000000, //CV_853 - + 0b00000000, //CV_854 - + 0b00000000, //CV_855 - + 0b00000000, //CV_856 - + 0b00000000, //CV_857 - + 0b00000000, //CV_858 - + 0b00000000, //CV_859 - + 0b00000000, //CV_860 - + 0b00000000, //CV_861 - + 0b00000000, //CV_862 - + 0b00000000, //CV_863 - + 0b00000000, //CV_864 - + 0b00000000, //CV_865 - + 0b00000000, //CV_866 - + 0b00000000, //CV_867 - + 0b00000000, //CV_868 - + 0b00000000, //CV_869 - + 0b00000000, //CV_870 - + 0b00000000, //CV_871 - + 0b00000000, //CV_872 - + 0b00000000, //CV_873 - + 0b00000000, //CV_874 - + 0b00000000, //CV_875 - + 0b00000000, //CV_876 - + 0b00000000, //CV_877 - + 0b00000000, //CV_878 - + 0b00000000, //CV_879 - + 0b00000000, //CV_880 - + 0b00000000, //CV_881 - + 0b00000000, //CV_882 - + 0b00000000, //CV_883 - + 0b00000000, //CV_884 - + 0b00000000, //CV_885 - + 0b00000000, //CV_886 - + 0b00000000, //CV_887 - + 0b00000000, //CV_888 - + 0b00000000, //CV_889 - + 0b00000000, //CV_890 - + 0b00000000, //CV_891 - + 0b00000000, //CV_892 - + 0b00000000, //CV_893 - + 0b00000000, //CV_894 - + 0b00000000, //CV_895 - + 0b00000000, //CV_896 - + 0b00000000, //CV_897 - + 0b00000000, //CV_898 - + 0b00000000, //CV_899 - + 0b00000000, //CV_900 - + 0b00000000, //CV_901 - + 0b00000000, //CV_902 - + 0b00000000, //CV_903 - + 0b00000000, //CV_904 - + 0b00000000, //CV_905 - + 0b00000000, //CV_906 - + 0b00000000, //CV_907 - + 0b00000000, //CV_908 - + 0b00000000, //CV_909 - + 0b00000000, //CV_910 - + 0b00000000, //CV_911 - + 0b00000000, //CV_912 - + 0b00000000, //CV_913 - + 0b00000000, //CV_914 - + 0b00000000, //CV_915 - + 0b00000000, //CV_916 - + 0b00000000, //CV_917 - + 0b00000000, //CV_918 - + 0b00000000, //CV_919 - + 0b00000000, //CV_920 - + 0b00000000, //CV_921 - + 0b00000000, //CV_922 - + 0b00000000, //CV_923 - + 0b00000000, //CV_924 - + 0b00000000, //CV_925 - + 0b00000000, //CV_926 - + 0b00000000, //CV_927 - + 0b00000000, //CV_928 - + 0b00000000, //CV_929 - + 0b00000000, //CV_930 - + 0b00000000, //CV_931 - + 0b00000000, //CV_932 - + 0b00000000, //CV_933 - + 0b00000000, //CV_934 - + 0b00000000, //CV_935 - + 0b00000000, //CV_936 - + 0b00000000, //CV_937 - + 0b00000000, //CV_938 - + 0b00000000, //CV_939 - + 0b00000000, //CV_940 - + 0b00000000, //CV_941 - + 0b00000000, //CV_942 - + 0b00000000, //CV_943 - + 0b00000000, //CV_944 - + 0b00000000, //CV_945 - + 0b00000000, //CV_946 - + 0b00000000, //CV_947 - + 0b00000000, //CV_948 - + 0b00000000, //CV_949 - + 0b00000000, //CV_950 - + 0b00000000, //CV_951 - + 0b00000000, //CV_952 - + 0b00000000, //CV_953 - + 0b00000000, //CV_954 - + 0b00000000, //CV_955 - + 0b00000000, //CV_956 - + 0b00000000, //CV_957 - + 0b00000000, //CV_958 - + 0b00000000, //CV_959 - + 0b00000000, //CV_960 - + 0b00000000, //CV_961 - + 0b00000000, //CV_962 - + 0b00000000, //CV_963 - + 0b00000000, //CV_964 - + 0b00000000, //CV_965 - + 0b00000000, //CV_966 - + 0b00000000, //CV_967 - + 0b00000000, //CV_968 - + 0b00000000, //CV_969 - + 0b00000000, //CV_970 - + 0b00000000, //CV_971 - + 0b00000000, //CV_972 - + 0b00000000, //CV_973 - + 0b00000000, //CV_974 - + 0b00000000, //CV_975 - + 0b00000000, //CV_976 - + 0b00000000, //CV_977 - + 0b00000000, //CV_978 - + 0b00000000, //CV_979 - + 0b00000000, //CV_980 - + 0b00000000, //CV_981 - + 0b00000000, //CV_982 - + 0b00000000, //CV_983 - + 0b00000000, //CV_984 - + 0b00000000, //CV_985 - + 0b00000000, //CV_986 - + 0b00000000, //CV_987 - + 0b00000000, //CV_988 - + 0b00000000, //CV_989 - + 0b00000000, //CV_990 - + 0b00000000, //CV_991 - + 0b00000000, //CV_992 - + 0b00000000, //CV_993 - + 0b00000000, //CV_994 - + 0b00000000, //CV_995 - + 0b00000000, //CV_996 - + 0b00000000, //CV_997 - + 0b00000000, //CV_998 - + 0b00000000, //CV_999 - + 0b00000000, //CV_1000 - + 0b00000000, //CV_1001 - + 0b00000000, //CV_1002 - + 0b00000000, //CV_1003 - + 0b00000000, //CV_1004 - + 0b00000000, //CV_1005 - + 0b00000000, //CV_1006 - + 0b00000000, //CV_1007 - + 0b00000000, //CV_1008 - + 0b00000000, //CV_1009 - + 0b00000000, //CV_1010 - + 0b00000000, //CV_1011 - + 0b00000000, //CV_1012 - + 0b00000000, //CV_1013 - + 0b00000000, //CV_1014 - + 0b00000000, //CV_1015 - + 0b00000000, //CV_1016 - + 0b00000000, //CV_1017 - + 0b00000000, //CV_1018 - + 0b00000000, //CV_1019 - + 0b00000000, //CV_1020 - + 0b00000000, //CV_1021 - + 0b00000000, //CV_1022 - + 0b00000000, //CV_1023 - + 0b00000000, //CV_1024 - +}; + + diff --git a/Software/RP2040-Decoder-board.h b/Software/RP2040-Decoder-board.h new file mode 100644 index 0000000..43e2b5a --- /dev/null +++ b/Software/RP2040-Decoder-board.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +// ----------------------------------------------------- +// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO +// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES +// ----------------------------------------------------- + +// Modified version of "boards/pico.h" for using the RP2040-Decoder board + +// pico_cmake_set PICO_PLATFORM=rp2040 + +#ifndef _BOARDS_RP2040_DECODER_H +#define _BOARDS_RP2040_DECODER_H + +// For board detection +#define RP2040_DECODER + +// In case the xosc takes longer to stabilize than usual +#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 +#endif + +// --- UART --- +#ifndef PICO_DEFAULT_UART +#define PICO_DEFAULT_UART 0 +#endif +#ifndef PICO_DEFAULT_UART_TX_PIN +#define PICO_DEFAULT_UART_TX_PIN 0 +#endif +#ifndef PICO_DEFAULT_UART_RX_PIN +#define PICO_DEFAULT_UART_RX_PIN 1 +#endif + +// --- LED --- +#ifndef RP2040_DECODER_DEFAULT_LED_PIN +#define RP2040_DECODER_DEFAULT_LED_PIN 12 +#endif + +// --- FLASH --- + +// Flash size is 8 MiB for W25Q64JVSSIQ if you decide to use another capacity flash IC change the size to the corresponding value +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) +#endif +// Offset from base address used for saving CV_ARRAY_FLASH - in this case one sector size from the end of flash +#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES-FLASH_SECTOR_SIZE) + +#ifndef PICO_FLASH_SPI_CLKDIV +#define PICO_FLASH_SPI_CLKDIV 2 +#endif + + +#ifndef PICO_RP2040_B0_SUPPORTED +#define PICO_RP2040_B0_SUPPORTED 1 +#endif + + + +#endif diff --git a/core0.c b/Software/core0.c similarity index 82% rename from core0.c rename to Software/core0.c index 90b3ba1..d09b7be 100644 --- a/core0.c +++ b/Software/core0.c @@ -8,11 +8,61 @@ // 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; +uint64_t input_bit_buffer = 1; uint16_t level_table[32] = {0}; absolute_time_t falling_edge_time, rising_edge_time; +// Function to read the flash size of the chip +uint32_t get_flash_size() { + // Prepare TX and RX buffers + uint8_t txbuf[4] = { FLASH_CMD_READ_JEDEC_ID, 0, 0, 0 }; // Send the 0x9F command + uint8_t rxbuf[4] = { 0, 0, 0, 0 }; // RX buffer for the response + + // Read the JEDEC ID + flash_do_cmd(txbuf, rxbuf, sizeof(txbuf)); + + // The third byte of the response (rxbuf[3]) contains the log2 size (e.g., 0x18 for 16 MB) + if (rxbuf[3] == 0) { + set_error(FLASH_SIZE_READBACK_FAILURE); + } + + // Calculate the actual size (2^size_code bytes) + uint32_t flash_size = (1u< 8\n"); - flash_range_erase(FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE); - flash_range_program(FLASH_TARGET_OFFSET, CV_ARRAY_DEFAULT, FLASH_PAGE_SIZE * 2); + uintptr_t params_erase[] = {FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE}; + int ret_val = flash_safe_execute(call_flash_range_erase, params_erase, UINT32_MAX); + if (ret_val != PICO_OK){ + set_error(FLASH_SAFE_EXECUTE_ERASE_FAILURE); + return; + } + uintptr_t params_program[] = {FLASH_TARGET_OFFSET, sizeof(CV_ARRAY_DEFAULT), (uintptr_t)CV_ARRAY_DEFAULT}; + ret_val = flash_safe_execute(call_flash_range_program, params_program, UINT32_MAX); + if(ret_val != PICO_OK){ + set_error(FLASH_SAFE_EXECUTE_PROGRAM_FAILURE); + return; + } } break; // CV_17 must have a value between 11000000->(192dec) and 11100111->(231dec) inclusive @@ -191,18 +272,6 @@ void program_mode(const uint8_t number_of_bytes, const uint8_t *const byte_array const uint16_t cv_address_ms_bits = cv_address_ms_bits_mask & byte_array[number_of_bytes - 1]; const 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(); - - const uint32_t saved_interrupts = save_and_disable_interrupts(); - if (instruction_type == 0b000001000) { // Verify CV bit instruction const uint8_t bit_pos_mask = 0b00000111; @@ -224,12 +293,6 @@ void program_mode(const uint8_t number_of_bytes, const uint8_t *const byte_array const uint8_t cv_data = byte_array[number_of_bytes - 3]; write_cv_handler(cv_address, cv_data); } - - // Restore interrupts - restore_interrupts(saved_interrupts); - // TODO: verify core1 launch... - multicore_launch_core1(core1_entry); - // TODO: Check busy wait necessity busy_wait_ms(5); } } @@ -536,45 +599,19 @@ void init_outputs() { 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) { + if (true || CV_ARRAY_FLASH[64] == 0xFF) { LOG(1, "found cv[64] equals to 0xff, reseting CVs (and CV[8] = 8)\n"); const uint8_t arr[4] = {125, 8, 7, 124}; program_mode(4, arr); //reset to CV_ARRAY_DEFAULT (write CV_8 = 8) } // Check for existing ADC offset setup TODO: always measure? - if (CV_ARRAY_FLASH[171] == 0xFF) { + if (false && CV_ARRAY_FLASH[171] == 0xFF) { // Write a value of 7 to read-only CV_7 in order to trigger a ADC offset measurement LOG(1, "found cv[171] equals to 0xff, adc offset adjstments (and cr[7] = 7)\n"); const 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"); - const uint16_t base_pwm_fwd = measure_base_pwm(true, 10); - const uint8_t base_pwm_fwd_high_byte = base_pwm_fwd >> 8; - const uint8_t base_pwm_fwd_low_byte = base_pwm_fwd & 0x00FF; - const uint8_t arr0[4] = {125, base_pwm_fwd_high_byte, 175, 124}; - program_mode(4, arr0); - const 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"); - const uint16_t base_pwm_rev = measure_base_pwm(false, 10); - const uint8_t base_pwm_rev_high_byte = base_pwm_rev >> 8; - const uint8_t base_pwm_rev_low_byte = base_pwm_rev & 0x00FF; - const uint8_t arr0[4] = {125, base_pwm_rev_high_byte, 177, 124}; - program_mode(4, arr0); - const 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]); } @@ -593,7 +630,7 @@ void init_motor_pwm(const uint8_t gpio) { pwm_set_gpio_level(gpio, 0); // Enable PWM pwm_set_enabled(slice_num, true); - LOG(2, "init motor(%d): wrapCounter %d clkdiv %d\n", gpio, wrap_counter, CV_ARRAY_FLASH[173]); + LOG(2, "Initialized Motor PWM on pin: %d; wrap_counter %d; clkdiv %d;\n", gpio, wrap_counter, CV_ARRAY_FLASH[173]); } void init_adc() { @@ -607,24 +644,32 @@ void init_adc() { } int main() { - stdio_init_all(); - LOG(1, "\n\n======\ncore0 init\n"); - LOG(1, "Init motor PWM\n"); + if(stdio_init_all() != true){ + set_error(STDIO_INIT_FAILURE); + } + multicore_launch_core1(core1_entry); + LOG(1, "core0 Initialization...\n"); + // Wait 1ms to give core1 some time to call flash_safe_execute_core_init() + busy_wait_ms(1); + // Check for error calling flash_safe_execute_core_init() on core1 + if(get_error_state() & FLASH_SAFE_EXECUTE_CORE_INIT_FAILURE){ + panic("Error calling flash_safe_execute_core_init() on core1!"); + } + // Check CV array for factory state of flash or missing ADC offset setup + LOG(1, "Check CV array\n"); + cv_setup_check(); + LOG(1, "Initializing Motor PWM...\n"); init_motor_pwm(MOTOR_FWD_PIN); init_motor_pwm(MOTOR_REV_PIN); - LOG(1, "Init ADC") + LOG(1, "Initializing ADC...") init_adc(); - LOG(1, "check cvs\n"); - cv_setup_check(); - LOG(1, "init outputs\n"); + LOG(1, "Initializing Outputs...\n"); init_outputs(); - LOG(1, "init gpios\n"); + LOG(1, "Initializing GPIO...\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"); - busy_wait_ms(100); - multicore_launch_core1(core1_entry); + LOG(1, "core0 Initialized!\n"); while (true); //sleep_ms(100); //TODO: any potential issues when using sleep? } \ No newline at end of file diff --git a/core0.h b/Software/core0.h similarity index 99% rename from core0.h rename to Software/core0.h index c89b4a9..09bca89 100644 --- a/core0.h +++ b/Software/core0.h @@ -17,6 +17,8 @@ #define MESSAGE_5_BYTES 0b11111111110000000000000000000000000000000000000000000001 #define MESSAGE_MASK_5_BYTES 0b11111111111000000001000000001000000001000000001000000001 +#define FLASH_CMD_READ_JEDEC_ID 0x9F + /*! * \brief Bitmasks used for clearing bits corresponding to function blocks * diff --git a/core1.c b/Software/core1.c similarity index 98% rename from core1.c rename to Software/core1.c index fd29b7b..c693188 100644 --- a/core1.c +++ b/Software/core1.c @@ -305,7 +305,11 @@ void init_controller(controller_parameter_t *const ctrl_par) { } void core1_entry() { - LOG(1, "core1 init...\n"); + LOG(1, "core1 Initialization...\n"); + if (flash_safe_execute_core_init() != true){ + set_error(FLASH_SAFE_EXECUTE_CORE_INIT_FAILURE); + return; + } controller_parameter_t control_parameter; controller_parameter_t *ctrl_par = &control_parameter; init_controller(ctrl_par); @@ -321,6 +325,6 @@ void core1_entry() { speed_helper, ctrl_par, &speed_helper_timer); - LOG(1, "core1 done\n"); + LOG(1, "core1 Initialized!\n"); while (true); //sleep_ms(100); //TODO: any potential issues when using sleep? } diff --git a/core1.h b/Software/core1.h similarity index 100% rename from core1.h rename to Software/core1.h diff --git a/pico_sdk_import.cmake b/Software/pico_sdk_import.cmake similarity index 68% rename from pico_sdk_import.cmake rename to Software/pico_sdk_import.cmake index 28efe9e..a0721d0 100644 --- a/pico_sdk_import.cmake +++ b/Software/pico_sdk_import.cmake @@ -18,9 +18,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") endif () +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG)) + set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG}) + message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')") +endif () + +if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG) + set(PICO_SDK_FETCH_FROM_GIT_TAG "master") + message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG") +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") +set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK") if (NOT PICO_SDK_PATH) if (PICO_SDK_FETCH_FROM_GIT) @@ -29,11 +40,22 @@ if (NOT PICO_SDK_PATH) 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 - ) + # GIT_SUBMODULES_RECURSE was added in 3.17 + if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0") + FetchContent_Declare( + pico_sdk + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} + GIT_SUBMODULES_RECURSE FALSE + ) + else () + FetchContent_Declare( + pico_sdk + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} + ) + endif () + if (NOT pico_sdk) message("Downloading Raspberry Pi Pico SDK") FetchContent_Populate(pico_sdk) diff --git a/shared.c b/Software/shared.c similarity index 93% rename from shared.c rename to Software/shared.c index cee7ed6..4ffe101 100644 --- a/shared.c +++ b/Software/shared.c @@ -9,6 +9,9 @@ uint8_t speed_step_target = 0; uint8_t speed_step_target_prev = 0; +uint32_t error_state = 0; + + // 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, @@ -68,3 +71,15 @@ bool get_direction_of_speed_step(uint8_t speed_step){ // Shift by 7 Bytes to move bit7 into bit0 position and return return speed_step >> 7; } + +void set_error(error_t err){ + error_state |= err; +} + +void clear_error(error_t err){ + error_state & (~err); +} + +uint32_t get_error_state(){ + return error_state; +} \ No newline at end of file diff --git a/shared.h b/Software/shared.h similarity index 90% rename from shared.h rename to Software/shared.h index cb20bf7..09a16ae 100644 --- a/shared.h +++ b/Software/shared.h @@ -11,11 +11,20 @@ #include "pico/stdlib.h" #include "pico/multicore.h" #include "pico/printf.h" +#include "pico/flash.h" #include "hardware/pwm.h" #include "hardware/adc.h" #include "hardware/flash.h" #include "hardware/gpio.h" +typedef enum { + FLASH_SAFE_EXECUTE_CORE_INIT_FAILURE = (1<<0), + FLASH_SAFE_EXECUTE_ERASE_FAILURE = (1<<1), + FLASH_SAFE_EXECUTE_PROGRAM_FAILURE = (1<<2), + FLASH_SIZE_READBACK_FAILURE = (1<<3), + STDIO_INIT_FAILURE = (1<<4), +} error_t; + // here you can enable printf debugging (needs extra soldering and you have to enable uart in the cmake configuration) // please note @@ -25,7 +34,7 @@ // - 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 LOGLEVEL 1 #define LOG(level, ...) { if(level <= LOGLEVEL) {printf(__VA_ARGS__);}} // Constant Value of 125 x 10^6 @@ -53,8 +62,6 @@ // 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; @@ -103,4 +110,10 @@ uint16_t get_16bit_CV (uint16_t CV_start_index); * @param speed_step The speed step byte. * @return `true` for forward direction, `false` for reverse direction. */ -bool get_direction_of_speed_step(uint8_t speed_step); \ No newline at end of file +bool get_direction_of_speed_step(uint8_t speed_step); + +void set_error(error_t err); + +void clear_error(error_t err); + +uint32_t get_error_state();