Skip to content

Commit

Permalink
Gecko SDK 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
silabsbot committed Jan 28, 2022
1 parent 991121c commit 9e70b13
Show file tree
Hide file tree
Showing 7,821 changed files with 225,063 additions and 110,513 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=com.silabs.sdk.stack.super

version=4.0.0
version=4.0.1

label=Gecko SDK Suite
description=Gecko SDK Suite
Expand Down
696 changes: 443 additions & 253 deletions app/bluetooth/bluetooth_production_demos.xml

Large diffs are not rendered by default.

167 changes: 90 additions & 77 deletions app/bluetooth/bluetooth_production_templates.xml

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions app/bluetooth/btmesh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
id=com.silabs.stack.btMesh
label=Bluetooth Mesh SDK
description=Bluetooth Mesh Software Development Kit
version=2.2.0.0
dependantSdkVersion=3.3.0
dependentBLESdkVersion=3.3.0
prop.subLabel=Bluetooth\\ Mesh\\ 2.2.0
version=2.2.1.0
prop.subLabel=Bluetooth\\ Mesh\\ 2.2.1

# Default compatibility of the BT Mesh SDK (This is needed for the documentation only)
prop.boardCompatibility=.*
Expand Down
52 changes: 26 additions & 26 deletions app/bluetooth/btmesh_internal_demos.xml

Large diffs are not rendered by default.

448 changes: 224 additions & 224 deletions app/bluetooth/btmesh_production_demos.xml

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions app/bluetooth/btmesh_production_templates.xml

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions app/bluetooth/common/app_btmesh_util/app_btmesh_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@

// This macro calculates the number of precompile logging enable request in the
// specific c file where the this header file is included from
#define APP_BTMESH_UTIL_COMPONENT_LOGGING \
(CTL_CLIENT_LOGGING \
+ CTL_SERVER_LOGGING \
+ FRIEND_LOGGING \
+ GENERIC_ONOFF_SERVER_LOGGING \
+ LC_SERVER_LOGGING \
+ LIGHTING_CLIENT_LOGGING \
+ LIGHTING_SERVER_LOGGING \
+ LPN_LOGGING \
+ PROVISIONING_DECORATOR_LOGGING \
+ SCENE_CLIENT_LOGGING \
+ SCHEDULER_SERVER_LOGGING \
+ SENSOR_CLIENT_LOGGING \
+ SENSOR_SERVER_LOGGING \
+ TIME_SERVER_LOGGING \
+ VENDOR_LOOPBACK_LOGGING)
#define APP_BTMESH_UTIL_COMPONENT_LOGGING \
(SL_BTMESH_CTL_CLIENT_LOGGING_CFG_VAL \
+ SL_BTMESH_CTL_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_FRIEND_LOGGING_CFG_VAL \
+ SL_BTMESH_GENERIC_ONOFF_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_LC_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_LIGHTING_CLIENT_LOGGING_CFG_VAL \
+ SL_BTMESH_LIGHTING_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_LPN_LOGGING_CFG_VAL \
+ SL_BTMESH_PROVISIONING_DECORATOR_LOGGING_CFG_VAL \
+ SL_BTMESH_SCENE_CLIENT_LOGGING_CFG_VAL \
+ SL_BTMESH_SCHEDULER_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_SENSOR_CLIENT_LOGGING_CFG_VAL \
+ SL_BTMESH_SENSOR_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_TIME_SERVER_LOGGING_CFG_VAL \
+ SL_BTMESH_VENDOR_LOOPBACK_LOGGING_CFG_VAL)
// Component A shall not include the config file of another component B because
// <COMPONENT_B>_LOGGING macro of component B could turn on the logging in the
// component A unnecessarily. This is important in case of components with log.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,37 @@

// <h> CTL Client configuration

// <o CTL_CLIENT_RETRANSMISSION_COUNT> CTL model retransmission count
// <o SL_BTMESH_CTL_CLIENT_RETRANSMISSION_COUNT_CFG_VAL> CTL model retransmission count
// <i> Default: 3
// <i> CTL model retransmission count (How many times CTL model messages are to be sent out for reliability).
#define CTL_CLIENT_RETRANSMISSION_COUNT (3)
#define SL_BTMESH_CTL_CLIENT_RETRANSMISSION_COUNT_CFG_VAL (3)

