/*CSR LED蓝牙底层函数库代码*/
LED.H
/*******************************************/Function Documentation
bool LedConfigure ( led_idled, led_config_key key, uint16 value )
Parameters
led The LED to configure
key Which LED parameter to configure
value The value the parameter specified by "key" should be set to
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.*/