libpynq  (release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
leds.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2023 Eindhoven University of Technology
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22 #ifndef LED_H
23 #define LED_H
24 
25 #include <gpio.h>
26 #include <pinmap.h>
27 
80 typedef enum {
87 
94 typedef enum {
99 
100 #define NUM_LED_COLORS 3 /* # colors per color LED (RGB) */
101 #define NUM_LEDS (NUM_GREEN_LEDS + NUM_COLOR_LEDS)
102 #define LED_OFF 0
103 #define LED_ON 255
104 
109 extern void leds_init_onoff(void);
110 
116 extern void green_leds_init_pwm(void);
117 
123 extern void color_leds_init_pwm(void);
124 
129 extern void leds_destroy(void);
130 
139 extern void green_led_onoff(const int led, const int onoff);
140 
148 extern void green_led_on(const int led);
149 
157 extern void green_led_off(const int led);
158 
166 extern void color_led_red_onoff(const int onoff);
167 
175 extern void color_led_green_onoff(const int onoff);
176 
184 extern void color_led_blue_onoff(const int onoff);
185 
194 extern void color_led_onoff(const int red_onoff, const int green_onoff,
195  const int blue_onoff);
196 
203 extern void color_led_on(void);
204 
211 extern void color_led_off(void);
212 
217 #endif
color_leds_init_pwm
void color_leds_init_pwm(void)
Initialize the color LEDs for use with variable intensity. The LED intensity can range from 0....
Definition: leds.c:4
COLOR_LED0
@ COLOR_LED0
Definition: leds.h:95
LED3
@ LED3
Definition: leds.h:84
green_led_index_t
green_led_index_t
Enum of green LEDs. Functions for green LEDs use a led number from 0..NUM_GREEN_LEDS-1....
Definition: leds.h:80
LED2
@ LED2
Definition: leds.h:83
green_led_off
void green_led_off(const int led)
Same as green_led_onoff(led, LED_OFF). Works in all modes.
Definition: leds.c:8
leds_destroy
void leds_destroy(void)
Definition: leds.c:5
color_led_blue_onoff
void color_led_blue_onoff(const int onoff)
Switches on/off the blue component of color LED 0.
Definition: leds.c:11
COLOR_LED1
@ COLOR_LED1
Definition: leds.h:96
color_led_on
void color_led_on(void)
Set color LED 0 to white. Same as color_led_onoff(LED_ON, LED_ON, LED_ON).
Definition: leds.c:14
color_led_onoff
void color_led_onoff(const int red_onoff, const int green_onoff, const int blue_onoff)
Switches on/off the red/green/blue components of color LED 0.
Definition: leds.c:12
color_led_green_onoff
void color_led_green_onoff(const int onoff)
Switches on/off the green component of color LED 0.
Definition: leds.c:10
color_led_index_t
color_led_index_t
Enum of color LEDs. Functions for color LEDs use a led number from 0..NUM_COLOR_LEDS-1....
Definition: leds.h:94
green_leds_init_pwm
void green_leds_init_pwm(void)
Initialize the green LEDs for use with variable intensity. The LED intensity can range from 0....
Definition: leds.c:3
green_led_onoff
void green_led_onoff(const int led, const int onoff)
Definition: leds.c:6
LED0
@ LED0
Definition: leds.h:81
pinmap.h
NUM_GREEN_LEDS
@ NUM_GREEN_LEDS
Definition: leds.h:85
gpio.h
color_led_off
void color_led_off(void)
Set color LED 0 to black. Same as color_led_onoff(LED_OFF, LED_OFF, LED_OFF).
Definition: leds.c:15
NUM_COLOR_LEDS
@ NUM_COLOR_LEDS
Definition: leds.h:97
LED1
@ LED1
Definition: leds.h:82
green_led_on
void green_led_on(const int led)
Same as green_led_onoff(led, LED_ON). Works in all modes.
Definition: leds.c:7
color_led_red_onoff
void color_led_red_onoff(const int onoff)
Switches on/off the red component of color LED 0.
Definition: leds.c:9
leds_init_onoff
void leds_init_onoff(void)
Initialize the green LEDs for on/off use.
Definition: leds.c:2