[BC2D-POS] initial commit
This commit is contained in:
@@ -461,16 +461,16 @@ void wk_tmr2_init(void)
|
||||
tmr_input_struct.input_channel_select = TMR_SELECT_CHANNEL_1;
|
||||
tmr_input_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
|
||||
tmr_input_struct.input_polarity_select = TMR_INPUT_RISING_EDGE;
|
||||
tmr_input_struct.input_filter_value = 0;
|
||||
tmr_input_struct.input_filter_value = 7;
|
||||
tmr_input_channel_init(TMR2, &tmr_input_struct, TMR_CHANNEL_INPUT_DIV_1);
|
||||
|
||||
tmr_input_struct.input_channel_select = TMR_SELECT_CHANNEL_2;
|
||||
tmr_input_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
|
||||
tmr_input_struct.input_polarity_select = TMR_INPUT_RISING_EDGE;
|
||||
tmr_input_struct.input_filter_value = 0;
|
||||
tmr_input_struct.input_filter_value = 7;
|
||||
tmr_input_channel_init(TMR2, &tmr_input_struct, TMR_CHANNEL_INPUT_DIV_1);
|
||||
|
||||
tmr_encoder_mode_config(TMR2, TMR_ENCODER_MODE_A, TMR_INPUT_RISING_EDGE, TMR_INPUT_RISING_EDGE);
|
||||
tmr_encoder_mode_config(TMR2, TMR_ENCODER_MODE_B, TMR_INPUT_RISING_EDGE, TMR_INPUT_RISING_EDGE);
|
||||
|
||||
tmr_counter_enable(TMR2, TRUE);
|
||||
|
||||
@@ -564,7 +564,7 @@ void wk_tmr4_init(void)
|
||||
/* add user code end tmr4_init 1 */
|
||||
|
||||
/* configure counter settings */
|
||||
tmr_base_init(TMR4, 1999, 999);
|
||||
tmr_base_init(TMR4, 1999, 1999);
|
||||
tmr_cnt_dir_set(TMR4, TMR_COUNT_UP);
|
||||
tmr_clock_source_div_set(TMR4, TMR_CLOCK_DIV1);
|
||||
tmr_period_buffer_enable(TMR4, FALSE);
|
||||
|
||||
@@ -68,10 +68,10 @@
|
||||
/* add user code end 0 */
|
||||
|
||||
/**
|
||||
* @brief main function.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
* @brief main function.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
/* add user code begin 1 */
|
||||
@@ -124,8 +124,12 @@ int main(void)
|
||||
LOGI("init done");
|
||||
/* add user code end 2 */
|
||||
|
||||
while (1) {
|
||||
while(1)
|
||||
{
|
||||
/* add user code begin 3 */
|
||||
// lwprintf("pwm value: %f\r\n", param_m1.out_pwm);
|
||||
// lwprintf("mot speed: %f\r\n", param_m1.real_speed);
|
||||
lwprintf("%f,%f,%f\r\n", param_m1.real_speed, param_m1.target_speed, param_m1.out_pwm);
|
||||
/* add user code end 3 */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user