// <o CTL_CLIENT_RETRANSMISSION_TIMEOUT> CTL model retransmission timeout [ms] <0-1275:5>
// <o SL_BTMESH_CTL_CLIENT_RETRANSMISSION_TIMEOUT_CFG_VAL> CTL model retransmission timeout [ms] <0-1275:5>
// <i> Default: 50
// <i> CTL model retransmission timeout.
#define CTL_CLIENT_RETRANSMISSION_TIMEOUT (50)
#define SL_BTMESH_CTL_CLIENT_RETRANSMISSION_TIMEOUT_CFG_VAL (50)

// <q CTL_CLIENT_TEMPERATURE_WRAP_ENABLED> Enable color temperature wraparound
// <q SL_BTMESH_CTL_CLIENT_TEMPERATURE_WRAP_ENABLED_CFG_VAL> Enable color temperature wraparound
// <i> Default: 0
// <i> If the color temperature reaches the max or min value then it wraps around.
#define CTL_CLIENT_TEMPERATURE_WRAP_ENABLED (0)
#define SL_BTMESH_CTL_CLIENT_TEMPERATURE_WRAP_ENABLED_CFG_VAL (0)

// <e CTL_CLIENT_LOGGING> Enable Logging
// <e SL_BTMESH_CTL_CLIENT_LOGGING_CFG_VAL> Enable Logging
// <i> Default: 1
// <i> Enable / disable Logging for CTL Client model specific messages for this component.
#define CTL_CLIENT_LOGGING (1)
#define SL_BTMESH_CTL_CLIENT_LOGGING_CFG_VAL (1)

// <s.128 CTL_CLIENT_LOGGING_NEW_TEMP_SET> Log text when new color temperature has been set.
// <s.128 SL_BTMESH_CTL_CLIENT_LOGGING_NEW_TEMP_SET_CFG_VAL> Log text when new color temperature has been set.
// <i> Set Log text when new color temperature has been set
#define CTL_CLIENT_LOGGING_NEW_TEMP_SET "Set temperature to %u %% / level %u K\r\n"
#define SL_BTMESH_CTL_CLIENT_LOGGING_NEW_TEMP_SET_CFG_VAL "Set temperature to %u %% / level %u K\r\n"

// <s.128 CTL_CLIENT_LOGGING_CLIENT_PUBLISH_FAIL> Log text when sending a CTL message fails.
// <s.128 SL_BTMESH_CTL_CLIENT_LOGGING_CLIENT_PUBLISH_FAIL_CFG_VAL> Log text when sending a CTL message fails.
// <i> Set Log text in case sending a CTL message fails
#define CTL_CLIENT_LOGGING_CLIENT_PUBLISH_FAIL "CTL Client Publish failed\r\n"
#define SL_BTMESH_CTL_CLIENT_LOGGING_CLIENT_PUBLISH_FAIL_CFG_VAL "CTL Client Publish failed\r\n"

// <s.128 CTL_CLIENT_LOGGING_RECALL_SUCCESS> Log text when recalling a scene recall is successful.
// <s.128 SL_BTMESH_CTL_CLIENT_LOGGING_RECALL_SUCCESS_CFG_VAL> Log text when recalling a scene recall is successful.
// <i> Set Log text a scene recall is successful.
#define CTL_CLIENT_LOGGING_RECALL_SUCCESS "CTL request sent, trid = %u, delay = %u\r\n"
#define SL_BTMESH_CTL_CLIENT_LOGGING_RECALL_SUCCESS_CFG_VAL "CTL request sent, trid = %u, delay = %u\r\n"

// </e>

Expand Down
14 changes: 7 additions & 7 deletions app/bluetooth/common/btmesh_ctl_client/sl_btmesh_ctl_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ static void send_ctl_request(uint8_t retrans)
);

if (sc == SL_STATUS_OK) {
log_info(CTL_CLIENT_LOGGING_RECALL_SUCCESS, ctl_trid, delay);
log_info(SL_BTMESH_CTL_CLIENT_LOGGING_RECALL_SUCCESS_CFG_VAL, ctl_trid, delay);
} else {
log_btmesh_status_f(sc, CTL_CLIENT_LOGGING_CLIENT_PUBLISH_FAIL);
log_btmesh_status_f(sc, SL_BTMESH_CTL_CLIENT_LOGGING_CLIENT_PUBLISH_FAIL_CFG_VAL);
}

