forked from MaJerle/lwesp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* \file esp_smart.c | ||
* \brief SMART API | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2020 Tilen MAJERLE | ||
* Copyright (c) 2020 Seeed Technology | ||
* | ||
* 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. | ||
* | ||
* This file is part of ESP-AT library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: $_version_$ | ||
*/ | ||
#include "esp/esp_private.h" | ||
#include "esp/esp_smart.h" | ||
#include "esp/esp_mem.h" | ||
|
||
#if ESP_CFG_SMART || __DOXYGEN__ | ||
|
||
/** | ||
* \brief Configure SMART function on ESP device | ||
* \param[in] en: Set to `1` to start SMART or `0` to stop SMART | ||
* \param[in] evt_fn: Callback function called when command has finished. Set to `NULL` when not used | ||
* \param[in] evt_arg: Custom argument for event callback function | ||
* \param[in] blocking: Status whether command should be blocking or not | ||
* \return \ref espOK on success, member of \ref espr_t enumeration otherwise | ||
*/ | ||
espr_t | ||
esp_smart_configure(uint8_t en, | ||
const esp_api_cmd_evt_fn evt_fn, void* const evt_arg, const uint32_t blocking) { | ||
ESP_MSG_VAR_DEFINE(msg); | ||
|
||
ESP_MSG_VAR_ALLOC(msg, blocking); | ||
ESP_MSG_VAR_SET_EVT(msg, evt_fn, evt_arg); | ||
ESP_MSG_VAR_REF(msg).cmd_def = en? ESP_CMD_WIFI_SMART_START: ESP_CMD_WIFI_SMART_STOP; | ||
|
||
return espi_send_msg_to_producer_mbox(&ESP_MSG_VAR_REF(msg), espi_initiate_cmd, 10000); | ||
} | ||
|
||
#endif /* ESP_CFG_SMART || __DOXYGEN__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* \file esp_smart.h | ||
* \brief Smart API | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2020 Tilen MAJERLE | ||
* Copyright (c) 2020 Seeed Technology | ||
* | ||
* 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. | ||
* | ||
* This file is part of ESP-AT library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: $_version_$ | ||
*/ | ||
#ifndef ESP_HDR_SMART_H | ||
#define ESP_HDR_SMART_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "esp/esp.h" | ||
|
||
/** | ||
* \ingroup ESP | ||
* \defgroup ESP_SMART | ||
* \brief SMART function on ESP device | ||
* \{ | ||
*/ | ||
|
||
espr_t esp_smart_configure(uint8_t en, const esp_api_cmd_evt_fn evt_fn, void* const evt_arg, const uint32_t blocking); | ||
|
||
/** | ||
* \} | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ESP_HDR_SMART_H */ |