SAKURA Internet IoT Communication Module Library for mbed

Dependents:   patlite_sakuraio sakuraio_lte_firmwareupdater shownet2017-iinebutton patlite_sakuraio_stack ... more

SAKURA Internet IoT Communication Module Library for mbed

Sakura Communication Module (with sakura.io) library for mbed.

Support

This library supports following products.

Reference

Please see the datasheet.

License

The MIT License (MIT)

Copyright (c) SAKURA Internet Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Files at this revision

API Documentation at this revision

Comitter:
okuhara
Date:
Fri Apr 13 10:23:27 2018 +0000
Parent:
12:70faddd6241b
Commit message:
Add the PowerSaveMode commands.

Changed in this revision

SakuraIO.cpp Show annotated file Show diff for this revision Revisions of this file
SakuraIO.h Show annotated file Show diff for this revision Revisions of this file
SakuraIO/commands.h Show annotated file Show diff for this revision Revisions of this file
diff -r 70faddd6241b -r a9dbb86be232 SakuraIO.cpp
--- a/SakuraIO.cpp	Fri Sep 29 00:58:48 2017 +0900
+++ b/SakuraIO.cpp	Fri Apr 13 10:23:27 2018 +0000
@@ -474,3 +474,20 @@
 uint8_t SakuraIO::reset(){
   return executeCommand(CMD_SOFTWARE_RESET, 0, 0, NULL, NULL);
 }
+
+uint8_t SakuraIO::setPowerSaveMode(uint8_t mode)
+{
+  uint8_t request[1] = {mode};
+  return executeCommand(CMD_SET_POWER_SAVE_MODE, 1, request, NULL, NULL);
+}
+
+uint8_t SakuraIO::getPowerSaveMode()
+{
+  uint8_t response[1] = {0x00};
+  uint8_t responseLength = 1;
+  if (executeCommand(CMD_GET_POWER_SAVE_MODE, 0, NULL, &responseLength, response) != CMD_ERROR_NONE) {
+      return 0xff;
+  }
+  return response[0];    
+}
+
diff -r 70faddd6241b -r a9dbb86be232 SakuraIO.h
--- a/SakuraIO.h	Fri Sep 29 00:58:48 2017 +0900
+++ b/SakuraIO.h	Fri Apr 13 10:23:27 2018 +0000
@@ -108,6 +108,8 @@
      uint8_t updateFirmware();
      uint8_t getFirmwareUpdateStatus();
      uint8_t reset();
+     uint8_t setPowerSaveMode(uint8_t mode);
+     uint8_t getPowerSaveMode();
  };
 
  class SakuraIO_SPI : public SakuraIO
diff -r 70faddd6241b -r a9dbb86be232 SakuraIO/commands.h
--- a/SakuraIO/commands.h	Fri Sep 29 00:58:48 2017 +0900
+++ b/SakuraIO/commands.h	Fri Apr 13 10:23:27 2018 +0000
@@ -61,6 +61,9 @@
 #define CMD_GET_UPDATE_FIRMWARE_STATUS  0xAA
 #define CMD_SOFTWARE_RESET              0xAF
 
+#define CMD_SET_POWER_SAVE_MODE         0xB0
+#define CMD_GET_POWER_SAVE_MODE         0xB1
+
 
 // Response
 #define CMD_ERROR_NONE             0x01