Skip to content

Commit

Permalink
finalize mk1
Browse files Browse the repository at this point in the history
  • Loading branch information
kokoscript committed Nov 18, 2020
1 parent 971f4ec commit e9b8059
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 32 deletions.
73 changes: 73 additions & 0 deletions anims.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,76 @@ void emotePensive() {
}
}
}

void emoteYes() {
mode = DISP_MODE_EMOTEYES;
for(int i = 0; i < 13; i++){
switch(i){
case 0:
case 4:
case 8:
case 12:
display_bitmap(1);
if(i == 0 || i == 4 || i == 8) ynSnd1();
break;
case 1:
case 3:
case 5:
case 7:
case 9:
case 11:
display_bitmap_delay(26, 80);
break;
case 2:
case 6:
case 10:
display_bitmap(27);
ynSnd2();
break;
default:
display_bitmap_delay(0, 100);
break;
}
}
}


void emoteNo() {
mode = DISP_MODE_EMOTENO;
for(int i = 0; i < 17; i++){
switch(i){
case 0:
case 4:
case 8:
case 12:
case 16:
display_bitmap_delay(30, 50);
break;
case 1:
case 3:
case 9:
case 11:
display_bitmap_delay(29, 50);
break;
case 2:
case 10:
display_bitmap(28);
ynSnd2();
break;
case 5:
case 7:
case 13:
case 15:
display_bitmap_delay(31, 50);
break;
case 6:
case 14:
display_bitmap_delay(32, 50);
ynSnd1();
break;
default:
display_bitmap_delay(0, 100);
break;
}
}
}
36 changes: 18 additions & 18 deletions bitmapData.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ const unsigned char bmpDat[][168] PROGMEM = {
{
// 0 boot
0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x18,
0x18, 0x18, 0x38, 0x30, 0x31, 0x01, 0x01, 0x00, 0x00, 0x18, 0x1c, 0x0e, 0x06, 0x07, 0x03, 0x03,
0x03, 0x7f, 0x7f, 0x00, 0x3f, 0x3f, 0x00, 0x00, 0x28, 0x57, 0x57, 0x00, 0x1f, 0x1f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x63, 0x63, 0x63, 0x63, 0x60, 0x70,
0x30, 0x38, 0x1c, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x66, 0x6e, 0x7c, 0x7c, 0x6e, 0x66, 0x00, 0x00,
0x42, 0x5a, 0x7e, 0x7e, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xf8, 0xc0, 0x00, 0x3c,
0xfc, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x80, 0x80, 0xf8, 0xf8, 0x00, 0x00, 0x00,
0xc0, 0xfc, 0xbc, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x9c, 0xbc, 0xd8,
0xe0, 0x70, 0x38, 0xf8, 0xf8, 0x80, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0x38, 0x1c, 0x0c, 0x0e,
0x06, 0x06, 0x86, 0x80, 0x0a, 0x0a, 0x14, 0x00
0x18, 0x18, 0x38, 0x30, 0x31, 0x01, 0x01, 0x00, 0x00, 0x18, 0x1c, 0x0e, 0x06, 0x07, 0x03, 0x03,
0x03, 0x7f, 0x7f, 0x00, 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x28, 0x57, 0x57, 0x00, 0x1f, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x63, 0x63, 0x63, 0x63, 0x60,
0x70, 0x30, 0x38, 0x1c, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x66, 0x6e, 0x7c, 0x7c, 0x6e, 0x66, 0x00,
0x00, 0x42, 0x5a, 0x7e, 0x7e, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xf8, 0xc0, 0x00, 0x3c,
0xfc, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x80, 0x80, 0xf8, 0xf8, 0x00, 0x00, 0x00,
0xc0, 0xfc, 0xbc, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x9c, 0xbc, 0xd8,
0xe0, 0x70, 0x38, 0xf8, 0xf8, 0x80, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0x38, 0x1c, 0x0c, 0x0e,
0x06, 0x06, 0x86, 0x80, 0x0a, 0x0a, 0x14, 0x00
},
{
// 1 main, yes1
Expand Down Expand Up @@ -126,13 +126,13 @@ const unsigned char bmpDat[][168] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
{ // 9 infoscreen
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x84, 0xb5, 0xb7, 0x94, 0x62, 0x00,
0x2b, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x84, 0xb5, 0xb7, 0x94, 0x62, 0x00,
0x78, 0x3c, 0x7e, 0x7f, 0x6f, 0x46, 0x00, 0x00, 0x00, 0xa4, 0xaa, 0xca, 0xa4, 0x80, 0x00, 0x00,
0x00, 0x01, 0x00, 0xc9, 0xaa, 0xaa, 0xa1, 0xc8, 0x24, 0x71, 0x25, 0x25, 0x45, 0x01, 0x00, 0x00,
0x00, 0x00, 0x01, 0x25, 0x53, 0x55, 0x25, 0x00, 0x00, 0x00, 0x01, 0xa8, 0x01, 0xc0, 0x80, 0x00,
0x00, 0x00, 0x29, 0x92, 0x92, 0x29, 0x00, 0x80, 0x80, 0x40, 0xd4, 0x54, 0x56, 0xc5, 0x10, 0x00,
0x80, 0xc0, 0xe0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x29, 0xc9, 0x65, 0x00, 0x00, 0x11,
0x15, 0x1b, 0x00, 0xc6, 0x2a, 0xca, 0x6a, 0x00, 0x00, 0x63, 0x75, 0x15, 0x65, 0x00, 0x12, 0x0e,
0x00, 0x00, 0x29, 0x92, 0x92, 0x29, 0x00, 0x80, 0x54, 0x56, 0xc5, 0x10, 0x00, 0x80, 0xc0, 0xe0,
0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x29, 0xc9, 0x65, 0x00, 0x00, 0x11, 0x15, 0x1b, 0x00,
0x00, 0x00, 0x00, 0xc6, 0x2a, 0xca, 0x6a, 0x00, 0x00, 0x63, 0x75, 0x15, 0x65, 0x00, 0x12, 0x0e,
0x52, 0x00, 0x08, 0x62, 0xa9, 0xa8, 0x68, 0x20, 0xd8, 0x48, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe2, 0x42, 0x42, 0x42, 0xe2, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x64, 0x54, 0x54, 0x64, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xb6, 0x00, 0x10, 0x20, 0x20, 0x70, 0x20, 0x00, 0xfc,
Expand Down Expand Up @@ -392,7 +392,7 @@ const unsigned char bmpDat[][168] PROGMEM = {
},
{
// 28 no1
0x60, 0x00, 0x60, 0x90, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0x07,
0x06, 0x00, 0x06, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0x07,
0xf1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x28, 0x11, 0x03, 0x07, 0x0e, 0x1c, 0x38, 0x38, 0x1e, 0x0f,
Expand All @@ -406,7 +406,7 @@ const unsigned char bmpDat[][168] PROGMEM = {
},
{
// 29 no2
0x30, 0x00, 0x30, 0x48, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf3, 0x03,
0x0c, 0x00, 0x0c, 0x12, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf3, 0x03,
0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x51, 0x23, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0x70, 0x3c, 0x1f,
Expand Down Expand Up @@ -434,7 +434,7 @@ const unsigned char bmpDat[][168] PROGMEM = {
},
{
// 31 no4
0x0c, 0x00, 0x0c, 0x12, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0x00,
0x30, 0x00, 0x30, 0x48, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0x00,
0xfc, 0xf8, 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, 0xc0, 0x20, 0x23, 0x47, 0x8e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0xc0, 0xf0, 0x7c,
Expand All @@ -448,7 +448,7 @@ const unsigned char bmpDat[][168] PROGMEM = {
},
{
// 32 no5
0x06, 0x00, 0x06, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x00,
0x60, 0x00, 0x60, 0x90, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x00,
0xfe, 0xfc, 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, 0x80, 0x40, 0x46, 0x8e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0x80, 0x80, 0xe0, 0xf8,
Expand Down
Binary file modified chained_bmp/boot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chained_bmp/info_chained.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chained_bmp/no1_chained.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chained_bmp/no2_chained.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chained_bmp/no4_chained.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chained_bmp/no5_chained.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion digitsune.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@
#define DISP_DEBUG false

#define TEAL 0b0000011111110000
#define TEAL32 0b00000000000000001111111110000000
#define PINK 0b1111100000010000
#define PINK32 0b00000000111111110000000010000000
#define PURPLE 0b1111100000011111
#define PURPLE32 0b00000000010000000000000011111100
#define RED 0b1111100000000000
#define RED32 0b00000000111111110000000000000000
#define GREEN 0b0000011111100000
#define GREEN32 0b00000000000000001111111100000000
#define BLUE 0b0000000000011111
#define BLUE32 0b00000000000000000000000011111111
#define WHITE 0b1111111111111111
#define WHITE32 0b00000000111111111111111111111111

#define RMT_MAIN 0x40BF708F
#define RMT_VOICE 0x40BFD02F
Expand All @@ -28,7 +39,11 @@
#define RMT_COLTEAL 0x40BF20DF
#define RMT_COLPINK 0x40BF40BF
#define RMT_COLPURPLE 0x40BFC03F
#define RMT_DEBUG true
#define RMT_COLRED 0x40BFE01F
#define RMT_COLGREEN 0x40BF609F
#define RMT_COLBLUE 0x40BFA05F
#define RMT_COLWHITE 0x40BF10EF
#define RMT_DEBUG false

enum DISP_MODE {
DISP_MODE_MAIN,
Expand Down
47 changes: 44 additions & 3 deletions digitsune.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "anims.h"

Adafruit_NeoMatrix *matrix = new Adafruit_NeoMatrix(DISP_WIDTH, DISP_HEIGHT, DISP_PIN, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel *earPix = new Adafruit_NeoPixel(2, 9, NEO_GRB + NEO_KHZ800);
uint16_t curColor = TEAL;
uint32_t curColor32 = TEAL32;

void display_bitmap(uint8_t bmp_num) {
// Clear prior bitmap first
Expand All @@ -19,6 +21,11 @@ void display_bitmap_delay(uint8_t bmp_num, uint16_t time){
delay(time);
}

void setEarColor(uint32_t col){
earPix->fill(col, 0, 2);
earPix->show();
}

// Measurepeak function
float measurePeak(uint32_t milliseconds) {
float soundMax = 0;
Expand Down Expand Up @@ -111,11 +118,11 @@ void loop() {
break;
case RMT_EMOTEYES:
modeBlip();
//emoteHappy();
emoteYes();
break;
case RMT_EMOTENO:
modeBlip();
//emoteHappy();
emoteNo();
break;
case RMT_INFO:
modeBlip();
Expand All @@ -125,11 +132,43 @@ void loop() {
modeBlip();
curColor = TEAL;
display_bitmap(currentBitmap);
setEarColor(TEAL32);
break;
case RMT_COLPINK:
modeBlip();
curColor = PINK;
display_bitmap(currentBitmap);
setEarColor(PINK32);
break;
case RMT_COLPURPLE:
modeBlip();
curColor = PURPLE;
display_bitmap(currentBitmap);
setEarColor(PURPLE32);
break;
case RMT_COLRED:
modeBlip();
curColor = RED;
display_bitmap(currentBitmap);
setEarColor(RED32);
break;
case RMT_COLGREEN:
modeBlip();
curColor = GREEN;
display_bitmap(currentBitmap);
setEarColor(GREEN32);
break;
case RMT_COLBLUE:
modeBlip();
curColor = BLUE;
display_bitmap(currentBitmap);
setEarColor(BLUE32);
break;
case RMT_COLWHITE:
modeBlip();
curColor = WHITE;
display_bitmap(currentBitmap);
setEarColor(WHITE32);
break;
}

Expand All @@ -142,15 +181,17 @@ void setup() {
#endif
CircuitPlayground.begin();
matrix->begin();
earPix->begin();
matrix->setBrightness(DISP_BRIGHTNESS);
CircuitPlayground.speaker.enable(true);
CircuitPlayground.irReceiver.enableIRIn();

#if DISP_DEBUG
matrix->fillScreen(TEAL);
matrix->show();
#else // if not debugging the display, show the boot img and then main
display_bitmap(0);
setEarColor(TEAL32);
happyChirp();
//sng1();
delay(1000);
Expand Down
18 changes: 8 additions & 10 deletions sfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ void happyChirp() {
CircuitPlayground.playTone(7000, 25);
}

void sadChirp() {
CircuitPlayground.playTone(1500, 25);
CircuitPlayground.playTone(3500, 25);
CircuitPlayground.playTone(5500, 25);
delay(125);
CircuitPlayground.playTone(500, 25);
CircuitPlayground.playTone(2500, 25);
CircuitPlayground.playTone(4500, 25);
}

void errChirp() {
CircuitPlayground.playTone(500, 15);
CircuitPlayground.playTone(2500, 15);
Expand Down Expand Up @@ -141,6 +131,14 @@ void sighOut() {
}
}

void ynSnd1() {
CircuitPlayground.playTone(500, 80);
}

void ynSnd2() {
CircuitPlayground.playTone(1000, 80);
}

void sng1() {
int len[13] = {1, 1, 16, 3, 3, 2, 4, 4, 4, 1, 4, 2, 14};
int note[13] = {NOTE_F4, NOTE_E4, NOTE_F4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_E4, NOTE_C4, NOTE_A3, NOTE_C4, NOTE_E4, NOTE_F4, NOTE_D4};
Expand Down

0 comments on commit e9b8059

Please sign in to comment.