From 8d8ac376754738b12cfa8bb02994b0ecca805163 Mon Sep 17 00:00:00 2001 From: Guo Wenxue <guowenxue@gmail.com> Date: Sat, 11 Jan 2025 15:10:02 +0800 Subject: [PATCH] Update iotd to add enable switch for publish --- modules/leds.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/modules/leds.c b/modules/leds.c index 7ea158b..8c3c7b0 100644 --- a/modules/leds.c +++ b/modules/leds.c @@ -13,6 +13,12 @@ * B <-----> #Pin37(BCM GPIO26) * GND <-----> GND * + * RGB Led Module Raspberry Pi Board + * R <-----> #Pin36(BCM GPIO16) + * G <-----> #Pin38(BCM GPIO20) + * B <-----> #Pin40(BCM GPIO21) + * GND <-----> GND + * * System install: * sudo apt install -y libgpiod-dev gpiod * @@ -54,11 +60,20 @@ struct gpiod_line *line; /* libgpiod line */ } led_info_t; +#define CONFIG_PIN_333537 +//#define CONFIG_PIN_363840 + static led_info_t leds_info[LEDCNT] = { +#ifdef CONFIG_PIN_333537 {"red", 13, 1, NULL }, {"green", 19, 1, NULL }, {"blue", 26, 1, NULL }, +#elif (defined CONFIG_PIN_363840) + {"red", 16, 1, NULL }, + {"green", 20, 1, NULL }, + {"blue", 21, 1, NULL }, +#endif }; /* Three LEDs API context */ @@ -107,7 +122,7 @@ printf("initial leds gpio failure, rv=%d\n", rv); return 1; } - printf("initial RGB Led gpios okay\n", rv); + printf("initial RGB Led gpios okay\n"); signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); -- Gitblit v1.9.1