// Keep track of how many requests has been sent
Expand All @@ -172,15 +172,15 @@ void sl_btmesh_change_temperature(int8_t change_percentage)
if (change_percentage > 0) {
temperature_percent += change_percentage;
if (temperature_percent > TEMPERATURE_PCT_MAX) {
#if (CTL_CLIENT_TEMPERATURE_WRAP_ENABLED != 0)
#if (SL_BTMESH_CTL_CLIENT_TEMPERATURE_WRAP_ENABLED_CFG_VAL != 0)
temperature_percent = 0;
#else
temperature_percent = TEMPERATURE_PCT_MAX;
#endif
}
} else {
if (temperature_percent < (-change_percentage)) {
#if (CTL_CLIENT_TEMPERATURE_WRAP_ENABLED != 0)
#if (SL_BTMESH_CTL_CLIENT_TEMPERATURE_WRAP_ENABLED_CFG_VAL != 0)
temperature_percent = TEMPERATURE_PCT_MAX;
#else
temperature_percent = 0;
Expand Down Expand Up @@ -217,20 +217,20 @@ void sl_btmesh_set_temperature(uint8_t new_color_temperature_percentage)
/ TEMPERATURE_PCT_MAX) \
* (TEMPERATURE_MAX - TEMPERATURE_MIN) \
/ TEMPERATURE_SCALE_FACTOR;
log(CTL_CLIENT_LOGGING_NEW_TEMP_SET,
log(SL_BTMESH_CTL_CLIENT_LOGGING_NEW_TEMP_SET_CFG_VAL,
temperature_percent * temperature_percent / TEMPERATURE_PCT_MAX,
temperature_level);

// Request is sent multiple times to improve reliability
ctl_request_count = CTL_CLIENT_RETRANSMISSION_COUNT;
ctl_request_count = SL_BTMESH_CTL_CLIENT_RETRANSMISSION_COUNT_CFG_VAL;

send_ctl_request(0); //Send the first request

// If there are more requests to send, start a repeating soft timer
// to trigger retransmission of the request after 50 ms delay
if (ctl_request_count > 0) {
sl_status_t sc = sl_simple_timer_start(&ctl_retransmission_timer,
CTL_CLIENT_RETRANSMISSION_TIMEOUT,
SL_BTMESH_CTL_CLIENT_RETRANSMISSION_TIMEOUT_CFG_VAL,
ctl_retransmission_timer_cb,
NO_CALLBACK_DATA,
true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,50 +34,50 @@

// <h> CTL Server configuration

// <o CTL_SERVER_NVM_SAVE_TIME> Timeout [ms] for saving States of the model to NVM.
// <o SL_BTMESH_CTL_SERVER_NVM_SAVE_TIME_CFG_VAL> Timeout [ms] for saving States of the model to NVM.
// <i> Default: 5000
// <i> Timeout [ms] for saving States of the model to NVM.
#define CTL_SERVER_NVM_SAVE_TIME (5000)
#define SL_BTMESH_CTL_SERVER_NVM_SAVE_TIME_CFG_VAL (5000)

// <o CTL_SERVER_PS_KEY> PS Key for NVM Page where the States of the Lighting Model are saved.
// <o SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL> PS Key for NVM Page where the States of the Lighting Model are saved.
// <i> Default: 0x4005
// <i> PS Key for NVM Page where the States of the Lighting Model are saved.
#define CTL_SERVER_PS_KEY (0x4005)
#define SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL (0x4005)

// <o CTL_SERVER_PWM_UPDATE_PERIOD> Periodicity [ms] for updating the PWM duty cycle during a transition.
// <o SL_BTMESH_CTL_SERVER_PWM_UPDATE_PERIOD_CFG_VAL> Periodicity [ms] for updating the PWM duty cycle during a transition.
// <i> Default: 1
// <i> Periodicity [ms] for updating the PWM duty cycle during a transition.
#define CTL_SERVER_PWM_UPDATE_PERIOD (1)
#define SL_BTMESH_CTL_SERVER_PWM_UPDATE_PERIOD_CFG_VAL (1)

// <o CTL_SERVER_UI_UPDATE_PERIOD> Periodicity [ms] for updating the UI with temperature & delta UV during a transition.
// <o SL_BTMESH_CTL_SERVER_UI_UPDATE_PERIOD_CFG_VAL> Periodicity [ms] for updating the UI with temperature & delta UV during a transition.
// <i> Default: 100
// <i> Periodicity [ms] for updating the temperature & delta UV values on the UI.
#define CTL_SERVER_UI_UPDATE_PERIOD (100)
#define SL_BTMESH_CTL_SERVER_UI_UPDATE_PERIOD_CFG_VAL (100)

// <o CTL_SERVER_DEFAULT_TEMPERATURE> Default Color Temperature
// <o SL_BTMESH_CTL_SERVER_DEFAULT_TEMPERATURE_CFG_VAL> Default Color Temperature
// <i> Default: 6500
// <i> Default Color Temperature value.
#define CTL_SERVER_DEFAULT_TEMPERATURE (6500)
#define SL_BTMESH_CTL_SERVER_DEFAULT_TEMPERATURE_CFG_VAL (6500)

// <o CTL_SERVER_DEFAULT_DELTAUV> Default Delta UV
// <o SL_BTMESH_CTL_SERVER_DEFAULT_DELTAUV_CFG_VAL> Default Delta UV
// <i> Default: 0
// <i> Default Delta UV.
#define CTL_SERVER_DEFAULT_DELTAUV (0)
#define SL_BTMESH_CTL_SERVER_DEFAULT_DELTAUV_CFG_VAL (0)

// <o CTL_SERVER_MINIMUM_TEMPERATURE> Minimum Color Temperature
// <o SL_BTMESH_CTL_SERVER_MINIMUM_TEMPERATURE_CFG_VAL> Minimum Color Temperature
// <i> Default: 800
// <i> Minimum Color Temperature.
#define CTL_SERVER_MINIMUM_TEMPERATURE (800)
#define SL_BTMESH_CTL_SERVER_MINIMUM_TEMPERATURE_CFG_VAL (800)

// <o CTL_SERVER_MAXIMUM_TEMPERATURE> Maximum Color Temperature
// <o SL_BTMESH_CTL_SERVER_MAXIMUM_TEMPERATURE_CFG_VAL> Maximum Color Temperature
// <i> Default: 800
// <i> Maximum Color Temperature.
#define CTL_SERVER_MAXIMUM_TEMPERATURE (20000)
#define SL_BTMESH_CTL_SERVER_MAXIMUM_TEMPERATURE_CFG_VAL (20000)

// <e CTL_SERVER_LOGGING> Enable Logging
// <e SL_BTMESH_CTL_SERVER_LOGGING_CFG_VAL> Enable Logging
// <i> Default: 1
// <i> Enable / disable Logging for Lighting Server model specific messages for this component.
#define CTL_SERVER_LOGGING (1)
#define SL_BTMESH_CTL_SERVER_LOGGING_CFG_VAL (1)

// </e>

Expand All @@ -86,8 +86,8 @@
// <<< end of configuration section >>>

// The PWM update period shall not be greater than the UI update period
#if (CTL_SERVER_UI_UPDATE_PERIOD) < (CTL_SERVER_PWM_UPDATE_PERIOD)
#error "The CTL_SERVER_PWM_UPDATE_PERIOD shall be less than CTL_SERVER_UI_UPDATE_PERIOD."
#if (SL_BTMESH_CTL_SERVER_UI_UPDATE_PERIOD_CFG_VAL) < (SL_BTMESH_CTL_SERVER_PWM_UPDATE_PERIOD_CFG_VAL)
#error "The SL_BTMESH_CTL_SERVER_PWM_UPDATE_PERIOD_CFG_VAL shall be less than SL_BTMESH_CTL_SERVER_UI_UPDATE_PERIOD_CFG_VAL."
#endif

#endif // SL_BTMESH_CTL_SERVER_CONFIG_H
30 changes: 15 additions & 15 deletions app/bluetooth/common/btmesh_ctl_server/sl_btmesh_ctl_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void ctl_state_store_timer_cb(sl_simple_timer_t *handle,
/***************************************************************************//**
* This function loads the saved light state from Persistent Storage and
* copies the data in the global variable lightbulb_state.
* If PS key with ID CTL_SERVER_PS_KEY does not exist or loading failed,
* If PS key with ID SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL does not exist or loading failed,
* lightbulb_state is set to zero and some default values are written to it.
*
* @return Returns SL_STATUS_OK (0) if succeed, non-zero otherwise.
Expand Down Expand Up @@ -1933,7 +1933,7 @@ static void init_ctl_models(void)
/***************************************************************************//**
* This function loads the saved light state from Persistent Storage and
* copies the data in the global variable lightbulb_state.
* If PS key with ID CTL_SERVER_PS_KEY does not exist or loading failed,
* If PS key with ID SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL does not exist or loading failed,
* lightbulb_state is set to zero and some default values are written to it.
*
* @return Returns SL_STATUS_OK (0) if succeed, non-zero otherwise.
Expand All @@ -1944,18 +1944,18 @@ static sl_status_t lightbulb_state_load(void)
size_t ps_len = 0;
struct lightbulb_state ps_data;

sc = sl_bt_nvm_load(CTL_SERVER_PS_KEY,
sc = sl_bt_nvm_load(SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL,
sizeof(ps_data),
&ps_len,
(uint8_t *)&ps_data);

// Set default values if ps_load fail or size of lightbulb_state has changed
if ((sc != SL_STATUS_OK) || (ps_len != sizeof(struct lightbulb_state))) {
memset(&lightbulb_state, 0, sizeof(struct lightbulb_state));
lightbulb_state.temperature_default = CTL_SERVER_DEFAULT_TEMPERATURE;
lightbulb_state.temperature_min = CTL_SERVER_MINIMUM_TEMPERATURE;
lightbulb_state.temperature_max = CTL_SERVER_MAXIMUM_TEMPERATURE;
lightbulb_state.deltauv_default = CTL_SERVER_DEFAULT_DELTAUV;
lightbulb_state.temperature_default = SL_BTMESH_CTL_SERVER_DEFAULT_TEMPERATURE_CFG_VAL;
lightbulb_state.temperature_min = SL_BTMESH_CTL_SERVER_MINIMUM_TEMPERATURE_CFG_VAL;
lightbulb_state.temperature_max = SL_BTMESH_CTL_SERVER_MAXIMUM_TEMPERATURE_CFG_VAL;
lightbulb_state.deltauv_default = SL_BTMESH_CTL_SERVER_DEFAULT_DELTAUV_CFG_VAL;

// Check if default values are valid and correct them if needed
lightbulb_state_validate_and_correct();
Expand Down Expand Up @@ -1984,15 +1984,15 @@ static sl_status_t lightbulb_state_load(void)
* This function saves the current light state in Persistent Storage so that
* the data is preserved over reboots and power cycles.
* The light state is hold in a global variable lightbulb_state.
* A PS key with ID CTL_SERVER_PS_KEY is used to store the whole struct.
* A PS key with ID SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL is used to store the whole struct.
*
* @return Returns SL_STATUS_OK (0) if succeed, non-zero otherwise.
******************************************************************************/
static sl_status_t lightbulb_state_store(void)
{
sl_status_t sc;

sc = sl_bt_nvm_save(CTL_SERVER_PS_KEY,
sc = sl_bt_nvm_save(SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL,
sizeof(struct lightbulb_state),
(const uint8_t *)&lightbulb_state);

Expand All @@ -2011,7 +2011,7 @@ static sl_status_t lightbulb_state_store(void)
static void lightbulb_state_changed(void)
{
sl_status_t sc = sl_simple_timer_start(&ctl_state_store_timer,
CTL_SERVER_NVM_SAVE_TIME,
SL_BTMESH_CTL_SERVER_NVM_SAVE_TIME_CFG_VAL,
ctl_state_store_timer_cb,
NO_CALLBACK_DATA,
false);
Expand All @@ -2024,11 +2024,11 @@ static void lightbulb_state_changed(void)
******************************************************************************/
static void lightbulb_state_validate_and_correct(void)
{
if (lightbulb_state.temperature_min < CTL_SERVER_MINIMUM_TEMPERATURE) {
lightbulb_state.temperature_min = CTL_SERVER_MINIMUM_TEMPERATURE;
if (lightbulb_state.temperature_min < SL_BTMESH_CTL_SERVER_MINIMUM_TEMPERATURE_CFG_VAL) {
lightbulb_state.temperature_min = SL_BTMESH_CTL_SERVER_MINIMUM_TEMPERATURE_CFG_VAL;
}
if (lightbulb_state.temperature_min > CTL_SERVER_MAXIMUM_TEMPERATURE) {
lightbulb_state.temperature_min = CTL_SERVER_MAXIMUM_TEMPERATURE;
if (lightbulb_state.temperature_min > SL_BTMESH_CTL_SERVER_MAXIMUM_TEMPERATURE_CFG_VAL) {
lightbulb_state.temperature_min = SL_BTMESH_CTL_SERVER_MAXIMUM_TEMPERATURE_CFG_VAL;
}
if (lightbulb_state.temperature_min > lightbulb_state.temperature_max) {
lightbulb_state.temperature_min = lightbulb_state.temperature_max;
Expand Down Expand Up @@ -2150,7 +2150,7 @@ void sl_btmesh_ctl_server_on_event(sl_btmesh_msg_t *evt)
break;

case sl_btmesh_evt_node_reset_id:
sl_bt_nvm_erase(CTL_SERVER_PS_KEY);
sl_bt_nvm_erase(SL_BTMESH_CTL_SERVER_PS_KEY_CFG_VAL);
break;
}
}
Expand Down
Loading

0 comments on commit 9e70b13

Please sign in to comment.