Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91255361
spi_led.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 9, 09:58
Size
2 KB
Mime Type
text/x-c
Expires
Mon, Nov 11, 09:58 (2 d)
Engine
blob
Format
Raw Data
Handle
22230803
Attached To
R6618 Oncilla Power Management Board Firmware
spi_led.h
View Options
/*
spi_led.h
Copyright (C) 2011 Michiel D'Haene <michiel.dhaene at gmail dot com>
UGent Reservoir lab (http://reslab.elis.ugent.be/michiel)
Ghent University (http://www.ugent.be)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \addtogroup spi_led */
/*@{*/
/** \file spi_led.h
\brief LED driver with SPI interface.
This file contains the declarations of the led driver functions, which is interfaced
through a SPI interface.
\author Michiel D'Haene
\version 2.0
\date 2011-08-10
*/
#ifndef __SPI_LED_H__
#define __SPI_LED_H__
#include "misc.h"
// Led driver output numbering
typedef enum {
LD1 = 0,
LD2 = 3,
LD3 = 6,
LD4 = 9,
POWER_LED = 12,
} LEDAddress;
// PWM value from 0 (off) to 8 (max)
enum { RGB_PWM_VALUE = 1};
// PWM feature: only switch on the RGB-leds part of the time,
// otherwise they are too powerfull.
// Supports 8 possible PWM values.
// we don't need to use the (safer) write_spi function, since
// refreshing is much slower than the spi write time
#define UPDATE_RGB_LED(systime) do {\
if (((systime)&0x0007) >= RGB_PWM_VALUE)\
SPI1BUF = led_outputs&0xF000;\
else\
SPI1BUF = led_outputs;\
}while(0)
#define BLINK (systime & 0x0200)
#define BLINK_FAST (systime & 0x0080)
/*************************************************************************
*
* PUBLIC FUNCTIONS
*
*************************************************************************/
void setLedOutput(int value);
void ledbar(int value, int max);
void RGB_led_test(void);
void init_spi_led(void);
void clear_leds(void);
void clear_RGB_leds(void);
void set_led(int nb, int status);
void set_RGB_led(int nb, int R, int G, int B);
void write_spi(uint16 values);
#endif /* __SPI_LED_H__ */
/*@}*/
Event Timeline
Log In to Comment