Skip to content

Commit

Permalink
fix: errors in length() function
Browse files Browse the repository at this point in the history
* Call error for Raspberry Pico
* Change function size (from uint16_t to uint32_t) for large EEPROM
  • Loading branch information
GogoVega committed May 22, 2022
1 parent 40b9758 commit ea1e37c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Card/Card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void Card::ClearCardNumber()
*/
void Card::EraseAllCards()
{
for (uint16_t n = 0; n < Code::length(); n++)
for (uint32_t n = 0; n < Code::length(); n++)
{
Code::write(n, 0);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Code/Code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ void Code::write(uint8_t address, byte *Code, uint8_t byteNumber)

/*!
@brief Returns the Number of Cells in the EEPROM.
@return the Number of Cells in the EEPROM (uint16_t).
@return the Number of Cells in the EEPROM (uint32_t).
*/
uint16_t Code::Length()
uint32_t Code::length()
{
return (_eepromSize * 128);
}
Expand Down Expand Up @@ -152,9 +152,9 @@ void Code::write(uint8_t address, byte *Code, uint8_t byteNumber)

/*!
@brief Returns the Number of Cells in the EEPROM.
@return the Number of Cells in the EEPROM (uint16_t).
@return the Number of Cells in the EEPROM (uint32_t).
*/
uint16_t Code::length()
uint32_t Code::length()
{
if (_local)
return EEPROM.length();
Expand Down
2 changes: 1 addition & 1 deletion src/Code/Code.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Code
uint8_t read(uint8_t address);
void write(uint8_t address, byte *Code, uint8_t byteNumber);
void write(uint8_t address, uint8_t data);
uint16_t length();
uint32_t length();

bool _local = true;
bool _twoAddress;
Expand Down

0 comments on commit ea1e37c

Please sign in to comment.