Skip to content

Commit

Permalink
crc size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
dontsovcmc committed Jun 13, 2020
1 parent 0eba365 commit aa26460
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
venv
venv_*
ESP8266/platformio.ini
Attiny85/platformio.ini
key
Expand Down
4 changes: 2 additions & 2 deletions Attiny85/src/Storage.cpp
Expand Up @@ -3,9 +3,9 @@
// https://gist.github.com/brimston3/83cdeda8f7d2cf55717b83f0d32f9b5e
// https://www.onlinegdb.com/online_c++_compiler
// Dallas CRC x8+x5+x4+1
uint8_t crc_8(unsigned char *b, uint8_t num_bytes) {
uint8_t crc_8(unsigned char *b, size_t num_bytes) {
uint8_t i, crc = 0;
for (uint8_t a = 0; a < num_bytes; a++) {
for (size_t a = 0; a < num_bytes; a++) {
i = (*(b+a) ^ crc) & 0xff;
crc = 0;
if (i & 1)
Expand Down
2 changes: 1 addition & 1 deletion Attiny85/src/Storage.h
Expand Up @@ -7,7 +7,7 @@
#include "Setup.h"


uint8_t crc_8(unsigned char *input_str, uint8_t num_bytes);
uint8_t crc_8(unsigned char *input_str, size_t num_bytes);

template<class T>
class EEPROMStorage
Expand Down

0 comments on commit aa26460

Please sign in to comment.