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 mesh_control; new handle to mesh params that may be updated OTA
- Loading branch information
Showing
8 changed files
with
66 additions
and
8 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
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,17 @@ | ||
|
||
#include "mesh_control.h" | ||
|
||
static mesh_control_t m_config; | ||
|
||
void mesh_control_init() { | ||
m_config.wake_interval = DEFAULT_WAKE_INTERVAL; | ||
m_config.enable_ble = 0; | ||
} | ||
|
||
uint16_t mesh_control_get_wake_interval() { | ||
return m_config.wake_interval; | ||
} | ||
|
||
void mesh_control_update_config(mesh_control_t *new_config) { | ||
m_config = *new_config; | ||
} |
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,25 @@ | ||
#ifndef MESH_CONTROL_H | ||
#define MESH_CONTROL_H | ||
|
||
#include <stdint.h> | ||
#include "toolchain.h" | ||
|
||
// Default wake interval is 10 seconds | ||
#define DEFAULT_WAKE_INTERVAL (10) | ||
|
||
typedef __packed_armcc struct | ||
{ | ||
uint16_t wake_interval; | ||
uint8_t enable_ble; // Not used yet... | ||
} __packed_gcc mesh_control_t; | ||
|
||
|
||
void mesh_control_init(); | ||
|
||
// Wake interval controls the cycle of waking and sleeping | ||
// current_epoch % wake_interval == 0 indicates the start of a wake period | ||
uint16_t mesh_control_get_wake_interval(); | ||
|
||
void mesh_control_update_config(mesh_control_t *new_config); | ||
|
||
#endif // MESH_CONTROL_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