Skip to content

Commit

Permalink
Merge local branch 'changes' into main.
Browse files Browse the repository at this point in the history
  • Loading branch information
gab-k committed Jan 1, 2024
2 parents df009a5 + df9b0ba commit 9ee13b6
Show file tree
Hide file tree
Showing 10 changed files with 3,325 additions and 400 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.vscode
.idea

# Doxygen generated files
doxygen

# Build folders
build
cmake-build-debug
Expand All @@ -12,4 +15,5 @@ KiCad/*/RP2040-Decoder-backups
KiCad/*/*.bak
KiCad/*/fp-info-cache
KiCad/*/_autosave-*
KiCad/*/*.kicad_prl
KiCad/*/*.kicad_prl

1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ target_link_libraries(
hardware_adc
hardware_flash
pico_multicore
pico_platform
)

# disable usb stack
Expand Down
1 change: 1 addition & 0 deletions CV.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ uint8_t CV_ARRAY_DEFAULT [CV_ARRAY_SIZE] = {
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 -
Expand Down
2,894 changes: 2,894 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

473 changes: 234 additions & 239 deletions core0.c

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions core0.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#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
#define MESSAGE_3_BYTES 0b11111111110000000000000000000000000001
#define MESSAGE_MASK_3_BYTES 0b11111111111000000001000000001000000001
#define MESSAGE_4_BYTES 0b11111111110000000000000000000000000000000000001
#define MESSAGE_MASK_4_BYTES 0b11111111111000000001000000001000000001000000001
#define MESSAGE_5_BYTES 0b11111111110000000000000000000000000000000000000000000001
#define MESSAGE_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)
Expand All @@ -29,7 +29,7 @@ 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);
//void write_cv_handler(uint16_t cv_index, uint8_t cv_data);


#define ProgramInstrVerifyBit 0b10
Expand All @@ -44,15 +44,14 @@ 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();
bool reset_message_check(uint8_t number_of_bytes, const uint8_t *const byte_array);
int8_t verify_dcc_message();
void bits_to_byte_array(int8_t number_of_bytes,uint8_t byte_array[]);
void evaluation();
void evaluate_message();
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();
Loading

0 comments on commit 9ee13b6

Please sign in to comment.