Skip to content

Commit 1edcce3

Browse files
committed
Updated for refactored I2C interface.
1 parent e13247d commit 1edcce3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/grbl_eeprom_extensions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "grbl/hal.h"
2727
#include "grbl/crc.h"
2828

29-
nvs_transfer_result_t memcpy_to_eeprom(uint32_t destination, uint8_t *source, uint32_t size, bool with_checksum)
29+
bool memcpy_to_eeprom(uint32_t destination, uint8_t *source, uint32_t size, bool with_checksum)
3030
{
3131
uint32_t dest = destination;
3232

@@ -41,20 +41,20 @@ nvs_transfer_result_t memcpy_to_eeprom(uint32_t destination, uint8_t *source, ui
4141
#endif
4242
}
4343

44-
return NVS_TransferResult_OK;
44+
return true;
4545
}
4646

47-
nvs_transfer_result_t memcpy_from_eeprom(uint8_t *destination, uint32_t source, uint32_t size, bool with_checksum)
47+
bool memcpy_from_eeprom(uint8_t *destination, uint32_t source, uint32_t size, bool with_checksum)
4848
{
4949
uint8_t *dest = destination; uint32_t sz = size;
5050

5151
for(; size > 0; size--)
5252
*(destination++) = eeprom_get_char(source++);
5353

5454
#if NVS_CRC_BYTES == 1
55-
return with_checksum ? (calc_checksum(destination, sz) == eeprom_get_char(source) ? NVS_TransferResult_OK : NVS_TransferResult_Failed) : NVS_TransferResult_OK;
55+
return !with_checksum || calc_checksum(destination, sz) == eeprom_get_char(source);
5656
#else
57-
return with_checksum ? (calc_checksum(destination, sz) == (eeprom_get_char(source) | (eeprom_get_char(source + 1) << 8)) ? NVS_TransferResult_OK : NVS_TransferResult_Failed) : NVS_TransferResult_OK;
57+
return !with_checksum || calc_checksum(destination, sz) == (eeprom_get_char(source) | (eeprom_get_char(source + 1) << 8));
5858
#endif
5959
}
6060

src/grbl_eeprom_extensions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "grbl/nvs.h"
22

3-
nvs_transfer_result_t memcpy_to_eeprom(uint32_t destination, uint8_t *source, uint32_t size, bool with_checksum);
4-
nvs_transfer_result_t memcpy_from_eeprom(uint8_t *destination, uint32_t source, uint32_t size, bool with_checksum);
3+
bool memcpy_to_eeprom(uint32_t destination, uint8_t *source, uint32_t size, bool with_checksum);
4+
bool memcpy_from_eeprom(uint8_t *destination, uint32_t source, uint32_t size, bool with_checksum);

0 commit comments

Comments
 (0)