This repository has been archived on 2025-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
controller-hd/User/application/inc/mode_pwmp.h

55 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __MODE_PWMP_H__
#define __MODE_PWMP_H__
#include "main.h"
#include "filter.h"
//--------------------
typedef enum
{
PWMP_PROCESS_CONTROL,
PWMP_PROCESS_ADJUST,
PWMP_PROCESS_TEST,
PWMP_PROCESS_STOP,
} mode_pwmp_process_state_e; // 处理状态
/*需要存储的变量*/
typedef struct
{
} mode_pwmp_storage_data_t;
typedef struct
{
} mode_pwmp_master_data_t;
typedef union
{
uint8_t data[128];
// 自定义数据结构
mode_pwmp_storage_data_t storage;
} mode_pwmp_params_u;
typedef struct
{
uint8_t auto_tune_state; // 自整定状态 0未整定 1整定中 2整定完成 3整定失败
uint16_t wait_count_max; // 等待次数最大值
uint16_t arr_default; // 默认值array推动值
uint8_t process_state; // 处理状态
uint8_t adjust_state; // 整定状态
uint16_t output; // 输出值
uint16_t current_adc; // 当前位置反馈的AD值
uint32_t count; // 计数
mode_pwmp_master_data_t master;
mode_pwmp_params_u *pwmp_save;
void (*params_save_cb)(void);
} mode_pwmp_t;
void mode_pwmp_init(mode_pwmp_params_u *params, void (*params_save_cb)(void));
void mode_pwmp_dinit(void);
void mode_pwmp_process(void);
void pwmp_process_state_set(mode_pwmp_process_state_e state);
extern mode_pwmp_t *mode_pwmp;
#endif // __MODE_PWMP_H__