Skip to content

Commit 55441ca

Browse files
authored
Merge branch 'master' into feat/detailed_comment
2 parents ecb7af1 + a568739 commit 55441ca

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/SakuraIO.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,3 +449,19 @@ uint8_t SakuraIO::getFirmwareUpdateStatus(){
449449
uint8_t SakuraIO::reset(){
450450
return executeCommand(CMD_SOFTWARE_RESET, 0, 0, NULL, NULL);
451451
}
452+
453+
uint8_t SakuraIO::setPowerSaveMode(uint8_t mode)
454+
{
455+
uint8_t request[1] = {mode};
456+
return executeCommand(CMD_SET_POWER_SAVE_MODE, 1, request, NULL, NULL);
457+
}
458+
459+
uint8_t SakuraIO::getPowerSaveMode()
460+
{
461+
uint8_t response[1] = {0x00};
462+
uint8_t responseLength = 1;
463+
if (executeCommand(CMD_GET_POWER_SAVE_MODE, 0, NULL, &responseLength, response) != CMD_ERROR_NONE) {
464+
return 0xff;
465+
}
466+
return response[0];
467+
}

src/SakuraIO.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class SakuraIO
7777
uint8_t updateFirmware();
7878
uint8_t getFirmwareUpdateStatus();
7979
uint8_t reset();
80+
uint8_t setPowerSaveMode(uint8_t mode);
81+
uint8_t getPowerSaveMode();
8082
};
8183

8284
class SakuraIO_SPI : public SakuraIO

src/SakuraIO/commands.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
#define CMD_GET_UPDATE_FIRMWARE_STATUS 0xAA // OK
3838
#define CMD_SOFTWARE_RESET 0xAF // OK
3939

40+
// Power Save
41+
#define CMD_SET_POWER_SAVE_MODE 0xB0
42+
#define CMD_GET_POWER_SAVE_MODE 0xB1
43+
44+
#define POWER_SAVE_MODE_DISABLE 0x00
45+
#define POWER_SAVE_MODE_AUTO_SLEEP 0x01
46+
#define POWER_SAVE_MODE_RF_OFF 0x02
4047

4148
// Response
4249
#define CMD_ERROR_NONE 0x01

0 commit comments

Comments
 (0)