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