LED API: Difference between revisions
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== | == API Overview== | ||
The calling sequence is [[#open|open]]>[[#turn_on|turn_on]]/[[#turn_off|turn_off]]/[[#get_status|get_status]]>[[#close|close ]] | The calling sequence is [[#open|open]]>[[#turn_on|turn_on]]/[[#turn_off|turn_off]]/[[#get_status|get_status]]>[[#close|close ]] | ||
=== open === | === <big>open</big> === | ||
int led_open() | <syntaxhighlight lang="c">int led_open()</syntaxhighlight > | ||
Open the LED device, which contains all the | Open the LED device, which contains all the LED service. | ||
This operation should be used before other operations. | This operation should be used before other operations. | ||
{|class="wizarpostable" | |||
|- | |||
! scope="row" colspan="2" | Returns | |||
|- | |||
| int || The result code, >= 0, success; <0 [[Error_code|error code]]. | |||
|} | |||
=== <big>close</big> === | |||
<syntaxhighlight lang="c">int led_close()</syntaxhighlight > | |||
Close the LED device, which contains all the LEDs’ service. | |||
The open and close API are pair operations. If you don’t want to use this device, you should call the close API to release this device. | |||
The result code, >= 0, success; <0 [[Error_code|error code]]. | {|class="wizarpostable" | ||
|- | |||
! scope="row" colspan="2" | Returns | |||
|- | |||
| int || The result code, >= 0, success; <0 [[Error_code|error code]]. | |||
|} | |||
=== <big>turn_on</big>=== | |||
<syntaxhighlight lang="c">int led_on(unsigned int nLedIndex)</syntaxhighlight > | |||
=== turn_on=== | |||
int led_on(unsigned int nLedIndex) | |||
Turn on the specified LED. | Turn on the specified LED. | ||
''' | {|class="wizarpostable" | ||
|- | |||
! scope="row" colspan="2" | Parameters | |||
|- | |||
| nLedIndex || '''unsigned int:''' Index of led, >= 0 && < MAX_LED_COUNT | |||
|} | |||
{| | {| | ||
|- | |- | ||
| | | | ||
|} | |} | ||
The result code, >= 0, success; <0 [[Error_code|error code]]. | {|class="wizarpostable" | ||
|- | |||
! scope="row" colspan="2" | Returns | |||
|- | |||
| int || The result code, >= 0, success; <0 [[Error_code|error code]]. | |||
|} | |||
=== turn_off=== | |||
int led_off(unsigned int nLedIndex) | === <big>turn_off</big>=== | ||
<syntaxhighlight lang="c">int led_off(unsigned int nLedIndex)</syntaxhighlight > | |||
Turn off the specified LED. | Turn off the specified LED. | ||
{|class="wizarpostable" | |||
|- | |||
! scope="row" colspan="2" | Parameters | |||
|- | |||
| nLedIndex || '''unsigned int:''' Index of led, >= 0 && < MAX_LED_COUNT | |||
|} | |||
{| | |||
|- | |||
| | |||
|} | |||
{|class="wizarpostable" | |||
|- | |||
! scope="row" colspan="2" | Returns | |||
|- | |- | ||
| | | int || The result code, >= 0, success; <0 [[Error_code|error code]]. | ||
|} | |} | ||
=== get_status=== | === <big>get_status</big>=== | ||
int led_get_status(unsigned int nLedIndex) | <syntaxhighlight lang="c">int led_get_status(unsigned int nLedIndex)</syntaxhighlight > | ||
Get the status of the specified LED. | Get the status of the specified LED. | ||
{|class="wizarpostable" | |||
''' | |- | ||
! scope="row" colspan="2" | Parameters | |||
|- | |||
| nLedIndex || '''unsigned int:''' Index of led, >= 0 && < MAX_LED_COUNT | |||
|} | |||
{| | {| | ||
|- | |- | ||
| | | | ||
|} | |} | ||
The result code, > 0, LED on; = 0, LED off; <0 [[Error_code|error code]]. | {|class="wizarpostable" | ||
|- | |||
! scope="row" colspan="2" | Returns | |||
|- | |||
| int || The result code, > 0, LED on; =0, LED off; <0 [[Error_code|error code]]. | |||
|} |
Latest revision as of 09:34, 11 March 2019
API Overview
The calling sequence is open>turn_on/turn_off/get_status>close
open
int led_open()
Open the LED device, which contains all the LED service. This operation should be used before other operations.
Returns | |
---|---|
int | The result code, >= 0, success; <0 error code. |
close
int led_close()
Close the LED device, which contains all the LEDs’ service. The open and close API are pair operations. If you don’t want to use this device, you should call the close API to release this device.
Returns | |
---|---|
int | The result code, >= 0, success; <0 error code. |
turn_on
int led_on(unsigned int nLedIndex)
Turn on the specified LED.
Parameters | |
---|---|
nLedIndex | unsigned int: Index of led, >= 0 && < MAX_LED_COUNT |
Returns | |
---|---|
int | The result code, >= 0, success; <0 error code. |
turn_off
int led_off(unsigned int nLedIndex)
Turn off the specified LED.
Parameters | |
---|---|
nLedIndex | unsigned int: Index of led, >= 0 && < MAX_LED_COUNT |
Returns | |
---|---|
int | The result code, >= 0, success; <0 error code. |
get_status
int led_get_status(unsigned int nLedIndex)
Get the status of the specified LED.
Parameters | |
---|---|
nLedIndex | unsigned int: Index of led, >= 0 && < MAX_LED_COUNT |
Returns | |
---|---|
int | The result code, > 0, LED on; =0, LED off; <0 error code. |