Browse Source

Add HT1632 library

master
Skia 7 months ago
parent
commit
e85cd24d83
15 changed files with 1228 additions and 0 deletions
  1. +499
    -0
      Raoul/HT1632/HT1632.cpp
  2. +184
    -0
      Raoul/HT1632/HT1632.h
  3. +34
    -0
      Raoul/HT1632/examples/HT1632_Animation/HT1632_Animation.ino
  4. +25
    -0
      Raoul/HT1632/examples/HT1632_Heart/HT1632_Heart.ino
  5. +38
    -0
      Raoul/HT1632/examples/HT1632_Heart_Bicolor/HT1632_Heart_Bicolor.ino
  6. +42
    -0
      Raoul/HT1632/examples/HT1632_Heart_Multiple_Bicolor/HT1632_Heart_Multiple_Bicolor.ino
  7. +26
    -0
      Raoul/HT1632/examples/HT1632_Sailboat/HT1632_Sailboat.ino
  8. +25
    -0
      Raoul/HT1632/examples/HT1632_Text/HT1632_Text.ino
  9. +25
    -0
      Raoul/HT1632/examples/HT1632_Text_8X4/HT1632_Text_8X4.ino
  10. +30
    -0
      Raoul/HT1632/examples/HT1632_Text_8X4_Multidisplay/HT1632_Text_8X4_Multidisplay.ino
  11. +21
    -0
      Raoul/HT1632/examples/HT1632_Text_From_Serial/HT1632_Text_From_Serial.ino
  12. +93
    -0
      Raoul/HT1632/font_5x4.h
  13. +92
    -0
      Raoul/HT1632/font_8x4.h
  14. +61
    -0
      Raoul/HT1632/images.h
  15. +33
    -0
      Raoul/HT1632/keywords.txt

+ 499
- 0
Raoul/HT1632/HT1632.cpp View File

@@ -0,0 +1,499 @@
#include "HT1632.h"

#if PIXELS_PER_BYTE != 8
#error "The current drawImage, drawText and getTextWidth implementation requires PIXELS_PER_BYTE == 8"
#endif

/*
* HIGH LEVEL FUNCTIONS
* Functions that perform advanced tasks using lower-level
* functions go here:
*/

void HT1632Class::drawText(const char text [], int x, int y, const byte font [], int font_end [], uint8_t font_height, uint8_t gutter_space) {
int curr_x = x;
char i = 0;
char currchar;
// Check if string is within y-bounds
if(y + font_height < 0 || y >= COM_SIZE)
return;
while(true){
if(text[i] == '\0')
return;
currchar = text[i] - 32;
if(currchar >= 65 && currchar <= 90) // If character is lower-case, automatically make it upper-case
currchar -= 32; // Make this character uppercase.

if(currchar < 0 || currchar >= 64) { // If out of bounds, skip
++i;
continue; // Skip this character.
}

// Check to see if character is not too far right.
if(curr_x >= OUT_SIZE)
break; // Stop rendering - all other characters are no longer within the screen
// Check to see if character is not too far left.
int chr_width = getCharWidth(font_end, font_height, currchar);
if(curr_x + chr_width + gutter_space >= 0){
drawImage(font, chr_width, font_height, curr_x, y, getCharOffset(font_end, currchar));
// Draw the gutter space
for(char j = 0; j < gutter_space; ++j)
drawImage(font, 1, font_height, curr_x + chr_width + j, y, 0);
}
curr_x += chr_width + gutter_space;
++i;
}
}

// Gives you the width, in columns, of a particular string.
int HT1632Class::getTextWidth(const char text [], int font_end [], uint8_t font_height, uint8_t gutter_space) {
int wd = 0;
char i = 0;
char currchar;
while(true){
if (text[i] == '\0') {
return wd - gutter_space;
}
currchar = text[i] - 32;
if (currchar >= 65 && currchar <= 90) { // If character is lower-case, automatically make it upper-case
currchar -= 32; // Make this character uppercase.
}

if (currchar < 0 || currchar >= 64) { // If out of bounds, skip
++i;
continue; // Skip this character.
}

wd += getCharWidth(font_end, font_height, currchar) + gutter_space;
++i;
}
}

int HT1632Class::getCharWidth(int font_end [], uint8_t font_height, uint8_t font_index) {
uint8_t bytesPerColumn = (font_height >> 3) + ((font_height & 0b111)?1:0); // Assumes that PIXELS_PER_BYTE is 8

if(font_index == 0) {
return font_end[0];
}
// The width is the difference between the ending index of
// this and the previous characters:
return (font_end[font_index] - font_end[font_index - 1])/bytesPerColumn;
}

int HT1632Class::getCharOffset(int font_end [], uint8_t font_index) {
if(font_index == 0) {
return 0;
}
// The offset is in the ending index of the previous character:
return font_end[font_index - 1];
}

/*
* MID LEVEL FUNCTIONS
* Functions that handle internal memory, initialize the hardware
* and perform the rendering go here:
*/

void HT1632Class::begin(uint8_t pinCS1, uint8_t pinWR, uint8_t pinDATA) {
_numActivePins = 1;
_pinCS[0] = pinCS1;
initialize(pinWR, pinDATA);
}
void HT1632Class::begin(uint8_t pinCS1, uint8_t pinCS2, uint8_t pinWR, uint8_t pinDATA) {
_numActivePins = 2;
_pinCS[0] = pinCS1;
_pinCS[1] = pinCS2;
initialize(pinWR, pinDATA);
}
void HT1632Class::begin(uint8_t pinCS1, uint8_t pinCS2, uint8_t pinCS3, uint8_t pinWR, uint8_t pinDATA) {
_numActivePins = 3;
_pinCS[0] = pinCS1;
_pinCS[1] = pinCS2;
_pinCS[2] = pinCS3;
initialize(pinWR, pinDATA);
}
void HT1632Class::begin(uint8_t pinCS1, uint8_t pinCS2, uint8_t pinCS3, uint8_t pinCS4, uint8_t pinWR, uint8_t pinDATA) {
_numActivePins = 4;
_pinCS[0] = pinCS1;
_pinCS[1] = pinCS2;
_pinCS[2] = pinCS3;
_pinCS[3] = pinCS4;
initialize(pinWR, pinDATA);
}

