Browse Source

update

master
Yuenold 3 years ago
parent
commit
b4d37f24a8
  1. 4
      APP/board.h
  2. 12
      APP/main.c
  3. 33
      APP/pwm.c
  4. 883
      project_ozone/Listings/project_o.map
  5. 495
      project_ozone/project_o.uvgui.admin
  6. 3678
      project_ozone/project_o.uvgui.admin.bak
  7. 19
      project_ozone/project_o.uvopt

4
APP/board.h

@ -10,4 +10,6 @@
// #define INTERVAL_WORK_PERIOD_MS (60 * 1000)
#define INTERVAL_WORK_PERIOD_MS (20 * 1000)
//
#define INTERVAL_WORK_DUTY ((uint8_t)50)
#define INTERVAL_WORK_DUTY ((uint8_t)50)
//PWM改变一次的周期
#define PWM_CHANGE_PERIOD 1000

12
APP/main.c

@ -21,6 +21,8 @@ static zkey_t s_keys[] = {
};
zkey_module_t key_module = ZMODULE_INIT(s_keys, onkey);
extern uint32_t target_frequencyhz;
extern uint32_t target_duty;
/***********************************************************************************************************************
* =========================================================================================================== *
***********************************************************************************************************************/
@ -49,7 +51,7 @@ void HOOK_pwm_module_set_pwm_duty(uint32_t frequencyhz, uint32_t duty) {
pwm_modble_enable_falg = true;
}
void HOOK_pwm_stop(void) {
set_pwm_modbul_freq_duty(PWM_FREQHZ, 0); //PWM输出
set_pwm_modbul_freq_duty(1, 0); //PWM输出
pwm_modble_enable_falg = false;
}
bool HOOK_pwm_is_enable(void) { return pwm_modble_enable_falg; }
@ -384,9 +386,17 @@ int main(void) {
* ==============================================rgb模式============================================== *
*******************************************************************************************************************/
process_interval_rgb_mode();
/*******************************************************************************************************************
* ==================================================PWM均匀增加================================================== *
*******************************************************************************************************************/
DO_IT_EACH_MS(PWM_CHANGE_PERIOD) {
set_pwm_modbul_freq_duty(target_frequencyhz, target_duty);
}
END();
/***********************************************************************************************************************
* ======================================================================================================= *
***********************************************************************************************************************/
//
DO_IT_EACH_MS(1000) {
if (g_power_flag && g_auto_shutdown_flag) {

33
APP/pwm.c

@ -1,5 +1,8 @@
#include "pwm.h"
#define CLCK 48
uint32_t target_frequencyhz;
uint32_t target_duty;
static double calculate_top(double target_frequency_hz) {
int clck = 0;
int top = 0;
@ -81,8 +84,36 @@ void set_pwm_t16_pa4(int freqhz, float duty) {
* @param frequency
* @param duty
*/
void set_pwm_modbul_freq_duty(uint32_t frequencyhz, uint32_t duty) {
static uint32_t now_frequencyhz;
static uint32_t now_duty;
target_frequencyhz = frequencyhz;
target_duty = duty;
// while (1) {
/**
* @brief 1khz
*
*/
// Delayms(1000);
if (now_frequencyhz == target_frequencyhz) {
return;
}
if (now_frequencyhz < target_frequencyhz) {
now_frequencyhz = now_frequencyhz + 1000;
if (now_frequencyhz >= target_frequencyhz) {
now_frequencyhz = target_frequencyhz;
}
set_pwm_t16_pa4(now_frequencyhz, duty);
} else if (now_frequencyhz > target_frequencyhz) {
now_frequencyhz = now_frequencyhz - 1000;
if (now_frequencyhz <= target_frequencyhz) {
now_frequencyhz = target_frequencyhz;
}
set_pwm_t16_pa4(now_frequencyhz, target_duty);
}
// }
printf("set_pwm_modbul_freq_duty freq:%d,duty%d\n", frequencyhz, duty);
set_pwm_t16_pa4(frequencyhz, duty);
// set_pwm_t16_pa4(frequencyhz, duty);
}
//######################################################

883
project_ozone/Listings/project_o.map
File diff suppressed because it is too large
View File

495
project_ozone/project_o.uvgui.admin
File diff suppressed because it is too large
View File

3678
project_ozone/project_o.uvgui.admin.bak
File diff suppressed because it is too large
View File

19
project_ozone/project_o.uvopt

@ -148,24 +148,7 @@
<Name>UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC1000 -FN1 -FF0ES8P5066 -FS00000000 -FL010000)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>63</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>5042</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\APP\uart0.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\project_o\../APP/uart0.c\63</Expression>
</Bp>
</Breakpoint>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>

Loading…
Cancel
Save