1 Star 1 Fork 1

worlderic/battman-firmware

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
led_rgb.c 825 Bytes
一键复制 编辑 原始数据 按行查看 历史
raphaelchang 提交于 2016-11-16 01:49 . Obnoxious buzzer
#include "led_rgb.h"
#include "ch.h"
#include "hal.h"
#include "hw_conf.h"
static PWMConfig pwmcfg = {
512000,
256,
NULL,
{
{PWM_OUTPUT_DISABLED, NULL},
{PWM_OUTPUT_ACTIVE_LOW, NULL},
{PWM_OUTPUT_ACTIVE_LOW, NULL},
{PWM_OUTPUT_ACTIVE_LOW, NULL}
},
0,
0
};
void led_rgb_init(void)
{
pwmStart(&LED_PWM_DEV, &pwmcfg);
pwmEnableChannel(&LED_PWM_DEV, LED_R_CHANNEL, 0);
pwmEnableChannel(&LED_PWM_DEV, LED_G_CHANNEL, 0);
pwmEnableChannel(&LED_PWM_DEV, LED_B_CHANNEL, 0);
}
void led_rgb_set(uint32_t color)
{
pwmEnableChannel(&LED_PWM_DEV, LED_B_CHANNEL, color & 0xFF);
color = color >> 8;
pwmEnableChannel(&LED_PWM_DEV, LED_G_CHANNEL, color & 0xFF);
color = color >> 8;
pwmEnableChannel(&LED_PWM_DEV, LED_R_CHANNEL, color & 0xFF);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/worlderic/battman-firmware.git
git@gitee.com:worlderic/battman-firmware.git
worlderic
battman-firmware
battman-firmware
master

搜索帮助