Browse Source

Use uint8_t in EEPROM code

Scott Lahteine 5 years ago
parent
commit
0bd54392b7

+ 1
- 1
Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp View File

@@ -53,7 +53,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
53 53
 
54 54
 bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
55 55
   do {
56
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
56
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
57 57
     if (writing) *value = c;
58 58
     crc16(crc, &c, 1);
59 59
     pos++;

+ 2
- 2
Marlin/src/HAL/HAL_DUE/HAL.h View File

@@ -124,8 +124,8 @@ uint8_t spiRec(uint32_t chan);
124 124
 //
125 125
 // EEPROM
126 126
 //
127
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
128
-unsigned char eeprom_read_byte(unsigned char *pos);
127
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
128
+uint8_t eeprom_read_byte(uint8_t *pos);
129 129
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
130 130
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
131 131
 

+ 1
- 1
Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp View File

@@ -67,7 +67,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
67 67
 
68 68
 bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
69 69
   do {
70
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
70
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
71 71
     if (writing) *value = c;
72 72
     crc16(crc, &c, 1);
73 73
     pos++;

+ 2
- 2
Marlin/src/HAL/HAL_ESP32/HAL.h View File

@@ -98,8 +98,8 @@ int freeMemory(void);
98 98
 void analogWrite(int pin, int value);
99 99
 
100 100
 // EEPROM
101
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
102
-unsigned char eeprom_read_byte(unsigned char *pos);
101
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
102
+uint8_t eeprom_read_byte(uint8_t *pos);
103 103
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
104 104
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
105 105
 

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/arduino.cpp View File

@@ -143,11 +143,11 @@ uint16_t analogRead(pin_t adc_pin) {
143 143
 // Persistent Config Storage
144 144
 // **************************
145 145
 
146
-void eeprom_write_byte(unsigned char *pos, unsigned char value) {
146
+void eeprom_write_byte(uint8_t *pos, unsigned char value) {
147 147
 
148 148
 }
149 149
 
150
-unsigned char eeprom_read_byte(uint8_t * pos) { return '\0'; }
150
+uint8_t eeprom_read_byte(uint8_t * pos) { return '\0'; }
151 151
 
152 152
 void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }
153 153
 

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/include/Arduino.h View File

@@ -109,8 +109,8 @@ void analogWrite(pin_t, int);
109 109
 uint16_t analogRead(pin_t);
110 110
 
111 111
 // EEPROM
112
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
113
-unsigned char eeprom_read_byte(unsigned char *pos);
112
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
113
+uint8_t eeprom_read_byte(uint8_t *pos);
114 114
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
115 115
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
116 116
 

+ 2
- 2
Marlin/src/HAL/HAL_STM32/HAL.h View File

@@ -196,8 +196,8 @@ uint8_t spiRec(uint32_t chan);
196 196
 /**
197 197
  * Wire library should work for i2c eeproms.
198 198
  */
199
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
200
-unsigned char eeprom_read_byte(unsigned char *pos);
199
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
200
+uint8_t eeprom_read_byte(uint8_t *pos);
201 201
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
202 202
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
203 203
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp View File

@@ -79,7 +79,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
79 79
       #if DISABLED(EEPROM_EMULATED_WITH_SRAM)
80 80
         eeprom_buffered_read_byte(pos)
81 81
       #else
82
-        (*(__IO uint8_t *)(BKPSRAM_BASE + ((unsigned char*)pos)))
82
+        (*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)))
83 83
       #endif
84 84
     );
85 85
 

+ 2
- 2
Marlin/src/HAL/HAL_STM32F1/HAL.h View File

@@ -212,8 +212,8 @@ uint8_t spiRec(uint32_t chan);
212 212
  * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
213 213
  * Wire library should work for i2c eeproms.
214 214
  */
215
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
216
-unsigned char eeprom_read_byte(unsigned char *pos);
215
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
216
+uint8_t eeprom_read_byte(uint8_t *pos);
217 217
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
218 218
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
219 219
 

+ 2
- 2
Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp View File

@@ -96,7 +96,7 @@ void eeprom_init() {
96 96
   }
97 97
 }
98 98
 
