forked from GeorgeHahn-Lab651/sensei_mesh
-
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.
Adding new module for handling app commands
- Loading branch information
Showing
7 changed files
with
46 additions
and
12 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
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,11 @@ | ||
|
||
#include "app_cmd.h" | ||
#include "nrf_error.h" | ||
#include "leds.h" | ||
|
||
uint16_t app_cmd_handler(uint8_t *data, uint16_t len, uint8_t *response, uint16_t *response_length) { | ||
toggle_led(LED_RED); | ||
data[0] = 0xfa; | ||
*response_length = 1; | ||
return NRF_SUCCESS; | ||
} |
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,30 @@ | ||
#ifndef APP_CMD_H | ||
#define APP_CMD_H | ||
|
||
#include <stdint.h> | ||
#include "toolchain.h" | ||
|
||
typedef enum | ||
{ | ||
APP_CMD_OPCODE_SET_TIME = 0x02, | ||
} app_cmd_opcode_t; | ||
|
||
typedef __packed_armcc struct | ||
{ | ||
uint8_t epoch[4]; | ||
} __packed_gcc app_cmd_params_set_time_t; | ||
|
||
|
||
typedef __packed_armcc struct | ||
{ | ||
app_cmd_opcode_t opcode; | ||
__packed_armcc union | ||
{ | ||
app_cmd_params_set_time_t set_time; | ||
} __packed_gcc params; | ||
} __packed_gcc app_cmd_t; | ||
|
||
|
||
uint16_t app_cmd_handler(uint8_t *data, uint16_t len, uint8_t *response, uint16_t *response_length); | ||
|
||
#endif // APP_CMD_H |
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