diff --git a/examples/atmega_clock/Roboto_Black_38.h b/examples/atmega_clock/Roboto_Black_38.h new file mode 100644 index 0000000..ca1e771 --- /dev/null +++ b/examples/atmega_clock/Roboto_Black_38.h @@ -0,0 +1,319 @@ +// Created with image_to_c +// https://github.com/bitbank2/image_to_c +// +// Roboto_Black_38 +// Data size = 4921 bytes +// +// for non-Arduino builds... +#ifndef PROGMEM +#define PROGMEM +#endif +const uint8_t Roboto_Black_38[] PROGMEM = { + 0xff,0xbb,0x20,0x00,0x7e,0x00,0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x12, + 0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0d,0x14,0x36,0x00,0x04,0x00,0xcc,0xff, + 0x1c,0x00,0x15,0x17,0x15,0x00,0x01,0x00,0xc9,0xff,0x28,0x00,0x28,0x2b,0x35,0x00, + 0x01,0x00,0xcc,0xff,0x60,0x00,0x25,0x2b,0x45,0x00,0x03,0x00,0xc4,0xff,0xad,0x00, + 0x31,0x37,0x36,0x00,0x03,0x00,0xcc,0xff,0x04,0x01,0x2f,0x32,0x36,0x00,0x02,0x00, + 0xcc,0xff,0x51,0x01,0x09,0x0b,0x15,0x00,0x01,0x00,0xc9,0xff,0x56,0x01,0x15,0x1a, + 0x4a,0x00,0x04,0x00,0xc7,0xff,0x8c,0x01,0x16,0x1a,0x4a,0x00,0x01,0x00,0xc7,0xff, + 0xc5,0x01,0x21,0x22,0x20,0x00,0x01,0x00,0xcc,0xff,0xfb,0x01,0x24,0x28,0x26,0x00, + 0x02,0x00,0xd5,0xff,0x14,0x02,0x0d,0x14,0x17,0x00,0x02,0x00,0xf8,0xff,0x24,0x02, + 0x16,0x21,0x09,0x00,0x05,0x00,0xe6,0xff,0x26,0x02,0x0e,0x16,0x0c,0x00,0x04,0x00, + 0xf5,0xff,0x33,0x02,0x1b,0x1a,0x3a,0x00,0xff,0xff,0xcc,0xff,0x5b,0x02,0x25,0x2b, + 0x36,0x00,0x03,0x00,0xcc,0xff,0x92,0x02,0x18,0x2b,0x35,0x00,0x06,0x00,0xcc,0xff, + 0xb0,0x02,0x26,0x2b,0x35,0x00,0x02,0x00,0xcc,0xff,0xe7,0x02,0x26,0x2b,0x36,0x00, + 0x02,0x00,0xcc,0xff,0x28,0x03,0x27,0x2b,0x35,0x00,0x02,0x00,0xcc,0xff,0x56,0x03, + 0x25,0x2b,0x36,0x00,0x03,0x00,0xcc,0xff,0x90,0x03,0x26,0x2b,0x36,0x00,0x03,0x00, + 0xcc,0xff,0xd1,0x03,0x26,0x2b,0x35,0x00,0x02,0x00,0xcc,0xff,0xf4,0x03,0x25,0x2b, + 0x36,0x00,0x03,0x00,0xcc,0xff,0x38,0x04,0x25,0x2b,0x36,0x00,0x03,0x00,0xcc,0xff, + 0x78,0x04,0x0e,0x16,0x29,0x00,0x04,0x00,0xd8,0xff,0x95,0x04,0x0f,0x15,0x37,0x00, + 0x03,0x00,0xd8,0xff,0xb8,0x04,0x20,0x26,0x24,0x00,0x02,0x00,0xd9,0xff,0xe2,0x04, + 0x21,0x2b,0x19,0x00,0x05,0x00,0xdd,0xff,0xea,0x04,0x20,0x26,0x24,0x00,0x04,0x00, + 0xd9,0xff,0x13,0x05,0x22,0x26,0x35,0x00,0x01,0x00,0xcc,0xff,0x46,0x05,0x3e,0x42, + 0x43,0x00,0x02,0x00,0xce,0xff,0xc9,0x05,0x33,0x32,0x35,0x00,0x00,0x00,0xcc,0xff, + 0xff,0x05,0x29,0x30,0x35,0x00,0x04,0x00,0xcc,0xff,0x2a,0x06,0x2c,0x31,0x36,0x00, + 0x03,0x00,0xcc,0xff,0x66,0x06,0x29,0x30,0x35,0x00,0x04,0x00,0xcc,0xff,0x8e,0x06, + 0x24,0x29,0x35,0x00,0x04,0x00,0xcc,0xff,0xa0,0x06,0x23,0x28,0x35,0x00,0x04,0x00, + 0xcc,0xff,0xb2,0x06,0x2c,0x32,0x36,0x00,0x03,0x00,0xcc,0xff,0xf0,0x06,0x2c,0x34, + 0x35,0x00,0x04,0x00,0xcc,0xff,0x06,0x07,0x0c,0x16,0x35,0x00,0x05,0x00,0xcc,0xff, + 0x0d,0x07,0x25,0x2a,0x36,0x00,0x01,0x00,0xcc,0xff,0x32,0x07,0x2c,0x2f,0x35,0x00, + 0x04,0x00,0xcc,0xff,0x5e,0x07,0x23,0x28,0x35,0x00,0x04,0x00,0xcc,0xff,0x6e,0x07, + 0x39,0x41,0x35,0x00,0x04,0x00,0xcc,0xff,0xa3,0x07,0x2c,0x34,0x35,0x00,0x04,0x00, + 0xcc,0xff,0xc7,0x07,0x2e,0x33,0x36,0x00,0x02,0x00,0xcc,0xff,0x08,0x08,0x29,0x30, + 0x35,0x00,0x04,0x00,0xcc,0xff,0x2a,0x08,0x2e,0x33,0x3f,0x00,0x03,0x00,0xcc,0xff, + 0x74,0x08,0x2a,0x30,0x35,0x00,0x04,0x00,0xcc,0xff,0x9d,0x08,0x2a,0x2e,0x36,0x00, + 0x02,0x00,0xcc,0xff,0xe7,0x08,0x2c,0x2f,0x35,0x00,0x01,0x00,0xcc,0xff,0x02,0x09, + 0x29,0x31,0x36,0x00,0x04,0x00,0xcc,0xff,0x27,0x09,0x31,0x31,0x35,0x00,0x00,0x00, + 0xcc,0xff,0x5c,0x09,0x3e,0x40,0x35,0x00,0x01,0x00,0xcc,0xff,0xa3,0x09,0x2f,0x2f, + 0x35,0x00,0x00,0x00,0xcc,0xff,0xe2,0x09,0x2f,0x2e,0x35,0x00,0x00,0x00,0xcc,0xff, + 0x12,0x0a,0x29,0x2d,0x35,0x00,0x02,0x00,0xcc,0xff,0x37,0x0a,0x10,0x15,0x4b,0x00, + 0x04,0x00,0xc3,0xff,0x4b,0x0a,0x23,0x20,0x3a,0x00,0xff,0xff,0xcc,0xff,0x76,0x0a, + 0x11,0x15,0x4b,0x00,0x00,0x00,0xc3,0xff,0x90,0x0a,0x1f,0x21,0x1a,0x00,0x01,0x00, + 0xcc,0xff,0xae,0x0a,0x21,0x21,0x09,0x00,0x00,0x00,0x01,0x00,0xb0,0x0a,0x14,0x19, + 0x0b,0x00,0x02,0x00,0xca,0xff,0xbc,0x0a,0x24,0x27,0x29,0x00,0x02,0x00,0xd9,0xff, + 0xf1,0x0a,0x24,0x2a,0x39,0x00,0x04,0x00,0xc9,0xff,0x1b,0x0b,0x22,0x26,0x29,0x00, + 0x02,0x00,0xd9,0xff,0x47,0x0b,0x24,0x2a,0x39,0x00,0x02,0x00,0xc9,0xff,0x77,0x0b, + 0x25,0x28,0x29,0x00,0x02,0x00,0xd9,0xff,0xab,0x0b,0x1a,0x1b,0x38,0x00,0x01,0x00, + 0xc9,0xff,0xd0,0x0b,0x25,0x2b,0x37,0x00,0x02,0x00,0xd9,0xff,0x11,0x0c,0x24,0x2a, + 0x38,0x00,0x03,0x00,0xc9,0xff,0x30,0x0c,0x0e,0x14,0x37,0x00,0x03,0x00,0xca,0xff, + 0x53,0x0c,0x15,0x14,0x47,0x00,0xfc,0xff,0xca,0xff,0x7b,0x0c,0x27,0x28,0x38,0x00, + 0x03,0x00,0xc9,0xff,0xa2,0x0c,0x0c,0x14,0x38,0x00,0x04,0x00,0xc9,0xff,0xaa,0x0c, + 0x38,0x40,0x28,0x00,0x04,0x00,0xd9,0xff,0xd6,0x0c,0x24,0x2a,0x28,0x00,0x03,0x00, + 0xd9,0xff,0xf2,0x0c,0x26,0x2a,0x29,0x00,0x02,0x00,0xd9,0xff,0x23,0x0d,0x24,0x2a, + 0x37,0x00,0x04,0x00,0xd9,0xff,0x4d,0x0d,0x24,0x2a,0x37,0x00,0x02,0x00,0xd9,0xff, + 0x7e,0x0d,0x18,0x1c,0x28,0x00,0x03,0x00,0xd9,0xff,0x8f,0x0d,0x23,0x26,0x29,0x00, + 0x01,0x00,0xd9,0xff,0xcb,0x0d,0x18,0x19,0x32,0x00,0x00,0x00,0xd0,0xff,0xec,0x0d, + 0x24,0x2a,0x28,0x00,0x03,0x00,0xda,0xff,0x08,0x0e,0x26,0x26,0x27,0x00,0x00,0x00, + 0xda,0xff,0x2e,0x0e,0x34,0x36,0x27,0x00,0x01,0x00,0xda,0xff,0x64,0x0e,0x26,0x26, + 0x27,0x00,0x00,0x00,0xda,0xff,0x92,0x0e,0x26,0x26,0x37,0x00,0x00,0x00,0xda,0xff, + 0xc4,0x0e,0x22,0x26,0x27,0x00,0x02,0x00,0xda,0xff,0xe3,0x0e,0x16,0x18,0x47,0x00, + 0x01,0x00,0xc7,0xff,0x18,0x0f,0x07,0x13,0x3f,0x00,0x06,0x00,0xcc,0xff,0x20,0x0f, + 0x16,0x18,0x47,0x00,0x01,0x00,0xc7,0xff,0x57,0x0f,0x28,0x2f,0x11,0x00,0x03,0x00, + 0xe3,0xff,0x42,0xff,0xd7,0xf2,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xfe,0xbf,0xf1,0xff,0xc8,0xf6,0x83,0xd3,0x8b,0xf9,0x01,0x5b,0x5b,0x0a,0x32,0x27, + 0xff,0xff,0xd7,0xff,0xd7,0xff,0xff,0xff,0xd7,0xfc,0x28,0x38,0xc4,0x53,0x11,0x75, + 0x5f,0xff,0xfe,0xab,0xd5,0x7f,0xff,0xff,0xea,0xbd,0x57,0xff,0xe5,0x72,0xff,0xff, + 0xf3,0x17,0xc9,0xbf,0xfa,0xaf,0x55,0xff,0xff,0xea,0xbd,0x54,0x44,0xc8,0x2f,0xff, + 0x28,0x20,0x9f,0x17,0x99,0xff,0xff,0xd5,0x7a,0xaf,0xff,0xff,0xfd,0x57,0xaa,0xff, + 0xff,0xe0,0x28,0x44,0xb9,0x1f,0xff,0xff,0xff,0x82,0x0f,0x04,0x0f,0x08,0x3c,0x27, + 0xa7,0xa7,0xa7,0xde,0xbc,0xc7,0x57,0xd3,0xe9,0x3f,0xde,0xbe,0xff,0xfe,0xc7,0xed, + 0xf7,0xde,0xc3,0xd8,0x7c,0x3d,0x87,0x86,0x1e,0xc3,0xc3,0x78,0x6f,0x0d,0xe1,0xbc, + 0x1b,0xdf,0x0d,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0xfd,0x2f,0xd7,0xfa,0xfd,0x7f,0xff, + 0xaf,0xf8,0xff,0xff,0xff,0x90,0x1f,0xff,0x7f,0xff,0xbf,0xf7,0xfb,0xff,0x7b,0xf7, + 0xbf,0xed,0xf7,0xbe,0xdf,0x7b,0x7b,0x7b,0x76,0xb7,0xda,0xdf,0x0f,0x00,0x20,0x65, + 0x34,0xa0,0xfb,0xd3,0xe1,0xf7,0x1c,0x81,0x3d,0xbd,0xbd,0xfb,0xdb,0xdf,0xbf,0xdb, + 0xfd,0xfb,0xff,0xdb,0xff,0xfe,0xff,0x7f,0xff,0xfe,0xff,0xff,0xff,0xaf,0xff,0xfd, + 0x7f,0xaf,0xff,0xd2,0xff,0xeb,0x5f,0xd2,0xfd,0x2f,0xd2,0xeb,0x5d,0x2d,0x2d,0x28, + 0xe4,0x05,0x70,0xb6,0xba,0xd8,0x50,0x28,0x34,0xe4,0x27,0xfa,0xff,0xff,0xfc,0x88, + 0xb9,0x8a,0x3c,0x3c,0x2e,0x81,0xe1,0x3e,0x1e,0x0b,0xc1,0xe1,0x62,0x22,0xe4,0x05, + 0x65,0xac,0x60,0xce,0x89,0xf3,0x98,0x4e,0x9e,0x9e,0x9e,0x8c,0x41,0x7a,0x5e,0xad, + 0xf4,0xde,0x95,0xea,0xde,0x93,0xe0,0xd4,0x2d,0xda,0xc3,0x50,0xa0,0x28,0x30,0xe5, + 0xa3,0xff,0xff,0xff,0xff,0xff,0xff,0xe2,0x66,0x27,0xfc,0xa0,0xc3,0x96,0x8f,0xff, + 0xff,0xff,0xff,0xff,0xff,0x80,0x20,0x7f,0xff,0xff,0xff,0xfe,0xbf,0x5e,0xb5,0xea, + 0x3a,0xa9,0x02,0x58,0x35,0x00,0xff,0x80,0x20,0x84,0xda,0x10,0x7a,0x7f,0x1d,0xd4, + 0x80,0xff,0x6b,0x0c,0x28,0x28,0x96,0x97,0xfe,0x97,0xff,0x5a,0xff,0x5a,0xff,0x5a, + 0xff,0x5a,0xff,0xf5,0xaf,0xf5,0xaf,0xf5,0xaf,0xf5,0xaf,0xff,0x5a,0xff,0x5a,0xff, + 0x5a,0xff,0x5a,0xff,0x5a,0xff,0xf5,0xaf,0xf5,0xaf,0xf5,0x1f,0x00,0x28,0x38,0xe4, + 0xa3,0x04,0x0f,0x08,0x3c,0x20,0xf4,0xf4,0xf4,0xff,0x4f,0x98,0xdb,0xd2,0x6f,0xa7, + 0xd2,0xbf,0x7f,0xff,0xfe,0x2a,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xf9,0x01,0x69, + 0x7f,0xff,0xfe,0xbb,0x75,0xda,0xed,0xa5,0xc7,0xb5,0xfb,0x5b,0x5b,0x58,0x61,0x61, + 0x85,0x83,0x05,0x00,0x28,0xb6,0x0b,0x05,0x82,0xc1,0x60,0xb0,0x58,0x28,0xfe,0x64, + 0xb9,0x2f,0x82,0xc2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xe0,0x28,0x38,0xe5,0x9f,0x04,0x0f,0x08,0x3c,0x20,0xf4,0xf4,0xf5,0xd3,0xfd, + 0x18,0xea,0xfa,0x0f,0xa5,0xf4,0xdf,0xf1,0xff,0x5f,0xca,0x18,0x5f,0xaf,0x5a,0xe9, + 0x7e,0x96,0xba,0x5a,0x5a,0x5a,0x5a,0x5a,0xe9,0x75,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5, + 0xa5,0xae,0x96,0x8d,0x22,0xaf,0xff,0xff,0xc0,0x28,0x34,0xe5,0xa1,0x04,0x74,0x8c, + 0x84,0x1e,0x10,0x7a,0x7a,0x7a,0x7a,0xf7,0xa3,0x1f,0xbc,0x26,0xfa,0x7f,0x7f,0xf1, + 0xff,0xff,0x4b,0x5c,0x25,0x9c,0xc5,0xba,0xeb,0xae,0x17,0x07,0xdf,0x7d,0xe7,0x58, + 0xed,0xf6,0xf7,0xef,0xdf,0x9c,0xc3,0xbe,0xaf,0xa5,0x20,0x2d,0x78,0x6b,0xc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a,0x28,0x34,0xe5,0xa1,0x04,0x0f,0x08,0x3c,0x20,0xf4, + 0xf4,0xf4,0xff,0x4f,0x98,0xeb,0xe9,0xf4,0x9b,0xff,0xfe,0x9f,0xfe,0xd7,0x7a,0xff, + 0xb5,0xdb,0x4b,0x62,0xba,0xc3,0x5b,0x5b,0x58,0x41,0xe9,0xe9,0xe9,0xe8,0xc7,0x57, + 0xd3,0xe9,0x37,0xd3,0xff,0x15,0x77,0xfd,0xaf,0xe4,0x05,0xa5,0xda,0xf6,0xbb,0x15, + 0xfb,0x5b,0x5b,0x5b,0x5b,0x58,0x30,0x58,0x30,0x50,0x28,0x38,0xe4,0xa3,0x04,0x1e, + 0x10,0x78,0x41,0xe9,0xe9,0xe9,0xe9,0xfe,0x8c,0x74,0x7d,0x07,0xd2,0x6f,0xae,0x37, + 0xee,0xbf,0xff,0xef,0xf7,0xf2,0x02,0xfd,0xae,0xc2,0xd8,0xf5,0xbf,0xef,0xbe,0x19, + 0x90,0x3d,0x85,0xe0,0xc2,0xac,0x57,0xf4,0xbf,0x4b,0x5d,0x2c,0x25,0x82,0xe7,0x21, + 0x6e,0xba,0xeb,0x85,0xd7,0x05,0xc2,0xe5,0xec,0x80,0x20,0x84,0xda,0x10,0x7a,0x7f, + 0x1d,0xd4,0x80,0xff,0x6b,0x0c,0x2c,0x7f,0xff,0xff,0xff,0xf2,0x4d,0x84,0x1e,0x9f, + 0xc7,0x75,0x20,0x3f,0xda,0xc3,0x0a,0x20,0xa4,0xd6,0x10,0x7a,0x7f,0xaf,0x7f,0x5b, + 0xfe,0xd6,0x18,0x58,0xff,0xff,0xff,0xff,0xff,0x95,0xd7,0xff,0xff,0xff,0xff,0xff, + 0xf5,0xfa,0xf5,0xaf,0x51,0xd5,0x48,0x12,0xc1,0xa8,0x28,0x7b,0x0b,0x0b,0x05,0x85, + 0x82,0xc2,0xc1,0x61,0x60,0xb0,0xb0,0x96,0x08,0x14,0x41,0x41,0x41,0x41,0x42,0xa8, + 0x38,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ff, + 0xfa,0x5f,0xfa,0x5f,0xa5,0xae,0x96,0x16,0x2a,0xaa,0xa1,0x54,0x28,0x53,0xac,0xd0, + 0xff,0x9c,0xd6,0xff,0xff,0xff,0x34,0x3f,0xff,0xfc,0xe6,0xb7,0xff,0xff,0xff,0x9a, + 0x49,0xfe,0xff,0x9c,0xd6,0xff,0xff,0xff,0xcd,0x0f,0xff,0xff,0x39,0xad,0xff,0xff, + 0xff,0xff,0xff,0xe0,0x28,0x44,0xe5,0xa9,0x04,0x74,0x90,0x82,0x0f,0x41,0xe1,0x3d, + 0x07,0xae,0x9f,0x7a,0xe8,0xc8,0xe7,0xc2,0x0f,0xa0,0x9b,0xf7,0xd2,0x7e,0xbf,0xbf, + 0x8a,0x1f,0xff,0x9c,0x95,0xbf,0xff,0xff,0x3a,0x46,0xfe,0x40,0x5f,0xff,0xef,0xb7, + 0xfe,0xc3,0x5c,0x30,0xb6,0x3f,0x7b,0x5b,0x5b,0x0b,0x0d,0x6c,0x2c,0x18,0x2c,0x19, + 0xcc,0x4c,0x39,0xa9,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x7f,0xe7,0x35,0x2f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x28, + 0x63,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xe6, + 0x97,0x20,0x3f,0xd7,0x6b,0xff,0x69,0x76,0xbb,0x1f,0x5b,0x5b,0x5b,0x5b,0x5b,0x0b, + 0x0d,0x67,0x34,0xa8,0x39,0xa7,0xe9,0x75,0xa5,0xae,0x97,0x5a,0x5a,0xf5,0xa5,0xa5, + 0xd6,0xba,0x5d,0x69,0x6b,0xd6,0x96,0x97,0xc5,0x55,0xf7,0x7d,0xf7,0x73,0x22,0x7d, + 0xd3,0xd3,0x75,0x74,0xfd,0xef,0xde,0xde,0xfd,0xef,0xde,0xdf,0xed,0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x30, + 0xe5,0xa3,0x04,0x0f,0x08,0x3c,0x27,0xa7,0xa7,0xa7,0xde,0x8c,0x74,0xf4,0x1f,0xab, + 0xff,0xdf,0x1f,0xff,0x39,0x8b,0x67,0x21,0xac,0x2e,0x17,0x5d,0x75,0xe6,0x3b,0xe2, + 0x17,0xf5,0xff,0xfe,0xb6,0xb6,0xb1,0xc8,0x0f,0x7e,0xf7,0xc3,0x32,0x0b,0xb0,0xae, + 0x0c,0x21,0x00,0x39,0x8e,0x7f,0xff,0xff,0xff,0x2d,0x23,0x08,0x3c,0x20,0xe2,0xee, + 0xef,0xb9,0x8f,0xb8,0x4d,0xd3,0xef,0xff,0xdf,0xbf,0xff,0xff,0xeb,0xaf,0xfd,0x6f, + 0x86,0x12,0x8e,0xba,0xa9,0x8b,0x2b,0x6b,0x0c,0x29,0x42,0x21,0x40,0x28,0x34,0xe5, + 0x23,0x04,0x0f,0x08,0x3d,0x3c,0x27,0xa7,0xde,0x9e,0xbc,0xc6,0xde,0x93,0x7a,0x7e, + 0xe2,0xbf,0xe3,0xff,0xff,0xce,0x59,0x7c,0x80,0xbf,0xae,0xfb,0x61,0x71,0x5b,0xed, + 0x75,0xb5,0x86,0xb6,0xb0,0xc2,0xc1,0x82,0x80,0x28,0x63,0xff,0xff,0xff,0xff,0xff, + 0xf9,0xcb,0x23,0x84,0x1f,0x09,0xf4,0xfa,0x1d,0x6b,0xeb,0x98,0xeb,0xa4,0x1f,0x5e, + 0x9f,0xe3,0xfa,0xff,0xff,0xff,0xde,0x40,0x7f,0xff,0xb5,0xdf,0x6c,0x2e,0x3b,0xfb, + 0xd9,0x93,0x3b,0x5d,0xae,0x1a,0xe1,0x82,0x10,0x28,0x38,0xe5,0x21,0x04,0x0f,0x08, + 0x3c,0x27,0xa7,0xa7,0xa7,0xde,0xbc,0xc7,0x57,0xa0,0x9f,0xa6,0xf5,0xfa,0x7f,0xff, + 0x8e,0xc7,0xfc,0x80,0x9c,0xc6,0xff,0xf6,0x64,0x0e,0xda,0x7d,0x85,0xd8,0x61,0x3e, + 0x2f,0x6f,0x6f,0x6b,0x6b,0x61,0x61,0xac,0x30,0xb0,0x67,0x28,0xf0,0x28,0x7a,0x18, + 0x27,0x58,0x5a,0xfa,0xd7,0xe7,0x73,0x29,0x75,0xfd,0x7f,0xfc,0x4d,0x4f,0xff,0xf9, + 0x05,0x3b,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xfe,0x28,0x30,0xe4,0x29,0x04,0x19,0x61,0x74,0x1f,0x09,0xf4,0x3f,0x5a,0xfa, + 0x31,0xf7,0x84,0x1e,0xaf,0xaf,0xfa,0xfe,0x3f,0xf5,0xff,0xdf,0xc8,0x0f,0xff,0xf7, + 0xef,0xba,0xe1,0x85,0xb1,0xfb,0xdf,0xde,0x19,0x90,0x3b,0x0b,0x83,0x0b,0x8f,0x27, + 0x2b,0xb5,0xa0,0xd2,0xe1,0x85,0xd0,0xad,0x7a,0xd2,0xda,0xda,0xc3,0x0b,0x0c,0x2c, + 0x19,0xcb,0x44,0x39,0x8e,0x7f,0xff,0xff,0xff,0x2f,0x23,0x04,0x1e,0x83,0xd3,0xd3, + 0x8e,0xfb,0x98,0xfd,0x84,0xf4,0xff,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xf0,0x20,0x84,0xda,0x10,0x7a,0xf7,0x1d,0xd4,0x80,0xfa,0xdf,0x0c,0x2c,0x7f, + 0xca,0x73,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xfe,0x28,0x59,0x37,0x84,0x1e,0x9f,0xf7,0x5f,0x7d,0x7e,0xd6, + 0x18,0x58,0xff,0x9d,0x0d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xfa,0xfd,0x75,0x8e,0xba,0xaa,0xa8,0x50,0x50,0x39,0xad,0xff, + 0xff,0xff,0xff,0xce,0x51,0xfa,0x0b,0x5d,0x2d,0x2e,0xb4,0xb4,0xb4,0xb5,0xeb,0x4a, + 0x2a,0xaa,0xbb,0xbe,0xfb,0xbe,0x63,0xd3,0xab,0xa7,0xef,0x6f,0x7e,0xf7,0xef,0x6f, + 0x7e,0xf6,0xfb,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x28,0x4c,0xbc,0xe3, + 0x90,0x41,0x8b,0xa0,0xc1,0x03,0xc2,0x69,0xe9,0xa7,0xa6,0x9c,0x6b,0x17,0xd9,0x8f, + 0xa6,0x46,0xc2,0x61,0x3a,0xde,0xd7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x28,0x4c,0xe4,0x1a,0x63,0x28,0x3c,0x27, + 0xa7,0xa7,0x17,0xf7,0x31,0xfb,0x4f,0x4f,0x5f,0xf7,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xc0,0x28,0x38,0xe5,0x21,0x04,0x0f,0x08,0x3c,0x27,0xa0,0xf4,0xf5, + 0xd3,0xef,0x46,0x3a,0xfa,0x0d,0xe9,0x3f,0x5f,0xb7,0x1f,0x5f,0xff,0x7f,0xff,0xaf, + 0xfb,0xe4,0x07,0xfa,0xf7,0x5b,0x6b,0xd8,0x4b,0x63,0xeb,0x6b,0x7d,0xad,0x85,0x86, + 0xb0,0xc2,0xc1,0x82,0x80,0x28,0x44,0xe4,0x1e,0x62,0xe0,0x78,0x41,0xe9,0xc5,0xdd, + 0xf7,0x31,0xf7,0x09,0xe9,0xbd,0xff,0xfb,0xf7,0xff,0xff,0xeb,0xf5,0xff,0xad,0xa5, + 0x0d,0x63,0xaa,0xea,0xa6,0x30,0xac,0x30,0xb0,0xc2,0xc7,0xff,0xff,0xff,0x80,0x28, + 0x2c,0xe4,0x2b,0x08,0x32,0xd2,0xa1,0x35,0xa0,0xfa,0xf4,0x3a,0xfa,0xe6,0x3a,0xe9, + 0x07,0xd3,0xeb,0xf8,0xfe,0xbf,0xff,0xff,0xf7,0x90,0x1f,0xff,0xef,0xb6,0xbb,0x0b, + 0x8e,0xfe,0xf7,0xbd,0x99,0x03,0x86,0x17,0x0c,0x2e,0x3f,0xff,0xff,0xff,0xff,0xf0, + 0x28,0x94,0xcc,0x9a,0xd6,0xbc,0x7e,0x78,0x20,0x2a,0xff,0xff,0xff,0xff,0xff,0xff, + 0xf8,0x28,0x34,0xe5,0x23,0x39,0x28,0xe1,0x03,0xd3,0xd3,0xd3,0xd3,0xef,0x46,0x36, + 0xfa,0x0f,0xd5,0xff,0xbe,0xc7,0x7c,0x3e,0x74,0xd3,0xb3,0xac,0x7e,0x0f,0x61,0xed, + 0xe1,0xbc,0x37,0x87,0xc1,0xbc,0xe9,0x21,0x83,0xed,0x9c,0xc2,0xfc,0x80,0xfd,0xa5, + 0xc3,0x5d,0x8f,0x6b,0xad,0xac,0x35,0xb5,0x86,0x16,0x0c,0xe5,0xa2,0x20,0xa6,0x67, + 0xff,0xff,0xff,0xff,0xf1,0x34,0xc7,0xf2,0x0a,0x66,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xdf,0xf7,0xb3,0x48,0x7f,0xef,0x7b,0xde,0x0d,0x40,0x39,0xa5, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe4,0x07,0xed,0x76,0x17,0x1f, + 0xbf,0xb3,0x28,0x76,0xbb,0x5d,0xae,0x0c,0x10,0x80,0x39,0xa6,0x75,0x20,0x35,0xef, + 0xfa,0xdf,0xf5,0xee,0xb7,0xff,0xf4,0xb6,0xff,0xff,0xdd,0x2e,0xff,0xf7,0xaf,0x5e, + 0xfd,0xeb,0xff,0x5d,0x8a,0xff,0xda,0xff,0xda,0xff,0xda,0xff,0xda,0xff,0xda,0x80, + 0x39,0x85,0x1c,0x82,0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,0xff,0xff,0xfd,0xff,0xfb, + 0xdf,0xbd,0xbe,0x1d,0xad,0xf7,0xc3,0x5b,0xe0,0xd4,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xfe,0x20,0x65,0x34,0xa0,0x7c,0x3d,0x3e,0xfb,0x8b,0x90,0x27,0xbe,0xdf,0xef, + 0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfe,0xc3,0xe0,0xef,0x78,0x7f,0x58, + 0x5f,0x40,0xb4,0xba,0xeb,0x5f,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xff,0x5e,0xb5, + 0xd2,0x8e,0x40,0x57,0x5b,0x5d,0x70,0xb6,0x0a,0x28,0x24,0xbd,0x88,0x41,0x9c,0xe2, + 0x21,0x07,0xd3,0x5a,0x7e,0xfa,0x6b,0x86,0xb4,0x2b,0x98,0xb7,0xe8,0x35,0xd3,0xfb, + 0x5d,0x35,0x1b,0x52,0x03,0x0d,0x62,0x18,0x50}; diff --git a/examples/atmega_clock/Roboto_Black_78.h b/examples/atmega_clock/Roboto_Black_78.h new file mode 100644 index 0000000..ef24b85 --- /dev/null +++ b/examples/atmega_clock/Roboto_Black_78.h @@ -0,0 +1,90 @@ +// Created with image_to_c +// https://github.com/bitbank2/image_to_c +// +// Roboto_Black_78 +// Data size = 1262 bytes +// +// for non-Arduino builds... +#ifndef PROGMEM +#define PROGMEM +#endif +const uint8_t Roboto_Black_78[] PROGMEM = { + 0xff,0xbb,0x30,0x00,0x3a,0x00,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4b,0x59, + 0x70,0x00,0x07,0x00,0x93,0xff,0x6a,0x00,0x32,0x59,0x6d,0x00,0x0c,0x00,0x94,0xff, + 0xa7,0x00,0x4e,0x59,0x6e,0x00,0x05,0x00,0x93,0xff,0x12,0x01,0x4f,0x59,0x70,0x00, + 0x04,0x00,0x93,0xff,0x95,0x01,0x4f,0x59,0x6d,0x00,0x05,0x00,0x94,0xff,0xe9,0x01, + 0x4c,0x59,0x6f,0x00,0x06,0x00,0x94,0xff,0x5d,0x02,0x4f,0x59,0x70,0x00,0x06,0x00, + 0x93,0xff,0xe6,0x02,0x4e,0x59,0x6d,0x00,0x04,0x00,0x94,0xff,0x2c,0x03,0x4c,0x59, + 0x70,0x00,0x06,0x00,0x93,0xff,0xb7,0x03,0x4c,0x59,0x70,0x00,0x06,0x00,0x93,0xff, + 0x3b,0x04,0x1c,0x2e,0x55,0x00,0x09,0x00,0xad,0xff,0x28,0x3c,0x71,0xc9,0x27,0x34, + 0x5f,0x04,0x0f,0x04,0x0f,0x09,0xe8,0x3c,0x20,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4, + 0xff,0x4f,0x4f,0xf4,0xf9,0x8e,0xfe,0x82,0x0d,0xf0,0x83,0xe9,0x3f,0xdf,0x4f,0xa5, + 0x7e,0xff,0xe9,0x3f,0xdf,0xff,0xf5,0xc6,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf5,0x20,0x35,0xef,0xff,0xff,0xad, + 0xb5,0xff,0xd7,0x6e,0xbb,0x5f,0xf6,0xd2,0xe1,0x85,0xd8,0x61,0x2e,0x3d,0xaf,0xda, + 0xda,0xfd,0xad,0xad,0xad,0xad,0xad,0xad,0xac,0x30,0xb6,0xb0,0xc2,0xc1,0x82,0xc1, + 0x82,0xce,0x7c,0x74,0x28,0xbf,0x05,0x82,0xc1,0x60,0xb0,0xb0,0x58,0x2c,0x16,0x0b, + 0x0b,0x05,0x82,0xc1,0x60,0xb0,0xb0,0x51,0xff,0xf3,0x2c,0xe0,0xb0,0x59,0xcc,0x36, + 0x0b,0x05,0x95,0x2f,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x00,0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x7d,0xad,0x99,0x29,0xed,0x78, + 0x6b,0xc3,0x09,0x2c,0x30,0xbc,0x30,0xbc,0xe6,0x85,0xf8,0xa5,0xfa,0x5f,0xae,0x97, + 0xe9,0x6b,0xa5,0x85,0xd2,0xc2,0x58,0x2e,0x09,0x67,0x34,0x9b,0x39,0x15,0xdf,0xd7, + 0x5d,0x75,0xd7,0x5c,0x2e,0xba,0xe1,0x70,0xba,0xe0,0xb8,0x5c,0x2e,0x72,0x8a,0xf3, + 0x90,0x5f,0x9c,0x53,0x50,0x28,0x49,0xd2,0xe8,0x40,0xf0,0x9e,0x83,0xd3,0xd7,0x4f, + 0xb8,0xff,0xb5,0xfc,0x80,0xfa,0xda,0xdf,0x6b,0x61,0x61,0xac,0x30,0x58,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x74,0xa7,0x08,0x1e,0x13,0xd0,0x7a,0x7a,0xe9, + 0xf7,0x1f,0xf6,0xbf,0x90,0x1f,0x5b,0x5b,0xed,0x6c,0x2c,0x35,0x86,0x0a}; diff --git a/examples/atmega_clock/atmega_clock.ino b/examples/atmega_clock/atmega_clock.ino new file mode 100644 index 0000000..0d4e87f --- /dev/null +++ b/examples/atmega_clock/atmega_clock.ino @@ -0,0 +1,202 @@ +// +// epaper clock on the humble ATmega328 +// +#include +#include +#include +#include +#include +#include + +#include "Roboto_Black_38.h" +#include "Roboto_Black_78.h" +#include +BBEPAPER bbep(EPD42_400x300); +static int iRunCount = 0; +static int iSec, iMin, iHour, iWDay, iMDay, iMon; +int iSleepTime; // number of microseconds to sleep in each wakeup phase + +// I2C base address of various RTCs +#define RTC_DS3231_ADDR 0x68 +#define RTC_RV3032_ADDR 0x51 +#define RTC_PCF8563_ADDR 0x51 +#define RTC_ADDR RTC_DS3231_ADDR +#define RTC_START_REG 0 +// Ugly solder job of Xiao ESP32-C6 and my e-paper adapter +#define PIN_SDA 4 +#define PIN_SCL 3 +#define POWER_PIN 5 +#define PIN_DC 14 +#define PIN_BUSY 16 +#define PIN_RST 15 + +const char *szDays[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; +const char *szMonths[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; +// AVR Power savings +// watchdog interrupt +ISR (WDT_vect) +{ + wdt_disable(); // disable watchdog +} // end of WDT_vect +// +// Use the watchdog timer to sleep for a fixed time and then wake up +// 16ms delay shifted left by teh shift value +// +void WDSleepOneSec(void) +{ + ADCSRA = 0; // Disable ADC + // clear various "reset" flags + MCUSR = 0; + // allow changes, disable reset + WDTCSR = bit (WDCE) | bit (WDE); // allow changes, disable reset + /** + * Setting the watchdog pre-scaler value with VCC = 5.0V and 16mHZ + * WDP3 WDP2 WDP1 WDP0 | Number of WDT | Typical Time-out at Oscillator Cycles + * 0 0 0 0 | 2K cycles | 16 ms + * 0 0 0 1 | 4K cycles | 32 ms + * 0 0 1 0 | 8K cycles | 64 ms + * 0 0 1 1 | 16K cycles | 0.125 s + * 0 1 0 0 | 32K cycles | 0.25 s + * 0 1 0 1 | 64K cycles | 0.5 s + * 0 1 1 0 | 128K cycles | 1.0 s + * 0 1 1 1 | 256K cycles | 2.0 s + * 1 0 0 0 | 512K cycles | 4.0 s + * 1 0 0 1 | 1024K cycles | 8.0 s + */ + // For some reason, the AVR compiler is broken and these must be done as compile-time + // constants. Experiments with building a mask from individual bits ended in failure + WDTCSR = (1<> 4) * 10) + (ucTemp[0] & 0xf); + iMin = ((ucTemp[1] >> 4) * 10) + (ucTemp[1] & 0xf); + // hours are stored in 24-hour format in the tm struct + if (ucTemp[2] & 64) { // 12 hour format + iHour = ucTemp[2] & 0xf; + iHour += ((ucTemp[2] >> 4) & 1) * 10; + iHour += ((ucTemp[2] >> 5) & 1) * 12; // AM/PM + } else { // 24 hour format + iHour = ((ucTemp[2] >> 4) * 10) + (ucTemp[2] & 0xf); + } + iWDay = ucTemp[3] - 1; // day of the week 0-6 + iMDay = ucTemp[4] & 0xf; + iMDay += ((ucTemp[4] >> 4) * 10); + iMon = ucTemp[5] & 0xf; + iMon += (((ucTemp[5] >> 4) & 1) * 10); + iMon--; // returns 1-12 instead of 0-11 +} /* rtc_get_time() */ + +void DrawPlane(int bInvert, int iPlane, char *string1, char *string2) +{ + int iFG, iBG; + + if (bInvert) { + iFG = BBEP_WHITE; iBG = BBEP_BLACK; + } else { + iFG = BBEP_BLACK; iBG = BBEP_WHITE; + } + bbep.setPlane(iPlane); + bbep.fillRect(0,0, bbep.width(), bbep.height(), iBG); // clear both buffers to white for full update + bbep.setFont(Roboto_Black_78); + bbep.setTextColor(iFG, iBG); + bbep.drawString(string1, CENTER_X, 120); + bbep.setFont(Roboto_Black_38); + bbep.drawString(szDays[iWDay], CENTER_X, 200); + bbep.drawString(string2, CENTER_X, 280); +} + +void setup() +{ + // Serial.begin(115200); + // Serial.println("Starting..."); + Wire.begin(); + Wire.setClock(400000); +} /* setup() */ + +void loop() +{ + char szTemp[32] ,szTemp2[32]; + int bPartial, iSleepTime, bInvert; + + bbep.initIO(PIN_DC, PIN_RST, PIN_BUSY); + while (1) { + bInvert = 1; + if ((iRunCount & 1) == 0) { // get time and update + bPartial = ((iRunCount & 0x1f) != 0); + rtc_get_time(); +// EPDInit((bPartial) ? MODE_PARTIAL : MODE_NORMAL); + if (bbep.getChip() == BBEP_CHIP_UC81xx) { + // On the UC81xx we have to explicitly write the old data and new for a partial update + // the SSD16xx remembers the old properly and just needs to know the new + if (bPartial) { // inverted too, with the old time strings + DrawPlane(bInvert, PLANE_1, szTemp, szTemp2); + bInvert = 0; + } + } // BBEP_CHIP_UC81xx + // Print the current hour:minute + sprintf(szTemp, "%02d:%02d", iHour, iMin); + sprintf(szTemp2, "%s %d", szMonths[iMon], iMDay); + + if (!bPartial) { + DrawPlane(bInvert, PLANE_1, szTemp, szTemp2); + } + DrawPlane(bInvert, PLANE_0, szTemp, szTemp2); + bbep.refresh((bPartial) ? REFRESH_PARTIAL : REFRESH_FULL, false); // do a full refresh +// iSleepTime = (bPartial) ? 750 : 4000; // sleep instead of watching the busy signal + iSleepTime = (bPartial) ? 1 : 4; // sleep instead of watching the busy signal + } else { // we're waking up after waiting for the update to finish + bbep.sleep(1); // deep sleep + iSleepTime = 59; // wake up in 59 seconds + } + //EPDDeInit(); // set GPIO to disconnected for lower power + iRunCount++; + if (!bPartial && iSleepTime == 59) iSleepTime = 56; // we already slept for 4 seconds + for (int j=0; jwidth; - + if (pBBEP == NULL) return; if (x+cx < 0 || y+cy < 0 || x >= pBBEP->native_width || y >= pBBEP->native_height) return; // out of bounds @@ -225,24 +225,24 @@ void bbepDrawSprite(BBEPDISP *pBBEP, const uint8_t *pSprite, int cx, int cy, int bbepSetAddrWindow(pBBEP, x, y, cx, cy); iDestPitch = (cx+7)/8; bbepWriteCmd(pBBEP, u8CMD); // memory write command - for (int ty=dy; ty> n); - *s++ = uc0; - uc0 = uc1 << (8-n); - } - *s++ = uc0; // store final byte - *s++ = 0; // and a zero for good measure - } - if (bInvert) InvertBytes(u8Cache, iDestPitch); - bbepWriteData(pBBEP, u8Cache, iDestPitch); // write each row into the EPD framebuffer - } // for y + for (int ty=dy; ty> n); + *s++ = uc0; + uc0 = uc1 << (8-n); + } + *s++ = uc0; // store final byte + *s++ = 0; // and a zero for good measure + } + if (bInvert) InvertBytes(u8Cache, iDestPitch); + bbepWriteData(pBBEP, u8Cache, iDestPitch); // write each row into the EPD framebuffer + } // for y } else { iStartX = 0; dx = x; @@ -306,15 +306,15 @@ void bbepDrawSprite(BBEPDISP *pBBEP, const uint8_t *pSprite, int cx, int cy, int // int bbepSetPixel(BBEPDISP *pBBEP, int x, int y, unsigned char ucColor) { -int i; -int iPitch, iSize; - + int i; + int iPitch, iSize; + // only available for local buffer operations if (!pBBEP || !pBBEP->ucScreen) return BBEP_ERROR_BAD_PARAMETER; iPitch = (pBBEP->native_width+7)>>3; iSize = iPitch * pBBEP->native_height; - + i = (x >> 3) + (y * iPitch); if (i < 0 || i > iSize-1) { // off the screen return BBEP_ERROR_BAD_PARAMETER; @@ -339,7 +339,7 @@ int iPitch, iSize; pBBEP->ucScreen[i] |= (0x80 >> (x & 7)); } } - return BBEP_SUCCESS; + return BBEP_SUCCESS; } /* obdSetPixel() */ // @@ -347,12 +347,12 @@ int iPitch, iSize; // void InvertBytes(uint8_t *pData, uint8_t bLen) { -uint8_t i; - for (i=0; i pBBEP->width) // must fit on the display - return BBEP_ERROR_BAD_PARAMETER; - cy = pgm_read_byte(pBMP + 22); + if (cx + dx > pBBEP->width) // must fit on the display + return BBEP_ERROR_BAD_PARAMETER; + cy = pgm_read_byte(pBMP + 22); cy += (pgm_read_byte(pBMP+23)<<8); - if (cy < 0) cy = -cy; - else bFlipped = 1; - if (cy + dy > pBBEP->height) // must fit on the display - return BBEP_ERROR_BAD_PARAMETER; + if (cy < 0) cy = -cy; + else bFlipped = 1; + if (cy + dy > pBBEP->height) // must fit on the display + return BBEP_ERROR_BAD_PARAMETER; if (pBBEP->ucScreen == NULL) { // no BG specified or no back buffer, BG color is opposite of FG if (iFG == -1) iFG = BBEP_WHITE; @@ -394,19 +394,19 @@ uint8_t bFlipped = 0; bbepSetAddrWindow(pBBEP, dx, dy, cx+(dx&7), cy); bbepStartWrite(pBBEP, pBBEP->iPlane); // get ready to write the data } - - i16 = pgm_read_byte(pBMP + 28); + + i16 = pgm_read_byte(pBMP + 28); i16 += (pgm_read_byte(pBMP+29)<<8); - if (i16 != 1) // must be 1 bit per pixel - return BBEP_ERROR_BAD_DATA; - iOffBits = pgm_read_byte(pBMP + 10); + if (i16 != 1) // must be 1 bit per pixel + return BBEP_ERROR_BAD_DATA; + iOffBits = pgm_read_byte(pBMP + 10); iOffBits += (pgm_read_byte(pBMP+11)); - iPitch = (((cx+7)>>3) + 3) & 0xfffc; // must be DWORD aligned - if (bFlipped) - { - iOffBits += ((cy-1) * iPitch); // start from bottom - iPitch = -iPitch; - } + iPitch = (((cx+7)>>3) + 3) & 0xfffc; // must be DWORD aligned + if (bFlipped) + { + iOffBits += ((cy-1) * iPitch); // start from bottom + iPitch = -iPitch; + } ucFill = (iBG == BBEP_WHITE && pBBEP->type < EPD42_400x300) ? iBG : 0xff; if (!pBBEP->ucScreen || iFG >= BBEP_YELLOW) { // this will override the B/W plane, so invert things ucFill = 0x00; @@ -414,43 +414,43 @@ uint8_t bFlipped = 0; iFG = iBG; iBG = x; // swap colors } - for (y=0; yucScreen) { - if (dx & 7) { // need to shift it over by 1-7 bits - uint8_t *d = u8Cache, uc1, uc0 = 0; // last shifted byte - uint8_t n = dx & 7; // shift amount - for (int j=0; j> n); - *d++ = uc0; - uc0 = uc1 << (8-n); - } - *d++ = uc0; // store final byte - *d++ = 0; // and a zero for good measure - } else { - memcpy_P(u8Cache, s, (cx+7)>>3); - } - bbepWriteData(pBBEP, u8Cache, (cx+(dx&7)+7)>>3); - } else { // use the setPixel function for more features - src_mask = 0; // make it read a byte to start - for (x=0; x= 0) - bbepSetPixel(pBBEP, dx+x, dy+y, (uint8_t)iFG); - } else { - if (iBG >= 0) - bbepSetPixel(pBBEP, dx+x, dy+y, (uint8_t)iBG); - } - src_mask >>= 1; - } // for x - } - } // for y - return BBEP_SUCCESS; + for (y=0; yucScreen) { + if (dx & 7) { // need to shift it over by 1-7 bits + uint8_t *d = u8Cache, uc1, uc0 = 0; // last shifted byte + uint8_t n = dx & 7; // shift amount + for (int j=0; j> n); + *d++ = uc0; + uc0 = uc1 << (8-n); + } + *d++ = uc0; // store final byte + *d++ = 0; // and a zero for good measure + } else { + memcpy_P(u8Cache, s, (cx+7)>>3); + } + bbepWriteData(pBBEP, u8Cache, (cx+(dx&7)+7)>>3); + } else { // use the setPixel function for more features + src_mask = 0; // make it read a byte to start + for (x=0; x= 0) + bbepSetPixel(pBBEP, dx+x, dy+y, (uint8_t)iFG); + } else { + if (iBG >= 0) + bbepSetPixel(pBBEP, dx+x, dy+y, (uint8_t)iBG); + } + src_mask >>= 1; + } // for x + } + } // for y + return BBEP_SUCCESS; } /* bbepLoadBMP() */ // // Load a 4-bpp Windows bitmap for a 3-color bitmap @@ -459,14 +459,14 @@ uint8_t bFlipped = 0; // int bbepLoadBMP3(BBEPDISP *pBBEP, const uint8_t *pBMP, int dx, int dy) { -int16_t i16, cx, cy, bpp; -int x, y, iOffBits; // offset to bitmap data -int iPitch, iDestPitch; -int iRedOff, iColors, iPalOff; -uint8_t uc, b, *s, *d; -uint8_t dst_mask; -uint8_t bFlipped = 0; -uint8_t ucColorMap[16]; + int16_t i16, cx, cy, bpp; + int x, y, iOffBits; // offset to bitmap data + int iPitch, iDestPitch; + int iRedOff, iColors, iPalOff; + uint8_t uc, b, *s, *d; + uint8_t dst_mask; + uint8_t bFlipped = 0; + uint8_t ucColorMap[16]; if (!(pBBEP->iFlags & BBEP_3COLOR) || pBBEP->ucScreen == 0) return BBEP_ERROR_NOT_SUPPORTED; // if not 3-color EPD or no back buffer, bye-byte @@ -507,7 +507,7 @@ uint8_t ucColorMap[16]; iOffBits += ((cy-1) * iPitch); // start from bottom iPitch = -iPitch; } -// Map the colors to white/black/red with a simple quantization. Convert colors to G3R3B2 and find the closest value (red in the middle) + // Map the colors to white/black/red with a simple quantization. Convert colors to G3R3B2 and find the closest value (red in the middle) // white = 0xff, red = 0x1c, black = 0x00 for (x=0; xucScreen[(((y+dy)>>3)*iDestPitch)+dx]; - s = (uint8_t *)&pBMP[iOffBits+(y*iPitch)]; - for (x=0; x> 4]; // left pixel - if (uc == BBEP_BLACK) - d[x] |= dst_mask; - else if (uc == BBEP_RED) - d[x+iRedOff] |= dst_mask; // we made it white already - uc = ucColorMap[b & 0xf]; // right pixel - if (uc == BBEP_BLACK) - d[x+1] |= dst_mask; - else if (uc == BBEP_RED) - d[x+1+iRedOff] |= dst_mask; - } // for x - } // for y - return BBEP_SUCCESS; + } + for (y=0; yucScreen[(((y+dy)>>3)*iDestPitch)+dx]; + s = (uint8_t *)&pBMP[iOffBits+(y*iPitch)]; + for (x=0; x> 4]; // left pixel + if (uc == BBEP_BLACK) + d[x] |= dst_mask; + else if (uc == BBEP_RED) + d[x+iRedOff] |= dst_mask; // we made it white already + uc = ucColorMap[b & 0xf]; // right pixel + if (uc == BBEP_BLACK) + d[x+1] |= dst_mask; + else if (uc == BBEP_RED) + d[x+1+iRedOff] |= dst_mask; + } // for x + } // for y + return BBEP_SUCCESS; } /* bbepLoadBMP3() */ // // Set the current cursor position @@ -554,30 +554,30 @@ uint8_t ucColorMap[16]; // void bbepSetCursor(BBEPDISP *pBBEP, int x, int y) { - pBBEP->iCursorX = x; - pBBEP->iCursorY = y; + pBBEP->iCursorX = x; + pBBEP->iCursorY = y; } /* bbepSetCursor() */ // // Turn text wrap on or off for the oldWriteString() function // void bbepSetTextWrap(BBEPDISP *pBBEP, int bWrap) { - pBBEP->wrap = bWrap; + pBBEP->wrap = bWrap; } /* bbepSetTextWrap() */ // // Draw a string of BB_FONT characters directly into the EPD framebuffer // void bbepWriteStringCustom(BBEPDISP *pBBEP, BB_FONT *pFont, int x, int y, char *szMsg, int iColor, uint8_t iPlane) { -int rc, i, h, w, end_y, dx, dy, tx, ty, iSrcPitch, iPitch; -unsigned int c; -uint8_t *s, bInvert = 0; -BB_GLYPH *pGlyph; -uint8_t *pBits, u8CMD1, u8CMD2, u8CMD, u8EndMask; -uint8_t first, last; - + int rc, i, h, w, end_y, dx, dy, tx, ty, iSrcPitch, iPitch; + unsigned int c; + uint8_t *s, bInvert = 0; + BB_GLYPH *pGlyph; + uint8_t *pBits, u8CMD1, u8CMD2, u8CMD, u8EndMask; + uint8_t first, last; + if (pBBEP == NULL || pFont == NULL) return; // invalid param - + if (x == -1) x = pBBEP->iCursorX; if (y == -1) @@ -587,12 +587,12 @@ uint8_t first, last; if (x == CENTER_X) { // center the string on the e-paper dx = i = 0; while (szMsg[i]) { - c = szMsg[i++]; - if (c < first || c > last) // undefined character - continue; // skip it - c -= first; // first char of font defined - pGlyph = &pFont->glyphs[c]; // glyph info for this character - dx += pgm_read_byte(&pGlyph->xAdvance); + c = szMsg[i++]; + if (c < first || c > last) // undefined character + continue; // skip it + c -= first; // first char of font defined + pGlyph = &pFont->glyphs[c]; // glyph info for this character + dx += pgm_read_byte(&pGlyph->xAdvance); } x = (pBBEP->native_width - dx)/2; if (x < 0) x = 0; @@ -601,106 +601,106 @@ uint8_t first, last; pBits = (uint8_t *)pFont; pBits += sizeof(BB_FONT); pBits += (last - first + 1) * sizeof(BB_GLYPH); - i = 0; - while (szMsg[i] && x < pBBEP->native_width && y < pBBEP->native_height) { - c = szMsg[i++]; - if (c < first || c > last) // undefined character - continue; // skip it - c -= first; // first char of font defined - pGlyph = &pFont->glyphs[c]; // glyph info for this character - if (pgm_read_byte(&pGlyph->width) > 1) { // skip this if drawing a space - s = pBits + pgm_read_word(&pGlyph->bitmapOffset); // start of compressed bitmap data - if (pgm_read_word(&pFont->rotation) == 0 || pgm_read_word(&pFont->rotation) == 180) { - h = pgm_read_word(&pGlyph->height); - w = pgm_read_byte(&pGlyph->width); - dx = x + pgm_read_word(&pGlyph->xOffset); // offset from character UL to start drawing - dy = y + pgm_read_word(&pGlyph->yOffset); - } else { // rotated - w = pgm_read_word(&pGlyph->height); - h = pgm_read_byte(&pGlyph->width); - dx = x + pgm_read_word(&pGlyph->yOffset); // offset from character UL to start drawing - dy = y + pgm_read_word(&pGlyph->xOffset); - } - if ((dy + h) > pBBEP->native_height) { // trim it - h = pBBEP->native_height - dy; - } - u8EndMask = 0xff; - if (w & 7) { // width ends on a partial byte - u8EndMask <<= (8-(w & 7)); - } - end_y = dy + h; - ty = (pgm_read_word(&pGlyph[1].bitmapOffset) - (intptr_t)(s - pBits)); // compressed size - if (ty < 0 || ty > 4096) ty = 4096; // DEBUG - rc = g5_decode_init(&g5dec, w, h, s, ty); - if (rc != G5_SUCCESS) return; // corrupt data? - if (pBBEP->ucScreen) { // backbuffer, draw pixels + i = 0; + while (szMsg[i] && x < pBBEP->native_width && y < pBBEP->native_height) { + c = szMsg[i++]; + if (c < first || c > last) // undefined character + continue; // skip it + c -= first; // first char of font defined + pGlyph = &pFont->glyphs[c]; // glyph info for this character + if (pgm_read_byte(&pGlyph->width) > 1) { // skip this if drawing a space + s = pBits + pgm_read_word(&pGlyph->bitmapOffset); // start of compressed bitmap data + if (pgm_read_word(&pFont->rotation) == 0 || pgm_read_word(&pFont->rotation) == 180) { + h = pgm_read_word(&pGlyph->height); + w = pgm_read_byte(&pGlyph->width); + dx = x + pgm_read_word(&pGlyph->xOffset); // offset from character UL to start drawing + dy = y + pgm_read_word(&pGlyph->yOffset); + } else { // rotated + w = pgm_read_word(&pGlyph->height); + h = pgm_read_byte(&pGlyph->width); + dx = x + pgm_read_word(&pGlyph->yOffset); // offset from character UL to start drawing + dy = y + pgm_read_word(&pGlyph->xOffset); + } + if ((dy + h) > pBBEP->native_height) { // trim it + h = pBBEP->native_height - dy; + } + u8EndMask = 0xff; + if (w & 7) { // width ends on a partial byte + u8EndMask <<= (8-(w & 7)); + } + end_y = dy + h; + ty = (pgm_read_word(&pGlyph[1].bitmapOffset) - (intptr_t)(s - pBits)); // compressed size + if (ty < 0 || ty > 4096) ty = 4096; // DEBUG + rc = g5_decode_init(&g5dec, w, h, s, ty); + if (rc != G5_SUCCESS) return; // corrupt data? + if (pBBEP->ucScreen) { // backbuffer, draw pixels #ifndef NO_RAM - for (ty=dy; tynative_height; ty++) { - uint8_t u8, u8Count; - g5_decode_line(&g5dec, u8Cache); - s = u8Cache; - u8 = *s++; - u8Count = 8; - for (tx=x; txnative_height; ty++) { + uint8_t u8, u8Count; + g5_decode_line(&g5dec, u8Cache); + s = u8Cache; + u8 = *s++; + u8Count = 8; + for (tx=x; txchip_type == BBEP_CHIP_UC81xx) { - u8CMD1 = UC8151_DTM2; - u8CMD2 = UC8151_DTM1; - } else { - u8CMD1 = SSD1608_WRITE_RAM; - u8CMD2 = SSD1608_WRITE_ALTRAM; - } - u8CMD = u8CMD1; - if (iColor == BBEP_BLACK) bInvert = 1; - else if (iColor == BBEP_RED && (pBBEP->iFlags & BBEP_3COLOR)) { - u8CMD = u8CMD2; // second plane is red (inverted) - } - bbepWriteCmd(pBBEP, u8CMD); // memory write command - for (ty=dy; tynative_height; ty++) { - rc = g5_decode_line(&g5dec, u8Cache); - u8Cache[iSrcPitch-1] &= u8EndMask; // clean pixels beyond character width - u8Cache[iSrcPitch] = 0; - if (dx & 7) { // need to shift it over by 1-7 bits - uint8_t *s = u8Cache, uc1, uc0 = 0; // last shifted byte - uint8_t n = dx & 7; // shift amount - for (int j=0; j> n); - *s++ = uc0; - uc0 = uc1 << (8-n); - } - *s++ = uc0; // store final byte - *s++ = 0; // and a zero for good measure - } - if (bInvert) InvertBytes(u8Cache, iPitch); - bbepWriteData(pBBEP, u8Cache, iPitch); // write each row into the EPD framebuffer - } // for y - } - } // if not drawing a space - if (pgm_read_word(&pFont->rotation) == 0 || pgm_read_word(&pFont->rotation) == 180) { - x += pgm_read_byte(&pGlyph->xAdvance); // width of this character - } else { - y += pgm_read_byte(&pGlyph->xAdvance); - } - } // while drawing characters + } else { // draw directly into EPD memory + // set the memory window for this character + iSrcPitch = (w+7)/8; + w += (dx & 7); // add parital byte + bbepSetAddrWindow(pBBEP, dx, dy, w, h); + iPitch = (w+7)/8; + // start writing into the correct plane + if (pBBEP->chip_type == BBEP_CHIP_UC81xx) { + u8CMD1 = UC8151_DTM2; + u8CMD2 = UC8151_DTM1; + } else { + u8CMD1 = SSD1608_WRITE_RAM; + u8CMD2 = SSD1608_WRITE_ALTRAM; + } + u8CMD = u8CMD1; + if (iColor == BBEP_BLACK) bInvert = 1; + else if (iColor == BBEP_RED && (pBBEP->iFlags & BBEP_3COLOR)) { + u8CMD = u8CMD2; // second plane is red (inverted) + } + bbepWriteCmd(pBBEP, u8CMD); // memory write command + for (ty=dy; tynative_height; ty++) { + rc = g5_decode_line(&g5dec, u8Cache); + u8Cache[iSrcPitch-1] &= u8EndMask; // clean pixels beyond character width + u8Cache[iSrcPitch] = 0; + if (dx & 7) { // need to shift it over by 1-7 bits + uint8_t *s = u8Cache, uc1, uc0 = 0; // last shifted byte + uint8_t n = dx & 7; // shift amount + for (int j=0; j> n); + *s++ = uc0; + uc0 = uc1 << (8-n); + } + *s++ = uc0; // store final byte + *s++ = 0; // and a zero for good measure + } + if (bInvert) InvertBytes(u8Cache, iPitch); + bbepWriteData(pBBEP, u8Cache, iPitch); // write each row into the EPD framebuffer + } // for y + } + } // if not drawing a space + if (pgm_read_word(&pFont->rotation) == 0 || pgm_read_word(&pFont->rotation) == 180) { + x += pgm_read_byte(&pGlyph->xAdvance); // width of this character + } else { + y += pgm_read_byte(&pGlyph->xAdvance); + } + } // while drawing characters pBBEP->iCursorX = x; pBBEP->iCursorY = y; } /* EPDWriteStringCustom() */ @@ -710,12 +710,12 @@ uint8_t first, last; // int bbepWriteString(BBEPDISP *pBBEP, int x, int y, char *szMsg, int iSize, int iColor) { -int i, iFontOff, iLen; + int i, iFontOff, iLen; uint8_t c, *s, ucCMD, ucCMD1, ucCMD2; -int iOldFG; // old fg color to make sure red works -uint8_t u8Temp[128]; + int iOldFG; // old fg color to make sure red works + uint8_t u8Temp[128]; - if (pBBEP == NULL) return BBEP_ERROR_BAD_PARAMETER; + if (pBBEP == NULL) return BBEP_ERROR_BAD_PARAMETER; if (pBBEP->chip_type == BBEP_CHIP_UC81xx) { ucCMD1 = UC8151_DTM2; ucCMD2 = UC8151_DTM1; @@ -734,159 +734,159 @@ uint8_t u8Temp[128]; pBBEP->iCursorX = x; pBBEP->iCursorY = y; } if (pBBEP->iCursorX >= pBBEP->width || pBBEP->iCursorY >= pBBEP->height) - return BBEP_ERROR_BAD_PARAMETER; // can't draw off the display - + return BBEP_ERROR_BAD_PARAMETER; // can't draw off the display + iOldFG = pBBEP->iFG; // save old fg color if (iColor >= BBEP_YELLOW) { - pBBEP->iFG = iColor; + pBBEP->iFG = iColor; } if (iSize == FONT_8x8) // 8x8 font { - i = 0; - while (pBBEP->iCursorX < pBBEP->width && szMsg[i] != 0 && pBBEP->iCursorY < pBBEP->height) - { - c = (unsigned char)szMsg[i]; - iFontOff = (int)(c-32) * 7; - // we can't directly use the pointer to FLASH memory, so copy to a local buffer - u8Temp[0] = 0; // first column is blank - memcpy_P(&u8Temp[1], &ucFont[iFontOff], 7); // only needed on AVR - if (iColor == BBEP_BLACK) InvertBytes(u8Temp, 8); - iLen = 8; - if (pBBEP->iCursorX + iLen > pBBEP->width) { // clip right edge - iLen = pBBEP->width - pBBEP->iCursorX; - } - if (!pBBEP->ucScreen) { // bufferless mode, rotate the coordinate system to fit the situation - bbepSetAddrWindow(pBBEP, pBBEP->native_width-8-pBBEP->iCursorY, pBBEP->iCursorX, 8, pBBEP->native_height-pBBEP->iCursorX); - bbepWriteCmd(pBBEP, ucCMD); // write to "new" plane - bbepWriteData(pBBEP, u8Temp, iLen); - } else { // draw in memory + i = 0; + while (pBBEP->iCursorX < pBBEP->width && szMsg[i] != 0 && pBBEP->iCursorY < pBBEP->height) + { + c = (unsigned char)szMsg[i]; + iFontOff = (int)(c-32) * 7; + // we can't directly use the pointer to FLASH memory, so copy to a local buffer + u8Temp[0] = 0; // first column is blank + memcpy_P(&u8Temp[1], &ucFont[iFontOff], 7); // only needed on AVR + if (iColor == BBEP_BLACK) InvertBytes(u8Temp, 8); + iLen = 8; + if (pBBEP->iCursorX + iLen > pBBEP->width) { // clip right edge + iLen = pBBEP->width - pBBEP->iCursorX; + } + if (!pBBEP->ucScreen) { // bufferless mode, rotate the coordinate system to fit the situation + bbepSetAddrWindow(pBBEP, pBBEP->native_width-8-pBBEP->iCursorY, pBBEP->iCursorX, 8, pBBEP->native_height-pBBEP->iCursorX); + bbepWriteCmd(pBBEP, ucCMD); // write to "new" plane + bbepWriteData(pBBEP, u8Temp, iLen); + } else { // draw in memory #ifndef NO_RAM - // DEBUG + // DEBUG #endif - } - pBBEP->iCursorX += iLen; - if (pBBEP->iCursorX >= pBBEP->width-7 && pBBEP->wrap) { // word wrap enabled? - pBBEP->iCursorX = 0; // start at the beginning of the next line - pBBEP->iCursorY+=8; - } - i++; - } // while - pBBEP->iFG = iOldFG; // restore color - return BBEP_SUCCESS; + } + pBBEP->iCursorX += iLen; + if (pBBEP->iCursorX >= pBBEP->width-7 && pBBEP->wrap) { // word wrap enabled? + pBBEP->iCursorX = 0; // start at the beginning of the next line + pBBEP->iCursorY+=8; + } + i++; + } // while + pBBEP->iFG = iOldFG; // restore color + return BBEP_SUCCESS; } else if (iSize == FONT_12x16) { // 6x8 stretched to 12x16 - i = 0; + i = 0; while (pBBEP->iCursorX < pBBEP->width && pBBEP->iCursorY < pBBEP->height && szMsg[i] != 0) { -// stretch the 'normal' font instead of using the big font - int tx, ty; - c = szMsg[i] - 32; - unsigned char uc1, uc2, ucMask, *pDest; - s = (unsigned char *)&ucSmallFont[(int)c*5]; - u8Temp[0] = 0; // first column is blank - memcpy_P(&u8Temp[1], s, 6); - if (iColor == BBEP_BLACK) - InvertBytes(u8Temp, 6); - // Stretch the font to double width + double height - memset(&u8Temp[6], 0, 24); // write 24 new bytes - for (tx=0; tx<6; tx++) - { - ucMask = 3; - pDest = &u8Temp[6+tx*2]; - uc1 = uc2 = 0; - c = u8Temp[tx]; - for (ty=0; ty<4; ty++) - { - if (c & (1 << ty)) // a bit is set - uc1 |= ucMask; - if (c & (1 << (ty + 4))) - uc2 |= ucMask; - ucMask <<= 2; - } - pDest[0] = uc1; - pDest[1] = uc1; // double width - pDest[12] = uc2; - pDest[13] = uc2; - } - // smooth the diagonal lines - for (tx=0; tx<5; tx++) - { - uint8_t c0, c1, ucMask2; - c0 = u8Temp[tx]; - c1 = u8Temp[tx+1]; - pDest = &u8Temp[6+tx*2]; - ucMask = 1; - ucMask2 = 2; - for (ty=0; ty<7; ty++) - { - if (((c0 & ucMask) && !(c1 & ucMask) && !(c0 & ucMask2) && (c1 & ucMask2)) || (!(c0 & ucMask) && (c1 & ucMask) && (c0 & ucMask2) && !(c1 & ucMask2))) - { - if (ty < 3) // top half - { - if (iColor == BBEP_BLACK) { + // stretch the 'normal' font instead of using the big font + int tx, ty; + c = szMsg[i] - 32; + unsigned char uc1, uc2, ucMask, *pDest; + s = (unsigned char *)&ucSmallFont[(int)c*5]; + u8Temp[0] = 0; // first column is blank + memcpy_P(&u8Temp[1], s, 6); + if (iColor == BBEP_BLACK) + InvertBytes(u8Temp, 6); + // Stretch the font to double width + double height + memset(&u8Temp[6], 0, 24); // write 24 new bytes + for (tx=0; tx<6; tx++) + { + ucMask = 3; + pDest = &u8Temp[6+tx*2]; + uc1 = uc2 = 0; + c = u8Temp[tx]; + for (ty=0; ty<4; ty++) + { + if (c & (1 << ty)) // a bit is set + uc1 |= ucMask; + if (c & (1 << (ty + 4))) + uc2 |= ucMask; + ucMask <<= 2; + } + pDest[0] = uc1; + pDest[1] = uc1; // double width + pDest[12] = uc2; + pDest[13] = uc2; + } + // smooth the diagonal lines + for (tx=0; tx<5; tx++) + { + uint8_t c0, c1, ucMask2; + c0 = u8Temp[tx]; + c1 = u8Temp[tx+1]; + pDest = &u8Temp[6+tx*2]; + ucMask = 1; + ucMask2 = 2; + for (ty=0; ty<7; ty++) + { + if (((c0 & ucMask) && !(c1 & ucMask) && !(c0 & ucMask2) && (c1 & ucMask2)) || (!(c0 & ucMask) && (c1 & ucMask) && (c0 & ucMask2) && !(c1 & ucMask2))) + { + if (ty < 3) // top half + { + if (iColor == BBEP_BLACK) { pDest[1] &= ~(1 << ((ty * 2)+1)); pDest[2] &= ~(1 << ((ty * 2)+1)); pDest[1] &= ~(1 << ((ty+1) * 2)); pDest[2] &= ~(1 << ((ty+1) * 2)); - } else { + } else { pDest[1] |= (1 << ((ty * 2)+1)); pDest[2] |= (1 << ((ty * 2)+1)); pDest[1] |= (1 << ((ty+1) * 2)); pDest[2] |= (1 << ((ty+1) * 2)); - } - } - else if (ty == 3) // on the border - { - if (iColor == BBEP_BLACK) { + } + } + else if (ty == 3) // on the border + { + if (iColor == BBEP_BLACK) { pDest[1] &= ~0x80; pDest[2] &= ~0x80; pDest[13] &= ~1; pDest[14] &= ~1; - } else { + } else { pDest[1] |= 0x80; pDest[2] |= 0x80; pDest[13] |= 1; pDest[14] |= 1; - } - } - else // bottom half - { - if (iColor == BBEP_BLACK) { + } + } + else // bottom half + { + if (iColor == BBEP_BLACK) { pDest[13] &= ~(1 << (2*(ty-4)+1)); pDest[14] &= ~(1 << (2*(ty-4)+1)); pDest[13] &= ~(1 << ((ty-3) * 2)); pDest[14] &= ~(1 << ((ty-3) * 2)); - } else { + } else { pDest[13] |= (1 << (2*(ty-4)+1)); pDest[14] |= (1 << (2*(ty-4)+1)); pDest[13] |= (1 << ((ty-3) * 2)); pDest[14] |= (1 << ((ty-3) * 2)); - } - } - } - else if (!(c0 & ucMask) && (c1 & ucMask) && (c0 & ucMask2) && !(c1 & ucMask2)) - { - if (ty < 4) // top half - { - if (iColor == BBEP_BLACK) { + } + } + } + else if (!(c0 & ucMask) && (c1 & ucMask) && (c0 & ucMask2) && !(c1 & ucMask2)) + { + if (ty < 4) // top half + { + if (iColor == BBEP_BLACK) { pDest[1] &= ~(1 << ((ty * 2)+1)); pDest[2] &= ~(1 << ((ty+1) * 2)); - } else { + } else { pDest[1] |= (1 << ((ty * 2)+1)); pDest[2] |= (1 << ((ty+1) * 2)); - } - } - else - { - if (iColor == BBEP_BLACK) { + } + } + else + { + if (iColor == BBEP_BLACK) { pDest[13] &= ~(1 << (2*(ty-4)+1)); pDest[14] &= ~(1 << ((ty-3) * 2)); - } else { + } else { pDest[13] |= (1 << (2*(ty-4)+1)); pDest[14] |= (1 << ((ty-3) * 2)); - } - } - } - ucMask <<= 1; ucMask2 <<= 1; - } - } - iLen = 12; - if (pBBEP->iCursorX + iLen > pBBEP->width) // clip right edge - iLen = pBBEP->width - pBBEP->iCursorX; + } + } + } + ucMask <<= 1; ucMask2 <<= 1; + } + } + iLen = 12; + if (pBBEP->iCursorX + iLen > pBBEP->width) // clip right edge + iLen = pBBEP->width - pBBEP->iCursorX; if (!pBBEP->ucScreen) { // bufferless mode bbepSetAddrWindow(pBBEP, pBBEP->native_width-8-pBBEP->iCursorY, pBBEP->iCursorX, 8, iLen); bbepWriteCmd(pBBEP, ucCMD); // write to "new" plane @@ -899,85 +899,85 @@ uint8_t u8Temp[128]; // DEBUG #endif } - pBBEP->iCursorX += iLen; - if (pBBEP->iCursorX >= pBBEP->width-11 && pBBEP->wrap) // word wrap enabled? - { + pBBEP->iCursorX += iLen; + if (pBBEP->iCursorX >= pBBEP->width-11 && pBBEP->wrap) // word wrap enabled? + { pBBEP->iCursorX = 0; // start at the beginning of the next line pBBEP->iCursorY += 16; - } - i++; - } // while - pBBEP->iFG = iOldFG; // restore color - return BBEP_SUCCESS; + } + i++; + } // while + pBBEP->iFG = iOldFG; // restore color + return BBEP_SUCCESS; } // 12x16 else if (iSize == FONT_6x8) { - i = 0; - while (pBBEP->iCursorX < pBBEP->width && pBBEP->iCursorY < pBBEP->height && szMsg[i] != 0) - { - c = szMsg[i] - 32; - // we can't directly use the pointer to FLASH memory, so copy to a local buffer - u8Temp[0] = 0; // first column is blank - memcpy_P(&u8Temp[1], &ucSmallFont[(int)c*5], 5); - if (iColor == BBEP_BLACK) InvertBytes(u8Temp, 6); - iLen = 6; - if (pBBEP->iCursorX + iLen > pBBEP->width) // clip right edge - iLen = pBBEP->width - pBBEP->iCursorX; - if (!pBBEP->ucScreen) { // bufferless mode - bbepSetAddrWindow(pBBEP, pBBEP->iCursorX, pBBEP->iCursorY, 8, iLen); - bbepWriteCmd(pBBEP, ucCMD); // write to "new" plane - bbepWriteData(pBBEP, u8Temp, iLen); - } else { // write to RAM + i = 0; + while (pBBEP->iCursorX < pBBEP->width && pBBEP->iCursorY < pBBEP->height && szMsg[i] != 0) + { + c = szMsg[i] - 32; + // we can't directly use the pointer to FLASH memory, so copy to a local buffer + u8Temp[0] = 0; // first column is blank + memcpy_P(&u8Temp[1], &ucSmallFont[(int)c*5], 5); + if (iColor == BBEP_BLACK) InvertBytes(u8Temp, 6); + iLen = 6; + if (pBBEP->iCursorX + iLen > pBBEP->width) // clip right edge + iLen = pBBEP->width - pBBEP->iCursorX; + if (!pBBEP->ucScreen) { // bufferless mode + bbepSetAddrWindow(pBBEP, pBBEP->iCursorX, pBBEP->iCursorY, 8, iLen); + bbepWriteCmd(pBBEP, ucCMD); // write to "new" plane + bbepWriteData(pBBEP, u8Temp, iLen); + } else { // write to RAM #ifndef NO_RAM - // DEBUG + // DEBUG #endif - } - pBBEP->iCursorX += iLen; - if (pBBEP->iCursorX >= pBBEP->width-5 && pBBEP->wrap) // word wrap enabled? - { - pBBEP->iCursorX = 0; // start at the beginning of the next line - pBBEP->iCursorY +=8; - } - i++; - } - pBBEP->iFG = iOldFG; // restore color - return BBEP_SUCCESS; + } + pBBEP->iCursorX += iLen; + if (pBBEP->iCursorX >= pBBEP->width-5 && pBBEP->wrap) // word wrap enabled? + { + pBBEP->iCursorX = 0; // start at the beginning of the next line + pBBEP->iCursorY +=8; + } + i++; + } + pBBEP->iFG = iOldFG; // restore color + return BBEP_SUCCESS; } // 6x8 - pBBEP->iFG = iOldFG; // restore color - return BBEP_ERROR_BAD_PARAMETER; // invalid size + pBBEP->iFG = iOldFG; // restore color + return BBEP_ERROR_BAD_PARAMETER; // invalid size } /* bbepWriteString() */ // // Get the width of text in a custom font // void bbepGetStringBox(BB_FONT *pFont, const char *szMsg, int *width, int *top, int *bottom) { -int cx = 0; -unsigned int c, i = 0; -BB_GLYPH *pBBG; -int miny, maxy; - - if (width == NULL || top == NULL || bottom == NULL || pFont == NULL || szMsg == NULL) return; // bad pointers - miny = 1000; maxy = 0; - while (szMsg[i]) { - c = szMsg[i++]; - if (c < pFont->first || c > pFont->last) // undefined character - continue; // skip it - c -= pFont->first; // first char of font defined - pBBG = &pFont->glyphs[c]; - cx += pBBG->xAdvance; - if (pBBG->yOffset < miny) miny = pBBG->yOffset; - if (pBBG->height+pBBG->yOffset > maxy) maxy = pBBG->height+pBBG->yOffset; - } - *width = cx; - *top = miny; - *bottom = maxy; + int cx = 0; + unsigned int c, i = 0; + BB_GLYPH *pBBG; + int miny, maxy; + + if (width == NULL || top == NULL || bottom == NULL || pFont == NULL || szMsg == NULL) return; // bad pointers + miny = 1000; maxy = 0; + while (szMsg[i]) { + c = szMsg[i++]; + if (c < pFont->first || c > pFont->last) // undefined character + continue; // skip it + c -= pFont->first; // first char of font defined + pBBG = &pFont->glyphs[c]; + cx += pBBG->xAdvance; + if (pBBG->yOffset < miny) miny = pBBG->yOffset; + if (pBBG->height+pBBG->yOffset > maxy) maxy = pBBG->height+pBBG->yOffset; + } + *width = cx; + *top = miny; + *bottom = maxy; } /* bbepGetStringBox() */ void bbepAllocBuffer(BBEPDISP *pBBEP) { #ifndef NO_RAM - pBBEP->ucScreen = (uint8_t *)malloc(pBBEP->width * ((pBBEP->height+7)>>3)); - pBBEP->iScreenOffset = 0; + pBBEP->ucScreen = (uint8_t *)malloc(pBBEP->width * ((pBBEP->height+7)>>3)); + pBBEP->iScreenOffset = 0; #endif } /* obdAllocBuffer() */ // @@ -986,22 +986,22 @@ void bbepAllocBuffer(BBEPDISP *pBBEP) // void bbepDrawLine(BBEPDISP *pBBEP, int x1, int y1, int x2, int y2, uint8_t ucColor) { - int temp; - int dx = x2 - x1; - int dy = y2 - y1; - int error; - uint8_t *p, *pStart, ucFill = 0, mask, bOld, bNew; - int xinc, yinc; - int y, x; - int iPitch; - int iRedOffset = 0; - - if (pBBEP == NULL) return; - - if (x1 < 0 || x2 < 0 || y1 < 0 || y2 < 0 || x1 >= pBBEP->width || x2 >= pBBEP->width || y1 >= pBBEP->height || y2 >= pBBEP->height) - return; + int temp; + int dx = x2 - x1; + int dy = y2 - y1; + int error; + uint8_t *p, *pStart, ucFill = 0, mask, bOld, bNew; + int xinc, yinc; + int y, x; + int iPitch; + int iRedOffset = 0; + + if (pBBEP == NULL) return; + + if (x1 < 0 || x2 < 0 || y1 < 0 || y2 < 0 || x1 >= pBBEP->width || x2 >= pBBEP->width || y1 >= pBBEP->height || y2 >= pBBEP->height) + return; iPitch = (pBBEP->width + 7)>>3; - if (ucColor >= BBEP_YELLOW && pBBEP->iFlags & (BBEP_3COLOR | BBEP_4COLOR)) { + if (ucColor >= BBEP_YELLOW && pBBEP->iFlags & (BBEP_3COLOR | BBEP_4COLOR)) { // use the second half of the image buffer iRedOffset = iPitch * pBBEP->height; } @@ -1012,119 +1012,117 @@ void bbepDrawLine(BBEPDISP *pBBEP, int x1, int y1, int x2, int y2, uint8_t ucCol ucFill = 0; memset(u8Cache, ucFill, sizeof(u8Cache)); } - if(abs(dx) > abs(dy)) { - // X major case - if(x2 < x1) { - dx = -dx; - temp = x1; - x1 = x2; - x2 = temp; - temp = y1; - y1 = y2; - y2 = temp; - } - - y = y1; - dy = (y2 - y1); - error = dx >> 1; - yinc = 1; - if (dy < 0) - { - dy = -dy; - yinc = -1; - } - if (pBBEP->ucScreen) { - p = pStart = &pBBEP->ucScreen[iRedOffset + (x1>>3) + (y * iPitch)]; // point to current spot in back buffer - } else { // no back buffer, draw directly to the display RAM - p = pStart = u8Cache; - } - mask = 0x80 >> (x1 & 7); // current bit offset - for(x=x1; x1 <= x2; x1++) { - if (ucColor == BBEP_BLACK) { - *p &= ~mask; // set pixel and increment x pointer - } else { - *p |= mask; + if(abs(dx) > abs(dy)) { + // X major case + if(x2 < x1) { + dx = -dx; + temp = x1; + x1 = x2; + x2 = temp; + temp = y1; + y1 = y2; + y2 = temp; } - mask >>= 1; - if (mask == 0) { - p++; - mask = 0x80; // next byte + + y = y1; + dy = (y2 - y1); + error = dx >> 1; + yinc = 1; + if (dy < 0) + { + dy = -dy; + yinc = -1; + } + if (pBBEP->ucScreen) { + p = pStart = &pBBEP->ucScreen[iRedOffset + (x1>>3) + (y * iPitch)]; // point to current spot in back buffer + } else { // no back buffer, draw directly to the display RAM + p = pStart = u8Cache; } - error -= dy; - if (error < 0) - { - error += dx; - if (pBBEP->ucScreen) { - p += (yinc > 0) ? iPitch : -iPitch; - pStart = p; - } else { // no buffer - // y is changing, dump the pixels we modified - bbepSetAddrWindow(pBBEP, x, y1, 8*(int)(p-pStart), 1); - bbepStartWrite(pBBEP, pBBEP->iPlane); - bbepWriteData(pBBEP, pStart, (int)(p-pStart)); // write the row we changed - memset(pStart, ucFill, (int)(p-pStart)); - p = pStart; - } - x = x1+1; // we've already written the byte at x1 - y1 += yinc; - } - } // for x1 - if (p != pStart) // some data needs to be written - { - bbepSetAddrWindow(pBBEP, x, y1, 8*(int)(p-pStart), 1); - bbepStartWrite(pBBEP, pBBEP->iPlane); - bbepWriteData(pBBEP, pStart, (int)(p-pStart)); - } - } else { - // Y major case - if(y1 > y2) { - dy = -dy; - temp = x1; - x1 = x2; - x2 = temp; - temp = y1; - y1 = y2; - y2 = temp; - } - dx = (x2 - x1); - error = dy >> 1; - xinc = 1; - if (dx < 0) { - dx = -dx; - xinc = -1; - } - for(; y1 <= y2; y1++) { mask = 0x80 >> (x1 & 7); // current bit offset - if (pBBEP->ucScreen) { - p = &pBBEP->ucScreen[iRedOffset + (x1>>3) + (y1 * iPitch)]; // point if (ucColor == BBEP_BLACK) - bOld = bNew = p[0]; // current pixels - } else { - bOld = bNew = ucFill; - } - if (ucColor == BBEP_BLACK) { - bNew &= ~mask; // set the pixel - } else { - bNew |= mask; - } - error -= dx; - if (bOld != bNew) { - if (pBBEP->ucScreen) { - p[0] = bNew; // save to RAM - p += iPitch; // next line - bOld = bNew = p[0]; - } else { - bbepSetAddrWindow(pBBEP, x1, y1, 8, 1); + for(x=x1; x1 <= x2; x1++) { + if (ucColor == BBEP_BLACK) { + *p &= ~mask; // set pixel and increment x pointer + } else { + *p |= mask; + } + mask >>= 1; + if (mask == 0) { + p++; + mask = 0x80; // next byte + } + error -= dy; + if (error < 0) { + error += dx; + if (pBBEP->ucScreen) { + p += (yinc > 0) ? iPitch : -iPitch; + pStart = p; + } else { // no buffer + // y is changing, dump the pixels we modified + bbepSetAddrWindow(pBBEP, x, y1, 16+x1-x, 1); + bbepStartWrite(pBBEP, pBBEP->iPlane); + bbepWriteData(pBBEP, pStart, (16+x1-x)>>3); // write the row we changed + memset(pStart, ucFill, (16+x1-x)>>3); + p = pStart; + } + x = x1+1; // we've already written the byte at x1 + y1 += yinc; + } + } // for x1 + if (x != x1) { // some data needs to be written + bbepSetAddrWindow(pBBEP, x, y1, 16+x1-x, 1); bbepStartWrite(pBBEP, pBBEP->iPlane); - bbepWriteData(pBBEP, &bNew, 1); - bOld = bNew = ucFill; + bbepWriteData(pBBEP, pStart, (16+x1-x)>>3); } - } - if (error < 0) { - error += dy; - x1 += xinc; - } - } // for y - } // y major case + } else { + // Y major case + if(y1 > y2) { + dy = -dy; + temp = x1; + x1 = x2; + x2 = temp; + temp = y1; + y1 = y2; + y2 = temp; + } + dx = (x2 - x1); + error = dy >> 1; + xinc = 1; + if (dx < 0) { + dx = -dx; + xinc = -1; + } + for(; y1 <= y2; y1++) { + mask = 0x80 >> (x1 & 7); // current bit offset + if (pBBEP->ucScreen) { + p = &pBBEP->ucScreen[iRedOffset + (x1>>3) + (y1 * iPitch)]; // point if (ucColor == BBEP_BLACK) + bOld = bNew = p[0]; // current pixels + } else { + bOld = bNew = ucFill; + } + if (ucColor == BBEP_BLACK) { + bNew &= ~mask; // set the pixel + } else { + bNew |= mask; + } + error -= dx; + if (bOld != bNew) { + if (pBBEP->ucScreen) { + p[0] = bNew; // save to RAM + p += iPitch; // next line + bOld = bNew = p[0]; + } else { + bbepSetAddrWindow(pBBEP, x1, y1, 8, 1); + bbepStartWrite(pBBEP, pBBEP->iPlane); + bbepWriteData(pBBEP, &bNew, 1); + bOld = bNew = ucFill; + } + } + if (error < 0) { + error += dy; + x1 += xinc; + } + } // for y + } // y major case } /* bbepDrawLine() */ // @@ -1136,12 +1134,12 @@ static void DrawScaledPixel(BBEPDISP *pBBEP, int iCX, int iCY, int x, int y, int uint8_t *d, ucMask; int iPitch; int iRedOffset = 0; - + iPitch = (pBBEP->width + 7) >> 3; if (ucColor >= BBEP_YELLOW && pBBEP->iFlags & (BBEP_3COLOR | BBEP_4COLOR)) { - // use the second half of the image buffer - iRedOffset = iPitch * pBBEP->height; - } + // use the second half of the image buffer + iRedOffset = iPitch * pBBEP->height; + } if (iXFrac != 0x10000) x = ((x * iXFrac) >> 16); if (iYFrac != 0x10000) y = ((y * iYFrac) >> 16); x += iCX; y += iCY; @@ -1160,7 +1158,7 @@ static void DrawScaledPixel(BBEPDISP *pBBEP, int iCX, int iCY, int x, int y, int static void DrawScaledLine(BBEPDISP *pBBEP, int iCX, int iCY, int x, int y, int32_t iXFrac, int32_t iYFrac, uint8_t ucColor) { int iLen, x2; - + if (iXFrac != 0x10000) x = ((x * iXFrac) >> 16); if (iYFrac != 0x10000) y = ((y * iYFrac) >> 16); iLen = x*2; @@ -1207,35 +1205,28 @@ void bbepEllipse(BBEPDISP *pBBEP, int iCenterX, int iCenterY, int32_t iRadiusX, int32_t iXFrac, iYFrac; int iRadius, iDelta, x, y; - if (pBBEP == NULL || (pBBEP->ucScreen == NULL && !bFilled) + if (pBBEP == NULL || (pBBEP->ucScreen == NULL && !bFilled)) return; // must have back buffer defined for outline mode - + if (iRadiusX <= 0 || iRadiusY <= 0) return; // invalid radii - if (iRadiusX > iRadiusY) // use X as the primary radius - { + if (iRadiusX > iRadiusY) {// use X as the primary radius iRadius = iRadiusX; iXFrac = 65536; iYFrac = (iRadiusY * 65536) / iRadiusX; - } - else - { + } else { iRadius = iRadiusY; iXFrac = (iRadiusX * 65536) / iRadiusY; iYFrac = 65536; } iDelta = 3 - (2 * iRadius); x = 0; y = iRadius; - while (x <= y) - { + while (x <= y) { BresenhamCircle(pBBEP, iCenterX, iCenterY, x, y, iXFrac, iYFrac, ucColor, bFilled); x++; - if (iDelta < 0) - { + if (iDelta < 0) { iDelta += (4*x) + 6; - } - else - { + } else { iDelta += 4 * (x-y) + 10; y--; } @@ -1251,21 +1242,21 @@ void bbepRectangle(BBEPDISP *pBBEP, int x1, int y1, int x2, int y2, uint8_t ucCo int tmp, iOff; int iPitch; int iRedOffset = 0; - + if (ucColor >= BBEP_YELLOW) { if (pBBEP->iFlags & (BBEP_3COLOR | BBEP_4COLOR)) { - // use the second half of the image buffer - iRedOffset = pBBEP->width * ((pBBEP->height+7)/8); + // use the second half of the image buffer + iRedOffset = pBBEP->width * ((pBBEP->height+7)/8); } else { // force red to black if not present ucColor = BBEP_BLACK; } } - + if (pBBEP == NULL) return; // invalid - must have BBEPDISP structure - + if (x1 < 0 || y1 < 0 || x2 < 0 || y2 < 0 || - x1 >= pBBEP->width || y1 >= pBBEP->height || x2 >= pBBEP->width || y2 >= pBBEP->height) return; // invalid coordinates + x1 >= pBBEP->width || y1 >= pBBEP->height || x2 >= pBBEP->width || y2 >= pBBEP->height) return; // invalid coordinates iPitch = pBBEP->width; // Make sure that X1/Y1 is above and to the left of X2/Y2 // swap coordinates as needed to make this true @@ -1333,7 +1324,7 @@ void bbepRectangle(BBEPDISP *pBBEP, int x1, int y1, int x2, int y2, uint8_t ucCo } else // outline { - // see if top and bottom lines are within the same byte rows + // see if top and bottom lines are within the same byte rows d = &pBBEP->ucScreen[iRedOffset + (y1 >> 3)*iPitch + x1]; if ((y1 >> 3) == (y2 >> 3)) { @@ -1388,8 +1379,7 @@ void bbepRectangle(BBEPDISP *pBBEP, int x1, int y1, int x2, int y2, uint8_t ucCo d = &pBBEP->ucScreen[iRedOffset + (y1 >> 3)*iPitch + x1]; iOff = (y2 >> 3) - (y1 >> 3); iOff *= iPitch; - for (; x1 < x2; x1++) - { + for (; x1 < x2; x1++) { if (ucColor) { *d |= ucMask; d[iOff] |= ucMask2;