Skip to content

Commit 78982de

Browse files
authored
Merge pull request #61 from konkers/pr/fix_examples
Resolve warning and compile errors with examples.
2 parents 6516289 + 3672244 commit 78982de

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

libraries/EEPROM/examples/Example2_AllFunctions/Example2_AllFunctions.ino

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
#include <EEPROM.h>
1818

19+
// Give a default if the variant does not define one.
20+
#ifndef A0
21+
#define A0 0
22+
#endif
23+
1924
void setup()
2025
{
2126
Serial.begin(9600);
@@ -39,7 +44,7 @@ void setup()
3944
Serial.println("8 bit tests");
4045
byte myValue1 = 200;
4146
byte myValue2 = 23;
42-
randomLocation = random(0, FLASH_EEPROM_SIZE);
47+
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
4348

4449
startTime = millis();
4550
EEPROM.write(randomLocation, myValue1); //(location, data)
@@ -61,7 +66,7 @@ void setup()
6166
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
6267
uint16_t myValue3 = 3411;
6368
int16_t myValue4 = -366;
64-
randomLocation = random(0, FLASH_EEPROM_SIZE);
69+
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
6570

6671
EEPROM.put(randomLocation, myValue3);
6772
EEPROM.put(randomLocation + 2, myValue4);
@@ -82,7 +87,7 @@ void setup()
8287
Serial.printf("Size of int: %d\n", sizeof(int));
8388
int myValue5 = -245000;
8489
unsigned int myValue6 = 400123;
85-
randomLocation = random(0, FLASH_EEPROM_SIZE);
90+
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
8691

8792
EEPROM.put(randomLocation, myValue5);
8893
EEPROM.put(randomLocation + 4, myValue6);
@@ -99,7 +104,7 @@ void setup()
99104
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
100105
int32_t myValue7 = -341002;
101106
uint32_t myValue8 = 241544;
102-
randomLocation = random(0, FLASH_EEPROM_SIZE);
107+
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
103108

104109
EEPROM.update(randomLocation, myValue7);
105110
EEPROM.update(randomLocation + 4, myValue8);
@@ -117,7 +122,7 @@ void setup()
117122
Serial.printf("Size of float: %d\n", sizeof(float));
118123
float myValue9 = -7.35;
119124
float myValue10 = 5.22;
120-
randomLocation = random(0, FLASH_EEPROM_SIZE);
125+
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
121126

122127
EEPROM.update(randomLocation, myValue9);
123128
EEPROM.update(randomLocation + 4, myValue10);
@@ -138,7 +143,7 @@ void setup()
138143
Serial.printf("Size of double: %d\n", sizeof(double));
139144
double myValue11 = -290.3485723409857;
140145
double myValue12 = 384.95734987;
141-
randomLocation = random(0, FLASH_EEPROM_SIZE);
146+
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
142147

143148
EEPROM.update(randomLocation, myValue11);
144149
EEPROM.update(randomLocation + 8, myValue12);
@@ -157,7 +162,7 @@ void setup()
157162
{
158163
if (x % 32 == 0)
159164
Serial.println();
160-
Serial.printf("0x%08X ", *(uint32_t *)(FLASH_EEPROM_START + x));
165+
Serial.printf("0x%08X ", *(uint32_t *)(AP3_FLASH_EEPROM_START + x));
161166
}
162167
Serial.println();
163168
}

libraries/EEPROM/src/EEPROM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ void ap3_EEPROM::get(uint16_t eepromLocation, double &dataToGet)
113113
double lf;
114114
uint32_t b[2];
115115
} temp;
116-
temp.b[1] = *(uint32_t *)(AP3_FLASH_EEPROM_START + eepromLocation); //LSB;
117-
temp.b[0] = *(uint32_t *)(AP3_FLASH_EEPROM_START + eepromLocation + 4) << 32; //MSB;
116+
temp.b[1] = *(uint32_t *)(AP3_FLASH_EEPROM_START + eepromLocation); //LSB;
117+
temp.b[0] = *(uint32_t *)(AP3_FLASH_EEPROM_START + eepromLocation + 4); //MSB;
118118
dataToGet = temp.lf;
119119
}
120120

libraries/SPI/src/SPI.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@
2323
#include <Arduino.h>
2424
#include "ap3_iomaster.h"
2525

26-
// Give a warning if the variant did not define these symbols:
27-
#ifndef MOSI
28-
#warning "variant has no definition for pin number 'MOSI'"
29-
#endif // MOSI
30-
#ifndef MISO
31-
#warning "variant has no definition for pin number 'MISO'"
32-
#endif // MISO
33-
#ifndef SCK
34-
#warning "variant has no definition for pin number 'SCK'"
35-
#endif // SCK
36-
3726
// SPI_HAS_TRANSACTION means SPI has
3827
// - beginTransaction()
3928
// - endTransaction()

0 commit comments

Comments
 (0)