diff --git a/html/CV_8h_source.html b/html/CV_8h_source.html new file mode 100644 index 0000000..17d5b02 --- /dev/null +++ b/html/CV_8h_source.html @@ -0,0 +1,1223 @@ + + +
+ + + + +|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
| Ccontroller_parameter_t | |
| Cpid_parameters_t | |
| Cstartup_parameters_t |
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
Go to the source code of this file.
++Functions | |
| float | two_std_dev (const float arr[], uint32_t length) |
| Function returns average of values deviating less than twice the standard deviation from original average. | |
| void | adc_offset_adjustment (uint32_t n) |
| Measures ADC offset and saves the offset value to flash memory. | |
| void | acknowledge () |
| Function for acknowledging a CV write or CV verify instruction. | |
| void | verify_cv_bit (uint16_t cv_address, bool bit_val, uint8_t bit_pos) |
| Function for verifying a single bit of a CV. | |
| void | verify_cv_byte (uint16_t cv_address, uint8_t cv_data) |
| Function for verifying a CV byte. | |
| void | write_cv_byte (uint16_t cv_address, uint8_t cv_data) |
| Function for writing a CV byte. | |
| void | program_mode (uint8_t number_of_bytes, const uint8_t byte_array[]) |
| CV Programming mode function Used on entering programming mode in order to write CV values to persistent flash memory or verify/read bits/bytes from flash. + Refers to NMRA Standard 9.2.3 ("Service Mode Programming") or RCN-216 + | |
| void | set_outputs (uint32_t functions_to_set_bitmask) |
| Set outputs according to function mapping in CV257 to CV512. | |
| +void | update_active_functions (uint32_t new_function_bitmask, uint8_t clr_bit_ind, bool direction_change) |
| +bool | error_detection (int8_t number_of_bytes, const uint8_t *byte_array) |
| +bool | is_long_address (uint8_t number_of_bytes, const uint8_t byte_array[]) |
| +bool | address_evaluation (uint8_t number_of_bytes, const uint8_t byte_array[]) |
| +void | instruction_evaluation (uint8_t number_of_bytes, const uint8_t byte_array[]) |
| +bool | reset_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 | evaluate_message () |
| void | track_signal_rise (unsigned int gpio, long unsigned int events) |
| Track signal rising edge interrupt callback function. | |
| void | track_signal_fall (unsigned int gpio, long unsigned int events) |
| Track signal falling edge interrupt callback function. | |
| void | init_outputs () |
| Output initialization function. | |
| void | cv_setup_check () |
| Checks various CV values in order to detect factory condition or pending calibrations. | |
| void | init_motor_pwm (uint8_t gpio) |
| Function initializes motor PWM for pin specified. | |
| void | init_adc () |
| Initializes ADC. | |
+Variables | |
| const uint32_t | clr_bit_arr [6] |
| Bitmasks used for clearing bits corresponding to function blocks. | |
Used exclusively by core0
+| void acknowledge | +( | +) | ++ |
Function for acknowledging a CV write or CV verify instruction.
+Acknowledgement works by creating a spike in current consumption, normally realized by running the motor in alternating directions. This current increase is detected by the command station. Refers to NMRA S-9.2.3 Section D and RCN-216 Section 3
+ +| void adc_offset_adjustment | +( | +uint32_t | n | ) | ++ |
Measures ADC offset and saves the offset value to flash memory.
+| n | Amount of measurements to be done |
| void cv_setup_check | +( | +) | ++ |
Checks various CV values in order to detect factory condition or pending calibrations.
+Procedure:
| void init_adc | +( | +) | ++ |
Initializes ADC.
+Function initializes ADC, corresponding GPIO pins and ADC FIFO
+ +| void init_motor_pwm | +( | +uint8_t | gpio | ) | ++ |
Function initializes motor PWM for pin specified.
+| gpio | GPIO pin |
| void init_outputs | +( | +) | ++ |
| void program_mode | +( | +uint8_t | number_of_bytes, | +
| + | + | const uint8_t | byte_array[] ) | +
CV Programming mode function Used on entering programming mode in order to write CV values to persistent flash memory or verify/read bits/bytes from flash.
+ Refers to NMRA Standard 9.2.3 ("Service Mode Programming") or RCN-216
+
Procedure:
| number_of_bytes | Number of bytes in byte_array[] |
| byte_array | Pointer to byte_array[] |
| void set_outputs | +( | +uint32_t | functions_to_set_bitmask | ) | ++ |
Set outputs according to function mapping in CV257 to CV512.
+This function maps the functions and direction to the mapped outputs configured in CV257 to CV512. Also enables PWM when enabled according to CV112 to CV115.
+| functions_to_set_bitmask | Function bitmask F0 is bit0, F1 is bit1, ... |
| void track_signal_fall | +( | +unsigned int | gpio, | +
| + | + | long unsigned int | events ) | +
Track signal falling edge interrupt callback function.
+Saves timer counter value using get_absolute_time(), then calculates time difference between rising and falling edge. When the time difference is greater than 87us, this bit is interpreted as a logical 0. Refers to NMRA S-9.1 and RCN-210 standards Puts the latest bit value into buffer, then evaluates complete buffer using evaluate_message(). Parameters are unused.
+| gpio | Unused parameter |
| events | Unused parameter |
| void track_signal_rise | +( | +unsigned int | gpio, | +
| + | + | long unsigned int | events ) | +
Track signal rising edge interrupt callback function.
+Saves timer counter value using get_absolute_time(), then disables rising edge IRQ and enables falling edge IRQ. Parameters are unused.
+| gpio | Unused parameter |
| events | Unused parameter |
| float two_std_dev | +( | +const float | arr[], | +
| + | + | uint32_t | length ) | +
Function returns average of values deviating less than twice the standard deviation from original average.
+| arr | input array |
| length | amount of elements in input array |
| void verify_cv_bit | +( | +uint16_t | cv_address, | +
| + | + | bool | bit_val, | +
| + | + | uint8_t | bit_pos ) | +
Function for verifying a single bit of a CV.
+| cv_address | CV Address |
| bit_val | Value of bit to be verified |
| bit_pos | Position of bit to be verified |
| void verify_cv_byte | +( | +uint16_t | cv_address, | +
| + | + | uint8_t | cv_data ) | +
Function for verifying a CV byte.
+| cv_address | CV Address |
| cv_data | Byte to be verified |
| void write_cv_byte | +( | +uint16_t | cv_address, | +
| + | + | uint8_t | cv_data ) | +
Function for writing a CV byte.
+| cv_address | |
| cv_data |
| const uint32_t clr_bit_arr[6] | +
Bitmasks used for clearing bits corresponding to function blocks.
+[0] = F0-F4 [1] = F5-F8 [2] = F9-F12 [3] = F13-F20 [4] = F21-F28 [5] = F29-F31
+ +|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
#include "shared.h"Go to the source code of this file.
++Data Structures | |
| struct | startup_parameters_t |
| struct | pid_parameters_t |
| struct | controller_parameter_t |
+Macros | |
| +#define | BASE_PWM_ARR_LEN 16 |
+Typedefs | |
| +typedef struct startup_parameters_t | startup_parameters_t |
| +typedef struct pid_parameters_t | pid_parameter_t |
| +typedef struct controller_parameter_t | controller_parameter_t |
+Enumerations | |
| enum | controller_mode_t { STARTUP_MODE +, PID_MODE + } |
+Functions | |
| +uint8_t | get_speed_step_table_index_of_speed_step (uint8_t speed_step) |
| +bool | speed_helper (struct repeating_timer *t) |
| +void | adjust_pwm_level (uint16_t level) |
| +float | get_kp (const controller_parameter_t *ctrl_par) |
| +uint16_t | get_initial_level (controller_parameter_t *ctrl_par) |
| +void | controller_startup_mode (controller_parameter_t *ctrl_par) |
| +bool | controller_general (struct repeating_timer *t) |
| +void | init_controller (controller_parameter_t *ctrl_par) |
Used exclusively by core1
+|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+