-
Notifications
You must be signed in to change notification settings - Fork 33
/
led.h
51 lines (45 loc) · 1.79 KB
/
led.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Sardine CAN (Open Source J2534 device) - Arduino firmware - version 0.4 alpha
**
** Copyright (C) 2012 Olaf @ Hacking Volvo blog (hackingvolvo.blogspot.com)
** Author: Olaf <[email protected]>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published
** by the Free Software Foundation, either version 3 of the License, or (at
** your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this program; if not, <http://www.gnu.org/licenses/>.
**
*/
#ifndef _SARDINE_LED_H
#define _SARDINE_LED_H
#define ENABLE_LEDS
#define LED_PIN_STATUS A5
#define LED_PIN_CAN A4
#define LED_PIN_ERROR A3
typedef struct {
bool enabled;
bool pwr; // is led now lit or off
uint8_t mode;
unsigned long nextSwitch;
unsigned int duration; // duration of one/multiple blinks
unsigned int multipleInterval; // duration between multiple blinks
unsigned int interval; // duration between blink (or series of blinks)
uint8_t blinkCount;
uint8_t blinkIndex;
unsigned int pin;
} led;
#define LED_SINGLE_BLINK 0
#define LED_BLINK_LOOP 1
void SetLED( led * targetLED, unsigned int duration );
void SetBlinkLED( led * targetLED, unsigned int duration, unsigned int interval );
void SetMultipleBlinkLED( led * targetLED, unsigned int blinkCount, unsigned int duration, unsigned multipleInterval, unsigned int seriesInterval );
void ClearLED( led * targetLED );
void HandleLED( led * targetLED );
#endif