Skip to content

Commit 801c4a1

Browse files
committed
returns 0xFFFF but we assign it to 0xFF.. better to make it clear
1 parent 2e4d02a commit 801c4a1

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

common_arm/flashmem.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ bool Flash_ReadID(flash_device_type_t *result, bool read_jedec) {
5858
// 0x9F JEDEC
5959
FlashSendByte(JEDECID);
6060

61-
result->manufacturer_id = FlashSendByte(0xFF);
62-
result->device_id = FlashSendByte(0xFF);
63-
result->device_id2 = FlashSendLastByte(0xFF);
61+
result->manufacturer_id = (FlashSendByte(0xFF) & 0xFF);
62+
result->device_id = (FlashSendByte(0xFF) & 0xFF);
63+
result->device_id2 = (FlashSendLastByte(0xFF) & 0xFF);
6464
} else {
6565
// 0x90 Manufacture ID / device ID
6666
FlashSendByte(ID);
6767
FlashSendByte(0x00);
6868
FlashSendByte(0x00);
6969
FlashSendByte(0x00);
7070

71-
result->manufacturer_id = FlashSendByte(0xFF);
72-
result->device_id = FlashSendLastByte(0xFF);
71+
result->manufacturer_id = (FlashSendByte(0xFF) & 0xFF);
72+
result->device_id = (FlashSendLastByte(0xFF) & 0xFF);
7373
}
7474

7575
return true;
@@ -92,10 +92,10 @@ uint16_t Flash_ReadData(uint32_t address, uint8_t *out, uint16_t len) {
9292
}
9393

9494
uint16_t i = 0;
95-
for (; i < (len - 1); i++)
96-
out[i] = FlashSendByte(0xFF);
97-
98-
out[i] = FlashSendLastByte(0xFF);
95+
for (; i < (len - 1); i++) {
96+
out[i] = (FlashSendByte(0xFF) & 0xFF);
97+
}
98+
out[i] = (FlashSendLastByte(0xFF) & 0xFF);
9999
FlashStop();
100100
return len;
101101
}
@@ -122,10 +122,10 @@ uint16_t Flash_ReadDataCont(uint32_t address, uint8_t *out, uint16_t len) {
122122
}
123123

124124
uint16_t i = 0;
125-
for (; i < (len - 1); i++)
126-
out[i] = FlashSendByte(0xFF);
127-
128-
out[i] = FlashSendLastByte(0xFF);
125+
for (; i < (len - 1); i++) {
126+
out[i] = ( FlashSendByte(0xFF) & 0xFF);
127+
}
128+
out[i] = (FlashSendLastByte(0xFF) & 0xFF);
129129
return len;
130130
}
131131

@@ -486,14 +486,14 @@ void Flash_UniqueID(uint8_t *uid) {
486486
FlashSendByte(0xFF);
487487
FlashSendByte(0xFF);
488488

489-
uid[7] = FlashSendByte(0xFF);
490-
uid[6] = FlashSendByte(0xFF);
491-
uid[5] = FlashSendByte(0xFF);
492-
uid[4] = FlashSendByte(0xFF);
493-
uid[3] = FlashSendByte(0xFF);
494-
uid[2] = FlashSendByte(0xFF);
495-
uid[1] = FlashSendByte(0xFF);
496-
uid[0] = FlashSendLastByte(0xFF);
489+
uid[7] = (FlashSendByte(0xFF) & 0xFF);
490+
uid[6] = (FlashSendByte(0xFF) & 0xFF);
491+
uid[5] = (FlashSendByte(0xFF) & 0xFF);
492+
uid[4] = (FlashSendByte(0xFF) & 0xFF);
493+
uid[3] = (FlashSendByte(0xFF) & 0xFF);
494+
uid[2] = (FlashSendByte(0xFF) & 0xFF);
495+
uid[1] = (FlashSendByte(0xFF) & 0xFF);
496+
uid[0] = (FlashSendLastByte(0xFF) & 0xFF);
497497
}
498498

499499
void FlashStop(void) {

0 commit comments

Comments
 (0)