62 lines
1.7 KiB
C
62 lines
1.7 KiB
C
#ifndef _RGB16MPM_H_
|
|
#define _RGB16MPM_H_
|
|
|
|
#define F_CPU 8000000
|
|
#include <util/delay.h>
|
|
|
|
#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 */
|
|
|
|
#define VERSION_STRING "rgb16mpm v0.99"
|
|
|
|
#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 */
|
|
uint8_t initialRGB[3][16]; /* initial color values */
|
|
uint16_t nvram_crc; /* last */
|
|
};
|
|
|
|
#define NVRAM_DEFAULTS {\
|
|
.initialRGB = { { 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x20, 0x40, 0x80, 0xFF, }, \
|
|
{ 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x80, 0xFF, }, \
|
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20, 0x40, 0x80, 0xFF, } }, \
|
|
};
|
|
|
|
/* eeprom.c vars */
|
|
extern struct _nvdata nvram_data;
|
|
|
|
/* eeprom.c funcs */
|
|
void eeprom_write(void);
|
|
void eeprom_read(void);
|
|
|
|
/* mpmctrl.c funcs */
|
|
void mpm_init(void);
|
|
void mpm_check_transfer(void);
|
|
|
|
/* rgbctrl.c vars */
|
|
extern uint8_t chan_value[3][16];
|
|
|
|
/* rgbctrl.c funcs */
|
|
void rgb_init(void);
|
|
uint8_t rgb_update(uint8_t dirty_mask, uint8_t blocking);
|
|
|
|
#endif /* _RGB16MPM_H_ */
|