You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// #include "ozone_pwm_control.h"
// #define TIMINT_TIM 1800000
// #define INTERVAL_TIM 300000
// #define CLCK 48
// ozone_messages_t ozone_messages;
// extern timing_message_t timing_message;
// extern uint32_t g_duty[4]; // PWMd��ռ�ձ�
// extern uint32_t g_frequency;
// extern ozone_message_t ozone_message;
// /**
// * @brief ��ʱ����
// * *
// * @brief ���ü�Ъ����������
// *
// * @param ozone_interval_period
// * @param ozone_interval_duty
// */
// void ozone_pwm_control_set_pwm2(uint32_t ozone_interval_period,uint32_t ozone_interval_duty){
// }
// /**
// * @brief ���ó���PWM����ʱ����ģʽ��һֱ��������ʱ��������Ъ������������
// *
// * @param mode
// */
// void set_ozone_work_mode(OZONE_WOEK_MODE_T mode) {
// if (mode == HAS_BEEN_WORKING) {
// set_ozone_work_gears(ozone_messages.will_be_set_work_gears);
// } else if (mode == TIMING_WORK) {
// ozone_pwm_control_set_pwm_output_1(ozone_messages.ozone_timing_duty);
// } else if (mode == TIMING_INTERVAL_WORK) {
// ozone_pwm_control_set_pwm_output_2(ozone_messages.ozone_timing_duty,
// ozone_messages.ozone_interval_duty);
// } else if (mode == STOP_PWM_WORK) {
// ozone_pwm_control_stop_pwm();
// }
// ozone_messages.now_ozone_woek_mode = mode;
// }
// /**
// * @brief ���ó���PWM������λ
// *
// * @param mode
// */
// void set_ozone_work_gears(OZONE_WOEK_GEARS_T gears) {
// if (gears == LOW_END) {
// ozone_pwm_control_set_pwm_duty(ozone_messages.ozone_pwm_frequency,
// ozone_messages.ozone_pwm_duty);
// } else if (gears == MIDDLE_GRADE) {
// ozone_pwm_control_set_pwm_duty(ozone_messages.ozone_pwm_frequency,
// ozone_messages.ozone_pwm_duty);
// } else if (gears == SLAP_UP) {
// ozone_pwm_control_set_pwm_duty(ozone_messages.ozone_pwm_frequency,
// ozone_messages.ozone_pwm_duty);
// }
// ozone_messages.now_ozone_woek_gears = gears;
// }
// //######################################################
// double calculate_top(double target_frequency) {
// int clck = 0;
// int target_frequency_hz = 0;
// int top = 0;
// clck = CLCK * 1000 * 1000;
// target_frequency_hz = (int)target_frequency * 1000;
// // printf("target_frequency_hz%d\n", target_frequency_hz);
// top = clck / target_frequency_hz;
// // printf("top%d\t\n", top);
// return top;
// }
// double calculate_MAT2(double top, double duty) {
// double percentage_duty = 0;
// double Mat2 = 0;
// percentage_duty = duty / 100;
// Mat2 = top * percentage_duty;
// return Mat2;
// }
// void ozone_pwm_control_set_pwm_duty(uint32_t set_frequency, uint32_t set_duty) {
// double top = 0;
// double Mat2 = 0;
// if (set_frequency > CLCK * 1000) {
// printf("out of range\n");
// return;
// }
// top = calculate_top(set_frequency); //������Ҫ��Ƶ�ʼ�����TOP���Զ���װ��ֵ��
// if (top == 0) {
// return;
// }
// Mat2 = calculate_MAT2(top, set_duty);
// // printf("top:\t%2.lf\n", top);
// // printf("MAT2:\t%2.lf\n", Mat2);
// // printf("MAT3:\t%2.lf\n", top);
// T16Nx_Disable(T16N0);
// t16n0_1_init();
// T16Nx_SetMAT2(T16N0, Mat2);
// T16Nx_SetMAT3(T16N0, top);
// T16Nx_SetTOP1(T16N0, top);
// }
// //######################################################
// /**
// * @brief �ж�ʱ����Ъ
// *
// * @param pwm_timing_duty
// */
// void ozone_pwm_control_set_pwm_output_1(uint32_t pwm_timing_duty) {}
// /**
// * @brief �ж�ʱ���м�Ъ
// *
// * @param pwm_duty
// * @param pwm_interval_duty
// */
// void ozone_pwm_control_set_pwm_output_2(uint32_t pwm_timing_duty,
// uint32_t pwm_interval_duty) {}
// /**
// * @brief ֹͣpwm����
// *
// */
// void ozone_pwm_control_stop_pwm(void) { stop_ozone_work(); }
// /**
// * @brief ��ʱʱ�䵽���Ժ��ػ�
// *
// */
// void try_shutdown(void) {
// if (port_haspassedms(ozone_message.count_down_begin_sys_time) >= TIMINT_TIM) {
// ozone_message.count_down_begin_sys_time = get_sys_ticket();
// if (ozone_message.timing_rank == 1) { //��ʱʱ�䵽
// set_timing_light_mode(CLOSE_ALL_LED);
// printf("time over\r\n");
// } else { //��ʱʱ����30min,ÿ��30min�ر�һ��led
// printf("time minus 30min\r\n");
// set_timing_light_mode(timing_message.now_timing_mode - 1);
// }
// }
// }
// /**
// * @brief �ر�pwm����
// *
// */
// void stop_ozone_work(void) {
// set_ozone_work_mode(STOP_PWM_WORK); //�ر�PWM����
// port_fan_set(false); //���Ƚ�������
// close_all_light(); //�ر�rgb���ر�led0~led3
// }
|