Others memory optimizations

This commit is contained in:
sinseman 2015-02-20 00:03:25 +01:00
parent abb99e5713
commit 7af41d52d7
4 changed files with 381 additions and 278 deletions

View File

@ -32,7 +32,6 @@ uint8_t date_minute;
/////////////////////////////////////////
//////////////////ENCODER///////////////////////
#define ENCODER_OPTIMIZE_INTERRUPTS
#define Enter 12
#define ENCODER_STEP 4
@ -84,7 +83,6 @@ MenuItem m_recreset = MenuItem(NULL, MENU_RECRESET); //Reset records
/////////////////////////////////////////
//////////////////ECRAN///////////////////////
#define enablePartialUpdate
#define PIN_SCLK 4
#define PIN_LIGHT 11
#define PIN_SCE 7
@ -204,17 +202,11 @@ void resetAllStats()
void playConfirmMelody()
{
if (true == conf.volume){
toneAC(700, 10, 150);
toneAC(500, 10, 150);
toneAC(700, 150);
toneAC(500, 150);
}
}
void initEeprom()
{
EEPROM_writeAnything(0, conf);
resetAllStats();
}
void renderChrono(Stat value = stat)
{
@ -665,12 +657,8 @@ void renderMenu(MenuItem newMenuItem = menu.getCurrent(), uint8_t dir = 2)
display.println();
display.print(F("m/s:"));
float m = floor(stat_to_display.txchutemax);
m = m + (round(10 * stat_to_display.txchutemax) - (10 * m)) / 10;
renderStatItem(m, F("|"));
m = floor(stat_to_display.txchutemin);
m = m + (round(10 * stat_to_display.txchutemin) - (10 * m)) / 10;
renderStatItem(m, F(""));
renderStatItem(stat_to_display.txchutemax, F("|"));
renderStatItem(stat_to_display.txchutemin, F(""));
display.println();
display.print(F("Cumul:"));
@ -710,7 +698,6 @@ void menuSetup()
m_contrast.name = F("Contra"); //eclairage
m_date.name = F("Date"); //date
m_retour2.name = F("Retour"); //Retour
//m_stat.name = F("Stat"); //Stats
m_recreset.name = F("Reset"); //Reset records
/*
@ -863,7 +850,8 @@ void makeBeeps()
if ((vario > conf.vario_climb_rate_start && conf.vario_climb_rate_start != 0) || (vario < conf.vario_sink_rate_start && conf.vario_sink_rate_start != 0)) {
//when climbing make faster and shorter beeps
toneAC(getBeepFrequency(variation), 10, beepLatency, true);
//toneAC(getBeepFrequency(variation), 10, beepLatency, true);
toneAC(getBeepFrequency(variation), beepLatency);
}
else {
toneAC(0);
@ -880,10 +868,13 @@ void setup()
{
//Serial.begin(9600);
// clear the configuration
if (initialisation){
EEPROM_writeAnything(0, conf);
resetAllStats();
}
// load the configuration
if (initialisation)
initEeprom();
EEPROM_readAnything(0, conf);
readStat();

View File

@ -11,260 +11,261 @@
// Standard ASCII 5x7 font
static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
0x18, 0x3C, 0x7E, 0x3C, 0x18,
0x1C, 0x57, 0x7D, 0x57, 0x1C,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
0x00, 0x18, 0x3C, 0x18, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
0x00, 0x18, 0x24, 0x18, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
0x30, 0x48, 0x3A, 0x06, 0x0E,
0x26, 0x29, 0x79, 0x29, 0x26,
0x40, 0x7F, 0x05, 0x05, 0x07,
0x40, 0x7F, 0x05, 0x25, 0x3F,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
0x14, 0x22, 0x7F, 0x22, 0x14,
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
0x06, 0x09, 0x7F, 0x01, 0x7F,
0x00, 0x66, 0x89, 0x95, 0x6A,
0x60, 0x60, 0x60, 0x60, 0x60,
0x94, 0xA2, 0xFF, 0xA2, 0x94,
0x08, 0x04, 0x7E, 0x04, 0x08,
0x10, 0x20, 0x7E, 0x20, 0x10,
0x08, 0x08, 0x2A, 0x1C, 0x08,
0x08, 0x1C, 0x2A, 0x08, 0x08,
0x1E, 0x10, 0x10, 0x10, 0x10,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x30, 0x38, 0x3E, 0x38, 0x30,
0x06, 0x0E, 0x3E, 0x0E, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C,
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C,
0x1E, 0xA1, 0xA1, 0x61, 0x12,
0x3A, 0x40, 0x40, 0x20, 0x7A,
0x38, 0x54, 0x54, 0x55, 0x59,
0x21, 0x55, 0x55, 0x79, 0x41,
0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut
0x21, 0x55, 0x54, 0x78, 0x40,
0x20, 0x54, 0x55, 0x79, 0x40,
0x0C, 0x1E, 0x52, 0x72, 0x12,
0x39, 0x55, 0x55, 0x55, 0x59,
0x39, 0x54, 0x54, 0x54, 0x59,
0x39, 0x55, 0x54, 0x54, 0x58,
0x00, 0x00, 0x45, 0x7C, 0x41,
0x00, 0x02, 0x45, 0x7D, 0x42,
0x00, 0x01, 0x45, 0x7C, 0x40,
0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut
0xF0, 0x28, 0x25, 0x28, 0xF0,
0x7C, 0x54, 0x55, 0x45, 0x00,
0x20, 0x54, 0x54, 0x7C, 0x54,
0x7C, 0x0A, 0x09, 0x7F, 0x49,
0x32, 0x49, 0x49, 0x49, 0x32,
0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut
0x32, 0x4A, 0x48, 0x48, 0x30,
0x3A, 0x41, 0x41, 0x21, 0x7A,
0x3A, 0x42, 0x40, 0x20, 0x78,
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut
0x3D, 0x40, 0x40, 0x40, 0x3D,
0x3C, 0x24, 0xFF, 0x24, 0x24,
0x48, 0x7E, 0x49, 0x43, 0x66,
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
0xFF, 0x09, 0x29, 0xF6, 0x20,
0xC0, 0x88, 0x7E, 0x09, 0x03,
0x20, 0x54, 0x54, 0x79, 0x41,
0x00, 0x00, 0x44, 0x7D, 0x41,
0x30, 0x48, 0x48, 0x4A, 0x32,
0x38, 0x40, 0x40, 0x22, 0x7A,
0x00, 0x7A, 0x0A, 0x0A, 0x72,
0x7D, 0x0D, 0x19, 0x31, 0x7D,
0x26, 0x29, 0x29, 0x2F, 0x28,
0x26, 0x29, 0x29, 0x29, 0x26,
0x30, 0x48, 0x4D, 0x40, 0x20,
0x38, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x38,
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
0x2F, 0x10, 0x28, 0x34, 0xFA,
0x00, 0x00, 0x7B, 0x00, 0x00,
0x08, 0x14, 0x2A, 0x14, 0x22,
0x22, 0x14, 0x2A, 0x14, 0x08,
0xAA, 0x00, 0x55, 0x00, 0xAA,
0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x00, 0x00, 0x00, 0xFF, 0x00,
0x10, 0x10, 0x10, 0xFF, 0x00,
0x14, 0x14, 0x14, 0xFF, 0x00,
0x10, 0x10, 0xFF, 0x00, 0xFF,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x14, 0x14, 0x14, 0xFC, 0x00,
0x14, 0x14, 0xF7, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x14, 0x14, 0xF4, 0x04, 0xFC,
0x14, 0x14, 0x17, 0x10, 0x1F,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0x1F, 0x00,
0x10, 0x10, 0x10, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x10,
0x10, 0x10, 0x10, 0x1F, 0x10,
0x10, 0x10, 0x10, 0xF0, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0xFF, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x14,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x1F, 0x10, 0x17,
0x00, 0x00, 0xFC, 0x04, 0xF4,
0x14, 0x14, 0x17, 0x10, 0x17,
0x14, 0x14, 0xF4, 0x04, 0xF4,
0x00, 0x00, 0xFF, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0xF7, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x17, 0x14,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0xF4, 0x14,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x00, 0x00, 0x1F, 0x10, 0x1F,
0x00, 0x00, 0x00, 0x1F, 0x14,
0x00, 0x00, 0x00, 0xFC, 0x14,
0x00, 0x00, 0xF0, 0x10, 0xF0,
0x10, 0x10, 0xFF, 0x10, 0xFF,
0x14, 0x14, 0x14, 0xFF, 0x14,
0x10, 0x10, 0x10, 0x1F, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x10,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x38, 0x44, 0x44, 0x38, 0x44,
0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta
0x7E, 0x02, 0x02, 0x06, 0x06,
0x02, 0x7E, 0x02, 0x7E, 0x02,
0x63, 0x55, 0x49, 0x41, 0x63,
0x38, 0x44, 0x44, 0x3C, 0x04,
0x40, 0x7E, 0x20, 0x1E, 0x20,
0x06, 0x02, 0x7E, 0x02, 0x02,
0x99, 0xA5, 0xE7, 0xA5, 0x99,
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
0x4C, 0x72, 0x01, 0x72, 0x4C,
0x30, 0x4A, 0x4D, 0x4D, 0x30,
0x30, 0x48, 0x78, 0x48, 0x30,
0xBC, 0x62, 0x5A, 0x46, 0x3D,
0x3E, 0x49, 0x49, 0x49, 0x00,
0x7E, 0x01, 0x01, 0x01, 0x7E,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x44, 0x44, 0x5F, 0x44, 0x44,
0x40, 0x51, 0x4A, 0x44, 0x40,
0x40, 0x44, 0x4A, 0x51, 0x40,
0x00, 0x00, 0xFF, 0x01, 0x03,
0xE0, 0x80, 0xFF, 0x00, 0x00,
0x08, 0x08, 0x6B, 0x6B, 0x08,
0x36, 0x12, 0x36, 0x24, 0x36,
0x06, 0x0F, 0x09, 0x0F, 0x06,
0x00, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x10, 0x10, 0x00,
0x30, 0x40, 0xFF, 0x01, 0x01,
0x00, 0x1F, 0x01, 0x01, 0x1E,
0x00, 0x19, 0x1D, 0x17, 0x12,
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00
0x00, 0x00, 0x00, 0x00, 0x00, //0 null
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, //1
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, //2
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, //3
0x18, 0x3C, 0x7E, 0x3C, 0x18, //4
0x1C, 0x57, 0x7D, 0x57, 0x1C, //5
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, //6
0x00, 0x18, 0x3C, 0x18, 0x00, //7
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, //8
0x00, 0x18, 0x24, 0x18, 0x00, //9
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, //10
0x30, 0x48, 0x3A, 0x06, 0x0E, //11
0x26, 0x29, 0x79, 0x29, 0x26, //12
0x40, 0x7F, 0x05, 0x05, 0x07, //13
0x40, 0x7F, 0x05, 0x25, 0x3F, //14
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, //15
0x7F, 0x3E, 0x1C, 0x1C, 0x08, //16
0x08, 0x1C, 0x1C, 0x3E, 0x7F, //17
0x14, 0x22, 0x7F, 0x22, 0x14, //18
0x5F, 0x5F, 0x00, 0x5F, 0x5F, //19
0x06, 0x09, 0x7F, 0x01, 0x7F, //20
0x00, 0x66, 0x89, 0x95, 0x6A, //21
0x60, 0x60, 0x60, 0x60, 0x60, //22
0x94, 0xA2, 0xFF, 0xA2, 0x94, //23
0x08, 0x04, 0x7E, 0x04, 0x08, //24
0x10, 0x20, 0x7E, 0x20, 0x10, //25
0x08, 0x08, 0x2A, 0x1C, 0x08, //26
0x08, 0x1C, 0x2A, 0x08, 0x08, //27
0x1E, 0x10, 0x10, 0x10, 0x10, //28
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, //29
0x30, 0x38, 0x3E, 0x38, 0x30, //30
0x06, 0x0E, 0x3E, 0x0E, 0x06, //31
0x00, 0x00, 0x00, 0x00, 0x00, //32 (space)
0x00, 0x00, 0x5F, 0x00, 0x00, //33 !
0x00, 0x07, 0x00, 0x07, 0x00, //34 "
0x14, 0x7F, 0x14, 0x7F, 0x14, //35 #
0x24, 0x2A, 0x7F, 0x2A, 0x12, //36 $
0x23, 0x13, 0x08, 0x64, 0x62, //37 %
0x36, 0x49, 0x56, 0x20, 0x50, //38 &
0x00, 0x08, 0x07, 0x03, 0x00, //39 ‘
0x00, 0x1C, 0x22, 0x41, 0x00, //40 (
0x00, 0x41, 0x22, 0x1C, 0x00, //41 )
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, //42 *
0x08, 0x08, 0x3E, 0x08, 0x08, //43 +
0x00, 0x80, 0x70, 0x30, 0x00, //44 ,
0x08, 0x08, 0x08, 0x08, 0x08, //45 -
0x00, 0x00, 0x60, 0x60, 0x00, //46 .
0x20, 0x10, 0x08, 0x04, 0x02, //47 /
0x3E, 0x51, 0x49, 0x45, 0x3E, //48 0
0x00, 0x42, 0x7F, 0x40, 0x00, //49 1
0x72, 0x49, 0x49, 0x49, 0x46, //50 2
0x21, 0x41, 0x49, 0x4D, 0x33, //51 3
0x18, 0x14, 0x12, 0x7F, 0x10, //52 4
0x27, 0x45, 0x45, 0x45, 0x39, //53 5
0x3C, 0x4A, 0x49, 0x49, 0x31, //54 6
0x41, 0x21, 0x11, 0x09, 0x07, //55 7
0x36, 0x49, 0x49, 0x49, 0x36, //56 8
0x46, 0x49, 0x49, 0x29, 0x1E, //57 9
0x00, 0x00, 0x14, 0x00, 0x00, //58 :
0x00, 0x40, 0x34, 0x00, 0x00, //59 ;
0x00, 0x08, 0x14, 0x22, 0x41, //60 <
0x14, 0x14, 0x14, 0x14, 0x14, //61 =
0x00, 0x41, 0x22, 0x14, 0x08, //62 >
0x02, 0x01, 0x59, 0x09, 0x06, //63 ?
0x3E, 0x41, 0x5D, 0x59, 0x4E, //64 @
0x7E, 0x09, 0x09, 0x09, 0x7E, //65 A
0x7F, 0x49, 0x49, 0x49, 0x36, //66 B
0x3E, 0x41, 0x41, 0x41, 0x00, //67 C
0x7F, 0x41, 0x41, 0x22, 0x1C, //68 D
0x7F, 0x49, 0x49, 0x49, 0x41, //69 E
0x7F, 0x09, 0x09, 0x09, 0x01, //70 F
0x3E, 0x41, 0x49, 0x49, 0x38, //71 G
0x7F, 0x08, 0x08, 0x08, 0x7F, //72 H
0x00, 0x00, 0x7F, 0x00, 0x00, //73 I
0x20, 0x40, 0x40, 0x40, 0x3F, //74 J
0x7F, 0x08, 0x14, 0x22, 0x41, //75 K
0x7F, 0x40, 0x40, 0x40, 0x40, //76 L
0x7F, 0x02, 0x04, 0x02, 0x7F, //77 M
0x7F, 0x02, 0x04, 0x08, 0x7F, //78 N
0x3E, 0x41, 0x41, 0x41, 0x3E, //79 O
0x7F, 0x09, 0x09, 0x09, 0x06, //80 P
0x3E, 0x41, 0x41, 0x61, 0x7E, //81 Q
0x7F, 0x09, 0x19, 0x29, 0x46, //82 R
0x26, 0x49, 0x49, 0x49, 0x32, //83 S
0x01, 0x01, 0x7F, 0x01, 0x01, //84 T
0x3F, 0x40, 0x40, 0x40, 0x3F, //85 U
0x1F, 0x20, 0x40, 0x20, 0x1F, //86 V
0x7F, 0x20, 0x10, 0x20, 0x7F, //87 W
0x63, 0x14, 0x08, 0x14, 0x63, //88 X
0x07, 0x08, 0x78, 0x08, 0x07, //89 Y
0x61, 0x51, 0x49, 0x45, 0x43, //90 Z
0x00, 0x7F, 0x41, 0x41, 0x41, //91
0x02, 0x04, 0x08, 0x10, 0x20, //92
0x00, 0x41, 0x41, 0x41, 0x7F, //93
0x04, 0x02, 0x01, 0x02, 0x04, //94
0x40, 0x40, 0x40, 0x40, 0x40, //95
0x00, 0x03, 0x07, 0x08, 0x00, //96
0x20, 0x54, 0x54, 0x78, 0x40, //97 a
0x7F, 0x28, 0x44, 0x44, 0x38, //98 b
0x38, 0x44, 0x44, 0x44, 0x28, //99 c
0x38, 0x44, 0x44, 0x28, 0x7F, //100 d
0x38, 0x54, 0x54, 0x54, 0x18, //101 e
0x00, 0x08, 0x7E, 0x09, 0x02, //102 f
0x18, 0xA4, 0xA4, 0x9C, 0x78, //103 g
0x7F, 0x08, 0x04, 0x04, 0x78, //104 h
0x00, 0x44, 0x7D, 0x40, 0x00, //105 i
0x20, 0x40, 0x40, 0x3D, 0x00, //106 j
0x7F, 0x10, 0x28, 0x44, 0x00, //107 k
0x00, 0x41, 0x7F, 0x40, 0x00, //108 l
0x7C, 0x04, 0x78, 0x04, 0x78, //109 m
0x7C, 0x08, 0x04, 0x04, 0x78, //110 n
0x38, 0x44, 0x44, 0x44, 0x38, //111 o
0xFC, 0x18, 0x24, 0x24, 0x18, //112 p
0x18, 0x24, 0x24, 0x18, 0xFC, //113 q
0x7C, 0x08, 0x04, 0x04, 0x08, //114 r
0x48, 0x54, 0x54, 0x54, 0x24, //115 s
0x04, 0x04, 0x3F, 0x44, 0x24, //116 t
0x3C, 0x40, 0x40, 0x20, 0x7C, //117 u
0x1C, 0x20, 0x40, 0x20, 0x1C, //118 v
0x3C, 0x40, 0x30, 0x40, 0x3C, //119 w
0x44, 0x28, 0x10, 0x28, 0x44, //120 x
0x4C, 0x90, 0x90, 0x90, 0x7C, //121 y
0x44, 0x64, 0x54, 0x4C, 0x44 //122 z
// 0x00, 0x08, 0x36, 0x41, 0x00, //123 {
// 0x00, 0x00, 0x77, 0x00, 0x00, //124 |
// 0x00, 0x41, 0x36, 0x08, 0x00, //125 }
// 0x02, 0x01, 0x02, 0x04, 0x02, //126 ~
// 0x3C, 0x26, 0x23, 0x26, 0x3C, //127 (delete)
// 0x1E, 0xA1, 0xA1, 0x61, 0x12, //128 €
// 0x3A, 0x40, 0x40, 0x20, 0x7A, //129
// 0x38, 0x54, 0x54, 0x55, 0x59, //130 ‚
// 0x21, 0x55, 0x55, 0x79, 0x41, //131 Æ’
// 0x21, 0x54, 0x54, 0x78, 0x41, //132 „
// 0x21, 0x55, 0x54, 0x78, 0x40, //133 …
// 0x20, 0x54, 0x55, 0x79, 0x40, //134 â€
// 0x0C, 0x1E, 0x52, 0x72, 0x12, //135 ‡
// 0x39, 0x55, 0x55, 0x55, 0x59, //136 ˆ
// 0x39, 0x54, 0x54, 0x54, 0x59, //137 ‰
// 0x39, 0x55, 0x54, 0x54, 0x58, //138 Å
// 0x00, 0x00, 0x45, 0x7C, 0x41, //139 ‹
// 0x00, 0x02, 0x45, 0x7D, 0x42, //140 Å’
// 0x00, 0x01, 0x45, 0x7C, 0x40, //141
// 0xF0, 0x29, 0x24, 0x29, 0xF0, //142 Ž
// 0xF0, 0x28, 0x25, 0x28, 0xF0, //143
// 0x7C, 0x54, 0x55, 0x45, 0x00, //144
// 0x20, 0x54, 0x54, 0x7C, 0x54, //145 ‘
// 0x7C, 0x0A, 0x09, 0x7F, 0x49, //146 ’
// 0x32, 0x49, 0x49, 0x49, 0x32, //147 “
// 0x32, 0x48, 0x48, 0x48, 0x32, //148 ”
// 0x32, 0x4A, 0x48, 0x48, 0x30, //149 •
// 0x3A, 0x41, 0x41, 0x21, 0x7A, //150 –
// 0x3A, 0x42, 0x40, 0x20, 0x78, //151 —
// 0x00, 0x9D, 0xA0, 0xA0, 0x7D, //152 ˜
// 0x39, 0x44, 0x44, 0x44, 0x39, //153 â„¢
// 0x3D, 0x40, 0x40, 0x40, 0x3D, //154 Å¡
// 0x3C, 0x24, 0xFF, 0x24, 0x24, //155 ›
// 0x48, 0x7E, 0x49, 0x43, 0x66, //156 Å“
// 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, //157
// 0xFF, 0x09, 0x29, 0xF6, 0x20, //158 ž
// 0xC0, 0x88, 0x7E, 0x09, 0x03, //159 Ÿ
// 0x20, 0x54, 0x54, 0x79, 0x41, //160
// 0x00, 0x00, 0x44, 0x7D, 0x41, //161 ¡
// 0x30, 0x48, 0x48, 0x4A, 0x32, //162 ¢
// 0x38, 0x40, 0x40, 0x22, 0x7A, //163 £
// 0x00, 0x7A, 0x0A, 0x0A, 0x72, //164 ¤
// 0x7D, 0x0D, 0x19, 0x31, 0x7D, //165 ¥
// 0x26, 0x29, 0x29, 0x2F, 0x28, //166 ¦
// 0x26, 0x29, 0x29, 0x29, 0x26, //167 §
// 0x30, 0x48, 0x4D, 0x40, 0x20, //168 ¨
// 0x38, 0x08, 0x08, 0x08, 0x08, //169 ©
// 0x08, 0x08, 0x08, 0x08, 0x38, //170 ª
// 0x2F, 0x10, 0xC8, 0xAC, 0xBA, //171 «
// 0x2F, 0x10, 0x28, 0x34, 0xFA, //172 ¬
// 0x00, 0x00, 0x7B, 0x00, 0x00, //173
// 0x08, 0x14, 0x2A, 0x14, 0x22, //174 ®
// 0x22, 0x14, 0x2A, 0x14, 0x08, //175 ¯
// 0xAA, 0x00, 0x55, 0x00, 0xAA, //176 °
// 0xAA, 0x55, 0xAA, 0x55, 0xAA, //177 ±
// 0x00, 0x00, 0x00, 0xFF, 0x00, //178 ²
// 0x10, 0x10, 0x10, 0xFF, 0x00, //179 ³
// 0x14, 0x14, 0x14, 0xFF, 0x00, //180 ´
// 0x10, 0x10, 0xFF, 0x00, 0xFF, //181 µ
// 0x10, 0x10, 0xF0, 0x10, 0xF0, //182 ¶
// 0x14, 0x14, 0x14, 0xFC, 0x00, //183 ·
// 0x14, 0x14, 0xF7, 0x00, 0xFF, //184 ¸
// 0x00, 0x00, 0xFF, 0x00, 0xFF, //185 ¹
// 0x14, 0x14, 0xF4, 0x04, 0xFC, //186 º
// 0x14, 0x14, 0x17, 0x10, 0x1F, //187 »
// 0x10, 0x10, 0x1F, 0x10, 0x1F, //188 ¼
// 0x14, 0x14, 0x14, 0x1F, 0x00, //189 ½
// 0x10, 0x10, 0x10, 0xF0, 0x00, //190 ¾
// 0x00, 0x00, 0x00, 0x1F, 0x10, //191 ¿
// 0x10, 0x10, 0x10, 0x1F, 0x10, //192 À
// 0x10, 0x10, 0x10, 0xF0, 0x10, //193 Á
// 0x00, 0x00, 0x00, 0xFF, 0x10, //194 Â
// 0x10, 0x10, 0x10, 0x10, 0x10, //195 Ã
// 0x10, 0x10, 0x10, 0xFF, 0x10, //196 Ä
// 0x00, 0x00, 0x00, 0xFF, 0x14, //197 Ã…
// 0x00, 0x00, 0xFF, 0x00, 0xFF, //198 Æ
// 0x00, 0x00, 0x1F, 0x10, 0x17, //199 Ç
// 0x00, 0x00, 0xFC, 0x04, 0xF4, //200 È
// 0x14, 0x14, 0x17, 0x10, 0x17, //201 É
// 0x14, 0x14, 0xF4, 0x04, 0xF4, //202 Ê
// 0x00, 0x00, 0xFF, 0x00, 0xF7, //203 Ë
// 0x14, 0x14, 0x14, 0x14, 0x14, //204 Ì
// 0x14, 0x14, 0xF7, 0x00, 0xF7, //205 Í
// 0x14, 0x14, 0x14, 0x17, 0x14, //206 ÃŽ
// 0x10, 0x10, 0x1F, 0x10, 0x1F, //207 Ï
// 0x14, 0x14, 0x14, 0xF4, 0x14, //208 Ð
// 0x10, 0x10, 0xF0, 0x10, 0xF0, //219 Ñ
// 0x00, 0x00, 0x1F, 0x10, 0x1F, //210 Ã’
// 0x00, 0x00, 0x00, 0x1F, 0x14, //211 Ó
// 0x00, 0x00, 0x00, 0xFC, 0x14, //212 Ô
// 0x00, 0x00, 0xF0, 0x10, 0xF0, //213 Õ
// 0x10, 0x10, 0xFF, 0x10, 0xFF, //214 Ö
// 0x14, 0x14, 0x14, 0xFF, 0x14, //215 ×
// 0x10, 0x10, 0x10, 0x1F, 0x00, //216 Ø
// 0x00, 0x00, 0x00, 0xF0, 0x10, //217 Ù
// 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //218 Ú
// 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, //219 Û
// 0xFF, 0xFF, 0xFF, 0x00, 0x00, //220 Ü
// 0x00, 0x00, 0x00, 0xFF, 0xFF, //221 Ý
// 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, //222 Þ
// 0x38, 0x44, 0x44, 0x38, 0x44, //223 ß
// 0x7C, 0x2A, 0x2A, 0x3E, 0x14, //224 Ã
// 0x7E, 0x02, 0x02, 0x06, 0x06, //225 á
// 0x02, 0x7E, 0x02, 0x7E, 0x02, //226 â
// 0x63, 0x55, 0x49, 0x41, 0x63, //227 ã
// 0x38, 0x44, 0x44, 0x3C, 0x04, //228 ä
// 0x40, 0x7E, 0x20, 0x1E, 0x20, //239 å
// 0x06, 0x02, 0x7E, 0x02, 0x02, //230 æ
// 0x99, 0xA5, 0xE7, 0xA5, 0x99, //231 ç
// 0x1C, 0x2A, 0x49, 0x2A, 0x1C, //232 è
// 0x4C, 0x72, 0x01, 0x72, 0x4C, //233 é
// 0x30, 0x4A, 0x4D, 0x4D, 0x30, //234 ê
// 0x30, 0x48, 0x78, 0x48, 0x30, //235 ë
// 0xBC, 0x62, 0x5A, 0x46, 0x3D, //236 ì
// 0x3E, 0x49, 0x49, 0x49, 0x00, //237 í
// 0x7E, 0x01, 0x01, 0x01, 0x7E, //238 î
// 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, //239 ï
// 0x44, 0x44, 0x5F, 0x44, 0x44, //240 ð
// 0x40, 0x51, 0x4A, 0x44, 0x40, //241 ñ
// 0x40, 0x44, 0x4A, 0x51, 0x40, //242 ò
// 0x00, 0x00, 0xFF, 0x01, 0x03, //243 ó
// 0xE0, 0x80, 0xFF, 0x00, 0x00, //244 ô
// 0x08, 0x08, 0x6B, 0x6B, 0x08, //245 õ
// 0x36, 0x12, 0x36, 0x24, 0x36, //246 ö
// 0x06, 0x0F, 0x09, 0x0F, 0x06, //247 ÷
// 0x00, 0x00, 0x18, 0x18, 0x00, //248 ø
// 0x00, 0x00, 0x10, 0x10, 0x00, //249 ù
// 0x30, 0x40, 0xFF, 0x01, 0x01, //250 ú
// 0x00, 0x1F, 0x01, 0x01, 0x1E, //251 û
// 0x00, 0x19, 0x1D, 0x17, 0x12, //252 ü
// 0x00, 0x3C, 0x3C, 0x3C, 0x3C, //253 ý
// 0x00, 0x00, 0x00, 0x00, 0x00 //254 þ
};
#endif // FONT5X7_H
#endif // FONT5X7_H

View File

@ -0,0 +1,111 @@
// ---------------------------------------------------------------------------
// toneAC Library - v1.2 - 01/27/2013
//
// AUTHOR/LICENSE:
// Created by Tim Eckel - teckel@leethost.com
// Copyright 2013 License: GNU GPL v3 http://www.gnu.org/licenses/gpl-3.0.html
//
// LINKS:
// Project home: http://code.google.com/p/arduino-tone-ac/
// Blog: http://arduino.cc/forum/index.php/topic,142097.msg1066968.html
//
// DISCLAIMER:
// This software is furnished "as is", without technical support, and with no
// warranty, express or implied, as to its usefulness for any purpose.
//
// PURPOSE:
// Replacement to the standard tone library with the advantage of nearly twice
// the volume, higher frequencies (even if running at a lower clock speed),
// higher quality (less clicking), nearly 1.5k smaller compiled code and less
// stress on the speaker. Disadvantages are that it must use certain pins and
// it uses two pins instead of one. But, if you're flexible with your pin
// choices, this is a great upgrade. It also uses timer 1 instead of timer 2,
// which may free up a conflict you have with the tone library. It exclusively
// uses port registers for the fastest and smallest code possible.
//
// USAGE:
// Connection is very similar to a piezo or standard speaker. Except, instead
// of connecting one speaker wire to ground you connect both speaker wires to
// Arduino pins. The pins you connect to are specific, as toneAC lets the
// ATmega microcontroller do all the pin timing and switching. This is
// important due to the high switching speed possible with toneAC and to make
// sure the pins are alyways perfectly out of phase with each other
// (push/pull). See the below CONNECTION section for which pins to use for
// different Arduinos. Just as usual when connecting a speaker, make sure you
// add an inline 100 ohm resistor between one of the pins and the speaker wire.
//
// CONNECTION:
// Pins 9 & 10 - ATmega328, ATmega128, ATmega640, ATmega8, Uno, Leonardo, etc.
// Pins 11 & 12 - ATmega2560/2561, ATmega1280/1281, Mega
// Pins 12 & 13 - ATmega1284P, ATmega644
// Pins 14 & 15 - Teensy 2.0
// Pins 25 & 26 - Teensy++ 2.0
//
// SYNTAX:
// toneAC( frequency [, volume [, length [, background ]]] ) - Play a note.
// Parameters:
// * frequency - Play the specified frequency indefinitely, turn off with toneAC().
// * volume - [optional] Set a volume level. (default: 10, range: 0 to 10 [0 = off])
// * length - [optional] Set the length to play in milliseconds. (default: 0 [forever], range: 0 to 2^32-1)
// * background - [optional] Play note in background or pause till finished? (default: false, values: true/false)
// toneAC() - Stop playing.
// noToneAC() - Same as toneAC().
//
// HISTORY:
// 01/27/2013 v1.2 - Fixed a counter error which went "over the top" and caused
// periods of silence (thanks Krodal). For advanced users needing tight code,
// the TONEAC_TINY switch in toneAC.h activates a version of toneAC() that
// saves 110 bytes. With TONEAC_TINY, the syntax is toneAC(frequency, length)
// while playing the note at full volume forever in the background. Added
// support for the ATmega 640, 644, 1281, 1284P and 2561 microcontrollers.
//
// 01/16/2013 v1.1 - Option to play notes in background, returning control back
// to your sketch for processing while note plays (similar to the way the tone
// library works). Volume is now linear and in the range from 0-10. Now uses
// prescaler 256 instead of 64 for frequencies below 122 Hz so it can go down
// to 1 Hz no matter what speed the CPU is clocked at (helpful if using toneAC
// to control a two-pin dual LED).
//
// 01/11/2013 v1.0 - Initial release.
//
// ---------------------------------------------------------------------------
#ifndef toneAC_h
#define toneAC_h
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
//#define TONEAC_TINY // Uncomment to use alternate function toneAC(frequency, length) that saves 110 bytes.
#if defined (__AVR_ATmega32U4__) || defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
#define PWMT1AMASK DDB5
#define PWMT1BMASK DDB6
#define PWMT1DREG DDRB
#define PWMT1PORT PORTB
#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__)
#define PWMT1AMASK DDD4
#define PWMT1BMASK DDD5
#define PWMT1DREG DDRD
#define PWMT1PORT PORTD
#else
#define PWMT1AMASK DDB1
#define PWMT1BMASK DDB2
#define PWMT1DREG DDRB
#define PWMT1PORT PORTB
#endif
#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__)
#define TIMSK1 TIMSK
#endif
#ifndef TONEAC_TINY
void toneAC(unsigned long frequency = 0, uint8_t volume = 10, unsigned long length = 0, uint8_t background = false);
#else
void toneAC(unsigned long frequency = 0, unsigned long length = 0);
#endif
void noToneAC();
#endif

View File

@ -79,7 +79,7 @@
#include <WProgram.h>
#endif
//#define TONEAC_TINY // Uncomment to use alternate function toneAC(frequency, length) that saves 110 bytes.
#define TONEAC_TINY // Uncomment to use alternate function toneAC(frequency, length) that saves 110 bytes.
#if defined (__AVR_ATmega32U4__) || defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
#define PWMT1AMASK DDB5