Static message display
This commit is contained in:
commit
d9589b49de
6 changed files with 317 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.pioenvs
|
||||
.piolibdeps
|
||||
*~
|
67
.travis.yml
Normal file
67
.travis.yml
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Continuous Integration (CI) is the practice, in software
|
||||
# engineering, of merging all developer working copies with a shared mainline
|
||||
# several times a day < http://docs.platformio.org/page/ci/index.html >
|
||||
#
|
||||
# Documentation:
|
||||
#
|
||||
# * Travis CI Embedded Builds with PlatformIO
|
||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
||||
#
|
||||
# * PlatformIO integration with Travis CI
|
||||
# < http://docs.platformio.org/page/ci/travis.html >
|
||||
#
|
||||
# * User Guide for `platformio ci` command
|
||||
# < http://docs.platformio.org/page/userguide/cmd_ci.html >
|
||||
#
|
||||
#
|
||||
# Please choice one of the following templates (proposed below) and uncomment
|
||||
# it (remove "# " before each line) or use own configuration according to the
|
||||
# Travis CI documentation (see above).
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
||||
#
|
||||
|
||||
# language: python
|
||||
# python:
|
||||
# - "2.7"
|
||||
#
|
||||
# sudo: false
|
||||
# cache:
|
||||
# directories:
|
||||
# - "~/.platformio"
|
||||
#
|
||||
# install:
|
||||
# - pip install -U platformio
|
||||
# - platformio update
|
||||
#
|
||||
# script:
|
||||
# - platformio run
|
||||
|
||||
|
||||
#
|
||||
# Template #2: The project is intended to by used as a library with examples
|
||||
#
|
||||
|
||||
# language: python
|
||||
# python:
|
||||
# - "2.7"
|
||||
#
|
||||
# sudo: false
|
||||
# cache:
|
||||
# directories:
|
||||
# - "~/.platformio"
|
||||
#
|
||||
# env:
|
||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
||||
#
|
||||
# install:
|
||||
# - pip install -U platformio
|
||||
# - platformio update
|
||||
#
|
||||
# script:
|
||||
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
|
41
lib/readme.txt
Normal file
41
lib/readme.txt
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
This directory is intended for the project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link to executable file.
|
||||
|
||||
The source code of each library should be placed in separate directory, like
|
||||
"lib/private_lib/[here are source files]".
|
||||
|
||||
For example, see how can be organized `Foo` and `Bar` libraries:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) http://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- readme.txt --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
Then in `src/main.c` you should use:
|
||||
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
// rest H/C/CPP code
|
||||
|
||||
PlatformIO will find your libraries automatically, configure preprocessor's
|
||||
include paths and build them.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- http://docs.platformio.org/page/librarymanager/ldf.html
|
15
platformio.ini
Normal file
15
platformio.ini
Normal file
|
@ -0,0 +1,15 @@
|
|||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; http://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:uno]
|
||||
platform = atmelavr
|
||||
board = uno
|
||||
framework = arduino
|
||||
build_flags=-Wall -Wextra -O3
|
135
src/font.h
Normal file
135
src/font.h
Normal file
|
@ -0,0 +1,135 @@
|
|||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
const uint8_t font_5x7_col[128][5] PROGMEM = {
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, //
|
||||
{ 0x03, 0x07, 0x7E, 0x20, 0x1C }, //
|
||||
{ 0x60, 0x66, 0x09, 0x09, 0x09 }, //
|
||||
{ 0x60, 0x6F, 0x0A, 0x0A, 0x08 }, //
|
||||
{ 0x10, 0x18, 0x1C, 0x18, 0x10 }, //
|
||||
{ 0x00, 0x3E, 0x1C, 0x08, 0x00 }, //
|
||||
{ 0x00, 0x08, 0x1C, 0x3E, 0x00 }, //
|
||||
{ 0x04, 0x0C, 0x1C, 0x0C, 0x04 }, //
|
||||
{ 0x7F, 0x00, 0x00, 0x00, 0x00 }, // (1 col left)
|
||||
{ 0x7F, 0x7F, 0x00, 0x00, 0x00 }, // (2 col left)
|
||||
{ 0x7F, 0x7F, 0x7F, 0x00, 0x00 }, // (3 col left)
|
||||
{ 0x7F, 0x7F, 0x7F, 0x7F, 0x00 }, // (4 col left)
|
||||
{ 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }, // (solid fill)
|
||||
{ 0x00, 0x7F, 0x7F, 0x7F, 0x7F }, // (4 col right)
|
||||
{ 0x00, 0x00, 0x7F, 0x7F, 0x7F }, // (3 col right)
|
||||
{ 0x00, 0x00, 0x00, 0x7F, 0x7F }, // (2 col right)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x7F }, // (1 col right)
|
||||
{ 0x03, 0x07, 0x7E, 0x20, 0x1C }, // (music note)
|
||||
{ 0x60, 0x66, 0x09, 0x09, 0x09 }, // (deg c)
|
||||
{ 0x60, 0x6F, 0x0A, 0x0A, 0x08 }, // (deg f)
|
||||
{ 0x10, 0x18, 0x1C, 0x18, 0x10 }, // (triangle down)
|
||||
{ 0x00, 0x3E, 0x1C, 0x08, 0x00 }, // (triangle right)
|
||||
{ 0x00, 0x08, 0x1C, 0x3E, 0x00 }, // (triangle left)
|
||||
{ 0x04, 0x0C, 0x1C, 0x0C, 0x04 }, // (triangle up)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // (space)
|
||||
{ 0x00, 0x7D, 0x00, 0x00, 0x00 }, // (!)
|
||||
{ 0x00, 0x70, 0x00, 0x70, 0x00 }, // (")
|
||||
{ 0x14, 0x7F, 0x14, 0x7F, 0x14 }, // (#)
|
||||
{ 0x12, 0x2A, 0x7F, 0x2A, 0x24 }, // ($)
|
||||
{ 0x62, 0x64, 0x08, 0x13, 0x23 }, // (%)
|
||||
{ 0x36, 0x49, 0x35, 0x02, 0x05 }, // (&)
|
||||
{ 0x00, 0x50, 0x60, 0x00, 0x00 }, // (')
|
||||
{ 0x00, 0x1C, 0x22, 0x41, 0x00 }, // (()
|
||||
{ 0x00, 0x41, 0x22, 0x1C, 0x00 }, // ())
|
||||
{ 0x44, 0x28, 0x7C, 0x28, 0x44 }, // (*)
|
||||
{ 0x08, 0x08, 0x7F, 0x08, 0x08 }, // (+)
|
||||
{ 0x05, 0x06, 0x00, 0x00, 0x00 }, // (,)
|
||||
{ 0x08, 0x08, 0x08, 0x00, 0x00 }, // (-)
|
||||
{ 0x00, 0x03, 0x03, 0x00, 0x00 }, // (.)
|
||||
{ 0x02, 0x04, 0x08, 0x10, 0x20 }, // (/)
|
||||
{ 0x3E, 0x45, 0x49, 0x51, 0x3E }, // (0)
|
||||
{ 0x00, 0x21, 0x7F, 0x01, 0x00 }, // (1)
|
||||
{ 0x21, 0x43, 0x45, 0x49, 0x31 }, // (2)
|
||||
{ 0x42, 0x41, 0x51, 0x69, 0x46 }, // (3)
|
||||
{ 0x0C, 0x14, 0x24, 0x7F, 0x04 }, // (4)
|
||||
{ 0x72, 0x51, 0x51, 0x51, 0x4E }, // (5)
|
||||
{ 0x1E, 0x29, 0x49, 0x49, 0x06 }, // (6)
|
||||
{ 0x43, 0x44, 0x48, 0x50, 0x60 }, // (7)
|
||||
{ 0x36, 0x49, 0x49, 0x49, 0x36 }, // (8)
|
||||
{ 0x30, 0x49, 0x49, 0x4A, 0x3C }, // (9)
|
||||
{ 0x00, 0x36, 0x36, 0x00, 0x00 }, // (:)
|
||||
{ 0x00, 0x35, 0x36, 0x00, 0x00 }, // (;)
|
||||
{ 0x08, 0x14, 0x22, 0x41, 0x00 }, // (<)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x14 }, // (=)
|
||||
{ 0x41, 0x22, 0x14, 0x08, 0x00 }, // (>)
|
||||
{ 0x20, 0x40, 0x45, 0x48, 0x30 }, // (?)
|
||||
{ 0x3E, 0x41, 0x4D, 0x51, 0x36 }, // (@)
|
||||
{ 0x3F, 0x48, 0x48, 0x48, 0x3F }, // (A)
|
||||
{ 0x7F, 0x49, 0x49, 0x49, 0x36 }, // (B)
|
||||
{ 0x3E, 0x41, 0x41, 0x41, 0x22 }, // (C)
|
||||
{ 0x7F, 0x41, 0x41, 0x41, 0x3E }, // (D)
|
||||
{ 0x7F, 0x49, 0x49, 0x49, 0x41 }, // (E)
|
||||
{ 0x7F, 0x48, 0x48, 0x48, 0x40 }, // (F)
|
||||
{ 0x3E, 0x41, 0x49, 0x49, 0x2E }, // (G)
|
||||
{ 0x7F, 0x08, 0x08, 0x08, 0x7F }, // (H)
|
||||
{ 0x00, 0x41, 0x7F, 0x41, 0x00 }, // (I)
|
||||
{ 0x02, 0x01, 0x41, 0x7E, 0x40 }, // (J)
|
||||
{ 0x7F, 0x08, 0x14, 0x22, 0x41 }, // (K)
|
||||
{ 0x7F, 0x01, 0x01, 0x01, 0x01 }, // (L)
|
||||
{ 0x7F, 0x20, 0x18, 0x20, 0x7F }, // (M)
|
||||
{ 0x7F, 0x10, 0x08, 0x04, 0x7F }, // (N)
|
||||
{ 0x3E, 0x41, 0x41, 0x41, 0x3E }, // (O)
|
||||
{ 0x7F, 0x48, 0x48, 0x48, 0x30 }, // (P)
|
||||
{ 0x3E, 0x41, 0x45, 0x42, 0x3D }, // (Q)
|
||||
{ 0x7F, 0x48, 0x4C, 0x4A, 0x31 }, // (R)
|
||||
{ 0x31, 0x49, 0x49, 0x49, 0x46 }, // (S)
|
||||
{ 0x40, 0x40, 0x7F, 0x40, 0x40 }, // (T)
|
||||
{ 0x7E, 0x01, 0x01, 0x01, 0x7E }, // (U)
|
||||
{ 0x7C, 0x02, 0x01, 0x02, 0x7C }, // (V)
|
||||
{ 0x7E, 0x01, 0x06, 0x01, 0x7E }, // (W)
|
||||
{ 0x63, 0x14, 0x08, 0x14, 0x63 }, // (X)
|
||||
{ 0x70, 0x08, 0x07, 0x08, 0x70 }, // (Y)
|
||||
{ 0x43, 0x45, 0x49, 0x51, 0x61 }, // (Z)
|
||||
{ 0x00, 0x7F, 0x41, 0x41, 0x00 }, // ([)
|
||||
{ 0x20, 0x10, 0x08, 0x04, 0x02 }, // (\)
|
||||
{ 0x00, 0x41, 0x41, 0x7F, 0x00 }, // (])
|
||||
{ 0x10, 0x20, 0x40, 0x20, 0x10 }, // (^)
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01 }, // (_)
|
||||
{ 0x00, 0x40, 0x20, 0x10, 0x00 }, // (`)
|
||||
{ 0x02, 0x15, 0x15, 0x15, 0x0F }, // (a)
|
||||
{ 0x7F, 0x09, 0x11, 0x11, 0x0E }, // (b)
|
||||
{ 0x0E, 0x11, 0x11, 0x11, 0x02 }, // (c)
|
||||
{ 0x0E, 0x11, 0x11, 0x09, 0x7F }, // (d)
|
||||
{ 0x0E, 0x15, 0x15, 0x15, 0x0C }, // (e)
|
||||
{ 0x08, 0x3F, 0x48, 0x40, 0x20 }, // (f)
|
||||
{ 0x18, 0x25, 0x25, 0x25, 0x3E }, // (g)
|
||||
{ 0x7F, 0x08, 0x10, 0x10, 0x0F }, // (h)
|
||||
{ 0x00, 0x11, 0x5F, 0x01, 0x00 }, // (i)
|
||||
{ 0x02, 0x01, 0x11, 0x5E, 0x00 }, // (j)
|
||||
{ 0x7F, 0x04, 0x0A, 0x11, 0x00 }, // (k)
|
||||
{ 0x00, 0x41, 0x7F, 0x01, 0x00 }, // (l)
|
||||
{ 0x1F, 0x10, 0x0C, 0x10, 0x0F }, // (m)
|
||||
{ 0x1F, 0x08, 0x10, 0x10, 0x0F }, // (n)
|
||||
{ 0x0E, 0x11, 0x11, 0x11, 0x0E }, // (o)
|
||||
{ 0x1F, 0x14, 0x14, 0x14, 0x08 }, // (p)
|
||||
{ 0x08, 0x14, 0x14, 0x14, 0x0F }, // (q)
|
||||
{ 0x1F, 0x08, 0x10, 0x10, 0x08 }, // (r)
|
||||
{ 0x09, 0x15, 0x15, 0x15, 0x02 }, // (s)
|
||||
{ 0x10, 0x7E, 0x11, 0x01, 0x02 }, // (t)
|
||||
{ 0x1E, 0x01, 0x01, 0x02, 0x1F }, // (u)
|
||||
{ 0x1C, 0x02, 0x01, 0x02, 0x1C }, // (v)
|
||||
{ 0x1E, 0x01, 0x02, 0x01, 0x1E }, // (w)
|
||||
{ 0x11, 0x0A, 0x04, 0x0A, 0x11 }, // (x)
|
||||
{ 0x18, 0x05, 0x05, 0x05, 0x1E }, // (y)
|
||||
{ 0x11, 0x13, 0x15, 0x19, 0x11 }, // (z)
|
||||
{ 0x08, 0x36, 0x41, 0x00, 0x00 }, // ({)
|
||||
{ 0x00, 0x00, 0x7F, 0x00, 0x00 }, // (|)
|
||||
{ 0x00, 0x00, 0x41, 0x36, 0x08 }, // (})
|
||||
{ 0x08, 0x08, 0x2A, 0x1C, 0x08 }, // (arrow right)
|
||||
{ 0x08, 0x1C, 0x2A, 0x08, 0x08 }, // (arrow left)
|
||||
};
|
||||
|
||||
#endif
|
56
src/main.cpp
Normal file
56
src/main.cpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <Arduino.h>
|
||||
#include <avr/cpufunc.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "font.h"
|
||||
|
||||
const int width = 120;
|
||||
const int lines = 7;
|
||||
|
||||
const int line_pins[7] = { 2, 3, 4, 5, 6, 7, 8 };
|
||||
|
||||
// Shift register needs to use raw AVR
|
||||
// B1 is clock
|
||||
// B2 is data
|
||||
void shiftout(uint8_t bit)
|
||||
{
|
||||
PORTB = bit << 2;
|
||||
PORTB |= 0x02;
|
||||
PORTB = 0;
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
for (uint8_t i = 2; i <= 10; i++) {
|
||||
pinMode(i, OUTPUT);
|
||||
}
|
||||
pinMode(13, OUTPUT);
|
||||
}
|
||||
|
||||
char *message = "Hello world! ";
|
||||
|
||||
void loop()
|
||||
{
|
||||
for (uint8_t y = 0; y < lines; y++) {
|
||||
uint8_t letter = 0;
|
||||
uint8_t lettercol = 0;
|
||||
for (uint8_t x = 0; x < width; x++) {
|
||||
if (lettercol == 5) {
|
||||
lettercol = 0;
|
||||
letter++;
|
||||
shiftout(0);
|
||||
} else {
|
||||
uint8_t col = pgm_read_byte_near(&font_5x7_col[message[letter]][lettercol]);
|
||||
uint8_t bit = (col & (1 << y)) ? 1 : 0;
|
||||
shiftout(bit);
|
||||
lettercol++;
|
||||
}
|
||||
}
|
||||
|
||||
digitalWrite(13, 1);
|
||||
digitalWrite(line_pins[y], 1);
|
||||
delayMicroseconds(200);
|
||||
digitalWrite(13, 0);
|
||||
digitalWrite(line_pins[y], 0);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue