From 1e32814e0bc7ee1eb5b7f64b703f8bd03cba7805 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Wed, 21 Aug 2024 16:58:57 +0800 Subject: [PATCH] update led/relay pin --- hal/api/led.h | 12 ++++++------ hal/api/relay.c | 6 +++--- hal/api/relay.h | 4 ++-- hal/api/led.c | 19 +++++++++---------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/hal/api/led.c b/hal/api/led.c index 16fe2f4..363cbb1 100644 --- a/hal/api/led.c +++ b/hal/api/led.c @@ -5,12 +5,11 @@ * Filename: led.c * Description: This file is used to control RGB 3-colors LED * - * * Pin connection: - * RGB Led Module IGKBoard - * R <-----> #Pin33 - * G <-----> #Pin35 - * B <-----> #Pin37 + * RGB Led Module IGKBoard-IMX6ULL + * R <-----> #Pin36 (GPIO1_IO11) + * G <-----> #Pin38 (GPIO1_IO10) + * B <-----> #Pin40 (GPIO5_IO09) * GND <-----> GND * ********************************************************************************/ @@ -72,18 +71,18 @@ *| Leds API based on libgpiod v2.0 | *+---------------------------------+*/ -static led_t leds_info[LEDCNT] = +static led_t leds_info[LED_CNT] = { - {"red", 0, 23, ACTIVE_HIGH, 0, NULL}, /* #31, GPIO1_IO23 on chip0 line 23, active high */ - {"green", 4, 1, ACTIVE_HIGH, 0, NULL}, /* #33, GPIO5_IO01 on chip4 line 1, active high */ - {"blue", 4, 8, ACTIVE_HIGH, 0, NULL}, /* #35, GPIO5_IO08 on chip4 line 8, active high */ + {"red", 0, 11, ACTIVE_HIGH, 0, NULL}, /* #Pin36, GPIO1_IO11 on chip0 line 11, active high */ + {"green", 0, 10, ACTIVE_HIGH, 0, NULL}, /* #Pin38, GPIO1_IO10 on chip0 line 10, active high */ + {"blue", 4, 9, ACTIVE_HIGH, 0, NULL}, /* #Pin40, GPIO5_IO09 on chip4 line 09, active high */ }; /* Leds context */ static leds_t leds = { .leds = leds_info, - .count = LEDCNT, + .count = LED_CNT, }; int init_led(void) diff --git a/hal/api/led.h b/hal/api/led.h index b486bcf..4f2937c 100644 --- a/hal/api/led.h +++ b/hal/api/led.h @@ -7,10 +7,10 @@ * * * Pin connection: - * RGB Led Module IGKBoard - * R <-----> #Pin33 - * G <-----> #Pin35 - * B <-----> #Pin37 + * RGB Led Module IGKBoard-IMX6ULL + * R <-----> #Pin36 (GPIO1_IO11) + * G <-----> #Pin38 (GPIO1_IO10) + * B <-----> #Pin40 (GPIO5_IO09) * GND <-----> GND * ********************************************************************************/ @@ -31,7 +31,7 @@ LED_R = 0, LED_G, LED_B, - LEDCNT, + LED_CNT, }; enum @@ -74,4 +74,4 @@ /* blink $which led status with $interval ms */ void blink_led(int which, int interval); -#endif /* ----- #ifndef _LEDS_H_ ----- */ +#endif diff --git a/hal/api/relay.c b/hal/api/relay.c index 93e45ff..4d14ae2 100644 --- a/hal/api/relay.c +++ b/hal/api/relay.c @@ -9,7 +9,7 @@ * Pin connection: * Relay Module IGKBoard-IMX6ULL * VCC <-----> 5V - * I <-----> #Pin31 + * I <-----> #Pin22 (GPIO3_IO23) * GND <-----> GND * ********************************************************************************/ @@ -102,7 +102,7 @@ static relay_t relays_info[RELAY_CNT] = { - {"relay1", 0, 22, ACTIVE_HIGH, 0, NULL}, /* #31, GPIO1_IO22 on chip0 line 22, active high */ + {"relay1", 2, 23, ACTIVE_HIGH, 0, NULL}, /* #Pin22, GPIO3_IO23 on chip2 line 23, active high */ }; /* relays context */ @@ -114,7 +114,7 @@ int init_relay(void) { - relay_t *relay; + relay_t *relay; int i, rv = 0; char chip_dev[32]; struct gpiod_chip *chip; /* gpio chip */ diff --git a/hal/api/relay.h b/hal/api/relay.h index bbdd1bd..c03cd9f 100644 --- a/hal/api/relay.h +++ b/hal/api/relay.h @@ -9,7 +9,7 @@ * Pin connection: * Relay Module IGKBoard-IMX6ULL * VCC <-----> 5V - * I <-----> #Pin31 + * I <-----> #Pin22 (GPIO3_IO23) * GND <-----> GND * ********************************************************************************/ @@ -67,4 +67,4 @@ /* toggle $which relay status */ int toggle_relay(int which); -#endif /* ----- #ifndef _relayS_H_ ----- */ +#endif -- Gitblit v1.9.1