Emulation of the 1970's Chip-8 machine. The emulator has 7 games that are unmodified from the original Chip-8 format.
Revision 0:bc3f11b1b41f, committed 2015-02-08
- Comitter:
- taylorza
- Date:
- Sun Feb 08 01:58:57 2015 +0000
- Commit message:
- Chip-8 Emulator
Changed in this revision
diff -r 000000000000 -r bc3f11b1b41f BlinkyGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BlinkyGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,301 @@ +#ifndef __BLINKYGAME_H__ +#define __BLINKYGAME_H__ +static const uint8_t BlinkyGame[] = +{ + 0x12,0x1a,0x32,0x2e,0x30,0x30,0x20,0x43, + 0x2e,0x20,0x45,0x67,0x65,0x62,0x65,0x72, + 0x67,0x20,0x31,0x38,0x2f,0x38,0x2d,0x27, + 0x39,0x31,0x80,0x03,0x81,0x13,0xa8,0xc8, + 0xf1,0x55,0x60,0x05,0xa8,0xcc,0xf0,0x55, + 0x87,0x73,0x86,0x63,0x27,0x72,0x00,0xe0, + 0x27,0x94,0x6e,0x40,0x87,0xe2,0x6e,0x27, + 0x87,0xe1,0x68,0x1a,0x69,0x0c,0x6a,0x38, + 0x6b,0x00,0x6c,0x02,0x6d,0x1a,0x27,0x50, + 0xa8,0xed,0xda,0xb4,0xdc,0xd4,0x23,0xd0, + 0x3e,0x00,0x12,0x7c,0xa8,0xcc,0xf0,0x65, + 0x85,0x00,0xc4,0xff,0x84,0x52,0x24,0xf6, + 0xc4,0xff,0x84,0x52,0x26,0x1e,0x60,0x01, + 0xe0,0xa1,0x27,0xd6,0x36,0xf7,0x12,0x4e, + 0x8e,0x60,0x28,0x7a,0x6e,0x64,0x28,0x7a, + 0x27,0xd6,0x12,0x2a,0xf0,0x07,0x40,0x00, + 0x13,0x10,0x80,0x80,0x80,0x06,0x81,0xa0, + 0x81,0x06,0x80,0x15,0x40,0x00,0x12,0x9a, + 0x40,0x01,0x12,0x9a,0x40,0xff,0x12,0x9a, + 0x12,0xc8,0x80,0x90,0x80,0x06,0x81,0xb0, + 0x81,0x06,0x80,0x15,0x40,0x00,0x12,0xb2, + 0x40,0x01,0x12,0xb2,0x40,0xff,0x12,0xb2, + 0x12,0xc8,0xa8,0xed,0xda,0xb4,0x6a,0x38, + 0x6b,0x00,0xda,0xb4,0x6e,0xf3,0x87,0xe2, + 0x6e,0x04,0x87,0xe1,0x6e,0x32,0x28,0x7a, + 0x80,0x80,0x80,0x06,0x81,0xc0,0x81,0x06, + 0x80,0x15,0x40,0x00,0x12,0xe0,0x40,0x01, + 0x12,0xe0,0x40,0xff,0x12,0xe0,0x12,0x54, + 0x80,0x90,0x80,0x06,0x81,0xd0,0x81,0x06, + 0x80,0x15,0x40,0x00,0x12,0xf8,0x40,0x01, + 0x12,0xf8,0x40,0xff,0x12,0xf8,0x12,0x54, + 0xa8,0xed,0xdc,0xd4,0x6c,0x02,0x6d,0x1a, + 0xdc,0xd4,0x6e,0xcf,0x87,0xe2,0x6e,0x20, + 0x87,0xe1,0x6e,0x19,0x28,0x7a,0x12,0x54, + 0x60,0x3f,0x28,0xa8,0x27,0x50,0xa8,0xed, + 0xda,0xb4,0xdc,0xd4,0x6e,0x40,0x87,0xe3, + 0x80,0x70,0x80,0xe2,0x30,0x00,0x12,0x32, + 0x8e,0x60,0x28,0x7a,0x28,0x8a,0x00,0xe0, + 0x66,0x11,0x67,0x0a,0xa8,0xca,0x27,0xe6, + 0x66,0x11,0x67,0x10,0xa8,0xc8,0x27,0xe6, + 0x64,0x00,0x65,0x08,0x66,0x00,0x67,0x0f, + 0xab,0x19,0xd4,0x69,0xab,0x22,0xd5,0x69, + 0x60,0x03,0x28,0xa8,0x3e,0x00,0x13,0xc6, + 0xab,0x19,0xd4,0x69,0xab,0x22,0xd5,0x69, + 0x74,0x02,0x75,0x02,0x34,0x30,0x13,0x48, + 0xab,0x19,0xd4,0x69,0xab,0x22,0xd5,0x69, + 0x60,0x03,0x28,0xa8,0x3e,0x00,0x13,0xc6, + 0xab,0x19,0xd4,0x69,0xab,0x22,0xd5,0x69, + 0x76,0x02,0x36,0x16,0x13,0x68,0xab,0x19, + 0xd4,0x69,0xab,0x22,0xd5,0x69,0x60,0x03, + 0x28,0xa8,0x3e,0x00,0x13,0xc6,0xab,0x19, + 0xd4,0x69,0xab,0x22,0xd5,0x69,0x74,0xfe, + 0x75,0xfe,0x34,0x00,0x13,0x86,0xab,0x19, + 0xd4,0x69,0xab,0x22,0xd5,0x69,0x60,0x03, + 0x28,0xa8,0x3e,0x00,0x13,0xc6,0xab,0x19, + 0xd4,0x69,0xab,0x22,0xd5,0x69,0x76,0xfe, + 0x36,0x00,0x13,0xa6,0x13,0x48,0xab,0x22, + 0xd5,0x69,0xab,0x2b,0xd5,0x69,0x12,0x1a, + 0x83,0x70,0x6e,0x03,0x83,0xe2,0x84,0x80, + 0x85,0x90,0x6e,0x06,0xee,0xa1,0x14,0x32, + 0x6e,0x03,0xee,0xa1,0x14,0x4a,0x6e,0x08, + 0xee,0xa1,0x14,0x62,0x6e,0x07,0xee,0xa1, + 0x14,0x7a,0x43,0x03,0x75,0x02,0x43,0x00, + 0x75,0xfe,0x43,0x02,0x74,0x02,0x43,0x01, + 0x74,0xfe,0x80,0x40,0x81,0x50,0x27,0xba, + 0x82,0x00,0x6e,0x08,0x80,0xe2,0x30,0x00, + 0x14,0x92,0x6e,0x07,0x80,0x20,0x82,0xe2, + 0x42,0x05,0x14,0x9a,0x42,0x06,0x14,0xb2, + 0x42,0x07,0x14,0xec,0x27,0x50,0x6e,0xfc, + 0x87,0xe2,0x87,0x31,0x88,0x40,0x89,0x50, + 0x17,0x50,0x80,0x40,0x81,0x50,0x71,0x02, + 0x27,0xba,0x82,0x00,0x6e,0x08,0x80,0xe2, + 0x30,0x00,0x13,0xf2,0x63,0x03,0x75,0x02, + 0x14,0x0e,0x80,0x40,0x81,0x50,0x71,0xfe, + 0x27,0xba,0x82,0x00,0x6e,0x08,0x80,0xe2, + 0x30,0x00,0x13,0xf2,0x63,0x00,0x75,0xfe, + 0x14,0x0e,0x80,0x40,0x81,0x50,0x70,0x02, + 0x27,0xba,0x82,0x00,0x6e,0x08,0x80,0xe2, + 0x30,0x00,0x13,0xf2,0x63,0x02,0x74,0x02, + 0x14,0x0e,0x80,0x40,0x81,0x50,0x70,0xfe, + 0x27,0xba,0x82,0x00,0x6e,0x08,0x80,0xe2, + 0x30,0x00,0x13,0xf2,0x63,0x01,0x74,0xfe, + 0x14,0x0e,0x27,0x50,0xd8,0x94,0x8e,0xf0, + 0x00,0xee,0x6e,0xf0,0x80,0xe2,0x80,0x31, + 0xf0,0x55,0xa8,0xf1,0xd4,0x54,0x76,0x01, + 0x61,0x05,0xf0,0x07,0x40,0x00,0xf1,0x18, + 0x14,0x24,0x6e,0xf0,0x80,0xe2,0x80,0x31, + 0xf0,0x55,0xa8,0xf5,0xd4,0x54,0x76,0x04, + 0x80,0xa0,0x81,0xb0,0x27,0xba,0x6e,0xf0, + 0x80,0xe2,0x30,0x00,0x14,0xd2,0x6e,0x0c, + 0x87,0xe3,0x80,0xc0,0x81,0xd0,0x27,0xba, + 0x6e,0xf0,0x80,0xe2,0x30,0x00,0x14,0xe4, + 0x6e,0x30,0x87,0xe3,0x60,0xff,0xf0,0x18, + 0xf0,0x15,0x14,0x24,0x43,0x01,0x64,0x3a, + 0x43,0x02,0x64,0x00,0x14,0x24,0x82,0x70, + 0x83,0x70,0x6e,0x0c,0x82,0xe2,0x80,0xa0, + 0x81,0xb0,0x27,0xba,0xa8,0xed,0x6e,0xf0, + 0x80,0xe2,0x30,0x00,0x15,0x24,0xda,0xb4, + 0x42,0x0c,0x7b,0x02,0x42,0x00,0x7b,0xfe, + 0x42,0x08,0x7a,0x02,0x42,0x04,0x7a,0xfe, + 0xda,0xb4,0x00,0xee,0x6e,0x80,0xf1,0x07, + 0x31,0x00,0x15,0xd4,0x34,0x00,0x15,0xd4, + 0x81,0x00,0x83,0x0e,0x3f,0x00,0x15,0x56, + 0x83,0x90,0x83,0xb5,0x4f,0x00,0x15,0x8c, + 0x33,0x00,0x15,0x74,0x87,0xe3,0x83,0x80, + 0x83,0xa5,0x4f,0x00,0x15,0xbc,0x33,0x00, + 0x15,0xa4,0x87,0xe3,0x15,0xd4,0x83,0x80, + 0x83,0xa5,0x4f,0x00,0x15,0xbc,0x33,0x00, + 0x15,0xa4,0x87,0xe3,0x83,0x90,0x83,0xb5, + 0x4f,0x00,0x15,0x8c,0x33,0x00,0x15,0x74, + 0x87,0xe3,0x15,0xd4,0x63,0x40,0x81,0x32, + 0x41,0x00,0x15,0xd4,0xda,0xb4,0x7b,0x02, + 0xda,0xb4,0x6e,0xf3,0x87,0xe2,0x62,0x0c, + 0x87,0x21,0x00,0xee,0x63,0x10,0x81,0x32, + 0x41,0x00,0x15,0xd4,0xda,0xb4,0x7b,0xfe, + 0xda,0xb4,0x6e,0xf3,0x87,0xe2,0x62,0x00, + 0x87,0x21,0x00,0xee,0x63,0x20,0x81,0x32, + 0x41,0x00,0x15,0xd4,0xda,0xb4,0x7a,0x02, + 0xda,0xb4,0x6e,0xf3,0x87,0xe2,0x62,0x08, + 0x87,0x21,0x00,0xee,0x63,0x80,0x81,0x32, + 0x41,0x00,0x15,0xd4,0xda,0xb4,0x7a,0xfe, + 0xda,0xb4,0x6e,0xf3,0x87,0xe2,0x62,0x04, + 0x87,0x21,0x00,0xee,0xc1,0xf0,0x80,0x12, + 0x30,0x00,0x15,0xe4,0x6e,0x0c,0x87,0xe3, + 0x82,0xe3,0x15,0x0e,0xda,0xb4,0x80,0x0e, + 0x4f,0x00,0x15,0xf2,0x62,0x04,0x7a,0xfe, + 0x16,0x14,0x80,0x0e,0x4f,0x00,0x15,0xfe, + 0x62,0x0c,0x7b,0x02,0x16,0x14,0x80,0x0e, + 0x4f,0x00,0x16,0x0a,0x62,0x08,0x7a,0x02, + 0x16,0x14,0x80,0x0e,0x4f,0x00,0x15,0xdc, + 0x62,0x00,0x7b,0xfe,0xda,0xb4,0x6e,0xf3, + 0x87,0xe2,0x87,0x21,0x00,0xee,0x82,0x70, + 0x83,0x70,0x6e,0x30,0x82,0xe2,0x80,0xc0, + 0x81,0xd0,0x27,0xba,0xa8,0xed,0x6e,0xf0, + 0x80,0xe2,0x30,0x00,0x16,0x4c,0xdc,0xd4, + 0x42,0x30,0x7d,0x02,0x42,0x00,0x7d,0xfe, + 0x42,0x20,0x7c,0x02,0x42,0x10,0x7c,0xfe, + 0xdc,0xd4,0x00,0xee,0x6e,0x80,0xf1,0x07, + 0x31,0x00,0x17,0x04,0x34,0x00,0x17,0x04, + 0x81,0x00,0x83,0x0e,0x4f,0x00,0x16,0x7e, + 0x83,0x90,0x83,0xd5,0x4f,0x00,0x16,0xb6, + 0x33,0x00,0x16,0x9c,0x87,0xe3,0x83,0x80, + 0x83,0xc5,0x4f,0x00,0x16,0xea,0x33,0x00, + 0x16,0xd0,0x87,0xe3,0x17,0x04,0x83,0x80, + 0x83,0xc5,0x4f,0x00,0x16,0xea,0x33,0x00, + 0x16,0xd0,0x87,0xe3,0x83,0x90,0x83,0xd5, + 0x4f,0x00,0x16,0xb6,0x33,0x00,0x16,0x9c, + 0x87,0xe3,0x17,0x04,0x63,0x40,0x81,0x32, + 0x41,0x00,0x17,0x04,0xdc,0xd4,0x7d,0x02, + 0xdc,0xd4,0x87,0xe3,0x6e,0xcf,0x87,0xe2, + 0x62,0x30,0x87,0x21,0x00,0xee,0x63,0x10, + 0x81,0x32,0x41,0x00,0x17,0x04,0xdc,0xd4, + 0x7d,0xfe,0xdc,0xd4,0x87,0xe3,0x6e,0xcf, + 0x87,0xe2,0x62,0x00,0x87,0x21,0x00,0xee, + 0x63,0x20,0x81,0x32,0x41,0x00,0x17,0x04, + 0xdc,0xd4,0x7c,0x02,0xdc,0xd4,0x87,0xe3, + 0x6e,0xcf,0x87,0xe2,0x62,0x20,0x87,0x21, + 0x00,0xee,0x63,0x80,0x81,0x32,0x41,0x00, + 0x17,0x04,0xdc,0xd4,0x7c,0xfe,0xdc,0xd4, + 0x87,0xe3,0x6e,0xcf,0x87,0xe2,0x62,0x10, + 0x87,0x21,0x00,0xee,0xc1,0xf0,0x80,0x12, + 0x30,0x00,0x17,0x16,0x87,0xe3,0x6e,0x30, + 0x87,0xe3,0x82,0xe3,0x16,0x36,0xdc,0xd4, + 0x80,0x0e,0x4f,0x00,0x17,0x24,0x62,0x90, + 0x7c,0xfe,0x17,0x46,0x80,0x0e,0x4f,0x00, + 0x17,0x30,0x62,0x30,0x7d,0x02,0x17,0x46, + 0x80,0x0e,0x4f,0x00,0x17,0x3c,0x62,0xa0, + 0x7c,0x02,0x17,0x46,0x80,0x0e,0x4f,0x00, + 0x17,0x0c,0x62,0x00,0x7d,0xfe,0xdc,0xd4, + 0x6e,0x4f,0x87,0xe2,0x87,0x21,0x00,0xee, + 0x80,0x70,0x6e,0x03,0x80,0xe2,0x80,0x0e, + 0x81,0x80,0x81,0x94,0x6e,0x02,0x81,0xe2, + 0x41,0x00,0x70,0x01,0x80,0x0e,0x80,0x0e, + 0xa8,0xcd,0xf0,0x1e,0xd8,0x94,0x8e,0xf0, + 0x00,0xee,0x6e,0x00,0xa9,0x19,0xfe,0x1e, + 0xfe,0x1e,0xfe,0x1e,0xfe,0x1e,0xf3,0x65, + 0xab,0x34,0xfe,0x1e,0xfe,0x1e,0xfe,0x1e, + 0xfe,0x1e,0xf3,0x55,0x7e,0x01,0x3e,0x80, + 0x17,0x74,0x00,0xee,0x82,0x23,0x83,0x33, + 0x6e,0x0f,0x80,0x20,0x81,0x30,0x27,0xbe, + 0x80,0xe2,0x80,0x0e,0xa8,0xf9,0xf0,0x1e, + 0xd2,0x32,0x72,0x02,0x32,0x40,0x17,0x9a, + 0x82,0x23,0x73,0x02,0x43,0x20,0x00,0xee, + 0x17,0x9a,0x70,0x02,0x71,0x02,0x80,0x06, + 0x81,0x06,0x81,0x0e,0x81,0x0e,0x81,0x0e, + 0x81,0x0e,0xab,0x34,0xf1,0x1e,0xf1,0x1e, + 0xf0,0x1e,0xf0,0x65,0x00,0xee,0xa8,0xcc, + 0xf0,0x65,0x80,0x06,0xf0,0x55,0x60,0x01, + 0xe0,0xa1,0x17,0xe0,0x00,0xee,0xf1,0x65, + 0x6e,0x01,0x84,0x43,0x82,0x00,0x83,0x10, + 0x65,0x10,0x83,0x55,0x4f,0x00,0x82,0xe5, + 0x4f,0x00,0x18,0x0c,0x65,0x27,0x82,0x55, + 0x4f,0x00,0x18,0x0c,0x80,0x20,0x81,0x30, + 0x84,0xe4,0x17,0xf0,0xf4,0x29,0xd6,0x75, + 0x76,0x06,0x84,0x43,0x82,0x00,0x83,0x10, + 0x65,0xe8,0x83,0x55,0x4f,0x00,0x82,0xe5, + 0x4f,0x00,0x18,0x34,0x65,0x03,0x82,0x55, + 0x4f,0x00,0x18,0x34,0x80,0x20,0x81,0x30, + 0x84,0xe4,0x18,0x18,0xf4,0x29,0xd6,0x75, + 0x76,0x06,0x84,0x43,0x82,0x00,0x83,0x10, + 0x65,0x64,0x83,0x55,0x4f,0x00,0x82,0xe5, + 0x4f,0x00,0x18,0x54,0x80,0x20,0x81,0x30, + 0x84,0xe4,0x18,0x40,0xf4,0x29,0xd6,0x75, + 0x76,0x06,0x84,0x43,0x82,0x00,0x83,0x10, + 0x65,0x0a,0x83,0x55,0x4f,0x00,0x18,0x6e, + 0x81,0x30,0x84,0xe4,0x18,0x60,0xf4,0x29, + 0xd6,0x75,0x76,0x06,0xf1,0x29,0xd6,0x75, + 0x00,0xee,0xa8,0xc8,0xf1,0x65,0x81,0xe4, + 0x3f,0x00,0x70,0x01,0xa8,0xc8,0xf1,0x55, + 0x00,0xee,0xa8,0xc8,0xf3,0x65,0x8e,0x00, + 0x8e,0x25,0x4f,0x00,0x00,0xee,0x3e,0x00, + 0x18,0xa2,0x8e,0x10,0x8e,0x35,0x4f,0x00, + 0x00,0xee,0xa8,0xca,0xf1,0x55,0x00,0xee, + 0x8e,0xe3,0x62,0x0f,0x63,0xff,0x61,0x10, + 0xe2,0xa1,0x18,0xc4,0x81,0x34,0x31,0x00, + 0x18,0xb0,0x61,0x10,0x80,0x34,0x30,0x00, + 0x18,0xb0,0x00,0xee,0x6e,0x01,0x00,0xee, + 0x00,0x00,0x00,0x00,0x05,0x00,0x50,0x70, + 0x20,0x00,0x50,0x70,0x20,0x00,0x60,0x30, + 0x60,0x00,0x60,0x30,0x60,0x00,0x30,0x60, + 0x30,0x00,0x30,0x60,0x30,0x00,0x20,0x70, + 0x50,0x00,0x20,0x70,0x50,0x00,0x20,0x70, + 0x70,0x00,0x00,0x20,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + 0x00,0xc0,0x00,0x00,0x00,0x80,0x80,0x00, + 0x00,0xc0,0x80,0x80,0x80,0xc0,0x00,0x80, + 0x00,0x0c,0x08,0x08,0x08,0x08,0x08,0x08, + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x0d,0x0c,0x08,0x08,0x08,0x08,0x08,0x08, + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x0d,0x0a,0x65,0x05,0x05,0x05,0x05,0xe5, + 0x05,0x05,0xe5,0x05,0x05,0x05,0x05,0xc5, + 0x0a,0x0a,0x65,0x05,0x05,0x05,0x05,0xe5, + 0x05,0x05,0xe5,0x05,0x05,0x05,0x05,0xc5, + 0x0a,0x0a,0x05,0x0c,0x08,0x08,0x0f,0x05, + 0x0c,0x0d,0x05,0x08,0x08,0x08,0x0d,0x05, + 0x0e,0x0f,0x05,0x0c,0x08,0x08,0x0f,0x05, + 0x0c,0x0d,0x05,0x08,0x08,0x08,0x0d,0x05, + 0x0a,0x0a,0x05,0x0a,0x65,0x06,0x05,0x95, + 0x0a,0x0a,0x35,0x05,0x05,0xc5,0x0a,0x35, + 0x05,0x05,0x95,0x0a,0x65,0x05,0x05,0x95, + 0x0a,0x0a,0x35,0x05,0x06,0xc5,0x0a,0x05, + 0x0a,0x0a,0x05,0x0f,0x05,0x08,0x08,0x08, + 0x08,0x08,0x0c,0x08,0x0f,0x05,0x08,0x08, + 0x08,0x08,0x08,0x0f,0x05,0x08,0x08,0x0c, + 0x08,0x08,0x08,0x08,0x0f,0x05,0x0f,0x05, + 0x0a,0x0a,0x75,0x05,0xb5,0x05,0x05,0x05, + 0x05,0xc5,0x0a,0x65,0x05,0xb5,0x05,0xe5, + 0x05,0x05,0xe5,0x05,0xb5,0x05,0xc5,0x0a, + 0x65,0x05,0x05,0x05,0x05,0xb5,0x05,0xd5, + 0x0a,0x0a,0x05,0x0c,0x08,0x08,0x08,0x08, + 0x0d,0x05,0x0f,0x05,0x0c,0x08,0x0f,0x05, + 0x08,0x0f,0x05,0x08,0x08,0x0d,0x05,0x0f, + 0x05,0x0c,0x08,0x08,0x08,0x08,0x0d,0x05, + 0x0a,0x0f,0x05,0x0f,0x65,0x05,0x05,0xc5, + 0x0a,0x35,0xe5,0x95,0x0a,0x65,0x05,0xb0, + 0x05,0x05,0xb5,0x05,0xc5,0x0a,0x35,0xe5, + 0x95,0x0a,0x65,0x05,0x05,0xc5,0x0f,0x05, + 0x0f,0x07,0x74,0x05,0xd5,0x08,0x0f,0x05, + 0x0e,0x0f,0x05,0x08,0x0f,0x05,0x0c,0x08, + 0x08,0x08,0x08,0x0d,0x05,0x08,0x0f,0x05, + 0x08,0x0f,0x05,0x08,0x0f,0x75,0x05,0xd4, + 0x07,0x0a,0x05,0x0a,0x35,0x05,0x05,0xf5, + 0x05,0x05,0xb5,0x05,0x05,0xd5,0x08,0x08, + 0x0d,0x0c,0x08,0x0f,0x75,0x05,0x05,0xb5, + 0x05,0x05,0xf5,0x05,0x05,0x95,0x0a,0x05, + 0x0a,0x0a,0x05,0x08,0x08,0x08,0x0d,0x05, + 0x0c,0x08,0x08,0x08,0x0d,0x35,0x05,0xc5, + 0x0a,0x0a,0x65,0x05,0x95,0x0c,0x08,0x08, + 0x08,0x0d,0x05,0x0c,0x08,0x08,0x0f,0x05, + 0x0a,0x0a,0x75,0x05,0x06,0xc5,0x0a,0x05, + 0x08,0x08,0x08,0x08,0x08,0x08,0x0f,0x05, + 0x08,0x0f,0x05,0x08,0x08,0x08,0x08,0x08, + 0x08,0x0f,0x05,0x0a,0x65,0x06,0x05,0xd5, + 0x0a,0x0a,0x05,0x0c,0x0d,0x05,0x0a,0x35, + 0x05,0x05,0x05,0x05,0xe5,0x05,0x05,0xf5, + 0x05,0x05,0xf5,0x05,0x05,0xe5,0x05,0x05, + 0x05,0x05,0x95,0x0a,0x05,0x0c,0x0d,0x05, + 0x0a,0x0a,0x05,0x08,0x0f,0x05,0x08,0x08, + 0x08,0x08,0x08,0x0f,0x05,0x0c,0x0d,0x05, + 0x08,0x0f,0x05,0x0c,0x0d,0x05,0x08,0x08, + 0x08,0x08,0x08,0x0f,0x05,0x08,0x0f,0x05, + 0x0a,0x0a,0x35,0x05,0x05,0xb5,0x05,0x05, + 0x05,0x05,0x05,0x05,0x95,0x0a,0x0a,0x35, + 0x05,0x05,0x95,0x0a,0x0a,0x35,0x05,0x05, + 0x05,0x05,0x05,0x05,0xb5,0x05,0x05,0x95, + 0x0a,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x08,0x08,0x08,0x08,0x08,0x0f,0x08,0x08, + 0x08,0x08,0x08,0x0f,0x08,0x08,0x08,0x08, + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x0f,0x3c,0x42,0x99,0x99,0x42,0x3c,0x01, + 0x10,0x0f,0x78,0x84,0x32,0x32,0x84,0x78, + 0x00,0x10,0xe0,0x78,0xfc,0xfe,0xfe,0x84, + 0x78,0x00,0x10,0xe0, +}; +#endif //__BLINKYGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f BrixGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BrixGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,41 @@ +#ifndef __BRIXGAME_H__ +#define __BRIXGAME_H__ +static const uint8_t BrixGame[] = +{ + 0x6e,0x05,0x65,0x00,0x6b,0x06,0x6a,0x00, + 0xa3,0x0c,0xda,0xb1,0x7a,0x04,0x3a,0x40, + 0x12,0x08,0x7b,0x02,0x3b,0x12,0x12,0x06, + 0x6c,0x20,0x6d,0x1f,0xa3,0x10,0xdc,0xd1, + 0x22,0xf6,0x60,0x00,0x61,0x00,0xa3,0x12, + 0xd0,0x11,0x70,0x08,0xa3,0x0e,0xd0,0x11, + 0x60,0x40,0xf0,0x15,0xf0,0x07,0x30,0x00, + 0x12,0x34,0xc6,0x0f,0x67,0x1e,0x68,0x01, + 0x69,0xff,0xa3,0x0e,0xd6,0x71,0xa3,0x10, + 0xdc,0xd1,0x60,0x04,0xe0,0xa1,0x7c,0xfe, + 0x60,0x06,0xe0,0xa1,0x7c,0x02,0x60,0x3f, + 0x8c,0x02,0xdc,0xd1,0xa3,0x0e,0xd6,0x71, + 0x86,0x84,0x87,0x94,0x60,0x3f,0x86,0x02, + 0x61,0x1f,0x87,0x12,0x47,0x1f,0x12,0xac, + 0x46,0x00,0x68,0x01,0x46,0x3f,0x68,0xff, + 0x47,0x00,0x69,0x01,0xd6,0x71,0x3f,0x01, + 0x12,0xaa,0x47,0x1f,0x12,0xaa,0x60,0x05, + 0x80,0x75,0x3f,0x00,0x12,0xaa,0x60,0x01, + 0xf0,0x18,0x80,0x60,0x61,0xfc,0x80,0x12, + 0xa3,0x0c,0xd0,0x71,0x60,0xfe,0x89,0x03, + 0x22,0xf6,0x75,0x01,0x22,0xf6,0x45,0x60, + 0x12,0xde,0x12,0x46,0x69,0xff,0x80,0x60, + 0x80,0xc5,0x3f,0x01,0x12,0xca,0x61,0x02, + 0x80,0x15,0x3f,0x01,0x12,0xe0,0x80,0x15, + 0x3f,0x01,0x12,0xee,0x80,0x15,0x3f,0x01, + 0x12,0xe8,0x60,0x20,0xf0,0x18,0xa3,0x0e, + 0x7e,0xff,0x80,0xe0,0x80,0x04,0x61,0x00, + 0xd0,0x11,0x3e,0x00,0x12,0x30,0x12,0xde, + 0x78,0xff,0x48,0xfe,0x68,0xff,0x12,0xee, + 0x78,0x01,0x48,0x02,0x68,0x01,0x60,0x04, + 0xf0,0x18,0x69,0xff,0x12,0x70,0xa3,0x14, + 0xf5,0x33,0xf2,0x65,0xf1,0x29,0x63,0x37, + 0x64,0x00,0xd3,0x45,0x73,0x05,0xf2,0x29, + 0xd3,0x45,0x00,0xee,0xe0,0x00,0x80,0x00, + 0xfc,0x00,0xaa,0x00,0x00,0x00,0x00,0x00, +}; +#endif //__BRIXGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f Chip8Emulator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Chip8Emulator.cpp Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,335 @@ +#include "Chip8Emulator.h" +#include <string.h> +#include "GameInput.h" +#include "Color565.h" + + +DigitalOut led1(P0_18, false); + +const uint8_t Chip8Emulator::_font[] = +{ + 0xF0,0x90,0x90,0x90,0xF0, // 0 + 0x20,0x60,0x20,0x20,0x70, // 1 + 0xF0,0x10,0xF0,0x80,0xF0, // 2 + 0xF0,0x10,0xF0,0x10,0xF0, // 3 + 0x90,0x90,0xF0,0x10,0x10, // 4 + 0xF0,0x80,0xF0,0x10,0xF0, // 5 + 0xF0,0x80,0xF0,0x90,0xF0, // 6 + 0xF0,0x10,0x20,0x40,0x40, // 7 + 0xF0,0x90,0xF0,0x90,0xF0, // 8 + 0xF0,0x90,0xF0,0x10,0xF0, // 9 + 0xF0,0x90,0xF0,0x90,0x90, // A + 0xE0,0x90,0xE0,0x90,0xE0, // B + 0xF0,0x80,0x80,0x80,0xF0, // C + 0xE0,0x90,0x90,0x90,0xE0, // D + 0xF0,0x80,0xF0,0x80,0xF0, // E + 0xF0,0x80,0xF0,0x80,0x80 // F +}; + +Chip8Emulator::Chip8Emulator(LCD_ST7735 &screen, const uint8_t *program, uint16_t programSize, uint8_t leftKey, uint8_t rightKey, uint8_t upKey, uint8_t downKey, uint8_t fireKey, uint8_t startKey) : + _bmp(64, 32), + _screen(screen), + _delay(0), + _sound(0), + _pc(0x200), + _sp(0), + _i(0), + _leftKey(leftKey), + _rightKey(rightKey), + _upKey(upKey), + _downKey(downKey), + _fireKey(fireKey), + _startKey(startKey) +{ + memset(_memory, 0, sizeof(_memory)); + memset(_stack, 0, sizeof(_stack)); + memset(_registers, 0, sizeof(_registers)); + + memcpy(_memory, _font, sizeof(_font)); + memcpy(_memory + _pc, program, programSize); +} + +void Chip8Emulator::run() +{ + _screen.clearScreen(0); + _bmp.clear(); + + Timer updateTimer; + updateTimer.start(); + int lastReading = updateTimer.read_ms(); + while(true) + { + int reading = updateTimer.read_ms(); + if (reading - lastReading > 16) + { + if (_delay > 0) --_delay; + if (_sound > 0) --_sound; + lastReading = reading; + } + wait_us(1500); + if (_sound != 0) led1 != led1; + switch(_memory[_pc] & 0xf0) + { + case 0x00: + switch(_memory[_pc + 1]) + { + case 0xe0: + _bmp.clear(); + _screen.clearScreen(); + break; + + case 0xee: + _pc = _stack[--_sp]; + break; + } + break; + + case 0x10: + _pc = ((_memory[_pc] & 0x0f) << 8) | _memory[_pc + 1]; + continue; + + case 0x20: + _stack[_sp++] = _pc; + _pc = ((_memory[_pc] & 0x0f) << 8) | _memory[_pc + 1]; + continue; + + case 0x30: + if (_registers[_memory[_pc] & 0x0f] == _memory[_pc + 1]) + { + _pc += 2; + } + break; + + case 0x40: + if (_registers[_memory[_pc] & 0x0f] != _memory[_pc + 1]) + { + _pc += 2; + } + break; + + case 0x50: + if (_registers[_memory[_pc] & 0x0f] == _registers[(_memory[_pc + 1] & 0x0f) >> 4]) + { + _pc += 2; + } + break; + + case 0x60: + _registers[_memory[_pc] & 0x0f] = _memory[_pc + 1]; + break; + + case 0x70: + _registers[_memory[_pc] & 0x0f] += _memory[_pc + 1]; + break; + + case 0x80: + switch(_memory[_pc + 1] & 0x0f) + { + case 0x00: _registers[_memory[_pc] & 0x0f] = _registers[(_memory[_pc + 1] & 0xf0) >> 4]; break; + case 0x01: _registers[_memory[_pc] & 0x0f] |= _registers[(_memory[_pc + 1] & 0xf0) >> 4]; break; + case 0x02: _registers[_memory[_pc] & 0x0f] &= _registers[(_memory[_pc + 1] & 0xf0) >> 4]; break; + case 0x03: _registers[_memory[_pc] & 0x0f] ^= _registers[(_memory[_pc + 1] & 0xf0) >> 4]; break; + + case 0x04: + { + uint8_t vx = _registers[_memory[_pc] & 0x0f]; + uint8_t vy = _registers[(_memory[_pc + 1] & 0xf0) >> 4]; + uint16_t result = vx + vy; + _registers[0x0f] = (uint8_t)(result >> 8); + _registers[_memory[_pc] & 0x0f] = (uint8_t)result; + } + break; + + case 0x05: + { + uint8_t vx = _registers[_memory[_pc] & 0x0f]; + uint8_t vy = _registers[(_memory[_pc + 1] & 0xf0) >> 4]; + uint16_t result = vx - vy; + _registers[0x0f] = (uint8_t)(((uint8_t)(result >> 8)) + 1); + _registers[_memory[_pc] & 0x0f] = (uint8_t)result; + } + break; + + case 0x06: + _registers[0x0f] = (uint8_t)(_registers[_memory[_pc] & 0x0f] & 0x01); + _registers[_memory[_pc] & 0x0f] >>= 1; + break; + + case 0x07: + _registers[0x0f] = (uint8_t)(_registers[(_memory[_pc + 1] & 0xf0) >> 4] > _registers[_memory[_pc] & 0x0f] ? 1 : 0); + _registers[_memory[_pc] & 0x0f] -= _registers[(_memory[_pc + 1] & 0xf0) >> 4]; + break; + + case 0x0E: + _registers[0x0f] = (uint8_t)(((_registers[_memory[_pc] & 0x0f] & 0x80) != 0) ? 1 : 0); + _registers[_memory[_pc] & 0x0f] <<= 1; + break; + + } + break; + + case 0x90: + if (_registers[_memory[_pc] & 0x0f] != _registers[(_memory[_pc + 1] & 0xf0) >> 4]) + { + _pc += 2; + } + break; + + case 0xA0: + _i = (uint16_t)(((_memory[_pc] & 0x0f) << 8) | _memory[_pc + 1]); + break; + + case 0xB0: + _pc = (uint16_t)((((_memory[_pc] & 0x0f) << 8) | _memory[_pc + 1]) + _registers[0]); + continue; + + case 0xC0: + _registers[_memory[_pc] & 0x0f] = (uint8_t)(rnd() & _memory[_pc + 1]); + break; + + case 0xD0: + { + _registers[0x0f] = 0; + uint8_t x = _registers[_memory[_pc] & 0x0f]; + uint8_t y = _registers[_memory[_pc + 1] >> 4]; + uint8_t n = _memory[_pc + 1] & 0x0f; + for (int i = 0; i < n; i++) + { + plot(x, y + i, _memory[_i + i]); + } + } + break; + + case 0xE0: + switch(_memory[_pc+1]) + { + case 0x9E : + if (isKeyPressed(_registers[_memory[_pc] & 0x0f])) _pc += 2; + break; + + case 0xA1 : + if (!isKeyPressed(_registers[_memory[_pc] & 0x0f])) _pc += 2; + break; + } + break; + + case 0xF0: + switch (_memory[_pc + 1]) + { + case 0x07: + _registers[_memory[_pc] & 0x0f] = _delay; + break; + + case 0x0A: + { + uint8_t key = getKeyPressed(); + if (key != 255) + { + _registers[_memory[_pc] & 0x0f] = key; + } + else + { + _pc -= 2; + } + } + break; + + case 0x15: + _delay = _registers[_memory[_pc] & 0x0f]; + break; + + case 0x18: + _sound = _registers[_memory[_pc] & 0x0f]; + break; + + case 0x1e: + _i += _registers[_memory[_pc] & 0x0f]; + break; + + case 0x29: + _i = (uint8_t)(_registers[_memory[_pc] & 0x0f] * 5); + break; + + case 0x33: + { + uint8_t r = _registers[_memory[_pc] & 0x0f]; + _memory[_i + 2] = (uint8_t)(r % 10); + r /= 10; + _memory[_i + 1] = (uint8_t)(r % 10); + r /= 10; + _memory[_i] = (uint8_t)(r % 10); + } + break; + + case 0x55: + { + uint8_t n = _memory[_pc] & 0x0f; + for (int r = 0; r <= n; r++) + { + _memory[_i + r] = _registers[r]; + } + } + break; + + case 0x65: + { + uint8_t n = _memory[_pc] & 0x0f; + for (int r = 0; r <= n; r++) + { + _registers[r] = _memory[_i + r]; + } + } + break; + } + break; + } + + _pc += 2; + if (_pc >= sizeof(_memory)) + { + _pc = 0x200 + (sizeof(_memory) - _pc - 1); + } + } +} + +uint8_t Chip8Emulator::rnd() +{ + return (uint8_t)(rand() % 256); +} + +bool Chip8Emulator::isKeyPressed(uint8_t key) +{ + return getKeyPressed() == key; +} + +uint8_t Chip8Emulator::getKeyPressed() +{ + if (GameInput::isLeftPressed()) return _leftKey; + if (GameInput::isRightPressed()) return _rightKey; + if (GameInput::isUpPressed()) return _upKey; + if (GameInput::isDownPressed()) return _downKey; + if (GameInput::isCirclePressed()) return _fireKey; + if (GameInput::isSquarePressed()) return _startKey; + + return 255; +} + +void Chip8Emulator::plot(int x, int y, uint8_t pattern) +{ + if (y >= 32) return; + for (int i = 0; i < 8; ++i) + { + if (x + i >= 64) return; + + uint16_t set = ((pattern << i) & 0x80) != 0 ? 1 : 0; + uint16_t current = _bmp.getPixel(x + i, y); + + if ((set & current) != 0) _registers[0x0f] = 1; + + _bmp.setPixel(x + i, y, current ^ set); + + int nx = OFFSET_X + (x + i) * 2; + int ny = OFFSET_Y + (y * 2); + _screen.fillRect(nx, ny, nx + 1, ny + 1, current ^ set ? Color565::White : Color565::Black); + } +} \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f Chip8Emulator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Chip8Emulator.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,45 @@ +#include "LCD_ST7735.h" +#include "Bitmap1bpp.h" + +#ifndef __CHIP8EMULATOR_H__ +#define __CHIP8EMULATOR_H__ + +class Chip8Emulator +{ +public: + Chip8Emulator(LCD_ST7735 &screen, const uint8_t *program, uint16_t programSize, uint8_t leftKey, uint8_t rightKey, uint8_t upKey, uint8_t downKey, uint8_t fireKey, uint8_t startKey); + void run(); + +private: + uint8_t rnd(); + bool isKeyPressed(uint8_t key); + uint8_t getKeyPressed(); + void plot(int x, int y, uint8_t pattern); + +private: + Bitmap1bpp _bmp; + LCD_ST7735 &_screen; + uint8_t _delay; + uint8_t _sound; + uint16_t _pc; + uint16_t _sp; + uint16_t _i; + uint8_t _memory[4096]; + uint16_t _stack[16]; + uint8_t _registers[16]; + + uint8_t _leftKey; + uint8_t _rightKey; + uint8_t _upKey; + uint8_t _downKey; + uint8_t _fireKey; + uint8_t _startKey; + +private: + static const int OFFSET_X = 16; + static const int OFFSET_Y = 32; + + static const uint8_t _font[]; +}; + +#endif //__CHIP8EMULATOR_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f GameInput.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameInput.cpp Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,8 @@ +#include "GameInput.h" + +DigitalIn GameInput::_up(P0_13, PullUp); +DigitalIn GameInput::_down(P0_12, PullUp); +DigitalIn GameInput::_left(P0_14, PullUp); +DigitalIn GameInput::_right(P0_11, PullUp); +DigitalIn GameInput::_square(P0_16, PullUp); +DigitalIn GameInput::_circle(P0_1, PullUp); \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f GameInput.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameInput.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +#ifndef __GAMEINPUT_H__ +#define __GAMEINPUT_H__ + +class GameInput +{ + private: + static DigitalIn _up; + static DigitalIn _down; + static DigitalIn _left; + static DigitalIn _right; + static DigitalIn _square; + static DigitalIn _circle; + + public: + static inline bool isUpPressed() { return !_up; } + static inline bool isDownPressed() { return !_down; } + static inline bool isLeftPressed() { return !_left; } + static inline bool isRightPressed() { return !_right; } + static inline bool isSquarePressed() { return !_square; } + static inline bool isCirclePressed() { return !_circle; } +}; + +#endif //__GAMEINPUT_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/Base.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/Base.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,6 @@ +#ifndef __BASE_H__ +#define __BASE_H__ + +template <typename T> +void swap(T &a, T &b) { T t = a; a = b; b = t; } +#endif // __BASE_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/Bitmap1bpp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/Bitmap1bpp.cpp Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,61 @@ +#include "mbed.h" +#include "Bitmap1bpp.h" + +Bitmap1bpp::Bitmap1bpp(uint16_t width, uint16_t height): + _width(width), + _height(height), + _stride((width >> 3) + ((width & 0x07) ? 1 : 0)), + _pBitmapData(new uint8_t[_stride * height]) +{ + +} + +Bitmap1bpp::~Bitmap1bpp() +{ + if (_pBitmapData != NULL) + { + delete []_pBitmapData; + _pBitmapData = NULL; + } +} + +void Bitmap1bpp::clear() +{ + memset(_pBitmapData, 0, _stride * _height); +} + +void Bitmap1bpp::setPixel(int16_t x, int16_t y, uint16_t color) +{ + if (x < 0 || x >= _width || y < 0 || y >= _height) return; + + uint8_t mask = 1 << (7 - (x % 8)); + uint8_t *p = _pBitmapData + ((y * _stride) + (x / 8)); + + if (color) *p |= mask; else *p &= ~mask; +} + +uint16_t Bitmap1bpp::getPixel(int16_t x, int16_t y) +{ + if (x < 0 || x >= _width || y < 0 || y >= _height) return 0; + + uint8_t mask = 1 << (7 - (x % 8)); + uint8_t *p = _pBitmapData + ((y * _stride) + (x / 8)); + + return (*p & mask) == mask ? 1 : 0; +} + +void Bitmap1bpp::fastHLine(int16_t x1, int16_t x2, int16_t y, uint16_t color) +{ + for (int x = x1; x <= x2; ++x) + { + setPixel(x, y, color); + } +} + +void Bitmap1bpp::fastVLine(int16_t y1, int16_t y2, int16_t x, uint16_t color) +{ + for (int y = y1; y <= y2; ++y) + { + setPixel(x, y, color); + } +} \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/Bitmap1bpp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/Bitmap1bpp.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,33 @@ +#include "stdint.h" + +#ifndef __BITMAP1BPP_H__ +#define __BITMAP1BPP_H__ + +class Bitmap1bpp +{ + public: + Bitmap1bpp(uint16_t width, uint16_t height); + ~Bitmap1bpp(); + + inline uint16_t getWidth() { return _width; } + inline uint16_t getHeight() { return _height; } + inline uint16_t getStride() { return _stride; } + + inline uint8_t *getBitmapData() { return _pBitmapData; } + + void clear(); + + void setPixel(int16_t x, int16_t y, uint16_t color); + uint16_t getPixel(int16_t x, int16_t y); + + void fastHLine(int16_t x1, int16_t x2, int16_t y, uint16_t color); + void fastVLine(int16_t y1, int16_t y2, int16_t x, uint16_t color); + + private: + uint16_t _width; + uint16_t _height; + uint16_t _stride; + uint8_t *_pBitmapData; +}; + +#endif //__BITMAP1BPP_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/Canvas.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/Canvas.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,102 @@ +#include "Base.h" + +#ifndef __CANVAS_H__ +#define __CANVAS_H__ + +template <typename T> +class Canvas +{ + public: + Canvas(T &surface) : + _surface(surface) + { + + } + + inline void clear() + { + _surface.clear(); + } + + inline void setPixel(int x, int y, uint16_t color) + { + _surface.setPixel(x, y, color); + } + + inline uint16_t getPixel(int x, int y) + { + return _surface.getPixel(x, y); + } + + void drawLine(int x1, int y1, int x2, int y2, uint16_t color) + { + int dx = abs(x2 - x1); + int dy = abs(y2 - y1); + + if (dx == 0) + { + if (y1 > y2) swap(y1, y2); + _surface.fastVLine(y1, y2, x1, color); + return; + } + else if(dy == 0) + { + if (x1 > x2) swap(x1, x2); + _surface.fastHLine(x1, x2, y1, color); + return; + } + + int sx = (x1 < x2) ? 1 : -1; + int sy = (y1 < y2) ? 1 : -1; + int err = dx - dy; + while(x1 != x2 || y1 != y2) + { + setPixel(x1, y1, color); + int e2 = err << 1; + if (e2 > -dy) + { + err -= dy; + x1 += sx; + } + if (e2 < dx) + { + err += dx; + y1 += sy; + } + } + setPixel(x2, y2, color); + } + + void drawRect(int x1, int y1, int x2, int y2, uint16_t color) + { + if (x1 > x2) swap(x1, x2); + if (y1 > y2) swap(y1, y2); + + _surface.fastHLine(x1, x2, y1, color); + _surface.fastHLine(x1, x2, y2, color); + + _surface.fastVLine(y1, y2, x1, color); + _surface.fastVLine(y1, y2, x2, color); + } + + void fillRect(int x1, int y1, int x2, int y2, uint16_t color) + { + if (x1 > x2) swap(x1, x2); + if (y1 > y2) swap(y1, y2); + + for (int x = x1; x <= x2; ++x) + { + _surface.fastVLine(y1, y2, x, color); + } + } + + void drawBitmap(int x, int y, T &bmp, int srcX, int srcY, int srcWidth, int srcHeight, bool transparent) + { + _surface.drawBitmap(x, y, bmp, srcX, srcY, srcWidth, srcHeight, transparent); + } + + private: + T &_surface; +}; + +#endif // __CANVAS_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/Color565.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/Color565.cpp Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////// +// LCD_ST7735 - Driver for ST7735 LCD display controller +// Author: Chris Taylor (taylorza) +#include "mbed.h" +#include "Color565.h" + +const uint16_t Color565::White = Color565::fromRGB(0xff, 0xff, 0xff); +const uint16_t Color565::Silver = Color565::fromRGB(0xc0, 0xc0, 0xc0); +const uint16_t Color565::Gray = Color565::fromRGB(0x80, 0x80, 0x80); +const uint16_t Color565::Black = Color565::fromRGB(0x00, 0x00, 0x00); +const uint16_t Color565::Red = Color565::fromRGB(0xff, 0x00, 0x00); +const uint16_t Color565::Maroon = Color565::fromRGB(0x80, 0x00, 0x00); +const uint16_t Color565::Yellow = Color565::fromRGB(0xff, 0xff, 0x00); +const uint16_t Color565::Olive = Color565::fromRGB(0x80, 0x80, 0x00); +const uint16_t Color565::Lime = Color565::fromRGB(0x00, 0xff, 0x00); +const uint16_t Color565::Green = Color565::fromRGB(0x00, 0x80, 0x00); +const uint16_t Color565::Aqua = Color565::fromRGB(0x00, 0xff, 0xff); +const uint16_t Color565::Teal = Color565::fromRGB(0x00, 0x80, 0x80); +const uint16_t Color565::Blue = Color565::fromRGB(0x00, 0x00, 0xff); +const uint16_t Color565::Navy = Color565::fromRGB(0x00, 0x00, 0x80); +const uint16_t Color565::Fuchsia = Color565::fromRGB(0xff, 0x00, 0xff); +const uint16_t Color565::Purple = Color565::fromRGB(0x80, 0x00, 0x80); \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/Color565.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/Color565.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// LCD_ST7735 - Driver for ST7735 LCD display controller +// Author: Chris Taylor (taylorza) + +#ifndef __COLOR565_H__ +#define __COLOR565_H__ +/** Color palete support for 16bit RGB colors with 565 color format +*/ +class Color565 +{ +public: + /**White*/ + static const uint16_t White; + + /**Silver*/ + static const uint16_t Silver; + + /**Gray*/ + static const uint16_t Gray; + + /**Black*/ + static const uint16_t Black; + + /**Red*/ + static const uint16_t Red; + + /**Maroon*/ + static const uint16_t Maroon; + + /**Yellow*/ + static const uint16_t Yellow; + + /**Olive*/ + static const uint16_t Olive; + + /**Lime*/ + static const uint16_t Lime; + + /**Green*/ + static const uint16_t Green; + + /**Aqua*/ + static const uint16_t Aqua; + + /**Teal*/ + static const uint16_t Teal; + + /**Blue*/ + static const uint16_t Blue; + + /**Navy*/ + static const uint16_t Navy; + + /**Fuchsia*/ + static const uint16_t Fuchsia; + + /**Purple*/ + static const uint16_t Purple; + + /**Returns a 565 RGB color built from individual RGB color components + * @param r Red component + * @param g Green component + * @param b Blue component + */ + static uint16_t fromRGB(uint8_t r, uint8_t g, uint8_t b) + { + return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3) ; + } +private: + Color565(){}; +}; +#endif // __COLOR565_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/LCD_ST7735.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/LCD_ST7735.cpp Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,761 @@ +#include "mbed.h" +#include "LCD_ST7735.h" +#include "Base.h" + +const uint16_t LCD_ST7735::DefaultPalette[] = { + 0x0000, // 0 - Black + 0x0019, // 1 - Blue + 0xc800, // 2 - Red + 0xc819, // 3 - Magenta + 0x0660, // 4 - Green + 0x0679, // 5 - Cyan + 0xce60, // 6 - Yellow + 0xce79, // 7 - White + 0x001f, // 8 - Bright Blue + 0xf800, // 9 - Bright Red + 0xf81f, // 10 - Bright Magenta + 0x07e0, // 11 - Bright Green + 0x07ff, // 12 - Bright Cyan + 0xffe0, // 13 - Bright Yellow + 0xffff, // 14 - Bright White +}; + +LCD_ST7735::LCD_ST7735( + PinName backlightPin, + PinName resetPin, + PinName dsPin, + PinName mosiPin, + PinName misoPin, + PinName clkPin, + PinName csPin, + PanelColorFilter colorFilter + ) : + _colorFilter(colorFilter), + _backlight(backlightPin, 0), + _reset(resetPin, 1), + _ds(dsPin, 0), + _cs(csPin, 1), + _spi(mosiPin, misoPin, clkPin) +{ + _spi.format(8, 3); + _spi.frequency(15000000); + + initDisplay(); + clearScreen(); + setForegroundColor(0xffff); + setBackgroundColor(0x0000); + + _palette = (uint16_t*)DefaultPalette; +} + +void LCD_ST7735::setOrientation(Orientation orientation, bool flip) +{ + const static uint8_t my = 0x80; + const static uint8_t mx = 0x40; + const static uint8_t mv = 0x20; + + uint8_t madctlData = _colorFilter; + switch(orientation) + { + case Rotate0: + _width = 128; + _height = 160; + madctlData |= flip ? mx : 0; + break; + + case Rotate90: + _width = 160; + _height = 128; + madctlData |= flip ? my | mv | mx : mv | mx; + break; + + case Rotate180: + _width = 128; + _height = 160; + madctlData |= flip ? my : mx | my; + break; + + case Rotate270: + _width = 160; + _height = 128; + madctlData |= flip ? mv : mv | my; + break; + } + write(CMD_MADCTL, (uint8_t[]){madctlData}, 1); +} + +int LCD_ST7735::getWidth() +{ + return _width; +} + +int LCD_ST7735::getHeight() +{ + return _height; +} + +void LCD_ST7735::setBacklight(bool state) +{ + _backlight = state ? 1 : 0; +} + +void LCD_ST7735::clearScreen(uint16_t color) +{ + clipRect(0, 0, _width - 1, _height - 1); + beginBatchCommand(CMD_RAMWR); + uint8_t colorHigh = color >> 8; + uint8_t colorLow = color; + for(int i = 0; i < 128 * 160 * 2; ++i) + { + writeBatchData(colorHigh, colorLow); + } + endBatchCommand(); +} + +void LCD_ST7735::setPixel(int x, int y, uint16_t color) +{ + write(CMD_CASET, (uint8_t[]){0, x, 0, x}, 4); + write(CMD_RASET, (uint8_t[]){0, y, 0, y}, 4); + write(CMD_RAMWR, color); +} + +void LCD_ST7735::drawLine(int x1, int y1, int x2, int y2, uint16_t color) +{ + int dx = abs(x2 - x1); + int dy = abs(y2 - y1); + + if (dx == 0) + { + drawVertLine(x1, y1, y2, color); + return; + } + else if(dy == 0) + { + drawHorizLine(x1, y1, x2, color); + return; + } + + int sx = (x1 < x2) ? 1 : -1; + int sy = (y1 < y2) ? 1 : -1; + int err = dx - dy; + while(x1 != x2 || y1 != y2) + { + setPixel(x1, y1, color); + int e2 = err << 1; + if (e2 > -dy) + { + err -= dy; + x1 += sx; + } + if (e2 < dx) + { + err += dx; + y1 += sy; + } + } + setPixel(x2, y2, color); +} + +void LCD_ST7735::drawRect(int x1, int y1, int x2, int y2, uint16_t color) +{ + if (x1 > x2) swap(x1, x2); + if (y1 > y2) swap(y1, y2); + + drawHorizLine(x1, y1, x2, color); + drawHorizLine(x1, y2, x2, color); + drawVertLine(x1, y1, y2, color); + drawVertLine(x2, y1, y2, color); +} + +void LCD_ST7735::drawCircle(int x, int y, int r, uint16_t color) +{ + int ix = r; + int iy = 0; + int err = 1 - r; + + while(ix >= iy) + { + setPixel(x + ix, y + iy, color); + setPixel(x + iy, y + ix, color); + setPixel(x - ix, y + iy, color); + setPixel(x - iy, y + ix, color); + setPixel(x - ix, y - iy, color); + setPixel(x - iy, y - ix, color); + setPixel(x + ix, y - iy, color); + setPixel(x + iy, y - ix, color); + iy++; + if (err < 0) + { + err += 2 * iy + 1; + } + else + { + ix--; + err += 2 * (iy - ix + 1); + } + } +} + +void LCD_ST7735::drawEllipse(int x, int y, int rx, int ry, uint16_t color) +{ + int a2 = rx * rx; + int b2 = ry * ry; + int fa2 = 4 * a2; + int fb2 = 4 * b2; + + int ix, iy, sigma; + for (ix = 0, iy = ry, sigma = 2 * b2 + a2 * (1 - 2 * ry); b2 * ix <= a2 * iy; ix++) + { + setPixel(x + ix, y + iy, color); + setPixel(x - ix, y + iy, color); + setPixel(x + ix, y - iy, color); + setPixel(x - ix, y - iy, color); + if (sigma >= 0) + { + sigma+= fa2 * (1 - iy); + iy--; + } + sigma += b2 * ((4 * ix) + 6); + } + + for (ix = rx, iy = 0, sigma = 2 * a2 + b2 * (1 - 2 * rx); a2 * iy <= b2 * ix; iy++) + { + setPixel(x + ix, y + iy, color); + setPixel(x - ix, y + iy, color); + setPixel(x + ix, y - iy, color); + setPixel(x - ix, y - iy, color); + if (sigma >= 0) + { + sigma+= fb2 * (1 - ix); + ix--; + } + sigma += a2 * ((4 * iy) + 6); + } +} +void LCD_ST7735::fillRect(int x1, int y1, int x2, int y2, uint16_t fillColor) +{ + if (x1 > x2) swap(x1, x2); + if (y1 > y2) swap(y1, y2); + + clipRect(x1, y1, x2, y2); + int c = ((x2 + 1 - x1) * (y2 + 1 - y1)) << 1; + uint8_t colorHigh = fillColor >> 8; + uint8_t colorLow = fillColor; + beginBatchCommand(CMD_RAMWR); + while(c--) + { + writeBatchData(colorHigh, colorLow); + } + endBatchCommand(); +} + +void LCD_ST7735::fillRect(int x1, int y1, int x2, int y2, uint16_t borderColor, uint16_t fillColor) +{ + if (x1 > x2) swap(x1, x2); + if (y1 > y2) swap(y1, y2); + + drawRect(x1, y1, x2, y2, borderColor); + ++x1; ++y1; --x2; --y2; + if (x2 >= x1 && y2 >= y1) + { + int c = ((x2 + 1 - x1) * (y2 + 1 - y1)) << 1; + + clipRect(x1, y1, x2, y2); + uint8_t colorHigh = fillColor >> 8; + uint8_t colorLow = fillColor; + beginBatchCommand(CMD_RAMWR); + while(c--) + { + writeBatchData(colorHigh, colorLow); + } + endBatchCommand(); + } +} + +void LCD_ST7735::fillCircle(int x, int y, int r, uint16_t borderColor, uint16_t fillColor) +{ + int ix = r; + int iy = 0; + int err = 1 - r; + + while(ix >= iy) + { + setPixel(x - ix, y + iy, borderColor); + setPixel(x + ix, y + iy, borderColor); + drawHorizLine(x - ix + 1, y + iy, x + ix - 1, fillColor); + + setPixel(x - iy, y + ix, borderColor); + setPixel(x + iy, y + ix, borderColor); + drawHorizLine(x - iy + 1, y + ix, x + iy - 1, fillColor); + + setPixel(x - ix, y - iy, borderColor); + setPixel(x + ix, y - iy, borderColor); + drawHorizLine(x - ix + 1, y - iy, x + ix - 1, fillColor); + + setPixel(x - iy, y - ix, borderColor); + setPixel(x + iy, y - ix, borderColor); + drawHorizLine(x - iy + 1, y - ix, x + iy - 1, fillColor); + iy++; + if (err < 0) + { + err += 2 * iy + 1; + } + else + { + ix--; + err += 2 * (iy - ix + 1); + } + } +} + +void LCD_ST7735::fillEllipse(int x, int y, int rx, int ry, uint16_t borderColor, uint16_t fillColor) +{ + int a2 = rx * rx; + int b2 = ry * ry; + int fa2 = 4 * a2; + int fb2 = 4 * b2; + + int ix, iy, sigma; + for (ix = 0, iy = ry, sigma = 2 * b2 + a2 * (1 - 2 * ry); b2 * ix <= a2 * iy; ix++) + { + setPixel(x + ix, y + iy, borderColor); + setPixel(x - ix, y + iy, borderColor); + drawHorizLine(x - ix + 1, y + iy, x + ix - 1, fillColor); + + setPixel(x + ix, y - iy, borderColor); + setPixel(x - ix, y - iy, borderColor); + drawHorizLine(x - ix + 1, y - iy, x + ix - 1, fillColor); + + if (sigma >= 0) + { + sigma+= fa2 * (1 - iy); + iy--; + } + sigma += b2 * ((4 * ix) + 6); + } + + for (ix = rx, iy = 0, sigma = 2 * a2 + b2 * (1 - 2 * rx); a2 * iy <= b2 * ix; iy++) + { + setPixel(x + ix, y + iy, borderColor); + setPixel(x - ix, y + iy, borderColor); + drawHorizLine(x - ix + 1, y + iy, x + ix - 1, fillColor); + + setPixel(x + ix, y - iy, borderColor); + setPixel(x - ix, y - iy, borderColor); + drawHorizLine(x - ix + 1, y - iy, x + ix - 1, fillColor); + if (sigma >= 0) + { + sigma+= fb2 * (1 - ix); + ix--; + } + sigma += a2 * ((4 * iy) + 6); + } +} + +void LCD_ST7735::drawBitmap(int x, int y, const uint16_t *pbmp) +{ + int w = *pbmp++; + int h = *pbmp++; + + clip(x, y, w, h); + int c = w * h; + beginBatchCommand(CMD_RAMWR); + while(c--) + { + writeBatchData(*pbmp++); + } + endBatchCommand(); +} + +void LCD_ST7735::drawBitmap(int x, int y, const uint16_t *pbmp, int srcX, int srcY, int srcWidth, int srcHeight) +{ + int w = *pbmp++; + int h = *pbmp++; + + clip(x, y, srcWidth, srcHeight); + beginBatchCommand(CMD_RAMWR); + const uint16_t *p = pbmp + srcX + (srcY * w); + for(int iy = 0; iy < srcHeight; ++iy) + { + for(int ix = 0; ix < srcWidth; ++ix) + { + writeBatchData(*(p + ix)); + } + p += w; + } + endBatchCommand(); +} + +void LCD_ST7735::drawBitmap(int x, int y, Bitmap1bpp &bmp, int srcX, int srcY, int srcWidth, int srcHeight, uint16_t foregroundColor, uint16_t backgroundColor) +{ + // Clip if out of screen + if ((x >= _width) || (x + srcWidth < 0) || + (y >= _height) || (y + srcHeight < 0)) + { + return; + } + + // Clip X + if (x < 0) { srcX += -x; srcWidth += x; x = 0; } + if (x + srcWidth >= _width) { srcWidth += _width - (x + srcWidth); } + + // Clip Y + if (y < 0) {srcY += -y; srcHeight += y; y = 0; } + if (y + srcHeight >= _height) { srcHeight += _height - (y + srcHeight); } + + uint8_t fch = foregroundColor >> 8; + uint8_t fcl = foregroundColor; + uint8_t bch = backgroundColor >> 8; + uint8_t bcl = backgroundColor; + + clip(x, y, srcWidth, srcHeight); + + int offset = (bmp.getStride() * srcY) + (srcX / 8); + int startbits = srcX % 8; + + beginBatchCommand(CMD_RAMWR); + for(int r = 0; r < srcHeight; ++r) + { + const uint8_t *p = bmp.getBitmapData() + offset; + + uint8_t b = *p; + for (int c = 0, shift = startbits; c < srcWidth; ++c, ++shift) + { + if (shift == 8) + { + shift = 0; + b = *++p; + } + + if ((b << shift) & 0x80) + { + writeBatchData(fch, fcl); + } + else + { + writeBatchData(bch, bcl); + } + } + offset += bmp.getStride(); + } + endBatchCommand(); +} + +void LCD_ST7735::setForegroundColor(uint16_t color) +{ + _foregroundColorHigh = color >> 8; + _foregroundColorLow = color; +} + +void LCD_ST7735::setBackgroundColor(uint16_t color) +{ + _backgroundColorHigh = color >> 8; + _backgroundColorLow = color; +} + +void LCD_ST7735::drawString(const uint8_t *pFont, int x, int y, const char *pString) +{ + uint8_t w = *pFont; + uint8_t h = *(pFont + 1); + uint8_t offset = *(pFont + 2); + uint8_t leftPad = *(pFont + 3); + uint8_t rightPad = *(pFont + 4); + uint8_t topPad = *(pFont + 5); + uint8_t bottomPad = *(pFont + 6); + + if (y + topPad + h + bottomPad < 0) return; + if (y >= _height) return; + if (x + leftPad + w + rightPad < 0) return; + + char *p = (char*)pString; + while(*p != 0) + { + if (x >= _width) return; + drawChar(pFont, x, y, *p++, w, h, offset, leftPad, rightPad, topPad, bottomPad); + x += (w + leftPad + rightPad); + } +} + +void LCD_ST7735::measureString(const uint8_t *pFont, const char *pString, uint8_t &width, uint8_t &height) +{ + uint8_t w = *pFont; + uint8_t h = *(pFont + 1); + uint8_t leftPad = *(pFont + 3); + uint8_t rightPad = *(pFont + 4); + uint8_t topPad = *(pFont + 5); + uint8_t bottomPad = *(pFont + 6); + + width = (w + leftPad + rightPad) * strlen(pString); + height = (h + topPad + bottomPad); +} + +void LCD_ST7735::selectDevice() +{ + _spi.prepareFastSPI(); +} + +void LCD_ST7735::drawVertLine(int x1, int y1, int y2, uint16_t color) +{ + clipRect(x1, y1, x1, y2); + beginBatchCommand(CMD_RAMWR); + int c = (y2 - y1) << 1; + uint8_t colorHigh = color >> 8; + uint8_t colorLow = color; + for (int i = 0; i < c; ++i) + { + writeBatchData(colorHigh, colorLow); + } + endBatchCommand(); +} + +void LCD_ST7735::drawHorizLine(int x1, int y1, int x2, uint16_t color) +{ + clipRect(x1, y1, x2, y1); + beginBatchCommand(CMD_RAMWR); + int c = (x2 - x1) << 1; + uint8_t colorHigh = color >> 8; + uint8_t colorLow = color; + for (int i = 0; i < c; ++i) + { + writeBatchData(colorHigh, colorLow); + } + endBatchCommand(); +} + +void LCD_ST7735::drawChar(const uint8_t *pFont, int x, int y, char c, uint8_t w, uint8_t h, uint8_t offset, uint8_t leftPad, uint8_t rightPad, uint8_t topPad, uint8_t bottomPad) +{ + const uint8_t *pChar = (pFont + 7) + ((c - offset) * h); + + clip(x, y, w + leftPad + rightPad, h + topPad + bottomPad); + + beginBatchCommand(CMD_RAMWR); + + // Render top spacing + for (int r = 0; r < topPad; ++r) + { + for (int c = 0; c < w + leftPad + rightPad; ++c) + { + writeBatchData(_backgroundColorHigh); + writeBatchData(_backgroundColorLow); + } + } + + // Render character + for(int r = 0; r < h; ++r) + { + uint8_t b = pChar[r]; + + // Render left spacing + for (int c = 0; c < leftPad; ++c) + { + writeBatchData(_backgroundColorHigh); + writeBatchData(_backgroundColorLow); + } + for(int c = 0; c < w; ++c) + { + if (b & 0x80) + { + writeBatchData(_foregroundColorHigh); + writeBatchData(_foregroundColorLow); + } + else + { + writeBatchData(_backgroundColorHigh); + writeBatchData(_backgroundColorLow); + } + + b <<= 1; + } + + for (int c = 0; c < rightPad; ++c) + { + writeBatchData(_backgroundColorHigh); + writeBatchData(_backgroundColorLow); + } + } + + // Render bottom spacing + for (int r = 0; r < bottomPad; ++r) + { + for (int c = 0; c < w + leftPad + rightPad; ++c) + { + writeBatchData(_backgroundColorHigh); + writeBatchData(_backgroundColorLow); + } + } + endBatchCommand(); +} + +void LCD_ST7735::initDisplay() +{ + selectDevice(); + reset(); + + writeCommand(CMD_SLPOUT); + + write(CMD_FRMCTR1, (uint8_t[]){0x01, 0x2c, 0x2d}, 3); + write(CMD_FRMCTR2, (uint8_t[]){0x01, 0x2c, 0x2d}, 3); + write(CMD_FRMCTR3, (uint8_t[]){0x01, 0x2c, 0x2d, 0x01, 0x2c, 0x2d}, 6); + + write(CMD_INVCTR, (uint8_t[]){0x07}, 1); + + write(CMD_PWCTR1, (uint8_t[]){0xa2, 0x02, 0x84}, 3); + write(CMD_PWCTR2, (uint8_t[]){0xc5}, 1); + write(CMD_PWCTR3, (uint8_t[]){0x0a, 0x00}, 2); + write(CMD_PWCTR4, (uint8_t[]){0x8a, 0x2a}, 2); + write(CMD_PWCTR5, (uint8_t[]){0x8a, 0xee}, 2); + + write(CMD_VMCTR1, (uint8_t[]){0x0e}, 1); + + write(CMD_MADCTL, (uint8_t[]){0xc0 | _colorFilter}, 1); + + // Gama sequence + write(CMD_GAMCTRP1, (uint8_t[]) + { + 0x0f, 0x1a, + 0x0f, 0x18, + 0x2f, 0x28, + 0x20, 0x22, + 0x1f, 0x1b, + 0x23, 0x37, + 0x00, 0x07, + 0x02, 0x10 + }, 16); + + write(CMD_GAMCTRN1, (uint8_t[]) + { + 0x0f, 0x1b, + 0x0f, 0x17, + 0x33, 0x2c, + 0x29, 0x2e, + 0x30, 0x30, + 0x39, 0x3f, + 0x00, 0x07, + 0x03, 0x10 + }, 16); + + write(CMD_CASET, (uint8_t[]){0x00, 0x00, 0x00, 0x7f}, 4); + write(CMD_RASET, (uint8_t[]){0x00, 0x00, 0x00, 0x9f}, 4); + + write(CMD_EXTCTRL, (uint8_t[]){0x01}, 1); + + // Disable RAM power save + write(0xf6, (uint8_t[]){0x00}, 1); + + // 65k color mode + write(CMD_COLMOD, (uint8_t[]){0x05}, 1); + + // Enable display + writeCommand(CMD_DISPON); + + setBacklight(true); +} + +void LCD_ST7735::reset() +{ + _reset = 0; + wait_us(100); + _reset = 1; + wait_us(100); +} + +void LCD_ST7735::clip(int x, int y, int w, int h) +{ + clipRect(x, y, (x + w) - 1, (y + h) - 1); +} + +void LCD_ST7735::clipRect(int x1, int y1, int x2, int y2) +{ + uint8_t x1l = (uint8_t)x1; + uint8_t x1h = (uint8_t)(x1 >> 8); + uint8_t x2l = (uint8_t)x2; + uint8_t x2h = (uint8_t)(x2 >> 8); + write(CMD_CASET, (uint8_t[]){x1h, x1l, x2h, x2l}, 4); + + uint8_t y1l = (uint8_t)y1; + uint8_t y1h = (uint8_t)(y1 >> 8); + uint8_t y2l = (uint8_t)y2; + uint8_t y2h = (uint8_t)(y2 >> 8); + write(CMD_RASET, (uint8_t[]){y1h, y1l, y2h, y2l}, 4); +} + +void LCD_ST7735::writeCommand(uint8_t cmd) +{ + _cs = 0; + _ds = 0; + _spi.fastWrite(cmd); + _spi.waitWhileBusy(); + _spi.clearRx(); + _cs = 1; +} + +void LCD_ST7735::write(uint8_t cmd, uint8_t data[], int dataLen) +{ + _cs = 0; + _ds = 0; + _spi.fastWrite(cmd); + _spi.waitWhileBusy(); + if (data != NULL & dataLen > 0) + { + _ds = 1; + for(int i = 0; i < dataLen; ++i) + { + _spi.fastWrite(data[i]); + } + _spi.waitWhileBusy(); + _ds = 0; + } + _spi.clearRx(); + _cs = 1; +} + +void LCD_ST7735::write(uint8_t cmd, uint16_t data) +{ + _cs = 0; + _ds = 0; + _spi.fastWrite(cmd); + _spi.waitWhileBusy(); + _ds = 1; + _spi.fastWrite(data >> 8); + _spi.fastWrite(data); + _spi.waitWhileBusy(); + _spi.clearRx(); + _ds = 0; + _cs = 1; +} + +void LCD_ST7735::beginBatchCommand(uint8_t cmd) +{ + _cs = 0; + _ds = 0; + _spi.fastWrite(cmd); + _spi.waitWhileBusy(); + _ds = 1; +} + +void LCD_ST7735::writeBatchData(uint8_t data) +{ + _spi.fastWrite(data); +} + +void LCD_ST7735::writeBatchData(uint8_t dataHigh, uint8_t dataLow) +{ + _spi.fastWrite(dataHigh); + _spi.fastWrite(dataLow); +} + + +void LCD_ST7735::writeBatchData(uint16_t data) +{ + _spi.fastWrite(data >> 8); + _spi.fastWrite(data); +} + +void LCD_ST7735::endBatchCommand() +{ + _spi.waitWhileBusy(); + _spi.clearRx(); + _ds = 0; + _cs = 1; +} +
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/LCD_ST7735.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/LCD_ST7735.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,353 @@ +/////////////////////////////////////////////////////////////////////////////// +// LCD_ST7735 - Driver for ST7735 LCD display controller +// Author: Chris Taylor (taylorza) +#include "mbed.h" +#include "Bitmap1bpp.h" + +#ifndef __LCD_ST7735__ +#define __LCD_ST7735__ +/** LCD_ST7735 is a simple driver for the ST7735 LCD controller. It provides basic drawing primitives sa well as text and font capabilities. + * The driver is currently hardcoded to support 65K colors using a 565 RGB pixel format. +*/ +class LCD_ST7735 +{ + public: + /** Orientation of the display */ + enum Orientation + { + /** No rotation of the display image*/ + Rotate0, + /** Rotate the display image 90 degrees */ + Rotate90, + /** Rotate the display image 180 degrees */ + Rotate180, + /** Rotate the display image 270 degrees */ + Rotate270 + }; + + /** Type of color filter of the panel */ + enum PanelColorFilter + { + /** RGB color filter panel */ + RGB = 0, + + /** BGR color filter panel */ + BGR = 8, + }; + + public: + /**Creates an instance of the LCD_ST7735 driver + * @param backlightPin pin used to control the backlight + * @param resetPin pin used to reset the display controller + * @param dsPin pin used to put the display controller into data mode + * @param mosiPin SPI channel MOSI pin + * @param misoPin SPI channel MISO pin + * @param clkPin SPI channel clock pin + * @param csPin SPI chip select pin + */ + LCD_ST7735( + PinName backlightPin, + PinName resetPin, + PinName dsPin, + PinName mosiPin, + PinName misoPin, + PinName clkPin, + PinName csPin, + PanelColorFilter colorFilter = BGR + ); + + /** Set the orientation of the display + * @param orientation Orientation of the display. + * @param flip Flips the display direction + */ + void setOrientation(Orientation orientation, bool flip); + + /** Get the width of the display given the current orientation */ + int getWidth(); + + /** Get the height of the display given the current orientation */ + int getHeight(); + + /** Control the display's backlight + * @param state true to turn the backlight on, false to turn it off + */ + void setBacklight(bool state); + + /** Set the palette used for 4 and 2 bpp bitmaps. + * @param palette array of Color565 color entries + */ + void setPalette(uint16_t *palette); + + /** Clear the screen + * @param color The color used to clear the screen. Defaults to black if not passed. + */ + void clearScreen(uint16_t color = 0x0000); + + /** Set a pixel on the display to the specified color + * @param x The X coordinate of the pixel (0..127) + * @param y The Y coordinate of the pixel (0..159) + * @param color Color to set the pixel to. + */ + void setPixel(int x, int y, uint16_t color); + + /** Draw a line on the display + * @param x1 The X coordinate of the starting point on the line + * @param y1 The Y coordinate of the starting point on the line + * @param x2 The X coordinate of the end point on the line + * @param y2 The Y coordinate of the end point on the line + * @param color The color used to draw the pixel + */ + void drawLine(int x1, int y1, int x2, int y2, uint16_t color); + + /** Draw a rectangle on the display + * @param x1 The X coordinate of the upper left corner + * @param y1 The Y coordinate of the upper left corner + * @param x2 The X coordinate of the lower right corner + * @param y2 The Y coordinate of the lower right corner + * @param color The color used to draw the rectangle + */ + void drawRect(int x1, int y1, int x2, int y2, uint16_t color); + + /** Draw a circle on the display + * @param x The X coordinate of the center of the circle + * @param y The Y coordinate of the center of the circle + * @param r The radius of the circle + * @param color The color used to draw the circle + */ + void drawCircle(int x, int y, int r, uint16_t color); + + /** Draw an ellipse on the display + * @param x The X coordinate of the center of the ellipse + * @param y The Y coordinate of the center of the ellipse + * @param rx The X radius of the ellipse + * @param ry The X radius of the ellipse + * @param color The color used to draw the ellipse + */ + void drawEllipse(int x, int y, int rx, int ry, uint16_t color); + + /** Draw a filled rectangle on the display + * @param x1 The X coordinate of the upper left corner + * @param y1 The Y coordinate of the upper left corner + * @param x2 The X coordinate of the lower right corner + * @param y2 The Y coordinate of the lower right corner + * @param fillColor The color used to fill the rectangle + */ + void fillRect(int x1, int y1, int x2, int y2, uint16_t fillColor); + + /** Draw a filled rectangle on the display + * @param x1 The X coordinate of the upper left corner + * @param y1 The Y coordinate of the upper left corner + * @param x2 The X coordinate of the lower right corner + * @param y2 The Y coordinate of the lower right corner + * @param borderColor The color used to draw the rectangle frame + * @param fillColor The color used to fill the rectangle + */ + void fillRect(int x1, int y1, int x2, int y2, uint16_t borderColor, uint16_t fillColor); + + /** Draw a filled circle on the display + * @param x The X coordinate of the center of the circle + * @param y The Y coordinate of the center of the circle + * @param borderColor The color used to draw the circumference of the circle + * @param fillColor The color used to fill the circle + */ + void fillCircle(int x, int y, int r, uint16_t borderColor, uint16_t fillColor); + + /** Draw a filled ellipse on the display + * @param x The X coordinate of the center of the ellipse + * @param y The Y coordinate of the center of the ellipse + * @param rx The X radius of the ellipse + * @param ry The X radius of the ellipse + * @param borderColor The color used to draw the circumference of the circle + * @param fillColor The color used to fill the circle + */ + void fillEllipse(int x, int y, int rx, int ry, uint16_t borderColor, uint16_t fillColor); + + /** Draw a bitmap on the screen + * @param x The X coordinate location to draw the bitmap. + * @param y The Y coordinate location to draw the bitmap. + * @param pbmp Pointer to the bitmap. + * @note The bitmap is an single dimensional uint8_t (unsigned short) array. + * The first to elements of the array indicate the width and height of the bitmap repectively. + * The rest of the entries int the array make up the pixel data for the array. + */ + void drawBitmap(int x, int y, const uint16_t *pbmp); + + /** Extracts a portion of a bitmap and draws it on the screen + * @param x The X coordinate location to draw the bitmap. + * @param y The Y coordinate location to draw the bitmap. + * @param pbmp Pointer to the bitmap. + * @param srcX X offset into the source bitmap of the portion to extract + * @param srcY Y offset into the source bitmap of the portion to extract + * @param srcWidth Width of the bitmap portion to draw + * @param srcHeight Height of the bitmap portion to draw + * @note The bitmap is an single dimensional uint8_t (unsigned short) array. + * The first to elements of the array indicate the width and height of the bitmap repectively. + * The rest of the entries int the array make up the pixel data for the array. + */ + void drawBitmap(int x, int y, const uint16_t *pbmp, int srcX, int srcY, int srcWidth, int srcHeight); + + /** Extracts a portion of a bitmap and draws it on the screen + * @param x The X coordinate location to draw the bitmap. + * @param y The Y coordinate location to draw the bitmap. + * @param bmp refence to a 1-bpp bitmap. + * @param srcX X offset into the source bitmap of the portion to extract + * @param srcY Y offset into the source bitmap of the portion to extract + * @param srcWidth Width of the bitmap portion to draw + * @param srcHeight Height of the bitmap portion to draw + * @param foregroundColor Color to use for pixels in the bitmap + * @param backgroundColor Color to use for off pixels in the bitmap + */ + void drawBitmap(int x, int y, Bitmap1bpp &bmp, int srcX, int srcY, int srcWidth, int srcHeight, uint16_t foregroundColor, uint16_t backgroundColor); + + /** Set the foreground color used to render text + * @param color Color used when drawing text to the display + * @note The color can be changed multiple times to render text in various colors on the display + */ + void setForegroundColor(uint16_t color); + + /** Set the background color used to render text + * @param color Color used when drawing background portions of the text + * @note The color can be changed multiple times to render text with various background colors on the display + */ + void setBackgroundColor(uint16_t color); + + /** Draw a string to the screen using the currently active foreground and background colors + * @param pFont Pointer to the font used to render the string to the display + * @param x The X coordinate location to draw the string. + * @param y The Y coordinate location to draw the string. + * @param pString ASCIIZ string to draw to the display. + */ + void drawString(const uint8_t *pFont, int x, int y, const char *pString); + + /** Measure the width and height of the string when rendered with the specified font + * @param pFont Pointer to the font used to measure the string + * @param pString ASCIIZ string to measure. + * @param width Reference to the variable that will contain the width + * @param height Reference to the variable that will contain the height + */ + void measureString(const uint8_t *pFont, const char *pString, uint8_t &width, uint8_t &height); + + /** Select the device on the SPI bus. + selectDevice needs to be called before accessing the screen if there are multiple devices on the SPI bus. + */ + void selectDevice(); + + protected: + void writeCommand(uint8_t cmd); + void write(uint8_t cmd, uint8_t data[], int dataLen); + void write(uint8_t cmd, uint16_t data); + + void beginBatchCommand(uint8_t cmd); + void writeBatchData(uint8_t data); + void writeBatchData(uint8_t dataHigh, uint8_t dataLow); + void writeBatchData(uint16_t data); + void endBatchCommand(); + + void clip(int x, int y, int w, int h); + void clipRect(int x1, int y1, int x2, int y2); + + private: + void drawVertLine(int x1, int y1, int y2, uint16_t color); + void drawHorizLine(int x1, int y1, int x2, uint16_t color); + void drawChar(const uint8_t *pFont, int x, int y, char c, uint8_t w, uint8_t h, uint8_t offset, uint8_t leftPad, uint8_t rightPad, uint8_t topPad, uint8_t bottomPad); + + private: + void initDisplay(); + void reset(); + + private: + int _width; + int _height; + Orientation _orientation; + PanelColorFilter _colorFilter; + bool _flip; + uint8_t _foregroundColorHigh; + uint8_t _foregroundColorLow; + uint8_t _backgroundColorHigh; + uint8_t _backgroundColorLow; + + private: + class LCDSPI : public SPI + { + public: + LCDSPI(PinName mosi, PinName miso, PinName sclk) : + SPI(mosi, miso, sclk) + { + } + + void prepareFastSPI() + { + #ifdef TARGET_LPC11U24 + aquire(); + #endif + } + + void waitWhileBusy() + { + #ifdef TARGET_LPC11U24 + while (((_spi.spi->SR) & 0x10) != 0); + #endif + } + + void fastWrite(uint8_t data) + { + #ifdef TARGET_LPC11U24 + while (((_spi.spi->SR) & 0x01) == 0); + _spi.spi->DR = data; + #else + SPI::write(data); + #endif + } + + void clearRx() + { + #ifdef TARGET_LPC11U24 + while (((_spi.spi->SR) & 0x14) != 0) + { + while (((_spi.spi->SR) & 0x04) == 0); + int data = _spi.spi->DR; + } + #endif + } + }; + + private: + DigitalOut _backlight; + DigitalOut _reset; + DigitalOut _ds; + DigitalOut _cs; + LCDSPI _spi; + + uint16_t *_palette; + + static const uint16_t DefaultPalette[]; + + protected: + static const uint8_t CMD_SLPOUT = 0x11; + static const uint8_t CMD_DISPON = 0x29; + static const uint8_t CMD_CASET = 0x2a; + static const uint8_t CMD_RASET = 0x2b; + static const uint8_t CMD_RAMWR = 0x2c; + + static const uint8_t CMD_MADCTL = 0x36; + static const uint8_t CMD_COLMOD = 0x3a; + + static const uint8_t CMD_FRMCTR1 = 0xb1; + static const uint8_t CMD_FRMCTR2 = 0xb2; + static const uint8_t CMD_FRMCTR3 = 0xb3; + static const uint8_t CMD_INVCTR = 0xb4; + + static const uint8_t CMD_PWCTR1 = 0xc0; + static const uint8_t CMD_PWCTR2 = 0xc1; + static const uint8_t CMD_PWCTR3 = 0xc2; + static const uint8_t CMD_PWCTR4 = 0xc3; + static const uint8_t CMD_PWCTR5 = 0xc4; + static const uint8_t CMD_VMCTR1 = 0xc5; + + static const uint8_t CMD_GAMCTRP1 = 0xe0; + static const uint8_t CMD_GAMCTRN1 = 0xe1; + + static const uint8_t CMD_EXTCTRL = 0xf0; +}; + +#endif // __LCD_ST7735__
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/font_IBM.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/font_IBM.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,269 @@ +/////////////////////////////////////////////////////////////////////////////// +// LCD_ST7735 - Driver for ST7735 LCD display controller +// Author: Chris Taylor (taylorza) + +#ifndef __FONT_IBM_H__ +#define __FONT_IBM_H__ + +const uint8_t font_ibm[] = +{ + 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // Width, Height, FirstChar, left padding, right padding, top padding, bottom padding + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 000 (.) + 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E, // Char 001 (.) + 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, // Char 002 (.) + 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, // Char 003 (.) + 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, // Char 004 (.) + 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0xD6, 0x10, 0x38, // Char 005 (.) + 0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x7C, 0x10, 0x38, // Char 006 (.) + 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, // Char 007 (.) + 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, // Char 008 (.) + 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, // Char 009 (.) + 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, // Char 010 (.) + 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, // Char 011 (.) + 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, // Char 012 (.) + 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0, // Char 013 (.) + 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, // Char 014 (.) + 0x18, 0xDB, 0x3C, 0xE7, 0xE7, 0x3C, 0xDB, 0x18, // Char 015 (.) + 0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00, // Char 016 (.) + 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, // Char 017 (.) + 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, // Char 018 (.) + 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, // Char 019 (.) + 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, // Char 020 (.) + 0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, // Char 021 (.) + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, // Char 022 (.) + 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, // Char 023 (.) + 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, // Char 024 (.) + 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, // Char 025 (.) + 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, // Char 026 (.) + 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, // Char 027 (.) + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, // Char 028 (.) + 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, // Char 029 (.) + 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, // Char 030 (.) + 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, // Char 031 (.) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( ) + 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00, // Char 033 (!) + 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 034 (") + 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, // Char 035 (#) + 0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00, // Char 036 ($) + 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, // Char 037 (%) + 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, // Char 038 (&) + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 039 (') + 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, // Char 040 (() + 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, // Char 041 ()) + 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, // Char 042 (*) + 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, // Char 043 (+) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, // Char 044 (,) + 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, // Char 045 (-) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, // Char 046 (.) + 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, // Char 047 (/) + 0x38, 0x6C, 0xC6, 0xD6, 0xC6, 0x6C, 0x38, 0x00, // Char 048 (0) + 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, // Char 049 (1) + 0x7C, 0xC6, 0x06, 0x1C, 0x30, 0x66, 0xFE, 0x00, // Char 050 (2) + 0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, // Char 051 (3) + 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, // Char 052 (4) + 0xFE, 0xC0, 0xC0, 0xFC, 0x06, 0xC6, 0x7C, 0x00, // Char 053 (5) + 0x38, 0x60, 0xC0, 0xFC, 0xC6, 0xC6, 0x7C, 0x00, // Char 054 (6) + 0xFE, 0xC6, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, // Char 055 (7) + 0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, // Char 056 (8) + 0x7C, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00, // Char 057 (9) + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, // Char 058 (:) + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, // Char 059 (;) + 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00, // Char 060 (<) + 0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, // Char 061 (=) + 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, // Char 062 (>) + 0x7C, 0xC6, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, // Char 063 (?) + 0x7C, 0xC6, 0xDE, 0xDE, 0xDE, 0xC0, 0x78, 0x00, // Char 064 (@) + 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, // Char 065 (A) + 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, // Char 066 (B) + 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, // Char 067 (C) + 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, // Char 068 (D) + 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, // Char 069 (E) + 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, // Char 070 (F) + 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00, // Char 071 (G) + 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, // Char 072 (H) + 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, // Char 073 (I) + 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, // Char 074 (J) + 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, // Char 075 (K) + 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, // Char 076 (L) + 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, // Char 077 (M) + 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, // Char 078 (N) + 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 079 (O) + 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, // Char 080 (P) + 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xCE, 0x7C, 0x0E, // Char 081 (Q) + 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00, // Char 082 (R) + 0x3C, 0x66, 0x30, 0x18, 0x0C, 0x66, 0x3C, 0x00, // Char 083 (S) + 0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x3C, 0x00, // Char 084 (T) + 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 085 (U) + 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, // Char 086 (V) + 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, // Char 087 (W) + 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, // Char 088 (X) + 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x3C, 0x00, // Char 089 (Y) + 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, // Char 090 (Z) + 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, // Char 091 ([) + 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, // Char 092 (\) + 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, // Char 093 (]) + 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, // Char 094 (^) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, // Char 095 (_) + 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 096 (`) + 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, // Char 097 (a) + 0xE0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0xDC, 0x00, // Char 098 (b) + 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, // Char 099 (c) + 0x1C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // Char 100 (d) + 0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, // Char 101 (e) + 0x3C, 0x66, 0x60, 0xF8, 0x60, 0x60, 0xF0, 0x00, // Char 102 (f) + 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, // Char 103 (g) + 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, // Char 104 (h) + 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, // Char 105 (i) + 0x06, 0x00, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, // Char 106 (j) + 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, // Char 107 (k) + 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, // Char 108 (l) + 0x00, 0x00, 0xEC, 0xFE, 0xD6, 0xD6, 0xD6, 0x00, // Char 109 (m) + 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x00, // Char 110 (n) + 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 111 (o) + 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0, // Char 112 (p) + 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, // Char 113 (q) + 0x00, 0x00, 0xDC, 0x76, 0x60, 0x60, 0xF0, 0x00, // Char 114 (r) + 0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, // Char 115 (s) + 0x30, 0x30, 0xFC, 0x30, 0x30, 0x36, 0x1C, 0x00, // Char 116 (t) + 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // Char 117 (u) + 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, // Char 118 (v) + 0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, // Char 119 (w) + 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, // Char 120 (x) + 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xFC, // Char 121 (y) + 0x00, 0x00, 0x7E, 0x4C, 0x18, 0x32, 0x7E, 0x00, // Char 122 (z) + 0x0E, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0E, 0x00, // Char 123 ({) + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // Char 124 (|) + 0x70, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x70, 0x00, // Char 125 (}) + 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 126 (~) + 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00, // Char 127 (.) + 0x7C, 0xC6, 0xC0, 0xC0, 0xC6, 0x7C, 0x0C, 0x78, // Char 128 (.) + 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // Char 129 (.) + 0x0C, 0x18, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, // Char 130 (.) + 0x7C, 0x82, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, // Char 131 (.) + 0xC6, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, // Char 132 (.) + 0x30, 0x18, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, // Char 133 (.) + 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, // Char 134 (.) + 0x00, 0x00, 0x7E, 0xC0, 0xC0, 0x7E, 0x0C, 0x38, // Char 135 (.) + 0x7C, 0x82, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, // Char 136 (.) + 0xC6, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, // Char 137 (.) + 0x30, 0x18, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, // Char 138 (.) + 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, // Char 139 (.) + 0x7C, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, // Char 140 (.) + 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00, // Char 141 (.) + 0xC6, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, // Char 142 (.) + 0x38, 0x6C, 0x7C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, // Char 143 (.) + 0x18, 0x30, 0xFE, 0xC0, 0xF8, 0xC0, 0xFE, 0x00, // Char 144 (.) + 0x00, 0x00, 0x7E, 0x18, 0x7E, 0xD8, 0x7E, 0x00, // Char 145 (.) + 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00, // Char 146 (.) + 0x7C, 0x82, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 147 (.) + 0xC6, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 148 (.) + 0x30, 0x18, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 149 (.) + 0x78, 0x84, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // Char 150 (.) + 0x60, 0x30, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // Char 151 (.) + 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xFC, // Char 152 (.) + 0xC6, 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x38, 0x00, // Char 153 (.) + 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 154 (.) + 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18, // Char 155 (.) + 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x66, 0xFC, 0x00, // Char 156 (.) + 0x66, 0x66, 0x3C, 0x7E, 0x18, 0x7E, 0x18, 0x18, // Char 157 (.) + 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC7, // Char 158 (.) + 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0xD8, 0x70, 0x00, // Char 159 (.) + 0x18, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, // Char 160 (.) + 0x0C, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00, // Char 161 (.) + 0x0C, 0x18, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Char 162 (.) + 0x18, 0x30, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // Char 163 (.) + 0x76, 0xDC, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x00, // Char 164 (.) + 0x76, 0xDC, 0x00, 0xE6, 0xF6, 0xDE, 0xCE, 0x00, // Char 165 (.) + 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, // Char 166 (.) + 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, // Char 167 (.) + 0x18, 0x00, 0x18, 0x18, 0x30, 0x63, 0x3E, 0x00, // Char 168 (.) + 0x00, 0x00, 0x00, 0xFE, 0xC0, 0xC0, 0x00, 0x00, // Char 169 (.) + 0x00, 0x00, 0x00, 0xFE, 0x06, 0x06, 0x00, 0x00, // Char 170 (.) + 0x63, 0xE6, 0x6C, 0x7E, 0x33, 0x66, 0xCC, 0x0F, // Char 171 (.) + 0x63, 0xE6, 0x6C, 0x7A, 0x36, 0x6A, 0xDF, 0x06, // Char 172 (.) + 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00, // Char 173 (.) + 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, // Char 174 (.) + 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, // Char 175 (.) + 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, // Char 176 (.) + 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, // Char 177 (.) + 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, // Char 178 (.) + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, // Char 179 (.) + 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, // Char 180 (.) + 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, // Char 181 (.) + 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, // Char 182 (.) + 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, // Char 183 (.) + 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, // Char 184 (.) + 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, // Char 185 (.) + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, // Char 186 (.) + 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, // Char 187 (.) + 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, // Char 188 (.) + 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, // Char 189 (.) + 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00, // Char 190 (.) + 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, // Char 191 (.) + 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, // Char 192 (.) + 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, // Char 193 (.) + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, // Char 194 (.) + 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, // Char 195 (.) + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, // Char 196 (.) + 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, // Char 197 (.) + 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, // Char 198 (.) + 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, // Char 199 (.) + 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, // Char 200 (.) + 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, // Char 201 (.) + 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, // Char 202 (.) + 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, // Char 203 (.) + 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, // Char 204 (.) + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, // Char 205 (.) + 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, // Char 206 (.) + 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, // Char 207 (.) + 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, // Char 208 (.) + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, // Char 209 (.) + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, // Char 210 (.) + 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00, // Char 211 (.) + 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, // Char 212 (.) + 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, // Char 213 (.) + 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36, // Char 214 (.) + 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, // Char 215 (.) + 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, // Char 216 (.) + 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, // Char 217 (.) + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, // Char 218 (.) + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Char 219 (.) + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, // Char 220 (.) + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, // Char 221 (.) + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // Char 222 (.) + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, // Char 223 (.) + 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00, // Char 224 (.) + 0x78, 0xCC, 0xCC, 0xD8, 0xCC, 0xC6, 0xCC, 0x00, // Char 225 (.) + 0xFE, 0xC6, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, // Char 226 (.) + 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, // Char 227 (.) + 0xFE, 0xC6, 0x60, 0x30, 0x60, 0xC6, 0xFE, 0x00, // Char 228 (.) + 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00, // Char 229 (.) + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0xC0, // Char 230 (.) + 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00, // Char 231 (.) + 0x7E, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x7E, // Char 232 (.) + 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00, // Char 233 (.) + 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00, // Char 234 (.) + 0x0E, 0x18, 0x0C, 0x3E, 0x66, 0x66, 0x3C, 0x00, // Char 235 (.) + 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00, // Char 236 (.) + 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0, // Char 237 (.) + 0x1E, 0x30, 0x60, 0x7E, 0x60, 0x30, 0x1E, 0x00, // Char 238 (.) + 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, // Char 239 (.) + 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0x00, // Char 240 (.) + 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00, // Char 241 (.) + 0x30, 0x18, 0x0C, 0x18, 0x30, 0x00, 0x7E, 0x00, // Char 242 (.) + 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x00, 0x7E, 0x00, // Char 243 (.) + 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, // Char 244 (.) + 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70, // Char 245 (.) + 0x00, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x00, 0x00, // Char 246 (.) + 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00, // Char 247 (.) + 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, // Char 248 (.) + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, // Char 249 (.) + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, // Char 250 (.) + 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C, // Char 251 (.) + 0x6C, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, // Char 252 (.) + 0x78, 0x0C, 0x18, 0x30, 0x7C, 0x00, 0x00, 0x00, // Char 253 (.) + 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, // Char 254 (.) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Char 255 (.) +}; + +#endif // __FONT_IBM_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f LCD_ST7735/font_OEM.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_ST7735/font_OEM.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// LCD_ST7735 - Driver for ST7735 LCD display controller +// Author: Chris Taylor (taylorza) +// Font: Standard LCD font by GHI Electronics + +#ifndef __FONT_OEM_H__ +#define __FONT_OEM_H__ + +const uint8_t font_oem[] = +{ + 0x06, 0x07, 0x20, 0x00, 0x00, 0x00, 0x01, // Width, Height, FirstChar, left padding, right padding, top padding, bottom padding + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Space */ + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, /* ! */ + 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, /* " */ + 0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50, /* # */ + 0x20, 0x78, 0xa0, 0x70, 0x28, 0xf0, 0x20, /* $ */ + 0xc0, 0xc8, 0x10, 0x20, 0x40, 0x98, 0x18, /* % */ + 0x60, 0x90, 0xa0, 0x40, 0xa0, 0x98, 0x60, /* & */ + 0x60, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, /* ' */ + 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, /* ( */ + 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, /* ) */ + 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, /* * */ + 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, /* + */ + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, /* , */ + 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, /* - */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, /* . */ + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, /* / */ + 0x70, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x70, /* 0 */ + 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, /* 1 */ + 0x70, 0x88, 0x08, 0x10, 0x20, 0x40, 0xf8, /* 2 */ + 0xf8, 0x10, 0x20, 0x10, 0x08, 0x88, 0x70, /* 3 */ + 0x10, 0x30, 0x50, 0x90, 0xf8, 0x10, 0x10, /* 4 */ + 0xf8, 0x80, 0xf0, 0x08, 0x08, 0x88, 0x70, /* 5 */ + 0x30, 0x40, 0x80, 0xf0, 0x88, 0x88, 0x70, /* 6 */ + 0xf8, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40, /* 7 */ + 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, /* 8 */ + 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60, /* 9 */ + 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, /* : */ + 0x00, 0x60, 0x60, 0x00, 0x60, 0x20, 0x40, /* ; */ + 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, /* < */ + 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, /* = */ + 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, /* > */ + 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20, /* ? */ + 0x70, 0x88, 0xb8, 0xa8, 0xb8, 0x80, 0x70, /* @ */ + 0x70, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, /* A */ + 0xf0, 0x88, 0x88, 0xf0, 0x88, 0x88, 0xf0, /* B */ + 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70, /* C */ + 0xe0, 0x90, 0x88, 0x88, 0x88, 0x90, 0xe0, /* D */ + 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0xf8, /* E */ + 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, /* F */ + 0x70, 0x88, 0x80, 0xb8, 0x88, 0x88, 0x78, /* G */ + 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, /* H */ + 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, /* I */ + 0x38, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, /* J */ + 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88, /* K */ + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, /* L */ + 0x88, 0xd8, 0xa8, 0xa8, 0x88, 0x88, 0x88, /* M */ + 0x88, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, /* N */ + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, /* O */ + 0xf0, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, /* P */ + 0x70, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, /* Q */ + 0xf0, 0x88, 0x88, 0xf0, 0xa0, 0x90, 0x88, /* R */ + 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, /* S */ + 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* T */ + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, /* U */ + 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, /* V */ + 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xa8, 0x50, /* W */ + 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, /* X */ + 0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, /* Y */ + 0xf8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xf8, /* Z */ + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, /* [ */ + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, /* \ */ + 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, /* ] */ + 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, /* ^ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, /* _ */ + 0x30, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, /* ` */ + 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, /* a */ + 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0xf0, /* b */ + 0x00, 0x00, 0x78, 0x80, 0x80, 0x80, 0x78, /* c */ + 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78, /* d */ + 0x00, 0x00, 0x70, 0x88, 0xf8, 0x80, 0x70, /* e */ + 0x18, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, /* f */ + 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x70, /* g */ + 0x80, 0x80, 0xb0, 0xc8, 0x88, 0x88, 0x88, /* h */ + 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, /* i */ + 0x10, 0x00, 0x30, 0x10, 0x10, 0x90, 0x60, /* j */ + 0x80, 0x80, 0x90, 0xa0, 0xc0, 0xa0, 0x90, /* k */ + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, /* l */ + 0x00, 0x00, 0xf0, 0xa8, 0xa8, 0xa8, 0xa8, /* m */ + 0x00, 0x00, 0xb0, 0xc8, 0x88, 0x88, 0x88, /* n */ + 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, /* o */ + 0x00, 0x00, 0xf0, 0x88, 0xf0, 0x80, 0x80, /* p */ + 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x08, /* q */ + 0x00, 0x00, 0xb0, 0xc0, 0x80, 0x80, 0x80, /* r */ + 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xf0, /* s */ + 0x20, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x18, /* t */ + 0x00, 0x00, 0x88, 0x88, 0x88, 0x98, 0x68, /* u */ + 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, /* v */ + 0x00, 0x00, 0x88, 0x88, 0xa8, 0xa8, 0x50, /* w */ + 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, /* x */ + 0x00, 0x00, 0x88, 0x88, 0x78, 0x08, 0x70, /* y */ + 0x00, 0x00, 0xf8, 0x10, 0x20, 0x40, 0xf8, /* z */ + 0x30, 0x40, 0x40, 0x80, 0x40, 0x40, 0x30, /* { */ + 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, /* | */ + 0x60, 0x10, 0x10, 0x08, 0x10, 0x10, 0x60, /* } */ + 0x00, 0x20, 0x10, 0xf8, 0x10, 0x20, 0x00, /* ~ */ +}; +#endif // __FONT_OEM_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f MissileGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MissileGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,29 @@ +#ifndef __MISSILEGAME_H__ +#define __MISSILEGAME_H__ +static const uint8_t MissileGame[] = +{ + 0x12,0x19,0x4d,0x49,0x53,0x53,0x49,0x4c, + 0x45,0x20,0x62,0x79,0x20,0x44,0x61,0x76, + 0x69,0x64,0x20,0x57,0x49,0x4e,0x54,0x45, + 0x52,0x6c,0x0c,0x60,0x00,0x61,0x00,0x65, + 0x08,0x66,0x0a,0x67,0x00,0x6e,0x01,0xa2, + 0xad,0xd0,0x14,0x70,0x08,0x30,0x40,0x12, + 0x29,0x60,0x00,0x61,0x1c,0xa2,0xb0,0xd0, + 0x14,0xa2,0xb0,0xd0,0x14,0x3e,0x01,0x12, + 0x49,0x70,0x04,0x40,0x38,0x6e,0x00,0x12, + 0x4f,0x70,0xfc,0x40,0x00,0x6e,0x01,0xd0, + 0x14,0xfc,0x15,0xfb,0x07,0x3b,0x00,0x12, + 0x53,0x62,0x08,0xe2,0x9e,0x12,0x95,0x3c, + 0x00,0x7c,0xfe,0x63,0x1b,0x82,0x00,0xa2, + 0xb0,0xd2,0x31,0x64,0x00,0xd2,0x31,0x73, + 0xff,0xd2,0x31,0x3f,0x00,0x64,0x01,0x33, + 0x03,0x12,0x6d,0xd2,0x31,0x34,0x01,0x12, + 0x91,0x77,0x05,0x75,0xff,0x82,0x00,0x63, + 0x00,0xa2,0xad,0xd2,0x34,0x45,0x00,0x12, + 0x97,0x76,0xff,0x36,0x00,0x12,0x39,0xa2, + 0xb4,0xf7,0x33,0xf2,0x65,0x63,0x1b,0x64, + 0x0d,0xf1,0x29,0xd3,0x45,0x73,0x05,0xf2, + 0x29,0xd3,0x45,0x12,0xab,0x10,0x38,0x38, + 0x10,0x38,0x7c,0xfe, +}; +#endif //__MISSILEGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f PongGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PongGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,37 @@ +#ifndef __PONGGAME_H__ +#define __PONGGAME_H__ +static const uint8_t PongGame[] = +{ + 0x6a,0x02,0x6b,0x0c,0x6c,0x3f,0x6d,0x0c, + 0xa2,0xea,0xda,0xb6,0xdc,0xd6,0x6e,0x00, + 0x22,0xd4,0x66,0x03,0x68,0x02,0x60,0x60, + 0xf0,0x15,0xf0,0x07,0x30,0x00,0x12,0x1a, + 0xc7,0x17,0x77,0x08,0x69,0xff,0xa2,0xf0, + 0xd6,0x71,0xa2,0xea,0xda,0xb6,0xdc,0xd6, + 0x60,0x01,0xe0,0xa1,0x7b,0xfe,0x60,0x04, + 0xe0,0xa1,0x7b,0x02,0x60,0x1f,0x8b,0x02, + 0xda,0xb6,0x8d,0x70,0xc0,0x0a,0x7d,0xfe, + 0x40,0x00,0x7d,0x02,0x60,0x00,0x60,0x1f, + 0x8d,0x02,0xdc,0xd6,0xa2,0xf0,0xd6,0x71, + 0x86,0x84,0x87,0x94,0x60,0x3f,0x86,0x02, + 0x61,0x1f,0x87,0x12,0x46,0x02,0x12,0x78, + 0x46,0x3f,0x12,0x82,0x47,0x1f,0x69,0xff, + 0x47,0x00,0x69,0x01,0xd6,0x71,0x12,0x2a, + 0x68,0x02,0x63,0x01,0x80,0x70,0x80,0xb5, + 0x12,0x8a,0x68,0xfe,0x63,0x0a,0x80,0x70, + 0x80,0xd5,0x3f,0x01,0x12,0xa2,0x61,0x02, + 0x80,0x15,0x3f,0x01,0x12,0xba,0x80,0x15, + 0x3f,0x01,0x12,0xc8,0x80,0x15,0x3f,0x01, + 0x12,0xc2,0x60,0x20,0xf0,0x18,0x22,0xd4, + 0x8e,0x34,0x22,0xd4,0x66,0x3e,0x33,0x01, + 0x66,0x03,0x68,0xfe,0x33,0x01,0x68,0x02, + 0x12,0x16,0x79,0xff,0x49,0xfe,0x69,0xff, + 0x12,0xc8,0x79,0x01,0x49,0x02,0x69,0x01, + 0x60,0x04,0xf0,0x18,0x76,0x01,0x46,0x40, + 0x76,0xfe,0x12,0x6c,0xa2,0xf2,0xfe,0x33, + 0xf2,0x65,0xf1,0x29,0x64,0x14,0x65,0x00, + 0xd4,0x55,0x74,0x15,0xf2,0x29,0xd4,0x55, + 0x00,0xee,0x80,0x80,0x80,0x80,0x80,0x80, + 0x80,0x00,0x00,0x00,0x00,0x00, +}; +#endif //__PONGGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f SpaceInvadersGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SpaceInvadersGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,169 @@ +#ifndef __SPACEINVADERSGAME_H__ +#define __SPACEINVADERSGAME_H__ +static const uint8_t SpaceInvadersGame[] = +{ + 0x12,0x25,0x53,0x50,0x41,0x43,0x45,0x20, + 0x49,0x4e,0x56,0x41,0x44,0x45,0x52,0x53, + 0x20,0x30,0x2e,0x39,0x31,0x20,0x42,0x79, + 0x20,0x44,0x61,0x76,0x69,0x64,0x20,0x57, + 0x49,0x4e,0x54,0x45,0x52,0x60,0x00,0x61, + 0x00,0x62,0x08,0xa3,0xdd,0xd0,0x18,0x71, + 0x08,0xf2,0x1e,0x31,0x20,0x12,0x2d,0x70, + 0x08,0x61,0x00,0x30,0x40,0x12,0x2d,0x69, + 0x05,0x6c,0x15,0x6e,0x00,0x23,0x91,0x60, + 0x0a,0xf0,0x15,0xf0,0x07,0x30,0x00,0x12, + 0x4b,0x23,0x91,0x7e,0x01,0x12,0x45,0x66, + 0x00,0x68,0x1c,0x69,0x00,0x6a,0x04,0x6b, + 0x0a,0x6c,0x04,0x6d,0x3c,0x6e,0x0f,0x00, + 0xe0,0x23,0x75,0x23,0x51,0xfd,0x15,0x60, + 0x04,0xe0,0x9e,0x12,0x7d,0x23,0x75,0x38, + 0x00,0x78,0xff,0x23,0x75,0x60,0x06,0xe0, + 0x9e,0x12,0x8b,0x23,0x75,0x38,0x39,0x78, + 0x01,0x23,0x75,0x36,0x00,0x12,0x9f,0x60, + 0x05,0xe0,0x9e,0x12,0xe9,0x66,0x01,0x65, + 0x1b,0x84,0x80,0xa3,0xd9,0xd4,0x51,0xa3, + 0xd9,0xd4,0x51,0x75,0xff,0x35,0xff,0x12, + 0xad,0x66,0x00,0x12,0xe9,0xd4,0x51,0x3f, + 0x01,0x12,0xe9,0xd4,0x51,0x66,0x00,0x83, + 0x40,0x73,0x03,0x83,0xb5,0x62,0xf8,0x83, + 0x22,0x62,0x08,0x33,0x00,0x12,0xc9,0x23, + 0x7d,0x82,0x06,0x43,0x08,0x12,0xd3,0x33, + 0x10,0x12,0xd5,0x23,0x7d,0x82,0x06,0x33, + 0x18,0x12,0xdd,0x23,0x7d,0x82,0x06,0x43, + 0x20,0x12,0xe7,0x33,0x28,0x12,0xe9,0x23, + 0x7d,0x3e,0x00,0x13,0x07,0x79,0x06,0x49, + 0x18,0x69,0x00,0x6a,0x04,0x6b,0x0a,0x6c, + 0x04,0x7d,0xf4,0x6e,0x0f,0x00,0xe0,0x23, + 0x51,0x23,0x75,0xfd,0x15,0x12,0x6f,0xf7, + 0x07,0x37,0x00,0x12,0x6f,0xfd,0x15,0x23, + 0x51,0x8b,0xa4,0x3b,0x12,0x13,0x1b,0x7c, + 0x02,0x6a,0xfc,0x3b,0x02,0x13,0x23,0x7c, + 0x02,0x6a,0x04,0x23,0x51,0x3c,0x18,0x12, + 0x6f,0x00,0xe0,0xa4,0xdd,0x60,0x14,0x61, + 0x08,0x62,0x0f,0xd0,0x1f,0x70,0x08,0xf2, + 0x1e,0x30,0x2c,0x13,0x33,0x60,0xff,0xf0, + 0x15,0xf0,0x07,0x30,0x00,0x13,0x41,0xf0, + 0x0a,0x00,0xe0,0xa7,0x06,0xfe,0x65,0x12, + 0x25,0xa3,0xc1,0xf9,0x1e,0x61,0x08,0x23, + 0x69,0x81,0x06,0x23,0x69,0x81,0x06,0x23, + 0x69,0x81,0x06,0x23,0x69,0x7b,0xd0,0x00, + 0xee,0x80,0xe0,0x80,0x12,0x30,0x00,0xdb, + 0xc6,0x7b,0x0c,0x00,0xee,0xa3,0xd9,0x60, + 0x1c,0xd8,0x04,0x00,0xee,0x23,0x51,0x8e, + 0x23,0x23,0x51,0x60,0x05,0xf0,0x18,0xf0, + 0x15,0xf0,0x07,0x30,0x00,0x13,0x89,0x00, + 0xee,0x6a,0x00,0x8d,0xe0,0x6b,0x04,0xe9, + 0xa1,0x12,0x57,0xa6,0x0c,0xfd,0x1e,0xf0, + 0x65,0x30,0xff,0x13,0xaf,0x6a,0x00,0x6b, + 0x04,0x6d,0x01,0x6e,0x01,0x13,0x97,0xa5, + 0x0a,0xf0,0x1e,0xdb,0xc6,0x7b,0x08,0x7d, + 0x01,0x7a,0x01,0x3a,0x07,0x13,0x97,0x00, + 0xee,0x3c,0x7e,0xff,0xff,0x99,0x99,0x7e, + 0xff,0xff,0x24,0x24,0xe7,0x7e,0xff,0x3c, + 0x3c,0x7e,0xdb,0x81,0x42,0x3c,0x7e,0xff, + 0xdb,0x10,0x38,0x7c,0xfe,0x00,0x00,0x7f, + 0x00,0x3f,0x00,0x7f,0x00,0x00,0x00,0x01, + 0x01,0x01,0x03,0x03,0x03,0x03,0x00,0x00, + 0x3f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x3f,0x08,0x08,0xff,0x00,0x00,0xfe, + 0x00,0xfc,0x00,0xfe,0x00,0x00,0x00,0x7e, + 0x42,0x42,0x62,0x62,0x62,0x62,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0xff,0x00,0x7d,0x00, + 0x41,0x7d,0x05,0x7d,0x7d,0x00,0x00,0xc2, + 0xc2,0xc6,0x44,0x6c,0x28,0x38,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0xff,0x00,0xf7,0x10, + 0x14,0xf7,0xf7,0x04,0x04,0x00,0x00,0x7c, + 0x44,0xfe,0xc2,0xc2,0xc2,0xc2,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0xff,0x00,0xef,0x20, + 0x28,0xe8,0xe8,0x2f,0x2f,0x00,0x00,0xf9, + 0x85,0xc5,0xc5,0xc5,0xc5,0xf9,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0xff,0x00,0xbe,0x00, + 0x20,0x30,0x20,0xbe,0xbe,0x00,0x00,0xf7, + 0x04,0xe7,0x85,0x85,0x84,0xf4,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0x7f, + 0x00,0x3f,0x00,0x7f,0x00,0x00,0x00,0xef, + 0x28,0xef,0x00,0xe0,0x60,0x6f,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xfe, + 0x00,0xfc,0x00,0xfe,0x00,0x00,0x00,0xc0, + 0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00, + 0xfc,0x04,0x04,0x04,0x04,0x04,0x04,0x04, + 0x04,0xfc,0x10,0x10,0xff,0xf9,0x81,0xb9, + 0x8b,0x9a,0x9a,0xfa,0x00,0xfa,0x8a,0x9a, + 0x9a,0x9b,0x99,0xf8,0xe6,0x25,0x25,0xf4, + 0x34,0x34,0x34,0x00,0x17,0x14,0x34,0x37, + 0x36,0x26,0xc7,0xdf,0x50,0x50,0x5c,0xd8, + 0xd8,0xdf,0x00,0xdf,0x11,0x1f,0x12,0x1b, + 0x19,0xd9,0x7c,0x44,0xfe,0x86,0x86,0x86, + 0xfc,0x84,0xfe,0x82,0x82,0xfe,0xfe,0x80, + 0xc0,0xc0,0xc0,0xfe,0xfc,0x82,0xc2,0xc2, + 0xc2,0xfc,0xfe,0x80,0xf8,0xc0,0xc0,0xfe, + 0xfe,0x80,0xf0,0xc0,0xc0,0xc0,0xfe,0x80, + 0xbe,0x86,0x86,0xfe,0x86,0x86,0xfe,0x86, + 0x86,0x86,0x10,0x10,0x10,0x10,0x10,0x10, + 0x18,0x18,0x18,0x48,0x48,0x78,0x9c,0x90, + 0xb0,0xc0,0xb0,0x9c,0x80,0x80,0xc0,0xc0, + 0xc0,0xfe,0xee,0x92,0x92,0x86,0x86,0x86, + 0xfe,0x82,0x86,0x86,0x86,0x86,0x7c,0x82, + 0x86,0x86,0x86,0x7c,0xfe,0x82,0xfe,0xc0, + 0xc0,0xc0,0x7c,0x82,0xc2,0xca,0xc4,0x7a, + 0xfe,0x86,0xfe,0x90,0x9c,0x84,0xfe,0xc0, + 0xfe,0x02,0x02,0xfe,0xfe,0x10,0x30,0x30, + 0x30,0x30,0x82,0x82,0xc2,0xc2,0xc2,0xfe, + 0x82,0x82,0x82,0xee,0x38,0x10,0x86,0x86, + 0x96,0x92,0x92,0xee,0x82,0x44,0x38,0x38, + 0x44,0x82,0x82,0x82,0xfe,0x30,0x30,0x30, + 0xfe,0x02,0x1e,0xf0,0x80,0xfe,0x00,0x00, + 0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x60, + 0x60,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x18,0x18,0x18,0x18,0x00,0x18,0x7c,0xc6, + 0x0c,0x18,0x00,0x18,0x00,0x00,0xfe,0xfe, + 0x00,0x00,0xfe,0x82,0x86,0x86,0x86,0xfe, + 0x08,0x08,0x08,0x18,0x18,0x18,0xfe,0x02, + 0xfe,0xc0,0xc0,0xfe,0xfe,0x02,0x1e,0x06, + 0x06,0xfe,0x84,0xc4,0xc4,0xfe,0x04,0x04, + 0xfe,0x80,0xfe,0x06,0x06,0xfe,0xc0,0xc0, + 0xc0,0xfe,0x82,0xfe,0xfe,0x02,0x02,0x06, + 0x06,0x06,0x7c,0x44,0xfe,0x86,0x86,0xfe, + 0xfe,0x82,0xfe,0x06,0x06,0x06,0x44,0xfe, + 0x44,0x44,0xfe,0x44,0xa8,0xa8,0xa8,0xa8, + 0xa8,0xa8,0xa8,0x6c,0x5a,0x00,0x0c,0x18, + 0xa8,0x30,0x4e,0x7e,0x00,0x12,0x18,0x66, + 0x6c,0xa8,0x5a,0x66,0x54,0x24,0x66,0x00, + 0x48,0x48,0x18,0x12,0xa8,0x06,0x90,0xa8, + 0x12,0x00,0x7e,0x30,0x12,0xa8,0x84,0x30, + 0x4e,0x72,0x18,0x66,0xa8,0xa8,0xa8,0xa8, + 0xa8,0xa8,0x90,0x54,0x78,0xa8,0x48,0x78, + 0x6c,0x72,0xa8,0x12,0x18,0x6c,0x72,0x66, + 0x54,0x90,0xa8,0x72,0x2a,0x18,0xa8,0x30, + 0x4e,0x7e,0x00,0x12,0x18,0x66,0x6c,0xa8, + 0x72,0x54,0xa8,0x5a,0x66,0x18,0x7e,0x18, + 0x4e,0x72,0xa8,0x72,0x2a,0x18,0x30,0x66, + 0xa8,0x30,0x4e,0x7e,0x00,0x6c,0x30,0x54, + 0x4e,0x9c,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8, + 0xa8,0x48,0x54,0x7e,0x18,0xa8,0x90,0x54, + 0x78,0x66,0xa8,0x6c,0x2a,0x30,0x5a,0xa8, + 0x84,0x30,0x72,0x2a,0xa8,0xd8,0xa8,0x00, + 0x4e,0x12,0xa8,0xe4,0xa2,0xa8,0x00,0x4e, + 0x12,0xa8,0x6c,0x2a,0x54,0x54,0x72,0xa8, + 0x84,0x30,0x72,0x2a,0xa8,0xde,0x9c,0xa8, + 0x72,0x2a,0x18,0xa8,0x0c,0x54,0x48,0x5a, + 0x78,0x72,0x18,0x66,0xa8,0x66,0x18,0x5a, + 0x54,0x66,0x72,0x6c,0xa8,0x72,0x2a,0x00, + 0x72,0xa8,0x72,0x2a,0x18,0xa8,0x30,0x4e, + 0x7e,0x00,0x12,0x18,0x66,0x6c,0xa8,0x00, + 0x66,0x18,0xa8,0x30,0x4e,0x0c,0x66,0x18, + 0x00,0x6c,0x30,0x4e,0x24,0xa8,0x72,0x2a, + 0x18,0x30,0x66,0xa8,0x1e,0x54,0x66,0x0c, + 0x18,0x9c,0xa8,0x24,0x54,0x54,0x12,0xa8, + 0x42,0x78,0x0c,0x3c,0xa8,0xae,0xa8,0xa8, + 0xa8,0xa8,0xa8,0xa8,0xa8,0xff,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, +}; +#endif //__SPACEINVADERSGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f TetrisGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TetrisGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,68 @@ +#ifndef __TETRISGAME_H__ +#define __TETRISGAME_H__ +static const uint8_t TetrisGame[] = +{ + 0xa2,0xb4,0x23,0xe6,0x22,0xb6,0x70,0x01, + 0xd0,0x11,0x30,0x25,0x12,0x06,0x71,0xff, + 0xd0,0x11,0x60,0x1a,0xd0,0x11,0x60,0x25, + 0x31,0x00,0x12,0x0e,0xc4,0x70,0x44,0x70, + 0x12,0x1c,0xc3,0x03,0x60,0x1e,0x61,0x03, + 0x22,0x5c,0xf5,0x15,0xd0,0x14,0x3f,0x01, + 0x12,0x3c,0xd0,0x14,0x71,0xff,0xd0,0x14, + 0x23,0x40,0x12,0x1c,0xe7,0xa1,0x22,0x72, + 0xe8,0xa1,0x22,0x84,0xe9,0xa1,0x22,0x96, + 0xe2,0x9e,0x12,0x50,0x66,0x00,0xf6,0x15, + 0xf6,0x07,0x36,0x00,0x12,0x3c,0xd0,0x14, + 0x71,0x01,0x12,0x2a,0xa2,0xc4,0xf4,0x1e, + 0x66,0x00,0x43,0x01,0x66,0x04,0x43,0x02, + 0x66,0x08,0x43,0x03,0x66,0x0c,0xf6,0x1e, + 0x00,0xee,0xd0,0x14,0x70,0xff,0x23,0x34, + 0x3f,0x01,0x00,0xee,0xd0,0x14,0x70,0x01, + 0x23,0x34,0x00,0xee,0xd0,0x14,0x70,0x01, + 0x23,0x34,0x3f,0x01,0x00,0xee,0xd0,0x14, + 0x70,0xff,0x23,0x34,0x00,0xee,0xd0,0x14, + 0x73,0x01,0x43,0x04,0x63,0x00,0x22,0x5c, + 0x23,0x34,0x3f,0x01,0x00,0xee,0xd0,0x14, + 0x73,0xff,0x43,0xff,0x63,0x03,0x22,0x5c, + 0x23,0x34,0x00,0xee,0x80,0x00,0x67,0x05, + 0x68,0x06,0x69,0x04,0x61,0x1f,0x65,0x10, + 0x62,0x07,0x00,0xee,0x40,0xe0,0x00,0x00, + 0x40,0xc0,0x40,0x00,0x00,0xe0,0x40,0x00, + 0x40,0x60,0x40,0x00,0x40,0x40,0x60,0x00, + 0x20,0xe0,0x00,0x00,0xc0,0x40,0x40,0x00, + 0x00,0xe0,0x80,0x00,0x40,0x40,0xc0,0x00, + 0x00,0xe0,0x20,0x00,0x60,0x40,0x40,0x00, + 0x80,0xe0,0x00,0x00,0x40,0xc0,0x80,0x00, + 0xc0,0x60,0x00,0x00,0x40,0xc0,0x80,0x00, + 0xc0,0x60,0x00,0x00,0x80,0xc0,0x40,0x00, + 0x00,0x60,0xc0,0x00,0x80,0xc0,0x40,0x00, + 0x00,0x60,0xc0,0x00,0xc0,0xc0,0x00,0x00, + 0xc0,0xc0,0x00,0x00,0xc0,0xc0,0x00,0x00, + 0xc0,0xc0,0x00,0x00,0x40,0x40,0x40,0x40, + 0x00,0xf0,0x00,0x00,0x40,0x40,0x40,0x40, + 0x00,0xf0,0x00,0x00,0xd0,0x14,0x66,0x35, + 0x76,0xff,0x36,0x00,0x13,0x38,0x00,0xee, + 0xa2,0xb4,0x8c,0x10,0x3c,0x1e,0x7c,0x01, + 0x3c,0x1e,0x7c,0x01,0x3c,0x1e,0x7c,0x01, + 0x23,0x5e,0x4b,0x0a,0x23,0x72,0x91,0xc0, + 0x00,0xee,0x71,0x01,0x13,0x50,0x60,0x1b, + 0x6b,0x00,0xd0,0x11,0x3f,0x00,0x7b,0x01, + 0xd0,0x11,0x70,0x01,0x30,0x25,0x13,0x62, + 0x00,0xee,0x60,0x1b,0xd0,0x11,0x70,0x01, + 0x30,0x25,0x13,0x74,0x8e,0x10,0x8d,0xe0, + 0x7e,0xff,0x60,0x1b,0x6b,0x00,0xd0,0xe1, + 0x3f,0x00,0x13,0x90,0xd0,0xe1,0x13,0x94, + 0xd0,0xd1,0x7b,0x01,0x70,0x01,0x30,0x25, + 0x13,0x86,0x4b,0x00,0x13,0xa6,0x7d,0xff, + 0x7e,0xff,0x3d,0x01,0x13,0x82,0x23,0xc0, + 0x3f,0x01,0x23,0xc0,0x7a,0x01,0x23,0xc0, + 0x80,0xa0,0x6d,0x07,0x80,0xd2,0x40,0x04, + 0x75,0xfe,0x45,0x02,0x65,0x04,0x00,0xee, + 0xa7,0x00,0xf2,0x55,0xa8,0x04,0xfa,0x33, + 0xf2,0x65,0xf0,0x29,0x6d,0x32,0x6e,0x00, + 0xdd,0xe5,0x7d,0x05,0xf1,0x29,0xdd,0xe5, + 0x7d,0x05,0xf2,0x29,0xdd,0xe5,0xa7,0x00, + 0xf2,0x65,0xa2,0xb4,0x00,0xee,0x6a,0x00, + 0x60,0x19,0x00,0xee,0x37,0x23, +}; +#endif //__TETRISGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f UfoGame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UfoGame.h Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,34 @@ +#ifndef __UFOGAME_H__ +#define __UFOGAME_H__ +static const uint8_t UfoGame[] = +{ + 0xa2,0xcd,0x69,0x38,0x6a,0x08,0xd9,0xa3, + 0xa2,0xd0,0x6b,0x00,0x6c,0x03,0xdb,0xc3, + 0xa2,0xd6,0x64,0x1d,0x65,0x1f,0xd4,0x51, + 0x67,0x00,0x68,0x0f,0x22,0xa2,0x22,0xac, + 0x48,0x00,0x12,0x22,0x64,0x1e,0x65,0x1c, + 0xa2,0xd3,0xd4,0x53,0x6e,0x00,0x66,0x80, + 0x6d,0x04,0xed,0xa1,0x66,0xff,0x6d,0x05, + 0xed,0xa1,0x66,0x00,0x6d,0x06,0xed,0xa1, + 0x66,0x01,0x36,0x80,0x22,0xd8,0xa2,0xd0, + 0xdb,0xc3,0xcd,0x01,0x8b,0xd4,0xdb,0xc3, + 0x3f,0x00,0x12,0x92,0xa2,0xcd,0xd9,0xa3, + 0xcd,0x01,0x3d,0x00,0x6d,0xff,0x79,0xfe, + 0xd9,0xa3,0x3f,0x00,0x12,0x8c,0x4e,0x00, + 0x12,0x2e,0xa2,0xd3,0xd4,0x53,0x45,0x00, + 0x12,0x86,0x75,0xff,0x84,0x64,0xd4,0x53, + 0x3f,0x01,0x12,0x46,0x6d,0x08,0x8d,0x52, + 0x4d,0x08,0x12,0x8c,0x12,0x92,0x22,0xac, + 0x78,0xff,0x12,0x1e,0x22,0xa2,0x77,0x05, + 0x12,0x96,0x22,0xa2,0x77,0x0f,0x22,0xa2, + 0x6d,0x03,0xfd,0x18,0xa2,0xd3,0xd4,0x53, + 0x12,0x86,0xa2,0xf8,0xf7,0x33,0x63,0x00, + 0x22,0xb6,0x00,0xee,0xa2,0xf8,0xf8,0x33, + 0x63,0x32,0x22,0xb6,0x00,0xee,0x6d,0x1b, + 0xf2,0x65,0xf0,0x29,0xd3,0xd5,0x73,0x05, + 0xf1,0x29,0xd3,0xd5,0x73,0x05,0xf2,0x29, + 0xd3,0xd5,0x00,0xee,0x01,0x7c,0xfe,0x7c, + 0x60,0xf0,0x60,0x40,0xe0,0xa0,0xf8,0xd4, + 0x6e,0x01,0x6d,0x10,0xfd,0x18,0x00,0xee, +}; +#endif //__UFOGAME_H__ \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,144 @@ +#include "mbed.h" +#include "LCD_ST7735.h" +#include "Color565.h" +#include "font_OEM.h" +#include "GameInput.h" +#include "Chip8Emulator.h" + +#include "SpaceInvadersGame.h" +#include "BrixGame.h" +#include "BlinkyGame.h" +#include "PongGame.h" +#include "TetrisGame.h" +#include "MissileGame.h" +#include "UfoGame.h" + +LCD_ST7735 screen(P0_19, P0_20, P0_7, P0_21, P0_22, P1_15, P0_2, LCD_ST7735::RGB); + + +void menu(const uint8_t **program, uint16_t &programSize, uint8_t &leftKey, uint8_t &rightKey, uint8_t &upKey, uint8_t &downKey, uint8_t &fireKey, uint8_t &startKey); +void drawString(const uint8_t *pFont, int y, const char *string); + +main() +{ + screen.setOrientation(LCD_ST7735::Rotate270, false); + + const uint8_t *program; + uint16_t programSize; + uint8_t leftKey; + uint8_t rightKey; + uint8_t upKey; + uint8_t downKey; + uint8_t fireKey; + uint8_t startKey; + + menu(&program, programSize, leftKey, rightKey, upKey, downKey, fireKey, startKey); + Chip8Emulator emulator(screen, program, programSize, leftKey, rightKey, upKey, downKey, fireKey, startKey); + emulator.run(); +} + +struct MenuItem +{ + const char *Text; + const uint8_t *Program; + const uint16_t ProgramSize; + const uint8_t LeftKey; + const uint8_t RightKey; + const uint8_t UpKey; + const uint8_t DownKey; + const uint8_t FireKey; + const uint8_t StartKey; + + MenuItem(const char *text, const uint8_t *program, const uint16_t programSize, uint8_t leftKey, uint8_t rightKey, uint8_t upKey, uint8_t downKey, uint8_t fireKey, uint8_t startKey) : + Text(text), + Program(program), + ProgramSize(programSize), + LeftKey(leftKey), + RightKey(rightKey), + UpKey(upKey), + DownKey(downKey), + FireKey(fireKey), + StartKey(startKey) + { + + } +}; + +MenuItem menuItems[] = +{ + MenuItem("Invaders", SpaceInvadersGame, sizeof(SpaceInvadersGame), 4, 6, 2, 8, 5, 15), + MenuItem("Brix", BrixGame, sizeof(BrixGame), 4, 6, 2, 8, 5, 15), + MenuItem("Blinky", BlinkyGame, sizeof(BlinkyGame), 7, 8, 3, 6, 1, 15), + MenuItem("Tetris", TetrisGame, sizeof(TetrisGame), 5, 6, 4, 0, 0, 0), + MenuItem("Pong", PongGame, sizeof(PongGame), 0, 0, 1, 4, 0, 0), + MenuItem("Missile", MissileGame, sizeof(MissileGame), 8, 8, 8, 8, 8, 8), + MenuItem("UFO", UfoGame, sizeof(UfoGame), 4, 6, 5, 8, 5, 15), +}; + +void drawString(const uint8_t *pFont, int y, const char *string) +{ + uint8_t w; + uint8_t h; + screen.measureString(pFont, string, w, h); + screen.drawString(pFont, (screen.getWidth() - w) / 2, y, string); +} + +void menu(const uint8_t **program, uint16_t &programSize, uint8_t &leftKey, uint8_t &rightKey, uint8_t &upKey, uint8_t &downKey, uint8_t &fireKey, uint8_t &startKey) +{ + screen.clearScreen(); + + drawString(font_oem, 0, "CHIP-8 Emulator"); + drawString(font_oem, 120, "(c)2015 Chris Taylor"); + + int itemCount = sizeof(menuItems) / sizeof(menuItems[0]); + int selectedItem = 0; + int counter = 0; + while(true) + { + counter++; + for (int i = 0; i < itemCount; ++i) + { + if (selectedItem == i) + { + screen.setForegroundColor(Color565::Yellow); + screen.setBackgroundColor(Color565::Blue); + } + else + { + screen.setForegroundColor(Color565::Yellow); + screen.setBackgroundColor(Color565::Black); + } + + int menuTop = (screen.getHeight() - (itemCount * 10)) / 2; + drawString(font_oem, menuTop + (i * 10), menuItems[i].Text); + } + + if (GameInput::isUpPressed()) + { + --selectedItem; + if (selectedItem < 0) selectedItem = itemCount - 1; + wait_ms(200); + } + else if (GameInput::isDownPressed()) + { + ++selectedItem; + if (selectedItem >= itemCount) selectedItem = 0; + wait_ms(200); + } + else if (GameInput::isCirclePressed()) + { + *program = menuItems[selectedItem].Program; + programSize = menuItems[selectedItem].ProgramSize; + leftKey = menuItems[selectedItem].LeftKey; + rightKey = menuItems[selectedItem].RightKey; + upKey = menuItems[selectedItem].UpKey; + downKey = menuItems[selectedItem].DownKey; + fireKey = menuItems[selectedItem].FireKey; + startKey = menuItems[selectedItem].StartKey; + + wait_ms(200); + srand(counter); + return; + } + } +} \ No newline at end of file
diff -r 000000000000 -r bc3f11b1b41f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 08 01:58:57 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file