rgb16mpm/rgb16mpm.h

83 lines
2.5 KiB
C
Raw Normal View History

2012-03-02 17:35:35 +01:00
#ifndef _RGB16MPM_H_
#define _RGB16MPM_H_
#define F_CPU 8000000
2012-03-11 15:49:41 +01:00
//#include <util/delay.h>
2012-03-02 17:35:35 +01:00
#define ROW1 PORTB1 /* RED */
#define ROW2 PORTB0 /* GREEN */
#define ROW3 PORTB3 /* BLUE */
#define ROW4 PORTB2 /* not used */
#define RXTX PORTD2 /* RS485 TX enable */
#define LED PORTD3
/* running without mpmboot? */
#define STANDALONE 0
#if (STANDALONE)
#define OSCCAL 0xAA
#define BAUDRATE 115200
#define MPM_ADDRESS 0x11
#endif /* STANDALONE */
2012-03-04 17:29:01 +01:00
#define VERSION_STRING "rgb16mpm v0.99"
2012-03-02 17:35:35 +01:00
#define COLOR_RED 0
#define COLOR_GREEN 1
#define COLOR_BLUE 2
#define COLOR_MASK ((1<<COLOR_RED) | (1<<COLOR_GREEN) | (1<<COLOR_BLUE))
struct _nvdata {
uint16_t nvram_size; /* first */
2012-03-11 15:49:41 +01:00
uint16_t channels; /* connected channels */
2012-03-11 12:42:29 +01:00
uint8_t initialRGB[16][3]; /* initial color values */
2012-03-11 15:49:41 +01:00
uint8_t demomode; /* initial demo mode */
2012-03-02 17:35:35 +01:00
uint16_t nvram_crc; /* last */
};
#define NVRAM_DEFAULTS {\
2012-03-11 15:49:41 +01:00
.channels = 0x1F1F, \
2012-03-11 12:42:29 +01:00
.initialRGB = { { 0xFF, 0x00, 0x00 }, { 0xFF, 0x80, 0x00 }, { 0xFF, 0xFF, 0x00 }, { 0x80, 0xFF, 0x00 }, \
{ 0x00, 0xFF, 0x00 }, { 0x00, 0xFF, 0x80 }, { 0x00, 0xFF, 0xFF }, { 0x00, 0x80, 0xFF }, \
{ 0x00, 0x00, 0xFF }, { 0x80, 0x00, 0xFF }, { 0xFF, 0x00, 0xFF }, { 0xFF, 0x00, 0x80 }, \
{ 0x20, 0x20, 0x20 }, { 0x40, 0x40, 0x40 }, { 0x80, 0x80, 0x80 }, { 0xFF, 0xFF, 0xFF } \
}, \
2012-03-11 15:49:41 +01:00
.demomode = 0x03, \
2012-03-02 17:35:35 +01:00
};
/* eeprom.c vars */
extern struct _nvdata nvram_data;
/* eeprom.c funcs */
void eeprom_write(void);
2012-03-11 15:49:41 +01:00
void eeprom_read(uint8_t defaults);
/* democode.c funcs */
void demomode_init(uint8_t mode);
extern uint16_t (*demomode_run)(void);
/* demohelper.c funcs */
uint8_t sequence_chase(uint8_t old_value, uint8_t *dir, uint16_t mask);
uint16_t color_ramp(uint16_t value, uint8_t *color);
void color_add(uint8_t *color1, uint8_t *color2, uint8_t *output);
void color_sub(uint8_t *color1, uint8_t *color2, uint8_t *output);
void color_div(uint8_t *color, uint8_t div, uint8_t *output);
2012-03-02 17:35:35 +01:00
/* mpmctrl.c funcs */
void mpm_init(void);
2012-03-04 17:29:01 +01:00
void mpm_check_transfer(void);
2012-03-02 17:35:35 +01:00
/* rgbctrl.c vars */
2012-03-11 12:42:29 +01:00
extern uint8_t chan_value[16][3];
2012-03-02 17:35:35 +01:00
/* rgbctrl.c funcs */
void rgb_init(void);
2012-03-11 15:49:41 +01:00
uint8_t rgb_update(uint8_t dirty_mask, uint8_t update_mode);
#define UPDATE_NONE 0x00
#define UPDATE_PARTIAL 0x01
#define UPDATE_BLOCKING 0x02
2012-03-02 17:35:35 +01:00
#endif /* _RGB16MPM_H_ */