diff --git a/html/CV_8h_source.html b/html/CV_8h_source.html new file mode 100644 index 0000000..b21ba3d --- /dev/null +++ b/html/CV_8h_source.html @@ -0,0 +1,697 @@ + + +
+ + + + +|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
| Cpid_params |
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
Go to the source code of this file.
++Functions | |
| +float | two_std_dev (const float arr[], uint32_t length) |
| +void | adc_offset_adjustment (uint32_t length) |
| +void | acknowledge () |
| +void | verify_cv_bit (uint16_t cv_address, bool bit_val, uint8_t bit_pos) |
| +void | verify_cv_byte (uint16_t cv_address, uint8_t cv_data) |
| +void | regular_cv_write (uint16_t cv_index, uint8_t cv_data) |
| void | 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) |
| +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) |
| +void | track_signal_fall (unsigned int gpio, long unsigned int events) |
| void | init_outputs () |
| Output initialization function. | |
| uint16_t | measure_base_pwm (bool direction, uint8_t iterations) |
| Measures base pwm duty cycles at which the motor barely starts moving. | |
| 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] |
Used exclusively by core0
+| 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 | +( | +) | ++ |
| uint16_t measure_base_pwm | +( | +bool | direction, | +
| + | + | uint8_t | iterations ) | +
Measures base pwm duty cycles at which the motor barely starts moving.
+Function starts with 1/20 of the maximum duty cycle then increases the duty cycle by 1/500 of the maximum until the motor movement can be measured. This is done for the specified amount of iterations. The array with raw measurements values is then passed to two_std_dev() in order to detect outliers and calculate the average.An additional correction factor is applied and the overall measurement result is then returned. In case no motor movement could be measured a value of 0 is returned and normally written to flash, indicating a pending calibration next time the decoder starts, rerunning the calibration.
| direction | Specifies direction which is to be measured |
| iterations | Specifies the amount of iterations the measurement is to be repeated and averaged out over |
| 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[] |
| const uint32_t clr_bit_arr[6] | +
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
#include "shared.h"Go to the source code of this file.
++Data Structures | |
| struct | pid_params |
+Typedefs | |
| +typedef struct pid_params | pid_params |
+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) |
| +void | update_m (pid_params *pid) |
| +void | update_y (pid_params *pid, float i) |
| +float | get_ff_val (const pid_params *pid) |
| +float | get_kp (const pid_params *pid) |
| +bool | pid_control (struct repeating_timer *t) |
| +void | init_pid (pid_params *pid) |
Used exclusively by core1
+|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+
|
+ RP2040-Decoder
+
+ |
+