void HT1632Class::initialize(uint8_t pinWR, uint8_t pinDATA) {
_pinWR = pinWR;
_pinDATA = pinDATA;
for (uint8_t i = 0; i < _numActivePins; ++i){
pinMode(_pinCS[i], OUTPUT);
}

pinMode(_pinWR, OUTPUT);
pinMode(_pinDATA, OUTPUT);
select();
for (uint8_t i = 0; i < NUM_CHANNEL; ++i) {
// Allocate new memory for each channel
mem[i] = (byte *)malloc(ADDR_SPACE_SIZE);
}
// Clear all memory
clear();

// Send configuration to chip:
// This configuration is from the HT1632 datasheet, with one modification:
// The RC_MASTER_MODE command is not sent to the master. Since acting as
// the RC Master is the default behaviour, this is not needed. Sending
// this command causes problems in HT1632C (note the C at the end) chips.
// Send Master commands
select(0b1111); // Assume that board 1 is the master.
writeData(HT1632_ID_CMD, HT1632_ID_LEN); // Command mode
writeCommand(HT1632_CMD_SYSDIS); // Turn off system oscillator
// Custom initialization from each:
#if defined TYPE_3208_MONO
writeCommand(HT1632_CMD_COMS00);
#elif defined TYPE_3216_BICOLOR
writeCommand(HT1632_CMD_COMS00);
writeCommand(HT1632_CMD_RCCLK); // Master Mode, external clock
#else
writeCommand(HT1632_CMD_COMS00);
#endif

writeCommand(HT1632_CMD_SYSEN); //Turn on system
writeCommand(HT1632_CMD_LEDON); // Turn on LED duty cycle generator
writeCommand(HT1632_CMD_PWM(16)); // PWM 16/16 duty
select();
// Clear all screens by default:
for(uint8_t i = 0; i < _numActivePins; ++i) {
renderTarget(i);
render();
}
// Set renderTarget to the first board.
renderTarget(0);
}

void HT1632Class::selectChannel(uint8_t channel) {
if(channel < NUM_CHANNEL) {
_tgtChannel = channel;
}
}

void HT1632Class::renderTarget(uint8_t target) {
if(target < _numActivePins) {
_tgtRender = target;
}
}

void HT1632Class::drawImage(const byte * img, uint8_t width, uint8_t height, int8_t x, int8_t y, int img_offset) {
// Assuming that we are using 8 PIXELS_PER_BYTE, this does the equivalent of Math.ceil(height/PIXELS_PER_BYTE):
uint8_t bytesPerColumn = (height >> 3) + ((height & 0b111)?1:0);

// Sanity checks
if(y + height < 0 || x + width < 0 || y > COM_SIZE || x > OUT_SIZE)
return;
// After looking at the rest of this function, you may need one.
// Copying Engine.

// Current off
int8_t dst_x = x;
int8_t src_x = 0;
// Repeat until each column has been copied.
while (src_x < width) {
if(dst_x < 0) {
// Skip this column if it is too far to the left.
src_x++;
dst_x++;
continue;
} else if (dst_x >= OUT_SIZE) {
// End the copy if it is too far to the right.
break;
}

int8_t src_y = 0;
int8_t dst_y = y;
while (src_y < height) {
if (dst_y < 0) {
// Skip pixels if the starting point to too far up.
src_y -= dst_y;
dst_y = 0;
continue;
} else if (dst_y >= COM_SIZE) {
// End copying this column if it is too far down
break;
}

// The use of bitmasking here assumes that PIXELS_PER_BYTE == 8

// Find out how many we can copy in the next step:
// as a minimum of the number of bits in the current byte of source
// and destination.
uint8_t copyInNextStep = 8 - max((src_y & 0b111), (dst_y & 0b111));

// Limit this by the height of the image:
copyInNextStep = min(copyInNextStep, (height - src_y));

// Prepare the bitmask with the number of bits that need to be copied.
uint8_t dst_copyMask = (0b1 << copyInNextStep) - 1;
// Shift the bitmasks to the correct position.
dst_copyMask <<= (8 - (dst_y & 0b111) - copyInNextStep);

// Shift the data to the bits of highest significance
uint8_t copyData = pgm_read_byte(&img[img_offset + (bytesPerColumn * src_x) + (src_y >> 3)]) << (src_y & 0b111);
// Shift data to match the destination place value.
copyData >>= (dst_y & 0b111);

// Perform the copy
mem[_tgtChannel][GET_ADDR_FROM_X_Y(dst_x, dst_y)] = // Put in destination
(mem[_tgtChannel][GET_ADDR_FROM_X_Y(dst_x, dst_y)] & ~dst_copyMask) | // All bits not in the mask from destination
(copyData & dst_copyMask); // All bits in the mask from source

src_y += copyInNextStep;
dst_y += copyInNextStep;
}

src_x++;
dst_x++;
}
}

void HT1632Class::setPixel(uint8_t x, uint8_t y) {
if( x < 0 || x > OUT_SIZE || y < 0 || y > COM_SIZE )
return;
mem[_tgtChannel][GET_ADDR_FROM_X_Y(x, y)] |= (0b1 << PIXELS_PER_BYTE-1) >> (y % PIXELS_PER_BYTE);
}
void HT1632Class::clearPixel(uint8_t x, uint8_t y) {
if( x < 0 || x > OUT_SIZE || y < 0 || y > COM_SIZE )
return;
mem[_tgtChannel][GET_ADDR_FROM_X_Y(x, y)] &= ~((0b1 << PIXELS_PER_BYTE-1) >> (y % PIXELS_PER_BYTE));
}
uint8_t HT1632Class::getPixel(uint8_t x, uint8_t y) {
if( x < 0 || x > OUT_SIZE || y < 0 || y > COM_SIZE )
return 0;
return mem[_tgtChannel][GET_ADDR_FROM_X_Y(x, y)] & (0b1 << PIXELS_PER_BYTE-1) >> (y % PIXELS_PER_BYTE);
}

void HT1632Class::setPixel(uint8_t x, uint8_t y, uint8_t channel) {
if( x < 0 || x > OUT_SIZE || y < 0 || y > COM_SIZE )
return;
mem[channel][GET_ADDR_FROM_X_Y(x, y)] |= GET_BIT_FROM_Y(y);
}
void HT1632Class::clearPixel(uint8_t x, uint8_t y, uint8_t channel) {
if( x < 0 || x > OUT_SIZE || y < 0 || y > COM_SIZE )
return;
mem[channel][GET_ADDR_FROM_X_Y(x, y)] &= ~(GET_BIT_FROM_Y(y));
}
uint8_t HT1632Class::getPixel(uint8_t x, uint8_t y, uint8_t channel) {
if( x < 0 || x > OUT_SIZE || y < 0 || y > COM_SIZE )
return 0;
return mem[channel][GET_ADDR_FROM_X_Y(x, y)] & GET_BIT_FROM_Y(y);
}

