PiyushPatle26 commented on code in PR #18907: URL: https://github.com/apache/nuttx/pull/18907#discussion_r3293824470
########## boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c: ########## @@ -0,0 +1,134 @@ +/**************************************************************************** + * boards/arm64/am62x/beagleplay/src/beagleplay_autoleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* LED state encoding (see board.h): + * + * SYMBOL USR0 USR1 USR2 + * ---------------------- ---- ---- ---- + * LED_STARTED ON OFF OFF + * LED_HEAPALLOCATE ON ON OFF + * LED_IRQSENABLED ON ON ON + * LED_STACKCREATED OFF ON OFF + * LED_PANIC --- blink --- + * + * NOTE: GPIO driver not yet implemented. The LED functions are stubs that + * will be filled in when the AM62x GPIO driver is added in a later phase. + * The architecture LED calls compile and link now so the overall board + * configuration is valid. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/board.h> +#include <arch/board/board.h> +#include "beagleplay.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Tracks whether we are in a panic so board_autoled_on/off know to blink */ + +static bool g_panic; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: beagleplay_led_initialize + * + * Description: + * Configure LED GPIO pins as outputs, all OFF initially. + * Stubbed until the GPIO driver is available. + * + ****************************************************************************/ + +void beagleplay_led_initialize(void) +{ + /* TODO: configure GPIO pins for USR0/USR1/USR2 LEDs once GPIO driver + * is implemented. + */ +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Turn ON the LED(s) associated with the OS event 'led'. + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + switch (led) + { + case LED_STARTED: + break; + + case LED_HEAPALLOCATE: + break; + + case LED_IRQSENABLED: + break; + + case LED_STACKCREATED: + break; + + case LED_PANIC: + g_panic = true; Review Comment: it did not need to be global. I had originally introduced `g_panic` to preserve a panic/blink state across board_autoled_on() and board_autoled_off(), but in this stub implementation there was no actual GPIO toggle logic behind it, so the state was unnecessary. I removed it and simplified the LED hooks to stateless no-ops until real GPIO-backed LED support is added. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
