Skip to content

Commit 53bb840

Browse files
Putting const modifier on function parameters
1 parent 5e3622b commit 53bb840

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/utility/spi_drv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ int SpiDrv::waitResponse(uint8_t cmd, uint8_t* numParamRead, uint8_t** params, u
469469
return 1;
470470
}
471471

472-
void SpiDrv::sendParamNoLen(uint8_t* param, size_t param_len, uint8_t lastParam)
472+
void SpiDrv::sendParamNoLen(const uint8_t* param, size_t param_len, uint8_t lastParam)
473473
{
474474
size_t i = 0;
475475
// Send SPI paramLen
@@ -486,7 +486,7 @@ void SpiDrv::sendParamNoLen(uint8_t* param, size_t param_len, uint8_t lastParam)
486486
spiTransfer(END_CMD);
487487
}
488488

489-
void SpiDrv::sendParam(uint8_t* param, uint8_t param_len, uint8_t lastParam)
489+
void SpiDrv::sendParam(const uint8_t* param, uint8_t param_len, uint8_t lastParam)
490490
{
491491
int i = 0;
492492
// Send SPI paramLen
@@ -537,7 +537,7 @@ uint16_t SpiDrv::readParamLen16(uint16_t* param_len)
537537
}
538538

539539

540-
void SpiDrv::sendBuffer(uint8_t* param, uint16_t param_len, uint8_t lastParam)
540+
void SpiDrv::sendBuffer(const uint8_t* param, uint16_t param_len, uint8_t lastParam)
541541
{
542542
uint16_t i = 0;
543543

src/utility/spi_drv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ class SpiDrv
8383
*/
8484
static int waitResponse(uint8_t cmd, uint8_t* numParamRead, uint8_t** params, uint8_t maxNumParams);
8585

86-
static void sendParam(uint8_t* param, uint8_t param_len, uint8_t lastParam = NO_LAST_PARAM);
86+
static void sendParam(const uint8_t* param, uint8_t param_len, uint8_t lastParam = NO_LAST_PARAM);
8787

88-
static void sendParamNoLen(uint8_t* param, size_t param_len, uint8_t lastParam = NO_LAST_PARAM);
88+
static void sendParamNoLen(const uint8_t* param, size_t param_len, uint8_t lastParam = NO_LAST_PARAM);
8989

90-
static void sendParamLen8(uint8_t param_len);
90+
static void sendParamLen8(const uint8_t param_len);
9191

92-
static void sendParamLen16(uint16_t param_len);
92+
static void sendParamLen16(const uint16_t param_len);
9393

9494
static uint8_t readParamLen8(uint8_t* param_len = NULL);
9595

9696
static uint16_t readParamLen16(uint16_t* param_len = NULL);
9797

98-
static void sendBuffer(uint8_t* param, uint16_t param_len, uint8_t lastParam = NO_LAST_PARAM);
98+
static void sendBuffer(const uint8_t* param, uint16_t param_len, uint8_t lastParam = NO_LAST_PARAM);
9999

100100
static void sendParam(uint16_t param, uint8_t lastParam = NO_LAST_PARAM);
101101

src/utility/wifi_drv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,7 @@ size_t WiFiDrv::prefStat() {
15131513
return result;
15141514
}
15151515

1516-
size_t WiFiDrv::prefPut(const char * key, PreferenceType type, uint8_t value[], size_t len) {
1516+
size_t WiFiDrv::prefPut(const char * key, PreferenceType type, const uint8_t value[], size_t len) {
15171517
WAIT_FOR_SLAVE_SELECT();
15181518

15191519
int commandSize = 4;
@@ -1525,7 +1525,7 @@ size_t WiFiDrv::prefPut(const char * key, PreferenceType type, uint8_t value[],
15251525
SpiDrv::sendParam((uint8_t*)&type, 1);
15261526
commandSize += 2;
15271527

1528-
SpiDrv::sendBuffer((uint8_t*)value, len, LAST_PARAM);
1528+
SpiDrv::sendBuffer(value, len, LAST_PARAM);
15291529
commandSize += len + 1;
15301530

15311531
// pad to multiple of 4

src/utility/wifi_drv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ class WiFiDrv
331331
static bool prefRemove(const char * key);
332332
static size_t prefLen(const char * key);
333333
static size_t prefStat();
334-
static size_t prefPut(const char * key, PreferenceType type, uint8_t value[], size_t len);
334+
static size_t prefPut(const char * key, PreferenceType type, const uint8_t value[], size_t len);
335335
static size_t prefGet(const char * key, PreferenceType type, uint8_t value[], size_t len);
336336
static PreferenceType prefGetType(const char * key);
337337

0 commit comments

Comments
 (0)