void HT1632Class::fill() {
for(uint8_t i = 0; i < ADDR_SPACE_SIZE; ++i) {
mem[_tgtChannel][i] = 0xFF;
}
}
void HT1632Class::fillAll() {
for(uint8_t c = 0; c < NUM_CHANNEL; ++c) {
for(uint8_t i = 0; i < ADDR_SPACE_SIZE; ++i) {
mem[c][i] = 0xFF; // Needs to be redrawn
}
}
}

void HT1632Class::clear(){
for(uint8_t c = 0; c < NUM_CHANNEL; ++c) {
for(uint8_t i = 0; i < ADDR_SPACE_SIZE; ++i) {
mem[c][i] = 0x00; // Needs to be redrawn
}
}
}

#if defined TYPE_3216_BICOLOR
// Draw the contents of mem
void HT1632Class::render() {
if(_tgtRender >= _numActivePins) {
return;
}

// Write chip-by-chip:
uint8_t _pinForCS = _pinCS[_tgtRender];
for (uint8_t nChip = 0; nChip < NUM_ACTIVE_CHIPS; ++nChip) {
// Select a single sub-chip:
digitalWrite(_pinForCS, HIGH);
for(uint8_t tmp = 0; tmp < NUM_ACTIVE_CHIPS; tmp++){
if (tmp == nChip) {
digitalWrite(_pinForCS, LOW);
pulseCLK();
digitalWrite(_pinForCS, HIGH);
} else {
pulseCLK();
}
}
// Output data!
writeData(HT1632_ID_WR, HT1632_ID_LEN);
writeData(0, HT1632_ADDR_LEN); // Selecting the memory address

// Write the channels in order
for(uint8_t c = 0; c < NUM_CHANNEL; ++c) {
//for(uint8_t i = (nChip & 0b1)?0:(ADDR_SPACE_SIZE >> 1); i < (nChip & 0b1)?(ADDR_SPACE_SIZE >> 1):ADDR_SPACE_SIZE; ++i) {
uint8_t i, iMax;

if(nChip & 0b1) { // If we're writing to the chips on the left
i = 0; // Start from zero
iMax = ADDR_SPACE_SIZE/2; // Stop at the halfway point.
} else { // If we're writing to the chips on the right
i = ADDR_SPACE_SIZE/2; // Start from the halfway point.
iMax = ADDR_SPACE_SIZE; // Stop at the end of the buffer.
}

// If we are not (top-row chip)
if(!(nChip & 0b10)) {
++i; // Write only odd-numbered bytes.
}

for(; i < iMax; i+=2) { // Write every other byte.
// Write the higher bits before the the lower bits.
writeData(mem[c][i] >> HT1632_WORD_LEN, HT1632_WORD_LEN);
writeData(mem[c][i], HT1632_WORD_LEN);
}
}
}
}
#elif defined TYPE_3208_MONO
// Draw the contents of mem
void HT1632Class::render() {
if(_tgtRender >= _numActivePins) {
return;
}
select(0b0001 << _tgtRender); // Selecting the chip
writeData(HT1632_ID_WR, HT1632_ID_LEN);
writeData(0, HT1632_ADDR_LEN); // Selecting the memory address

// Write the channels in order
for(uint8_t c = 0; c < NUM_CHANNEL; ++c) {
for(uint8_t i = 0; i < ADDR_SPACE_SIZE; ++i) {
// Write the higher bits before the the lower bits.
writeData(mem[c][i] >> HT1632_WORD_LEN, HT1632_WORD_LEN); // Write the data in reverse.
writeData(mem[c][i], HT1632_WORD_LEN); // Write the data in reverse.
}
}

select(); // Close the stream at the end
}
#endif

// Set the brightness to an integer level between 1 and 16 (inclusive).
// Uses the PWM feature to set the brightness.
void HT1632Class::setBrightness(char brightness, char selectionmask) {
if(selectionmask == 0b00010000) {
if(_tgtRender < _numActivePins) {
selectionmask = 0b0001 << _tgtRender;
} else {
return;
}
}
select(selectionmask);
writeData(HT1632_ID_CMD, HT1632_ID_LEN); // Command mode
writeCommand(HT1632_CMD_PWM(brightness)); // Set brightness
select();
}


/*
* LOWER LEVEL FUNCTIONS
* Functions that directly talk to hardware go here:
*/
void HT1632Class::writeCommand(char data) {
writeData(data, HT1632_CMD_LEN);
writeSingleBit();
}
// Integer write to display. Used to write commands/addresses.
// PRECONDITION: WR is LOW
void HT1632Class::writeData(byte data, uint8_t len) {
for(int j = len - 1, t = 1 << (len - 1); j >= 0; --j, t >>= 1){
// Set the DATA pin to the correct state
digitalWrite(_pinDATA, ((data & t) == 0)?LOW:HIGH);
NOP(); // Delay
// Raise the WR momentarily to allow the device to capture the data
digitalWrite(_pinWR, HIGH);
NOP(); // Delay
// Lower it again, in preparation for the next cycle.
digitalWrite(_pinWR, LOW);
}
}

// Write single bit to display, used as padding between commands.
// PRECONDITION: WR is LOW
void HT1632Class::writeSingleBit() {
// Set the DATA pin to the correct state
digitalWrite(_pinDATA, LOW);
NOP(); // Delay
// Raise the WR momentarily to allow the device to capture the data
digitalWrite(_pinWR, HIGH);
NOP(); // Delay
// Lower it again, in preparation for the next cycle.
digitalWrite(_pinWR, LOW);
}

void HT1632Class::setCLK(uint8_t pinCLK) {
_pinCLK = pinCLK;
pinMode(_pinCLK, OUTPUT);
digitalWrite(_pinCLK, LOW);
}

inline void HT1632Class::pulseCLK() {
digitalWrite(_pinCLK, HIGH);
NOP();
digitalWrite(_pinCLK, LOW);
}

#if defined TYPE_3216_BICOLOR
// This is used to send initialization commands, and so selects all chips
// in the selected board.
void HT1632Class::select(uint8_t mask) {
for(uint8_t i=0, t=1; i<_numActivePins; ++i, t <<= 1){
digitalWrite(_pinCS[i], (t & mask)?LOW:HIGH);
}
for (uint8_t tmp = 0; tmp < NUM_ACTIVE_CHIPS; tmp++) {
pulseCLK();
}
}
#elif defined TYPE_3208_MONO
// Choose a chip. This function sets the correct CS line to LOW, and the rest to HIGH
// Call the function with no arguments to deselect all chips.
// Call the function with a bitmask (0b4321) to select specific chips. 0b1111 selects all.
void HT1632Class::select(uint8_t mask) {
for(uint8_t i=0, t=1; i<_numActivePins; ++i, t <<= 1){
digitalWrite(_pinCS[i], (t & mask)?LOW:HIGH);
}
}
#endif
void HT1632Class::select() {
select(0);
}

