Skip to content

Commit e689a56

Browse files
committed
Added name of currently selected fuse bit to fuse input page
1 parent 8fe7c4f commit e689a56

File tree

5 files changed

+197
-34
lines changed

5 files changed

+197
-34
lines changed

firmware-programmer/firmware-programmer.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define XSTR(s) STR(s)
22
#define STR(s) #s
33

4-
#define __PVERSION__ "v-1.1"
4+
#define __PVERSION__ "v-1.2"
55

66
// External Dependencies
77
#include <SPI.h>

firmware-uim/firmware-uim.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define XSTR(s) STR(s)
22
#define STR(s) #s
33

4-
#define __PVERSION__ "v-1.1"
4+
#define __PVERSION__ "v-1.2"
55

66
#include "src/page.h"
77
#include "src/pageManager.h"

firmware-uim/src/fuseNames.h

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#pragma once
2+
3+
#if defined(ARDUINO) && ARDUINO >= 100
4+
#include "arduino.h"
5+
#else
6+
#include "WProgram.h"
7+
#endif
8+
9+
// Names of the fuse bits are stored below. They are mapped
10+
// to signatures inside signatures.h. They can be retrieved via
11+
// strcpy_P.
12+
13+
const byte FBIT_MAX_LENGTH = 12;
14+
15+
const char FBIT_NO_FUNCTION [] PROGMEM = "NO FUNCTION";
16+
const char FBIT_UNKNOWN [] PROGMEM = "UNKNOWN";
17+
18+
const char FBIT_CKDIV8 [] PROGMEM = "CKDIV8";
19+
const char FBIT_CKOUT [] PROGMEM = "CKOUT";
20+
const char FBIT_SUT1 [] PROGMEM = "SUT1";
21+
const char FBIT_SUT0 [] PROGMEM = "SUT0";
22+
const char FBIT_CKSEL3 [] PROGMEM = "CKSEL3";
23+
const char FBIT_CKSEL2 [] PROGMEM = "CKSEL2";
24+
const char FBIT_CKSEL1 [] PROGMEM = "CKSEL1";
25+
const char FBIT_CKSEL0 [] PROGMEM = "CKSEL0";
26+
const char FBIT_RSTDISBL [] PROGMEM = "RSTDISBL";
27+
const char FBIT_DWEN [] PROGMEM = "DWEN";
28+
const char FBIT_SPIEN [] PROGMEM = "SPIEN";
29+
const char FBIT_WDTON [] PROGMEM = "WDTON";
30+
const char FBIT_EESAVE [] PROGMEM = "EESAVE";
31+
const char FBIT_BOOTSZ1 [] PROGMEM = "BOOTSZ1";
32+
const char FBIT_BOOTSZ0 [] PROGMEM = "BOOTSZ0";
33+
const char FBIT_BOOTRST [] PROGMEM = "BOOTRST";
34+
const char FBIT_BODLEVEL2 [] PROGMEM = "BODLEVEL2";
35+
const char FBIT_BODLEVEL1 [] PROGMEM = "BODLEVEL1";
36+
const char FBIT_BODLEVEL0 [] PROGMEM = "BODLEVEL0";
37+
const char FBIT_SELFPRGEN [] PROGMEM = "SELFPRGEN";
38+
const char FBIT_OCDEN [] PROGMEM = "OCDEN";
39+
const char FBIT_JTAGEN [] PROGMEM = "JTAGEN";
40+
const char FBIT_HWBE [] PROGMEM = "HWBE";

firmware-uim/src/pages/writeFuseInputPage.cpp

+37
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ void WriteFuseInputPage::initRender(SSD1306Ascii* display)
8383
break;
8484
}
8585

86+
// Display Fuse bit name prefix
87+
if (this->fuse == lowFuse ||
88+
this->fuse == extFuse ||
89+
this->fuse == highFuse)
90+
{
91+
display->setCursor(0, 5);
92+
display->print(F("->"));
93+
}
94+
8695
display->setCursor(0, DISPLAY_ROWS - 1);
8796
display->print(this->back);
8897
display->setCursor(DISPLAY_COLUMNS - display->strWidth(this->ok), DISPLAY_ROWS - 1);
@@ -105,6 +114,34 @@ void WriteFuseInputPage::render(SSD1306Ascii* display)
105114
display->print(" ");
106115
}
107116

117+
// Display Fuse bit name if chip signature is known
118+
display->setCursor(3 * DISPLAY_COLUMNS_FONT, 5);
119+
if (this->signatureKnown)
120+
{
121+
if (this->getTabIndex() < 8)
122+
{
123+
// Allocate buffer for name of bit and copy from PROGMEM
124+
char bitName[FBIT_MAX_LENGTH] = "";
125+
switch (this->fuse)
126+
{
127+
case lowFuse:
128+
strcpy_P(bitName, this->signature.lowFuseNames[this->getTabIndex()]);
129+
break;
130+
case highFuse:
131+
strcpy_P(bitName, this->signature.highFuseNames[this->getTabIndex()]);
132+
break;
133+
case extFuse:
134+
strcpy_P(bitName, this->signature.extFuseNames[this->getTabIndex()]);
135+
break;
136+
}
137+
display->clearToEOL();
138+
display->println(bitName);
139+
}
140+
else
141+
// Back or Confirm button
142+
display->clearToEOL();
143+
}
144+
108145
display->setCursor(0, DISPLAY_ROWS - 1);
109146
if (this->getTabIndex() == 8)
110147
display->print(F(">"));

0 commit comments

Comments
 (0)