-updated readme, -modified F0-F31 handling, - implemented pwm for F0-F31

This commit is contained in:
1nct committed 2022-03-05 01:41:40 +01:00
1 parent 4f5283521d
commit a6fa9ef249
7 files changed
+224 -169

No files matched your search

+10 -7
View File
@@ -10,17 +10,20 @@
#include "pico/float.h"
#define SIZE_BYTE_ARRAY 5
#define SIZE_ACTIVE_FUNCTIONS 32
#define DCC_INPUT_PIN 4
//Default
//#define ALLOWED_GPIO_MASK 0b00000000000000000000111111111100 //prevents setting GPIO's that are not allowed (ADC, PWM, ...)
//Custom
#define ALLOWED_GPIO_MASK 0b00000000000000000000001111111100 //prevents setting GPIO's that are not allowed (ADC, PWM, ...)
#define PACKAGE_3_BYTES 0b11111111110000000000000000000000000001
#define PACKAGE_MASK_3_BYTES 0b11111111111000000001000000001000000001
#define PACKAGE_4_BYTES 0b11111111110000000000000000000000000000000000001
#define PACKAGE_MASK_4_BYTES 0b11111111111000000001000000001000000001000000001
#define PACKAGE_5_BYTES 0b11111111110000000000000000000000000000000000000000000001
#define PACKAGE_MASK_5_BYTES 0b11111111111000000001000000001000000001000000001000000001
const uint32_t clr_bit_arr[6] = {
0b11111111111111111111111111100000, // Clear Bits 0-4 (F0-F4)
0b11111111111111111111111000011111, // Clear Bits 5-8 (F5-F8)
0b11111111111111111110000111111111, // Clear Bits 9-12 (F9-F12)
0b11111111111000000001111111111111, // Clear Bits 13-20 (F13-F20)
0b11100000000111111111111111111111, // Clear Bits 21-28 (F21-F28)
0b00011111111111111111111111111111, // Clear Bits 29-31 (F29-F31)
};
int8_t check_for_package();
void writeLastBit(bool bit) ;
void bits_to_byte_array(int8_t number_of_bytes,uint8_t byte_array[]) ;
@@ -30,8 +33,8 @@ void verify_cv_byte(uint16_t cv_address, uint8_t cv_data);
void write_cv_byte(uint16_t cv_index, uint8_t cv_data);
bool reset_package_check(uint8_t number_of_bytes,const uint8_t byte_array[]);
void program_mode(uint8_t number_of_bytes, const uint8_t byte_array[]);
void set_outputs() ;
void update_active_functions(uint8_t function_number, uint8_t input_byte, uint8_t count) ;
void set_outputs(uint32_t active_functions);
void update_active_functions(uint32_t byte, uint8_t clr_bit_ind) ;
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[]) ;