HT1632Class HT1632;

+ 184
- 0
Raoul/HT1632/HT1632.h View File

@@ -0,0 +1,184 @@
/*
HT1632.h - Library for communicating with the popular HT1632/HT1632C
LED controllers. This library provides higher-level access (including
text drawing) for these chips. Currently, the library supports writing
to a single chip at a time, and has been tested with two
Sure Electronics 3208 5mm red board.
Created by Gaurav Manek, April 8, 2011.
Released into the public domain.
*/
#ifndef HT1632_h
#define HT1632_h

#include <Arduino.h>
#ifdef __AVR__
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
#else
#define PROGMEM
#endif

// Custom typedefs
typedef unsigned char uint8_t;
typedef unsigned char byte;
// typedef char int8_t;


/*
* USER OPTIONS
* Change these options
*/

// Uncomment the line that matches the board you have, or edit the
// settings in the else block:

// SureElectronics 32X16 Bicolor LED Dot Matrix Unit Board
//#define TYPE_3216_BICOLOR 1

// SureElectronics 32X08 Monochrome LED Dot Matrix Unit Board
#define TYPE_3208_MONO 1

// SureElectronics 16X08 Bicolor (emulation)
// #define TYPE_1608_DEBUG 1

#if defined TYPE_3216_BICOLOR
#define COM_SIZE 16
#define OUT_SIZE 32
#define NUM_CHANNEL 2
#define USE_NMOS 1
// Number of chips in a single Bicolor board:
#define NUM_ACTIVE_CHIPS 4
#elif defined TYPE_3208_MONO
#define COM_SIZE 8
#define OUT_SIZE 32
#define NUM_CHANNEL 1
#define USE_NMOS 1
#elif defined TYPE_1608_DEBUG
#define COM_SIZE 8
#define OUT_SIZE 16
#define NUM_CHANNEL 2
#define USE_NMOS 1
#else
// SET YOUR CUSTOM VALUES HERE, AND COMMENT THE NEXT LINE
#error "Pick a board type!"

// Size of COM and OUT in bits:
#define COM_SIZE 8
#define OUT_SIZE 32
// COM_SIZE MUST be either 8 or 16.

// Number of color channels. The default is a single color channel.
#define NUM_CHANNEL 1

// Use N-MOS (if 1) or P-MOS (if 0):
#define USE_NMOS 1
// There are known issues with this. If the default doesn't work,
// try changing the value.
#endif

/*
* END USER OPTIONS
* Don't edit anything below unless you know what you are doing!
*/


// Pixels in a single byte of the internal image representation:
#define PIXELS_PER_BYTE 8

// Address space size (number of 4-bit words in HT1632 memory)
// Exactly equal to the number of 4-bit address spaces available.
#define ADDR_SPACE_SIZE (COM_SIZE * OUT_SIZE / PIXELS_PER_BYTE)
#define GET_ADDR_FROM_X_Y(_x,_y) ((_x)*((COM_SIZE)/(PIXELS_PER_BYTE))+(_y)/(PIXELS_PER_BYTE))
#define GET_BIT_FROM_Y(_y) ( (0b1 << PIXELS_PER_BYTE-1) >> (y % PIXELS_PER_BYTE) )

// NO-OP Definition
#define NOP(); __asm__("nop\n\t");
// The HT1632 requires at least 50 ns between the change in data and the rising
// edge of the WR signal. On a 16MHz processor, this provides 62.5ns per NOP.

// Standard command list.
// This list is modified from original code by Bill Westfield

#define HT1632_ID_CMD 0b100 /* ID = 100 - Commands */
#define HT1632_ID_RD 0b110 /* ID = 110 - Read RAM */
#define HT1632_ID_WR 0b101 /* ID = 101 - Write RAM */
#define HT1632_ID_LEN 3 /* IDs are 3 bits */

#define HT1632_CMD_SYSDIS 0x00 /* CMD= 0000-0000-x Turn off oscil */
#define HT1632_CMD_SYSEN 0x01 /* CMD= 0000-0001-x Enable system oscil */
#define HT1632_CMD_LEDOFF 0x02 /* CMD= 0000-0010-x LED duty cycle gen off */
#define HT1632_CMD_LEDON 0x03 /* CMD= 0000-0011-x LEDs ON */
#define HT1632_CMD_BLOFF 0x08 /* CMD= 0000-1000-x Blink ON */
#define HT1632_CMD_BLON 0x09 /* CMD= 0000-1001-x Blink Off */
#define HT1632_CMD_SLVMD 0x10 /* CMD= 0001-00xx-x Slave Mode */
#define HT1632_CMD_MSTMD 0x14 /* CMD= 0001-01xx-x Master Mode, on-chip clock */
#define HT1632_CMD_RCCLK 0x18 /* CMD= 0001-10xx-x Master Mode, external clock */
#define HT1632_CMD_EXTCLK 0x1C /* CMD= 0001-11xx-x Use external clock */
#define HT1632_CMD_COMS00 0x20 /* CMD= 0010-ABxx-x commons options */
#define HT1632_CMD_COMS01 0x24 /* CMD= 0010-ABxx-x commons options */
#define HT1632_CMD_COMS10 0x28 /* CMD= 0010-ABxx-x commons options */
#define HT1632_CMD_COMS11 0x2C /* CMD= 0010-ABxx-x commons options */
#define HT1632_CMD_PWM_T 0xA0 /* CMD= 101x-PPPP-x PWM duty cycle - template*/
#define HT1632_CMD_PWM(lvl) (HT1632_CMD_PWM_T | (lvl-1))
/* Produces the correct command from the given value of lvl. lvl = [0..15] */
#define HT1632_CMD_LEN 8 /* Commands are 8 bits long, excluding the trailing bit */
#define HT1632_ADDR_LEN 7 /* Addresses are 7 bits long */
#define HT1632_WORD_LEN 4 /* Words are 4 bits long */

