You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* \brief Enables access to the on-board status leds
10
+
* \brief Enables access to the on-board status LED(s)
11
11
*
12
-
* Boards usually have access to an on-board status leds which are configured via the board header (\see PICO_DEFAULT_LED_PIN and \see PICO_DEFAULT_WS2812_PIN)
13
-
* This library hides the details so you can use the status leds for all boards without changing your code.
12
+
* Boards usually have access to an on-board status LEDs which are configured via the board header (\see PICO_DEFAULT_LED_PIN and \see PICO_DEFAULT_WS2812_PIN)
13
+
* This library hides the details so you can use the status LEDs for all boards without changing your code.
14
14
*/
15
15
16
16
#ifndef_PICO_STATUS_LED_H
@@ -28,188 +28,217 @@ struct async_context;
28
28
extern"C" {
29
29
#endif
30
30
31
-
// PICO_CONFIG: PICO_STATUS_LED_COLOR_WRGB, Indicate if the colored status led supports WRGB, type=bool, default=0, group=pico_status_led
32
-
#ifndefPICO_STATUS_LED_COLOR_WRGB
33
-
#definePICO_STATUS_LED_COLOR_WRGB 0
31
+
// PICO_CONFIG: PICO_STATUS_LED_AVAILABLE, Indicate whether a non-colored status LED is availble, type=bool, default=1 if PICO_DEFAULT_LED_PIN or CYW43_WL_GPIO_LED_PIN is defined; may be set by the user to 0 to not use either even if they are available, group=pico_status_led
// PICO_CONFIG: PICO_STATUS_LED_COLOR_ONLY, Indicate if only the colored status led should be used. Only true by default if a WS2812 pin is defined and no led pin is defined, type=bool, group=pico_status_led
40
+
// PICO_CONFIG: PICO_COLORED_STATUS_LED_AVAILABLE, Indicate whether a colored status LED is availble, type=bool, default=1 if PICO_DEFAULT_WS2812_PIN is defined; may be set by the user to 0 to not use either even if available, group=pico_status_led
41
+
#ifndefPICO_COLORED_STATUS_LED_AVAILABLE
37
42
#ifdefPICO_DEFAULT_WS2812_PIN
38
-
#ifndefPICO_STATUS_LED_COLOR_ONLY
39
-
#definePICO_STATUS_LED_COLOR_ONLY !(defined PICO_DEFAULT_LED_PIN || defined CYW43_WL_GPIO_LED_PIN)
40
-
#endif
43
+
#definePICO_COLORED_STATUS_LED_AVAILABLE 1
41
44
#else
42
-
// Force this off if PICO_DEFAULT_WS2812_PIN is not defined
43
-
#undef PICO_STATUS_LED_COLOR_ONLY
44
-
#definePICO_STATUS_LED_COLOR_ONLY 0
45
+
#definePICO_COLORED_STATUS_LED_AVAILABLE 0
46
+
#endif
47
+
#endif
48
+
49
+
// PICO_CONFIG: PICO_STATUS_LED_VIA_COLORED_STATUS_LED, Indicate if the colored status LED should be used for both status_led and colored_status_led APIs. type=bool, default=1 if PICO_COLORED_STATUS_LED_AVAILABLE is 1 and PICO_STATUS_LED_AVAILABLE is 0, group=pico_status_led
// PICO_CONFIG: PICO_STATUS_LED_COLOR_ON_DEFAULT, the default pixel color value of the colored status led when it is on, type=int, group=pico_status_led
// PICO_CONFIG: PICO_DEFUALT_COLORED_STATUS_LED_ON_COLOR, the default pixel color value of the colored status LED when it is on, type=int, group=pico_status_led
* Initialise the status leds and the resources they need before use.
87
+
* Initialize the status LED(s) and the resources they need before use. On some devices (e.g. Pico W, Pico 2 W) accessing
88
+
* the status LED requires talking to the WiFi chip, which requires an \ref async_context. This method will create one for you,
89
+
* however an application only one has a single \ref async_context instance to talk to the WiFi chip, you should use \ref
90
+
* status_led_init_with_context instead and pass it the \ref async_context already created within your application
85
91
*
86
-
* \note: You must call this function before using any other status led functions.
92
+
* \note: You must call this function (or \ref status_led_init_with_context) before using any other pico_status_led functions.
87
93
*
88
-
* \param context An async context is needed to control the led on some devices (e.g. Pico W).
89
-
* You generally only have one async context, so pass your async context into the function if you have one, or pass NULL if you know one isn't needed (not Pico W) oror if you don't have one, pass NULL to get the function to just create a context for it's own use as and if required.
90
-
* \return Returns true if the led was initialised successfully, otherwise false on failure
94
+
* \return Returns true if the LED was initialized successfully, otherwise false on failure
95
+
* \sa status_led_init_with_context
91
96
*/
92
-
boolpico_status_led_init(void);
97
+
boolstatus_led_init(void);
93
98
94
-
/*! \brief Initialise the status leds
99
+
/*! \brief Initialise the status LED(s)
95
100
* \ingroup pico_status_led
96
101
*
97
-
* Initialise the status leds and the resources they need before use.
102
+
* Initialize the status LED(s) and the resources they need before use.
98
103
*
99
-
* \note: You must call this function before using any other status led functions.
104
+
* \note: You must call this function (or \ref status_led_init) before using any other pico_status_led functions.
100
105
*
101
-
* \param context An async context is needed to control the led on some devices (e.g. Pico W).
102
-
* You generally only have one async context, so pass your async context into the function if you have one, or pass NULL if you know one isn't needed (not Pico W) oror if you don't have one, pass NULL to get the function to just create a context for it's own use as and if required.
103
-
* \return Returns true if the LED was initialised successfully, otherwise false on failure
106
+
* \param context An \ref async_context used to communicate with the status LED (e.g. on Pico W or Pico 2 W)
107
+
* \return Returns true if the LED was initialized successfully, otherwise false on failure
0 commit comments