Skip to content

Commit 6acd28e

Browse files
committed
Clean-ups to avoid warnings in IDE 1.6.7
1 parent efd5473 commit 6acd28e

File tree

9 files changed

+42
-16
lines changed

9 files changed

+42
-16
lines changed

Atmega_Board_Detector/Atmega_Board_Detector.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
// Version 1.15: Added preliminary support for high-voltage programming mode for Atmega328 family
2121
// Version 1.16: Major tidy-ups, made code more modular
2222
// Version 1.17: Added signature for Leonardo_prod_firmware_2012_12_10 bootloader
23+
// Version 1.18: Got rid of compiler warnings in IDE 1.6.7
2324

24-
const char Version [] = "1.17";
25+
const char Version [] = "1.18";
2526

2627
// make true to use the high-voltage parallel wiring
2728
#define HIGH_VOLTAGE_PARALLEL false
@@ -90,6 +91,7 @@ const int ENTER_PROGRAMMING_ATTEMPTS = 50;
9091
#include "HV_Pins.h"
9192
#include "Signatures.h"
9293
#include "General_Stuff.h"
94+
#include <string.h> // needed for memcpy
9395

9496
// for looking up known signatures
9597
typedef struct {

Atmega_Board_Detector/Programming_Utils.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ void showHex (const byte b, const boolean newline, const boolean show0x)
6363
if (show0x)
6464
Serial.print (F("0x"));
6565
// try to avoid using sprintf
66-
char buf [4] = { ((b >> 4) & 0x0F) | '0', (b & 0x0F) | '0', ' ' , 0 };
66+
char buf [4];
67+
buf [0] = ((b >> 4) & 0x0F) | '0';
68+
buf [1] = (b & 0x0F) | '0';
69+
buf [2] = ' ';
70+
buf [3] = 0;
6771
if (buf [0] > '9')
6872
buf [0] += 7;
6973
if (buf [1] > '9')

Atmega_Board_Programmer/Atmega_Board_Programmer.ino

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Atmega chip programmer
22
// Author: Nick Gammon
33
// Date: 22nd May 2012
4-
// Version: 1.33
4+
// Version: 1.36
55

66
// IMPORTANT: If you get a compile or verification error, due to the sketch size,
77
// make some of these false to reduce compile size (the ones you don't want).
@@ -62,8 +62,9 @@ Tools -> Boards menu.
6262
// Version 1.33: Added support for ATMEGA256RFR2 (Pinoccio Scout)
6363
// Version 1.34: Added support for high-voltage programming mode for Atmega328 / ATtiny25 family
6464
// Version 1.35: Updated bootloader for Leonardo/Micro to Leonardo-prod-firmware-2012-12-10.hex
65+
// Version 1.36: Got rid of compiler warnings in IDE 1.6.7
6566

66-
#define VERSION "1.35"
67+
#define VERSION "1.36"
6768

6869
// make true to use the high-voltage parallel wiring
6970
#define HIGH_VOLTAGE_PARALLEL false

Atmega_Board_Programmer/Programming_Utils.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ void showHex (const byte b, const boolean newline, const boolean show0x)
6363
if (show0x)
6464
Serial.print (F("0x"));
6565
// try to avoid using sprintf
66-
char buf [4] = { ((b >> 4) & 0x0F) | '0', (b & 0x0F) | '0', ' ' , 0 };
66+
char buf [4];
67+
buf [0] = ((b >> 4) & 0x0F) | '0';
68+
buf [1] = (b & 0x0F) | '0';
69+
buf [2] = ' ';
70+
buf [3] = 0;
6771
if (buf [0] > '9')
6872
buf [0] += 7;
6973
if (buf [1] > '9')

Atmega_Fuse_Calculator/Atmega_Fuse_Calculator.ino

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Atmega chip fuse caculator
22
// Author: Nick Gammon
33
// Date: 22nd May 2012
4-
// Version: 1.10
4+
// Version: 1.11
55

66
// Version 1.1: Output an 8 MHz clock on pin 9
77
// Version 1.2: Corrected flash size for Atmega1284P.
@@ -14,8 +14,9 @@
1414
// Version 1.8: Cleaned up _BV () macro to use bit () macro instead for readability
1515
// Version 1.9: Display message if cannot enter programming mode.
1616
// Version 1.10: Added support for At90USB82, At90USB162
17+
// Version 1.11: Got rid of compiler warnings in IDE 1.6.7
1718

18-
#define VERSION "1.10"
19+
#define VERSION "1.11"
1920

2021
/*
2122
@@ -442,7 +443,7 @@ const fuseMeaning ATmega8_fuses [] PROGMEM =
442443
// structure for information about a single processor
443444
typedef struct {
444445
byte sig [3];
445-
char * desc;
446+
const char * desc;
446447
unsigned long flashSize;
447448
unsigned int baseBootSize;
448449
const fuseMeaning * fusesInfo;
@@ -533,7 +534,11 @@ void showHex (const byte b, const boolean newline)
533534
{
534535
Serial.print (F("0x"));
535536
// try to avoid using sprintf
536-
char buf [4] = { ((b >> 4) & 0x0F) | '0', (b & 0x0F) | '0', ' ' , 0 };
537+
char buf [4];
538+
buf [0] = ((b >> 4) & 0x0F) | '0';
539+
buf [1] = (b & 0x0F) | '0';
540+
buf [2] = ' ';
541+
buf [3] = 0;
537542
if (buf [0] > '9')
538543
buf [0] += 7;
539544
if (buf [1] > '9')

Atmega_Hex_Uploader/Atmega_Hex_Uploader.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Atmega hex file uploader (from SD card)
22
// Author: Nick Gammon
33
// Date: 22nd May 2012
4-
// Version: 1.31 // NB update 'Version' variable below!
4+
// Version: 1.35 // NB update 'Version' variable below!
55

66
// Version 1.1: Some code cleanups as suggested on the Arduino forum.
77
// Version 1.2: Cleared temporary flash area to 0xFF before doing each page
@@ -42,6 +42,7 @@
4242
// Version 1.32: Added preliminary support for high-voltage programming mode for Atmega328 family
4343
// Version 1.33: Major tidy-ups, made code more modular
4444
// Version 1.34: Added include for SPI.h, and various tidy-ups to correct some issues
45+
// Version 1.35: Got rid of compiler warnings in IDE 1.6.7
4546

4647

4748
const bool allowTargetToRun = true; // if true, programming lines are freed when not programming
@@ -123,7 +124,7 @@ const bool allowTargetToRun = true; // if true, programming lines are freed whe
123124

124125
// #include <memdebug.h>
125126

126-
const char Version [] = "1.34";
127+
const char Version [] = "1.35";
127128

128129
const unsigned int ENTER_PROGRAMMING_ATTEMPTS = 50;
129130

@@ -242,7 +243,7 @@ const byte CLOCKOUT = 9;
242243
#endif
243244

244245
const int MAX_FILENAME = 13;
245-
const int LAST_FILENAME_LOCATION_IN_EEPROM = 0;
246+
void * LAST_FILENAME_LOCATION_IN_EEPROM = 0;
246247

247248
// file system object
248249
SdFat sd;

Atmega_Hex_Uploader/File_Utils.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ bool chooseInputFile ()
388388

389389
// save new file name if it changed from what we have saved
390390
if (strcmp (fileNameInEEPROM, lastFileName) != 0)
391-
eeprom_write_block (&lastFileName, LAST_FILENAME_LOCATION_IN_EEPROM, MAX_FILENAME);
391+
eeprom_write_block ((const void *) &lastFileName, LAST_FILENAME_LOCATION_IN_EEPROM, MAX_FILENAME);
392392

393393
// check file would fit into device memory
394394
if (highestAddress > currentSignature.flashSize)

Atmega_Hex_Uploader/Programming_Utils.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ void showHex (const byte b, const boolean newline, const boolean show0x)
6363
if (show0x)
6464
Serial.print (F("0x"));
6565
// try to avoid using sprintf
66-
char buf [4] = { ((b >> 4) & 0x0F) | '0', (b & 0x0F) | '0', ' ' , 0 };
66+
char buf [4];
67+
buf [0] = ((b >> 4) & 0x0F) | '0';
68+
buf [1] = (b & 0x0F) | '0';
69+
buf [2] = ' ';
70+
buf [3] = 0;
6771
if (buf [0] > '9')
6872
buf [0] += 7;
6973
if (buf [1] > '9')

Atmega_Self_Read_Signature/Atmega_Self_Read_Signature.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include <avr/boot.h>
3636
#include <avr/pgmspace.h>
37+
#include <string.h> // for memcpy
3738

3839
extern "C"
3940
{
@@ -47,7 +48,7 @@ extern "C"
4748

4849
typedef struct {
4950
byte sig [3];
50-
char * desc;
51+
const char * desc;
5152
unsigned long flashSize;
5253
unsigned int baseBootSize;
5354
} signatureType;
@@ -126,7 +127,11 @@ void showHex (const byte b, const boolean newline = false);
126127
void showHex (const byte b, const boolean newline)
127128
{
128129
// try to avoid using sprintf
129-
char buf [4] = { ((b >> 4) & 0x0F) | '0', (b & 0x0F) | '0', ' ' , 0 };
130+
char buf [4];
131+
buf [0] = ((b >> 4) & 0x0F) | '0';
132+
buf [1] = (b & 0x0F) | '0';
133+
buf [2] = ' ';
134+
buf [3] = 0;
130135
if (buf [0] > '9')
131136
buf [0] += 7;
132137
if (buf [1] > '9')

0 commit comments

Comments
 (0)