forked from RT-Thread/rt-thread
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'RT-Thread:master' into master
- Loading branch information
Showing
21 changed files
with
3,842 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2006-2022, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2022-3-08 GuEe-GUI the first version | ||
*/ | ||
|
||
#ifndef __LED_H__ | ||
#define __LED_H__ | ||
|
||
#include <rthw.h> | ||
#include <rtdef.h> | ||
|
||
struct rt_led_ops; | ||
|
||
enum rt_led_state | ||
{ | ||
RT_LED_S_OFF, | ||
RT_LED_S_ON, | ||
RT_LED_S_TOGGLE, | ||
RT_LED_S_BLINK, | ||
|
||
RT_LED_STATE_NR, | ||
}; | ||
|
||
struct rt_led_device | ||
{ | ||
struct rt_device parent; | ||
|
||
const struct rt_led_ops *ops; | ||
|
||
struct rt_spinlock spinlock; | ||
|
||
void *sysdata; | ||
void *priv; | ||
}; | ||
|
||
struct rt_led_ops | ||
{ | ||
rt_err_t (*set_state)(struct rt_led_device *led, enum rt_led_state state); | ||
rt_err_t (*get_state)(struct rt_led_device *led, enum rt_led_state *out_state); | ||
rt_err_t (*set_period)(struct rt_led_device *led, rt_uint32_t period_ms); | ||
rt_err_t (*set_brightness)(struct rt_led_device *led, rt_uint32_t brightness); | ||
}; | ||
|
||
rt_err_t rt_hw_led_register(struct rt_led_device *led); | ||
rt_err_t rt_hw_led_unregister(struct rt_led_device *led); | ||
|
||
rt_err_t rt_led_set_state(struct rt_led_device *led, enum rt_led_state state); | ||
rt_err_t rt_led_get_state(struct rt_led_device *led, enum rt_led_state *out_state); | ||
rt_err_t rt_led_set_period(struct rt_led_device *led, rt_uint32_t period_ms); | ||
rt_err_t rt_led_set_brightness(struct rt_led_device *led, rt_uint32_t brightness); | ||
|
||
#endif /* __LED_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
menuconfig RT_USING_LED | ||
bool "Using Light Emitting Diode (LED) device drivers" | ||
depends on RT_USING_DM | ||
default n | ||
|
||
config RT_LED_GPIO | ||
bool "GPIO connected LEDs Support" | ||
depends on RT_USING_LED | ||
depends on RT_USING_PINCTRL | ||
depends on RT_USING_OFW | ||
default n | ||
|
||
if RT_USING_LED | ||
osource "$(SOC_DM_LED_DIR)/Kconfig" | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from building import * | ||
|
||
group = [] | ||
|
||
if not GetDepend(['RT_USING_DM', 'RT_USING_LED']): | ||
Return('group') | ||
|
||
cwd = GetCurrentDir() | ||
CPPPATH = [cwd + '/../include'] | ||
|
||
src = ['led.c'] | ||
|
||
if GetDepend(['RT_LED_GPIO']): | ||
src += ['led-gpio.c'] | ||
|
||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
Oops, something went wrong.