class HT1632Class
{
private:
uint8_t _pinCS [4];
uint8_t _numActivePins;
uint8_t _pinWR;
uint8_t _pinDATA;
uint8_t _pinCLK;
uint8_t _currSelectionMask;
uint8_t _tgtRender;
uint8_t _tgtChannel;
byte * mem [5];
void writeCommand(char);
void writeData(byte, uint8_t);
void writeDataRev(byte, uint8_t);
void writeSingleBit();
void initialize(uint8_t, uint8_t);
void select();
void select(uint8_t mask);
int getCharWidth(int font_end [], uint8_t font_height, uint8_t font_index);
int getCharOffset(int font_end [], uint8_t font_index);
inline void pulseCLK();
public:
void begin(uint8_t pinCS1, uint8_t pinWR, uint8_t pinDATA);
void begin(uint8_t pinCS1, uint8_t pinCS2, uint8_t pinWR, uint8_t pinDATA);
void begin(uint8_t pinCS1, uint8_t pinCS2, uint8_t pinCS3, uint8_t pinWR, uint8_t pinDATA);
void begin(uint8_t pinCS1, uint8_t pinCS2, uint8_t pinCS3, uint8_t pinCS4, uint8_t pinWR, uint8_t pinDATA);
void setCLK(uint8_t pinCLK);
void sendCommand(uint8_t command);
void renderTarget(uint8_t targetScreen);
void selectChannel(uint8_t channel);
void render();
void transition(uint8_t mode, int time = 1000); // Time is in milliseconds.
void clear();
void drawImage(const byte img [], uint8_t width, uint8_t height, int8_t x, int8_t y, int offset = 0);
void drawText(const char text [], int x, int y, const byte font [], int font_end [], uint8_t font_height, uint8_t gutter_space = 1);
int getTextWidth(const char text [], int font_end [], uint8_t font_height, uint8_t gutter_space = 1);
void setBrightness(char brightness, char selectionmask = 0b00010000);
void setPixel(uint8_t x, uint8_t y);
void clearPixel(uint8_t x, uint8_t y);
uint8_t getPixel(uint8_t x, uint8_t y);
void setPixel(uint8_t x, uint8_t y, uint8_t channel);
void clearPixel(uint8_t x, uint8_t y, uint8_t channel);
uint8_t getPixel(uint8_t x, uint8_t y, uint8_t channel);
void fill();
void fillAll();
};

extern HT1632Class HT1632;

#else
//#error "HT1632.h" already defined!
#endif

+ 34
- 0
Raoul/HT1632/examples/HT1632_Animation/HT1632_Animation.ino View File

@@ -0,0 +1,34 @@
#include <HT1632.h>
#include <font_5x4.h>
#include <images.h>

int i = 0;

void setup () {
HT1632.begin(12, 10, 9);
}

void loop () {
// Clear the previous image contents:
HT1632.clear();

// Draw a different image based on the frame number:
if(i++ % 2 == 0) {
HT1632.drawImage(IMG_SPEAKER_A, IMG_SPEAKER_WIDTH, IMG_SPEAKER_HEIGHT, 0, 0);
HT1632.drawImage(IMG_MUSICNOTE, IMG_MUSICNOTE_WIDTH, IMG_MUSICNOTE_HEIGHT, 8, 0);
HT1632.drawImage(IMG_MUSIC, IMG_MUSIC_WIDTH, IMG_MUSIC_HEIGHT, 13, 1);
HT1632.drawImage(IMG_MUSICNOTE, IMG_MUSICNOTE_WIDTH, IMG_MUSICNOTE_HEIGHT, 23, 0);
HT1632.drawImage(IMG_MUSICNOTE, IMG_MUSICNOTE_WIDTH, IMG_MUSICNOTE_HEIGHT, 28, 1);
} else {
HT1632.drawImage(IMG_SPEAKER_B, IMG_SPEAKER_WIDTH, IMG_SPEAKER_HEIGHT, 0, 0);
HT1632.drawImage(IMG_MUSICNOTE, IMG_MUSICNOTE_WIDTH, IMG_MUSICNOTE_HEIGHT, 8, 1);
HT1632.drawImage(IMG_MUSIC, IMG_MUSIC_WIDTH, IMG_MUSIC_HEIGHT, 13, 0);
HT1632.drawImage(IMG_MUSICNOTE, IMG_MUSICNOTE_WIDTH, IMG_MUSICNOTE_HEIGHT, 23, 1);
HT1632.drawImage(IMG_MUSICNOTE, IMG_MUSICNOTE_WIDTH, IMG_MUSICNOTE_HEIGHT, 28, 0);
}

// Perform the drawing:
HT1632.render();
delay(200);
}

+ 25
- 0
Raoul/HT1632/examples/HT1632_Heart/HT1632_Heart.ino View File

@@ -0,0 +1,25 @@
#include <HT1632.h>
#include <font_5x4.h>
#include <images.h>

int i = 0;

void setup () {
HT1632.begin(12, 10, 9);
}

void loop () {
// The definitions for IMG_HEART and its width and height are available in images.h.
// This step only performs the drawing in internal memory.
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, (OUT_SIZE - IMG_HEART_WIDTH)/2, 0);
HT1632.render(); // This updates the display on the screen.
delay(1000);
HT1632.clear(); // This zeroes out the internal memory.
HT1632.render(); // This updates the screen display.
delay(1000);
}

+ 38
- 0
Raoul/HT1632/examples/HT1632_Heart_Bicolor/HT1632_Heart_Bicolor.ino View File

@@ -0,0 +1,38 @@
#include <HT1632.h>
#include <font_5x4.h>
#include <images.h>

int i = 0;
int j = 0;

void setup () {
// Working with Bicolor displays.
// Make sure that a bicolor display is set in HT1632.h
HT1632.setCLK(13);
HT1632.begin(12, 10, 9);
}

void loop () {
// Zero all data in all channels:
HT1632.clear();
if (~i & 0b01) { // On frames 1 and 3:
HT1632.selectChannel(0); // Select the first channel
// Draw a heart:
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, j - IMG_HEART_WIDTH, 3);
}
if (~i & 0b10) { // On frames 2 and 3:
HT1632.selectChannel(1); // Select the second channel
// Draw a heart:
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, j - IMG_HEART_WIDTH, 3);
}
HT1632.render(); // This sends the data in both channels to the screen.

// Get the next number in the sequence, wrapping from 3 back to 0:
i = (i + 1) % 3;
j = (j + 1) % (OUT_SIZE + IMG_HEART_WIDTH * 2);
delay(150);
}

+ 42
- 0
Raoul/HT1632/examples/HT1632_Heart_Multiple_Bicolor/HT1632_Heart_Multiple_Bicolor.ino View File

@@ -0,0 +1,42 @@
#include <HT1632.h>
#include <font_5x4.h>
#include <images.h>

int j = 0;

void setup () {
// Working with Bicolor displays.
// Make sure that a bicolor display is set in HT1632.h
HT1632.setCLK(13);
HT1632.begin(12, 6, 10, 9);
}

void loop () {
// Zero all data in all channels:
HT1632.renderTarget(0);
HT1632.clear();

HT1632.selectChannel(0); // Red heart on first screen:
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, j - IMG_HEART_WIDTH, 3);

HT1632.selectChannel(1); // Green heart on first screen:
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, OUT_SIZE * 2 - j, 3);
HT1632.render(); // This sends the data in both channels to the screen.

