mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
fix(boards): align LED indices and add docs for corvon 743v1 (#26699)
* boards: corvon 743v1 support (Docs and LED alignment) This PR addresses #24769 by providing the required official documentation, while simultaneously aligning the board's LED semantics entirely with the PX4 standard. Key Changes: - Add complete corvon 743v1 hardware documentation and manufacturer link. - Fix LED out-of-bounds bug and strictly align RGB states to Pixhawk standard (LED_BLUE=0, LED_RED=1, LED_GREEN=3). - Update bootloader pin config (hw_config.h) to use red LED for boot/error, and update pre-built bootloader.bin. * Prettier and file reduce * docs: address reviewer feedback & board ID fix * Apply suggestion from @hamishwillee Co-authored-by: Hamish Willee <hamishwillee@gmail.com> * docs: resolve final reviewer feedback (PPM, Debug Port, Manufacturer List) --------- Co-authored-by: Hamish Willee <hamishwillee@gmail.com> Co-authored-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Regular → Executable
BIN
Binary file not shown.
@@ -104,7 +104,7 @@
|
||||
#define OSC_FREQ 8
|
||||
|
||||
#define BOARD_PIN_LED_ACTIVITY GPIO_nLED_BLUE // BLUE
|
||||
#define BOARD_PIN_LED_BOOTLOADER GPIO_nLED_GREEN // GREEN
|
||||
#define BOARD_PIN_LED_BOOTLOADER GPIO_nLED_RED // RED
|
||||
#define BOARD_LED_ON 0
|
||||
#define BOARD_LED_OFF 1
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
drv_led_start();
|
||||
led_off(LED_RED);
|
||||
led_off(LED_BLUE);
|
||||
led_off(LED_GREEN);
|
||||
|
||||
if (board_hardfault_init(2, true) != 0) {
|
||||
led_on(LED_BLUE);
|
||||
|
||||
@@ -63,12 +63,23 @@ extern void led_toggle(int led);
|
||||
__END_DECLS
|
||||
|
||||
# define xlat(p) (p)
|
||||
// index: 0=BLUE, 1=RED, 2=SAFETY, 3=GREEN
|
||||
static uint32_t g_ledmap[] = {
|
||||
GPIO_nLED_GREEN, // Indexed by BOARD_LED_GREEN
|
||||
GPIO_nLED_BLUE, // Indexed by BOARD_LED_BLUE
|
||||
GPIO_nLED_RED, // Indexed by BOARD_LED_RED
|
||||
GPIO_nLED_BLUE, // LED_BLUE (0)
|
||||
GPIO_nLED_RED, // LED_RED (1)
|
||||
0, // LED_SAFETY (2) - no independent safety LED, use 0 placeholder
|
||||
GPIO_nLED_GREEN, // LED_GREEN (3)
|
||||
};
|
||||
|
||||
#ifndef arraySize
|
||||
#define arraySize(a) (sizeof((a))/sizeof(((a)[0])))
|
||||
#endif
|
||||
|
||||
static inline bool valid_led_index(int led)
|
||||
{
|
||||
return (led >= 0) && ((size_t)led < arraySize(g_ledmap));
|
||||
}
|
||||
|
||||
__EXPORT void led_init(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
@@ -81,6 +92,10 @@ __EXPORT void led_init(void)
|
||||
|
||||
static void phy_set_led(int led, bool state)
|
||||
{
|
||||
if (!valid_led_index(led)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Drive Low to switch on */
|
||||
if (g_ledmap[led] != 0) {
|
||||
stm32_gpiowrite(g_ledmap[led], !state);
|
||||
@@ -89,6 +104,10 @@ static void phy_set_led(int led, bool state)
|
||||
|
||||
static bool phy_get_led(int led)
|
||||
{
|
||||
if (!valid_led_index(led)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If Low it is on */
|
||||
if (g_ledmap[led] != 0) {
|
||||
return !stm32_gpioread(g_ledmap[led]);
|
||||
|
||||
Reference in New Issue
Block a user