CSR 8670 LED的底层代码

本文档介绍了CSRLED蓝牙底层函数库中控制LED硬件的函数LedConfigure及其参数配置。包括了LED的功能开启、占空比调试、PWM频率设置等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


/*CSR LED蓝牙底层函数库代码*/


LED.H

/*******************************************/
Function Documentation


bool LedConfigure (    led_idled, led_config_key key,  uint16 value ) 


Control the LED hardware present on some BlueCore variants.


Parameters
         led The LED to configure

         key Which LED parameter to configure

         value The value the parameter specified by "key" should be set to


Returns

          TRUE if the led_id is valid and the input value is in valid range, else FALSE.

          More detailed information on the keys and values can be found in led_if.h 

         See the data sheet for accurate information on which LED hardware a given 

         BlueCore variant supports



 


led_if.h




Configuration parameters for LED control.


bool LedConfigure (led_id led, led_config_key key, uint16 value)


//
enum led_id


Enumerator
LED_0
LED_1
LED_2
LED_3
LED_4
LED_5
NUM_OF_LEDS
/


enum led_config_key


LED_ENABLE 
/*
(LED功能开启)
Examples:
LedConfigure(LED_0, LED_ENABLE, 1);  Turn on LED 0
LedConfigure(LED_0, LED_ENABLE, 0);  Turn off LED 0
*/


LED_DUTY_CYCLE 


/*
(LED占空比调试)
LED_DUTY_CYCLE controls the the PWM duty cycle. 
Valid values with this key range from 0..0xFFF. 
0x0 turns the LED off fully, 0xFFF turns the LED on fully. 
All other values set the duty cycle to the value /4096.


*/




LED_PERIOD 


/*
(LEDPWM的频率)
ED_PERIOD controls the PWM period. 
Valid values with this key range from 0..0xF. 
pwm_period is calculated as follows:
pwm_period = clock_period * 4096 * 2^LED_PERIOD


*/
LED_FLASH_ENABLE 


/*
LED_FLASH_ENABLE 为0,灭
LED_FLASH_ENABLE 非0,亮
When using this key, a zero value will disable the LED 
flashing hardwareand a non zero value will enable the 
flashing hardware.
*/


LED_FLASH_RATE


/*
设定FLSAH LED 占空比和频率
Set the rate to flash/pulse LED. Valid values to Where pwm_period is as calculated above.


And so, LED_FLASH_RATE maps to a multiplier as follows.


LED_FLASH_RATE = 0: Led Flash Period = pwm_period * 96


LED_FLASH_RATE = 1: Led Flash Period = pwm_period * 192


LED_FLASH_RATE = 2: Led Flash Period = pwm_period * 384


LED_FLASH_RATE = 3: Led Flash Period = pwm_period * 768


LED_FLASH_RATE = 4: Led Flash Period = pwm_period * 1536
...
LED_FLASH_RATE = 15: Led Flash Period = pwm_period * 3145728use with this key range from 0..0xF.


Led Flash Period = pwm_period * 96 * 2^LED_FLASH_RATE


*/


LED_FLASH_MAX_HOLD
/*
Sets hold time for max PWM when flashing
*/
LED_FLASH_MIN_HOLD
/*
Sets hold time for min PWM when flashing
*/
LED_FLASH_SEL_INVERT 


/*
反转
Inverts the PWM output. When using this key, 
a zero value will disable the feature and a 
non zero value will enable the feature.
*/


LED_FLASH_SEL_DRIVE 


/*
Selects the status of DRIVE pad if Drive EnableB 
is used for LED output. When using this key, a zero 
value will disable the feature and a non zero value
 will enable the feature.*/


 LED_FLASH_SEL_TRISTATE 
/*
Selects that the LED PWM output controls the Pad drive
enableB rather than output. When using this key, a zero 
value will disable the feature and a non zero value will
 enable the feature.*/






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值