HT1632.renderTarget(1);
HT1632.clear();

HT1632.selectChannel(0); // Red heart on second screen:
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, j - IMG_HEART_WIDTH - OUT_SIZE, 3);

HT1632.selectChannel(1); // Green heart on second screen:
HT1632.drawImage(IMG_HEART, IMG_HEART_WIDTH, IMG_HEART_HEIGHT, OUT_SIZE - j, 3);

HT1632.render();

// Get the next number in the sequence, wrapping from 3 back to 0:
j = (j + 1) % (OUT_SIZE * 2);
delay(50);
}

+ 26
- 0
Raoul/HT1632/examples/HT1632_Sailboat/HT1632_Sailboat.ino View File

@@ -0,0 +1,26 @@
#include <HT1632.h>
#include <font_5x4.h>
#include <images.h>

int i = 0;
int wd;

void setup () {
HT1632.begin(12, 10, 9);
}

void loop () {
HT1632.clear();
// This step only performs the drawing in internal memory.
HT1632.drawImage(IMG_SAILBOAT, IMG_SAILBOAT_WIDTH, IMG_SAILBOAT_HEIGHT, i, 0);
// If the image intersects with the end,
if (i > OUT_SIZE - IMG_SAILBOAT_WIDTH) {
// Draw it wrapping around.
HT1632.drawImage(IMG_SAILBOAT, IMG_SAILBOAT_WIDTH, IMG_SAILBOAT_HEIGHT, i - OUT_SIZE, 0);
}
HT1632.render(); // This updates the display on the screen.
delay(100);
i = (i + 1) % (OUT_SIZE);
}

+ 25
- 0
Raoul/HT1632/examples/HT1632_Text/HT1632_Text.ino View File

@@ -0,0 +1,25 @@
#include <HT1632.h>
#include <font_5x4.h>
#include <images.h>

int i = 0;
int wd;
char disp [] = "Hello, how are you?";

void setup () {
HT1632.begin(12, 10, 9);
wd = HT1632.getTextWidth(disp, FONT_5X4_END, FONT_5X4_HEIGHT);
}

void loop () {
HT1632.drawTarget(BUFFER_BOARD(1));
HT1632.clear();
HT1632.drawText(disp, OUT_SIZE - i, 2, FONT_5X4, FONT_5X4_END, FONT_5X4_HEIGHT);
HT1632.render();
i = (i+1)%(wd + OUT_SIZE);
delay(100);
}

+ 25
- 0
Raoul/HT1632/examples/HT1632_Text_8X4/HT1632_Text_8X4.ino View File

@@ -0,0 +1,25 @@
#include <HT1632.h>
#include <font_8x4.h>
#include <images.h>

int i = 0;
int wd;
char disp [] = "Hello, how are you?";

void setup () {
HT1632.begin(12, 10, 9);
wd = HT1632.getTextWidth(disp, FONT_8X4_END, FONT_8X4_HEIGHT);
}

void loop () {
HT1632.drawTarget(BUFFER_BOARD(1));
HT1632.clear();
HT1632.drawText(disp, OUT_SIZE - i, 0, FONT_8X4, FONT_8X4_END, FONT_8X4_HEIGHT);
HT1632.render();
i = (i+1)%(wd + OUT_SIZE);
delay(100);
}

+ 30
- 0
Raoul/HT1632/examples/HT1632_Text_8X4_Multidisplay/HT1632_Text_8X4_Multidisplay.ino View File

@@ -0,0 +1,30 @@
#include <HT1632.h>
#include <font_8x4.h>
#include <images.h>

int i = 0;
int wd;
char disp [] = "Hello, how are you?";

void setup () {
HT1632.begin(12, 13, 10, 9);
wd = HT1632.getTextWidth(disp, FONT_8X4_END, FONT_8X4_HEIGHT);
}

void loop () {
HT1632.renderTarget(0);
HT1632.clear();
HT1632.drawText(disp, OUT_SIZE * 2 - i, 0, FONT_8X4, FONT_8X4_END, FONT_8X4_HEIGHT);
HT1632.render();
HT1632.renderTarget(1);
HT1632.clear();
HT1632.drawText(disp, OUT_SIZE - i, 0, FONT_8X4, FONT_8X4_END, FONT_8X4_HEIGHT);
HT1632.render();
i = (i+1)%(wd + OUT_SIZE * 2);
delay(100);
}

+ 21
- 0
Raoul/HT1632/examples/HT1632_Text_From_Serial/HT1632_Text_From_Serial.ino View File

@@ -0,0 +1,21 @@
#include <HT1632.h>
#include <font_8x4.h>
#include <images.h>

char c [] = "S\0";

void setup () {
Serial.begin(9600);
HT1632.begin(12, 10, 9);
}

void loop () {
while(!Serial.available());
int ct = Serial.read();
c[0] = (char) ct;
HT1632.drawTarget(BUFFER_BOARD(1));
HT1632.clear();
HT1632.drawText(c, 0, 0, FONT_8X4, FONT_8X4_END, FONT_8X4_HEIGHT);
HT1632.render();
delay(50);
}

+ 93
- 0
Raoul/HT1632/font_5x4.h View File

@@ -0,0 +1,93 @@
/*
* 5-high FONT FOR RENDERING TO THE LED SCREEN.
* Includes kerning support

* 8 pixels-per-byte, variable width.
* Gaurav Manek, 2011
*/

#ifndef __FONT5X4_H
#define __FONT5X4_H

#define FONT_5X4_HEIGHT 5
// Number of bytes per glyph

