chenming 1e21cdb572 1.优化上下电时序
2.修改开关FCD_EN时的死机问题
3.修改快速开关FCD_EN信号时出现花屏的问题
4.修改cola_set_event事件参数,都是一个32bit的整数,每个事件占用1个bit
5.将B+高低压ADC判断改为电压mv判断
6.修改lvds lock信号消抖时间
7.修改不接lvds线时,快速开关FCD_EN不进入BIST模式的问题
8.添加A样相关资料
2025-05-30 14:10:31 +08:00

79 lines
1.4 KiB
C

/*
* fml_pwm.c
*
* Created on: 2025年4月10日
* Author: 22332
*/
#include <stdio.h>
#include <stdlib.h>
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "fml_pwm.h"
#include "shell.h"
extern void logWrite(const char *fmt, ...);
static cola_device_t *g_pDevpwm = NULL;
static uint8_t g_iHostPWMValue = 240; //主机发过来的PWM值
void fml_pwm_init(void)
{
g_pDevpwm = cola_device_find("DEVICE_PWM");
if(g_pDevpwm)
cola_device_open(g_pDevpwm, 0);
}
void fml_pwm_change_duty(uint8_t duty)
{
g_iHostPWMValue = duty;
cola_device_cfg(g_pDevpwm,duty,0);
}
void fml_pwm_adjust(bool bTempHigh)
{
if(g_iHostPWMValue > 0)
{
uint8_t value = g_iHostPWMValue;
if(bTempHigh)
value /= 2;
cola_device_cfg(g_pDevpwm,value,0);
}
//logWrite("fml_pwm_adjust,g_iHostPWMValue=%d\r\n",g_iHostPWMValue);
}
void fml_pwm_deinit(void)
{
if(g_pDevpwm)
{
g_pDevpwm = NULL;
cola_device_close(g_pDevpwm);
}
}
int fml_pwm(int argc, char *argv[])
{
if (argc < 3)
{
logWrite("para length must greater than 3\r\n");
return 0;
}
int mode = atoi(argv[1]);
int value = atoi(argv[2]);
if(mode == 0)
{
logWrite("pwm_value=%d\r\n",value);
fml_pwm_change_duty(value);
}
else if(mode == 1)
{
logWrite("g_iHostPWMValue=%d\r\n",g_iHostPWMValue);
}
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),pwm, fml_pwm, pwm control);