99
-void eeprom_write_byte(unsigned char *pos, unsigned char value) {
99
+void eeprom_write_byte(uint8_t *pos, unsigned char value) {
100 100
   uint16_t eeprom_address = (unsigned) pos;
101 101
 
102 102
   eeprom_init();
@@ -110,7 +110,7 @@ void eeprom_write_byte(unsigned char *pos, unsigned char value) {
110 110
   HAL_FLASH_Lock();
111 111
 }
112 112
 
113
-unsigned char eeprom_read_byte(unsigned char *pos) {
113
+uint8_t eeprom_read_byte(uint8_t *pos) {
114 114
   uint16_t data = 0xFF;
115 115
   uint16_t eeprom_address = (unsigned)pos;
116 116
 

+ 2
- 2
Marlin/src/HAL/HAL_STM32F4/HAL.h View File

@@ -212,8 +212,8 @@ uint8_t spiRec(uint32_t chan);
212 212
  * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
213 213
  * Wire library should work for i2c eeproms.
214 214
  */
215
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
216
-unsigned char eeprom_read_byte(unsigned char *pos);
215
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
216
+uint8_t eeprom_read_byte(uint8_t *pos);
217 217
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
218 218
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
219 219
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp View File

@@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
55 55
 
56 56
 bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing) {
57 57
   do {
58
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
58
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
59 59
     if (writing) *value = c;
60 60
     crc16(crc, &c, 1);
61 61
     pos++;

+ 2
- 2
Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp View File

@@ -94,7 +94,7 @@ void eeprom_init() {
94 94
   }
95 95
 }
96 96
 
97
-void eeprom_write_byte(unsigned char *pos, unsigned char value) {
97
+void eeprom_write_byte(uint8_t *pos, unsigned char value) {
98 98
   uint16_t eeprom_address = (unsigned) pos;
99 99
 
100 100
   eeprom_init();
@@ -108,7 +108,7 @@ void eeprom_write_byte(unsigned char *pos, unsigned char value) {
108 108
   HAL_FLASH_Lock();
109 109
 }
110 110
 
111
-unsigned char eeprom_read_byte(unsigned char *pos) {
111
+uint8_t eeprom_read_byte(uint8_t *pos) {
112 112
   uint16_t data = 0xFF;
113 113
   uint16_t eeprom_address = (unsigned)pos;
114 114
 

+ 2
- 2
Marlin/src/HAL/HAL_STM32F7/HAL.h View File

@@ -200,8 +200,8 @@ uint8_t spiRec(uint32_t chan);
200 200
  * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
201 201
  * Wire library should work for i2c eeproms.
202 202
  */
203
-void eeprom_write_byte(unsigned char *pos, unsigned char value);
204
-unsigned char eeprom_read_byte(unsigned char *pos);
203
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
204
+uint8_t eeprom_read_byte(uint8_t *pos);
205 205
 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
206 206
 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
207 207
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp View File

@@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
55 55
 
56 56
 bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc) {
57 57
   do {
58
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
58
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
59 59
     *value = c;
60 60
     crc16(crc, &c, 1);
61 61
     pos++;

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp View File

@@ -35,7 +35,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
35 35
 
36 36
 bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
37 37
   do {
38
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
38
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
39 39
     if (writing) *value = c;
40 40
     crc16(crc, &c, 1);
41 41
     pos++;

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp View File

@@ -56,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
56 56
 
57 57
 bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
58 58
   do {
59
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
59
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
60 60
     if (writing) *value = c;
61 61
     crc16(crc, &c, 1);
62 62
     pos++;

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp View File

@@ -35,7 +35,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
35 35
 
36 36
 bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
37 37
   do {
38
-    uint8_t c = eeprom_read_byte((unsigned char*)pos);
38
+    uint8_t c = eeprom_read_byte((uint8_t*)pos);
39 39
     if (writing) *value = c;
40 40
     crc16(crc, &c, 1);
41 41
     pos++;

+ 2
- 2
Marlin/src/HAL/shared/I2cEeprom.cpp View File

@@ -82,7 +82,7 @@ static void eeprom_init(void) {
82 82
   }
83 83
 }
84 84
 
85
-void eeprom_write_byte(unsigned char *pos, unsigned char value) {
85
+void eeprom_write_byte(uint8_t *pos, unsigned char value) {
86 86
   unsigned eeprom_address = (unsigned) pos;
87 87
 
88 88
   eeprom_init();
@@ -128,7 +128,7 @@ void eeprom_update_block(const void *pos, void* eeprom_address, size_t n) {
128 128
 }
129 129
 
130 130
 
131
-unsigned char eeprom_read_byte(unsigned char *pos) {
131
+uint8_t eeprom_read_byte(uint8_t *pos) {
132 132
   byte data = 0xFF;
133 133
   unsigned eeprom_address = (unsigned)pos;
134 134
 

Loading…
Cancel
Save