const byte FONT_5X4 [] PROGMEM = {
0b00000000, //
0b11101000, // !
0b11000000, 0b00000000, 0b11000000, // "
0b01010000, 0b11111000, 0b01010000, 0b11111000, 0b01010000, // #
0b00000000, 0b00000000, 0b00000000, 0b00000000, // $
0b11001000, 0b11010000, 0b00100000, 0b01011000, 0b10011000, // %
0b01010000, 0b10101000, 0b10011000, 0b01011000, // &
0b11000000, // '
0b01110000, 0b10001000, // (
0b10001000, 0b01110000, // )
0b10100000, 0b01000000, 0b10100000, // *
0b00100000, 0b00100000, 0b11111000, 0b00100000, 0b00100000, // +
0b00001000, 0b00010000, // ,
0b00100000, 0b00100000, 0b00100000, // -
0b00001000, // .
0b00001000, 0b00110000, 0b01100000, 0b10000000, // /
0b01110000, 0b10001000, 0b01110000, // 0
0b01001000, 0b11111000, 0b00001000, // 1
0b01001000, 0b10011000, 0b10101000, 0b01001000, // 2
0b10101000, 0b10101000, 0b01010000, // 3
0b00110000, 0b01010000, 0b11111000, 0b00010000, // 4
0b11101000, 0b10101000, 0b10110000, // 5
0b01110000, 0b10101000, 0b10101000, 0b00010000, // 6
0b10000000, 0b10111000, 0b10100000, 0b11000000, // 7
0b01010000, 0b10101000, 0b10101000, 0b01010000, // 8
0b01000000, 0b10100000, 0b10101000, 0b01110000, // 9
0b01010000, // :
0b00001000, 0b01010000, // ;
0b00100000, 0b01010000, 0b10001000, // <
0b01010000, 0b01010000, 0b01010000, // =
0b10001000, 0b01010000, 0b00100000, // >
0b01000000, 0b10000000, 0b10011000, 0b01100000, // ?
0b01110000, 0b10000000, 0b10110000, 0b10101000, 0b11110000, // @
0b01111000, 0b10100000, 0b10100000, 0b01111000, // A
0b11111000, 0b10101000, 0b01010000, // B
0b01110000, 0b10001000, 0b10001000, 0b01010000, // C
0b11111000, 0b10001000, 0b01110000, // D
0b11111000, 0b10101000, 0b10001000, // E
0b11111000, 0b10100000, 0b10100000, // F
0b01110000, 0b10001000, 0b10011000, 0b01010000, // G
0b11111000, 0b00100000, 0b00100000, 0b11111000, // H
0b10001000, 0b11111000, 0b10001000, // I
0b10010000, 0b10001000, 0b11110000, // J
0b11111000, 0b00100000, 0b01010000, 0b10001000, // K
0b11111000, 0b00001000, 0b00001000, // L
0b11111000, 0b01000000, 0b00100000, 0b01000000, 0b11111000, // M
0b11111000, 0b01000000, 0b00100000, 0b00010000, 0b11111000, // N
0b01110000, 0b10001000, 0b10001000, 0b01110000, // O
0b11111000, 0b10100000, 0b01000000, // P
0b01110000, 0b10001000, 0b10001000, 0b10010000, 0b01101000, // Q
0b11111000, 0b10100000, 0b01011000, // R
0b01001000, 0b10101000, 0b10101000, 0b10010000, // S
0b10000000, 0b11111000, 0b10000000, // T
0b11110000, 0b00001000, 0b00001000, 0b11110000, // U
0b11000000, 0b00110000, 0b00001000, 0b00110000, 0b11000000, // V
0b11110000, 0b00001000, 0b00110000, 0b00001000, 0b11110000, // W
0b11011000, 0b00100000, 0b11011000, // X
0b11000000, 0b00111000, 0b11000000, // Y
0b10011000, 0b10101000, 0b10101000, 0b11001000, // Z
0b11111000, 0b10001000, // [
0b10000000, 0b01100000, 0b00110000, 0b00001000, // \
0b10001000, 0b11111000, // ]
0b01000000, 0b10000000, 0b01000000, // ^
0b00001000, 0b00001000, 0b00001000, // _
};

int FONT_5X4_END [] = {
1, 2, 5, 10, 14, 19, 23, 24,
26, 28, 31, 36, 38, 41, 42, 46,
49, 52, 56, 59, 63, 66, 70, 74,
78, 82, 83, 85, 88, 91, 94, 98,
103, 107, 110, 114, 117, 120, 123, 127,
131, 134, 137, 141, 144, 149, 154, 158,
161, 166, 169, 173, 176, 180, 185, 190,
193, 196, 200, 202, 206, 208, 211, 214
};

#endif // __FONT5X4_H

+ 92
- 0
Raoul/HT1632/font_8x4.h View File

@@ -0,0 +1,92 @@
/*
* 8-high FONT FOR RENDERING TO THE LED SCREEN.
* 8 pixels-per-byte, variable width.
*
* By Gaurav Manek, 2014.
* Based loosely on the font by Louis Roy, based on 7x5 by David Soyez, 2013
*/

#ifndef __FONT8X4_H
#define __FONT8X4_H

#define FONT_8X4_HEIGHT 8

const byte FONT_8X4 [] PROGMEM = {
0b00000000, // SPACE
0b01110000, 0b11111101, 0b01110000, // !
0b11000000, 0b00000000, 0b11000000, // "
0b00100100, 0b11111111, 0b00100100, 0b11111111, 0b00100100, // #
0b00100100, 0b01010010, 0b11011011, 0b01001010, 0b00100100, // $
0b11000001, 0b11000110, 0b00011000, 0b01100011, 0b10000011, // %
0b01101110, 0b10010001, 0b10010010, 0b01100101, // &
0b11000000, // '
0b00111100, 0b01000010, 0b10000001, // (
0b10000001, 0b01000010, 0b00111100, // )
0b10100000, 0b01000000, 0b10100000, // *
0b00001000, 0b00001000, 0b00111110, 0b00001000, 0b00001000, // +
0b00000001, 0b00000010, // ,
0b00001000, 0b00001000, 0b00001000, // -
0b00000001, // .
0b00000011, 0b00001100, 0b00110000, 0b11000000, // /
0b01111110, 0b10110001, 0b10001101, 0b01111110, // 0
0b01000001, 0b11111111, 0b00000001, // 1
0b01000011, 0b10000101, 0b10001001, 0b01110001, // 2
0b01000010, 0b10001001, 0b10001001, 0b01110110, // 3
0b00011100, 0b00100100, 0b01001111, 0b10000100, // 4
0b11110001, 0b10010001, 0b10010001, 0b10001110, // 5
0b01111110, 0b10001001, 0b10001001, 0b01000110, // 6
0b10000000, 0b10000111, 0b10011000, 0b11100000, // 7
0b01110110, 0b10001001, 0b10001001, 0b01110110, // 8
0b01110010, 0b10001001, 0b10001001, 0b01111110, // 9
0b00100010, // :
0b00000001, 0b00100010, // ;
0b00011000, 0b00100100, 0b01000010, 0b10000001, // <
0b00010100, 0b00010100, 0b00010100, 0b00010100, // =
0b10000001, 0b01000010, 0b00100100, 0b00011000, // >
0b01000000, 0b10001101, 0b10001000, 0b01110000, // ?
0b01111110, 0b10000001, 0b10111001, 0b10000101, 0b01111100, // @
0b01111111, 0b10001000, 0b10001000, 0b01111111, // A
0b11111111, 0b10001001, 0b10001001, 0b01110110, // B
0b01111110, 0b10000001, 0b10000001, 0b01000010, // C
0b11111111, 0b10000001, 0b10000001, 0b01111110, // D
0b11111111, 0b10001001, 0b10001001, 0b10000001, // E
0b11111111, 0b10010000, 0b10010000, 0b10000000, // F
0b01111110, 0b10000001, 0b10001001, 0b01001110, // G
0b11111111, 0b00001000, 0b00001000, 0b11111111, // H
0b10000001, 0b11111111, 0b10000001, // I
0b10000110, 0b10000001, 0b10000001, 0b11111110, // J
0b11111111, 0b00010000, 0b00101000, 0b11000111, // K
0b11111111, 0b00000001, 0b00000001, 0b00000001, // L
0b01111111, 0b11000000, 0b00110000, 0b11000000, 0b01111111, // M
0b11111111, 0b01100000, 0b00011000, 0b00000110, 0b11111111, // N
0b01111110, 0b10000001, 0b10000001, 0b01111110, // O
0b11111111, 0b10001000, 0b10001000, 0b01110000, // P
0b01111110, 0b10000001, 0b10000101, 0b10000010, 0b01111101, // Q
0b11111111, 0b10001000, 0b10001100, 0b01110011, // R
0b01100010, 0b10010001, 0b10001001, 0b01000110, // S
0b10000000, 0b11111111, 0b10000000, // T
0b11111110, 0b00000001, 0b00000001, 0b11111110, // U
0b11111110, 0b00000001, 0b00000110, 0b11111000, // V
0b11111100, 0b00000011, 0b00011100, 0b00000011, 0b11111100, // W
0b10000001, 0b01100110, 0b00011000, 0b01100110, 0b10000001, // X
0b11000000, 0b00110000, 0b00001111, 0b00110000, 0b11000000, // Y
0b10000011, 0b10001101, 0b10110001, 0b11000001, // Z
0b11111111, 0b10000001, // [
0b11000000, 0b00110000, 0b00001100, 0b00000011, // \
0b10000001, 0b11111111, // ]
0b01000000, 0b10000000, 0b01000000, // ^
0b00000001, 0b00000001, 0b00000001, 0b00000001, // _
};

