-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from MausTec/mt-actions
mt actions
- Loading branch information
Showing
13 changed files
with
141 additions
and
49 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
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,18 @@ | ||
#ifndef __actions__index_h | ||
#define __actions__index_h | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void actions_register_system(void); | ||
|
||
static inline void actions_register_all(void) { | ||
actions_register_system(); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
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,16 @@ | ||
#ifndef __actions__system_h | ||
#define __actions__system_h | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "mt_actions.h" | ||
|
||
int action_system_delay(mta_plugin_t* plugin, cJSON* args); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
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
Submodule mt-accessory-common
updated
2 files
+0 −126 | include/maus_bus_drivercfg.h | |
+0 −306 | src/maus_bus_drivercfg.c |
Submodule mt-actions
added at
7a1a29
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,26 @@ | ||
#include "actions/system.h" | ||
#include <esp_log.h> | ||
#include <freertos/FreeRTOS.h> | ||
#include <freertos/task.h> | ||
|
||
static const char* TAG = "actions:system"; | ||
|
||
int action_system_delay(struct mta_plugin* plugin, cJSON* args) { | ||
char* arg = cJSON_Print(args); | ||
ESP_LOGI(TAG, "fn args: %s", arg); | ||
free(arg); | ||
|
||
cJSON* ms_json = cJSON_GetObjectItem(args, "ms"); | ||
if (ms_json == NULL) return -1; | ||
int ms = ms_json->valueint; | ||
|
||
ESP_LOGI(TAG, "delay(%d) start", ms); | ||
vTaskDelay(ms / portTICK_PERIOD_MS); | ||
ESP_LOGI(TAG, "delay done"); | ||
|
||
return 0; | ||
} | ||
|
||
void actions_register_system(void) { | ||
mta_register_system_function("delay", action_system_delay); | ||
} |
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