int FONT_8X4_END [] = {
1, 4, 7, 12, 17, 22, 26, 27,
30, 33, 36, 41, 43, 46, 47, 51,
55, 58, 62, 66, 70, 74, 78, 82,
86, 90, 91, 93, 97, 101, 105, 109,
114, 118, 122, 126, 130, 134, 138, 142,
146, 149, 153, 157, 161, 166, 171, 175,
179, 184, 188, 192, 195, 199, 203, 208,
213, 218, 222, 224, 228, 230, 233, 237
};

#endif // __FONT8X4_H

+ 61
- 0
Raoul/HT1632/images.h View File

@@ -0,0 +1,61 @@
/*
* SIMPLE IMAGES FOR RENDERING TO THE LED SCREEN.
* 8 pixels-per-byte
* Gaurav Manek, 2014
*/

//
// CUSTOM, Promo 13
//
const byte IMG_PROMO [] PROGMEM = {0b00010000, 0b00101000, 0b01000100, 0b10000010, 0b01000001, 0b00100001, 0b01000001, 0b10000010, 0b01000100, 0b00101000, 0b00010000, 0b00000000, 0b00000000, 0b00010000, 0b00100001, 0b01000001, 0b01111111, 0b00000001, 0b00000001, 0b00000000, 0b00000000, 0b01100011, 0b01001001, 0b01001001, 0b01011101, 0b01111111, 0b00000000, 0b00011000, 0b00011000, 0b00001111, 0b00011000, 0b00011000};
#define IMG_PROMO_WIDTH 32
#define IMG_PROMO_HEIGHT 8

//
// Online Services:
//

const byte IMG_MAIL [] PROGMEM = {0b11111111, 0b11000001, 0b10100001, 0b10010001, 0b10001001, 0b10000101, 0b10000101, 0b10001001};
#define IMG_MAIL_WIDTH 8
#define IMG_MAIL_HEIGHT 8

const byte IMG_FB [] PROGMEM = {0b00111111, 0b01000000, 0b10000100, 0b10011111, 0b10100100, 0b10100000, 0b10000000, 0b10000000};
#define IMG_FB_WIDTH 8
#define IMG_FB_HEIGHT 8

const byte IMG_TWITTER [] PROGMEM = {0b01111110, 0b10000001, 0b10111001, 0b10010101, 0b10010101, 0b10000001, 0b01111110};
#define IMG_TWITTER_WIDTH 7
#define IMG_TWITTER_HEIGHT 8

//
// Music:
//

const byte IMG_MUSIC [] PROGMEM = {0b00000010, 0b00000111, 0b11111110, 0b11000000, 0b11000000, 0b11000100, 0b11001110, 0b11111100};
#define IMG_MUSIC_WIDTH 8
#define IMG_MUSIC_HEIGHT 8

const byte IMG_MUSICNOTE [] PROGMEM = {0b00000100, 0b00001110, 0b11111100, 0b01000000};
#define IMG_MUSICNOTE_WIDTH 4
#define IMG_MUSICNOTE_HEIGHT 7

const byte IMG_SPEAKER_A [] PROGMEM = {0b00011000, 0b00011000, 0b00111100, 0b01000010, 0b10100101, 0b00011000};
const byte IMG_SPEAKER_B [] PROGMEM = {0b00011000, 0b00011000, 0b00111100, 0b01000010, 0b10111101, 0b00000000};
#define IMG_SPEAKER_WIDTH 6
#define IMG_SPEAKER_HEIGHT 8

//
// Emotions:
//

const byte IMG_HEART [] PROGMEM = {0b01110000, 0b11111000, 0b11111100, 0b11111110, 0b01111111, 0b11111110, 0b11111100, 0b11111000, 0b01110000};
#define IMG_HEART_WIDTH 9
#define IMG_HEART_HEIGHT 8

//
// Things:
//

const byte IMG_SAILBOAT [] PROGMEM = {0b00000010, 0b00100011, 0b01100011, 0b11111111, 0b01111011, 0b00111011, 0b00011011, 0b00001010};
#define IMG_SAILBOAT_WIDTH 8
#define IMG_SAILBOAT_HEIGHT 8

+ 33
- 0
Raoul/HT1632/keywords.txt View File

@@ -0,0 +1,33 @@
#######################################
# Syntax Highlighting for HT1632
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################

HT1632 KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################

begin KEYWORD2
sendCommand KEYWORD2
renderTarget KEYWORD2
selectChannel KEYWORD2
render KEYWORD2
transition KEYWORD2
clear KEYWORD2
drawImage KEYWORD2
drawText KEYWORD2
getTextWidth KEYWORD2
setBrightness KEYWORD2
setCLK KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################

COM_SIZE LITERAL1
OUT_SIZE LITERAL1

Loading…
Cancel
Save