hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | sensor_server_publish | void | static void sensor_server_publish(void)
{
uint8_t sensor_data[SENSOR_DATA_BUF_LEN];
uint8_t len = 0;
#ifdef SL_CATALOG_BTMESH_SENSOR_PEOPLE_COUNT_PRESENT
count16_t people_count = sl_btmesh_get_people_count();
sl_btmesh_sensor_server_on_people_count_measurement(people_count);
len += mesh_sensor_data_to_buf(PEOPLE_COUNT,
&sensor_data[len],
(uint8_t*)&people_count);
#endif // SL_CATALOG_BTMESH_SENSOR_PEOPLE_COUNT_PRESENT
#if defined(SL_BOARD_ENABLE_SENSOR_LIGHT) && SL_BOARD_ENABLE_SENSOR_LIGHT
#if defined(SL_CATALOG_SENSOR_LIGHT_PRESENT) \
|| defined(SL_CATALOG_SENSOR_LUX_PRESENT)
illuminance_t light = get_light();
len += mesh_sensor_data_to_buf(PRESENT_AMBIENT_LIGHT_LEVEL,
&sensor_data[len],
(uint8_t*)&light);
#endif // SL_CATALOG_SENSOR_LIGHT_PRESENT || SL_CATALOG_SENSOR_LUX_PRESENT
#endif // SL_BOARD_ENABLE_SENSOR_LIGHT
#if defined(SL_BOARD_ENABLE_SENSOR_RHT) && SL_BOARD_ENABLE_SENSOR_RHT
#ifdef SL_CATALOG_SENSOR_RHT_PRESENT
temperature_8_t temperature = get_temperature();
len += mesh_sensor_data_to_buf(PRESENT_AMBIENT_TEMPERATURE,
&sensor_data[len],
(uint8_t*) &temperature);
#endif // SL_CATALOG_SENSOR_RHT_PRESENT
#endif // SL_BOARD_ENABLE_SENSOR_RHT
if (len > 0) {
sl_status_t sc = sl_btmesh_sensor_server_send_status(PUBLISH_TO_ALL_NODES,
BTMESH_SENSOR_SERVER_MAIN,
IGNORED,
NO_FLAGS,
len,
sensor_data);
log_btmesh_status_f(sc, SENSOR_SERVER_SEND_FAILED_TEXT, "status");
}
} | /***************************************************************************/
/**
* It is used for sensor states publishing
*
* @return none
******************************************************************************/ | It is used for sensor states publishing
@return none | [
"It",
"is",
"used",
"for",
"sensor",
"states",
"publishing",
"@return",
"none"
] | static void sensor_server_publish(void)
{
uint8_t sensor_data[SENSOR_DATA_BUF_LEN];
uint8_t len = 0;
#ifdef SL_CATALOG_BTMESH_SENSOR_PEOPLE_COUNT_PRESENT
count16_t people_count = sl_btmesh_get_people_count();
sl_btmesh_sensor_server_on_people_count_measurement(people_count);
len += mesh_sensor_data_to_buf(PEOPLE_COUNT,
&sensor_data[len],
(uint8_t*)&people_count);
#endif
#if defined(SL_BOARD_ENABLE_SENSOR_LIGHT) && SL_BOARD_ENABLE_SENSOR_LIGHT
#if defined(SL_CATALOG_SENSOR_LIGHT_PRESENT) \
|| defined(SL_CATALOG_SENSOR_LUX_PRESENT)
illuminance_t light = get_light();
len += mesh_sensor_data_to_buf(PRESENT_AMBIENT_LIGHT_LEVEL,
&sensor_data[len],
(uint8_t*)&light);
#endif
#endif
#if defined(SL_BOARD_ENABLE_SENSOR_RHT) && SL_BOARD_ENABLE_SENSOR_RHT
#ifdef SL_CATALOG_SENSOR_RHT_PRESENT
temperature_8_t temperature = get_temperature();
len += mesh_sensor_data_to_buf(PRESENT_AMBIENT_TEMPERATURE,
&sensor_data[len],
(uint8_t*) &temperature);
#endif
#endif
if (len > 0) {
sl_status_t sc = sl_btmesh_sensor_server_send_status(PUBLISH_TO_ALL_NODES,
BTMESH_SENSOR_SERVER_MAIN,
IGNORED,
NO_FLAGS,
len,
sensor_data);
log_btmesh_status_f(sc, SENSOR_SERVER_SEND_FAILED_TEXT, "status");
}
} | [
"static",
"void",
"sensor_server_publish",
"(",
"void",
")",
"{",
"uint8_t",
"sensor_data",
"[",
"SENSOR_DATA_BUF_LEN",
"]",
";",
"uint8_t",
"len",
"=",
"0",
";",
"#ifdef",
"SL_CATALOG_BTMESH_SENSOR_PEOPLE_COUNT_PRESENT",
"count16_t",
"people_count",
"=",
"sl_btmesh_get_people_count",
"(",
")",
";",
"sl_btmesh_sensor_server_on_people_count_measurement",
"(",
"people_count",
")",
";",
"len",
"+=",
"mesh_sensor_data_to_buf",
"(",
"PEOPLE_COUNT",
",",
"&",
"sensor_data",
"[",
"len",
"]",
",",
"(",
"uint8_t",
"*",
")",
"&",
"people_count",
")",
";",
"#endif",
"#if",
"defined",
"(",
"SL_BOARD_ENABLE_SENSOR_LIGHT",
")",
"&&",
"SL_BOARD_ENABLE_SENSOR_LIGHT",
"\n",
"#if",
"defined",
"(",
"SL_CATALOG_SENSOR_LIGHT_PRESENT",
")",
"||",
"defined",
"(",
"SL_CATALOG_SENSOR_LUX_PRESENT",
")",
"\n",
"illuminance_t",
"light",
"=",
"get_light",
"(",
")",
";",
"len",
"+=",
"mesh_sensor_data_to_buf",
"(",
"PRESENT_AMBIENT_LIGHT_LEVEL",
",",
"&",
"sensor_data",
"[",
"len",
"]",
",",
"(",
"uint8_t",
"*",
")",
"&",
"light",
")",
";",
"#endif",
"#endif",
"#if",
"defined",
"(",
"SL_BOARD_ENABLE_SENSOR_RHT",
")",
"&&",
"SL_BOARD_ENABLE_SENSOR_RHT",
"\n",
"#ifdef",
"SL_CATALOG_SENSOR_RHT_PRESENT",
"temperature_8_t",
"temperature",
"=",
"get_temperature",
"(",
")",
";",
"len",
"+=",
"mesh_sensor_data_to_buf",
"(",
"PRESENT_AMBIENT_TEMPERATURE",
",",
"&",
"sensor_data",
"[",
"len",
"]",
",",
"(",
"uint8_t",
"*",
")",
"&",
"temperature",
")",
";",
"#endif",
"#endif",
"if",
"(",
"len",
">",
"0",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_btmesh_sensor_server_send_status",
"(",
"PUBLISH_TO_ALL_NODES",
",",
"BTMESH_SENSOR_SERVER_MAIN",
",",
"IGNORED",
",",
"NO_FLAGS",
",",
"len",
",",
"sensor_data",
")",
";",
"log_btmesh_status_f",
"(",
"sc",
",",
"SENSOR_SERVER_SEND_FAILED_TEXT",
",",
"\"",
"\"",
")",
";",
"}",
"}"
] | It is used for sensor states publishing
@return none | [
"It",
"is",
"used",
"for",
"sensor",
"states",
"publishing",
"@return",
"none"
] | [
"// SL_CATALOG_BTMESH_SENSOR_PEOPLE_COUNT_PRESENT",
"// SL_CATALOG_SENSOR_LIGHT_PRESENT || SL_CATALOG_SENSOR_LUX_PRESENT",
"// SL_BOARD_ENABLE_SENSOR_LIGHT",
"// SL_CATALOG_SENSOR_RHT_PRESENT",
"// SL_BOARD_ENABLE_SENSOR_RHT"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | handle_sensor_server_publish_event | void | static void handle_sensor_server_publish_event(
sl_btmesh_evt_sensor_server_publish_t *evt)
{
#if SENSOR_THERMOMETER_CADENCE || SENSOR_PEOPLE_COUNT_CADENCE
publish_period = *evt;
#else
(void)evt;
sensor_server_publish();
#endif
} | /***************************************************************************/
/**
* Handling of sensor server publish event.
* Indicates that the publishing period timer elapsed and updates the current
* publishing period that can be used to estimate the next tick, e.g., when
* the state should be reported at higher frequency.
*
* @param[in] evt Pointer to sensor server publish request event structure
******************************************************************************/ | Handling of sensor server publish event.
Indicates that the publishing period timer elapsed and updates the current
publishing period that can be used to estimate the next tick, e.g., when
the state should be reported at higher frequency.
@param[in] evt Pointer to sensor server publish request event structure | [
"Handling",
"of",
"sensor",
"server",
"publish",
"event",
".",
"Indicates",
"that",
"the",
"publishing",
"period",
"timer",
"elapsed",
"and",
"updates",
"the",
"current",
"publishing",
"period",
"that",
"can",
"be",
"used",
"to",
"estimate",
"the",
"next",
"tick",
"e",
".",
"g",
".",
"when",
"the",
"state",
"should",
"be",
"reported",
"at",
"higher",
"frequency",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"sensor",
"server",
"publish",
"request",
"event",
"structure"
] | static void handle_sensor_server_publish_event(
sl_btmesh_evt_sensor_server_publish_t *evt)
{
#if SENSOR_THERMOMETER_CADENCE || SENSOR_PEOPLE_COUNT_CADENCE
publish_period = *evt;
#else
(void)evt;
sensor_server_publish();
#endif
} | [
"static",
"void",
"handle_sensor_server_publish_event",
"(",
"sl_btmesh_evt_sensor_server_publish_t",
"*",
"evt",
")",
"{",
"#if",
"SENSOR_THERMOMETER_CADENCE",
"||",
"SENSOR_PEOPLE_COUNT_CADENCE",
"\n",
"publish_period",
"=",
"*",
"evt",
";",
"#else",
"(",
"void",
")",
"evt",
";",
"sensor_server_publish",
"(",
")",
";",
"#endif",
"}"
] | Handling of sensor server publish event. | [
"Handling",
"of",
"sensor",
"server",
"publish",
"event",
"."
] | [] | [
{
"param": "evt",
"type": "sl_btmesh_evt_sensor_server_publish_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_sensor_server_publish_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | handle_sensor_setup_server_get_cadence_request | void | static void handle_sensor_setup_server_get_cadence_request(
sl_btmesh_evt_sensor_setup_server_get_cadence_request_t *evt)
{
sl_status_t sc;
uint16_t buff_len = 0;
uint8_t* buff_addr = NULL;
#if SENSOR_THERMOMETER_CADENCE || SENSOR_PEOPLE_COUNT_CADENCE
uint8_t cadence_status_buf[SENSOR_CADENCE_BUF_LEN];
#endif
#if SENSOR_THERMOMETER_CADENCE
if (PRESENT_AMBIENT_TEMPERATURE == evt->property_id) {
buff_len = sl_btmesh_sensor_thermometer_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
#endif // SENSOR_THERMOMETER_CADENCE
#if SENSOR_PEOPLE_COUNT_CADENCE
if (PEOPLE_COUNT == evt->property_id) {
buff_len = sl_btmesh_sensor_people_count_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
#endif // SENSOR_THERMOMETER_CADENCE
sc = sl_btmesh_sensor_setup_server_send_cadence_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
buff_len,
buff_addr);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"cadence status");
} | /***************************************************************************/
/**
* Handling of sensor setup server get cadence request event.
*
* @param[in] evt Pointer to sensor server get cadence request event.
******************************************************************************/ | Handling of sensor setup server get cadence request event.
@param[in] evt Pointer to sensor server get cadence request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"get",
"cadence",
"request",
"event",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"sensor",
"server",
"get",
"cadence",
"request",
"event",
"."
] | static void handle_sensor_setup_server_get_cadence_request(
sl_btmesh_evt_sensor_setup_server_get_cadence_request_t *evt)
{
sl_status_t sc;
uint16_t buff_len = 0;
uint8_t* buff_addr = NULL;
#if SENSOR_THERMOMETER_CADENCE || SENSOR_PEOPLE_COUNT_CADENCE
uint8_t cadence_status_buf[SENSOR_CADENCE_BUF_LEN];
#endif
#if SENSOR_THERMOMETER_CADENCE
if (PRESENT_AMBIENT_TEMPERATURE == evt->property_id) {
buff_len = sl_btmesh_sensor_thermometer_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
#endif
#if SENSOR_PEOPLE_COUNT_CADENCE
if (PEOPLE_COUNT == evt->property_id) {
buff_len = sl_btmesh_sensor_people_count_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
#endif
sc = sl_btmesh_sensor_setup_server_send_cadence_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
buff_len,
buff_addr);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"cadence status");
} | [
"static",
"void",
"handle_sensor_setup_server_get_cadence_request",
"(",
"sl_btmesh_evt_sensor_setup_server_get_cadence_request_t",
"*",
"evt",
")",
"{",
"sl_status_t",
"sc",
";",
"uint16_t",
"buff_len",
"=",
"0",
";",
"uint8_t",
"*",
"buff_addr",
"=",
"NULL",
";",
"#if",
"SENSOR_THERMOMETER_CADENCE",
"||",
"SENSOR_PEOPLE_COUNT_CADENCE",
"\n",
"uint8_t",
"cadence_status_buf",
"[",
"SENSOR_CADENCE_BUF_LEN",
"]",
";",
"#endif",
"#if",
"SENSOR_THERMOMETER_CADENCE",
"\n",
"if",
"(",
"PRESENT_AMBIENT_TEMPERATURE",
"==",
"evt",
"->",
"property_id",
")",
"{",
"buff_len",
"=",
"sl_btmesh_sensor_thermometer_get_cadence",
"(",
"SENSOR_CADENCE_BUF_LEN",
",",
"cadence_status_buf",
")",
";",
"buff_addr",
"=",
"cadence_status_buf",
";",
"}",
"#endif",
"#if",
"SENSOR_PEOPLE_COUNT_CADENCE",
"\n",
"if",
"(",
"PEOPLE_COUNT",
"==",
"evt",
"->",
"property_id",
")",
"{",
"buff_len",
"=",
"sl_btmesh_sensor_people_count_get_cadence",
"(",
"SENSOR_CADENCE_BUF_LEN",
",",
"cadence_status_buf",
")",
";",
"buff_addr",
"=",
"cadence_status_buf",
";",
"}",
"#endif",
"sc",
"=",
"sl_btmesh_sensor_setup_server_send_cadence_status",
"(",
"evt",
"->",
"client_address",
",",
"BTMESH_SENSOR_SERVER_MAIN",
",",
"evt",
"->",
"appkey_index",
",",
"NO_FLAGS",
",",
"evt",
"->",
"property_id",
",",
"buff_len",
",",
"buff_addr",
")",
";",
"log_status_error_f",
"(",
"sc",
",",
"SENSOR_SETUP_SERVER_SEND_FAILED_TEXT",
",",
"\"",
"\"",
")",
";",
"}"
] | Handling of sensor setup server get cadence request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"get",
"cadence",
"request",
"event",
"."
] | [
"// SENSOR_THERMOMETER_CADENCE",
"// SENSOR_THERMOMETER_CADENCE"
] | [
{
"param": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_get_cadence_request_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_get_cadence_request_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | handle_sensor_setup_server_set_cadence_request | void | static void handle_sensor_setup_server_set_cadence_request(
sl_btmesh_evt_sensor_setup_server_set_cadence_request_t *evt)
{
bool param_validity = true;
uint16_t buff_len = 0;
uint8_t* buff_addr = NULL;
#if SENSOR_THERMOMETER_CADENCE || SENSOR_PEOPLE_COUNT_CADENCE
uint8_t cadence_status_buf[SENSOR_CADENCE_BUF_LEN];
#endif
#if SENSOR_THERMOMETER_CADENCE
if (PRESENT_AMBIENT_TEMPERATURE == evt->property_id) {
// store incoming cadence parameters
param_validity = sl_btmesh_sensor_thermometer_set_cadence(evt);
if ((SET_CADENCE_ACK_FLAG == (evt->flags & SET_CADENCE_ACK_FLAG))
&& (true == param_validity)) {
// prepare buffer for cadence status response
buff_len = sl_btmesh_sensor_thermometer_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
}
#endif // SENSOR_THERMOMETER_CADENCE
#if SENSOR_PEOPLE_COUNT_CADENCE
if (PEOPLE_COUNT == evt->property_id) {
// store incoming cadence parameters
param_validity = sl_btmesh_sensor_people_count_set_cadence(evt);
if ((SET_CADENCE_ACK_FLAG == (evt->flags & SET_CADENCE_ACK_FLAG))
&& (true == param_validity)) {
// prepare buffer for cadence status response
buff_len = sl_btmesh_sensor_people_count_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
}
#endif // SENSOR_PEOPLE_COUNT_CADENCE
if ((SET_CADENCE_ACK_FLAG == (evt->flags & SET_CADENCE_ACK_FLAG))
&& (true == param_validity)) {
sl_status_t sc = sl_btmesh_sensor_setup_server_send_cadence_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
buff_len,
buff_addr);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"cadence status");
}
} | /***************************************************************************/
/**
* Handling of sensor setup server set cadence request event.
*
* @param[in] evt Pointer to sensor server set cadence request event.
******************************************************************************/ | Handling of sensor setup server set cadence request event.
@param[in] evt Pointer to sensor server set cadence request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"set",
"cadence",
"request",
"event",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"sensor",
"server",
"set",
"cadence",
"request",
"event",
"."
] | static void handle_sensor_setup_server_set_cadence_request(
sl_btmesh_evt_sensor_setup_server_set_cadence_request_t *evt)
{
bool param_validity = true;
uint16_t buff_len = 0;
uint8_t* buff_addr = NULL;
#if SENSOR_THERMOMETER_CADENCE || SENSOR_PEOPLE_COUNT_CADENCE
uint8_t cadence_status_buf[SENSOR_CADENCE_BUF_LEN];
#endif
#if SENSOR_THERMOMETER_CADENCE
if (PRESENT_AMBIENT_TEMPERATURE == evt->property_id) {
param_validity = sl_btmesh_sensor_thermometer_set_cadence(evt);
if ((SET_CADENCE_ACK_FLAG == (evt->flags & SET_CADENCE_ACK_FLAG))
&& (true == param_validity)) {
buff_len = sl_btmesh_sensor_thermometer_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
}
#endif
#if SENSOR_PEOPLE_COUNT_CADENCE
if (PEOPLE_COUNT == evt->property_id) {
param_validity = sl_btmesh_sensor_people_count_set_cadence(evt);
if ((SET_CADENCE_ACK_FLAG == (evt->flags & SET_CADENCE_ACK_FLAG))
&& (true == param_validity)) {
buff_len = sl_btmesh_sensor_people_count_get_cadence(SENSOR_CADENCE_BUF_LEN, cadence_status_buf);
buff_addr = cadence_status_buf;
}
}
#endif
if ((SET_CADENCE_ACK_FLAG == (evt->flags & SET_CADENCE_ACK_FLAG))
&& (true == param_validity)) {
sl_status_t sc = sl_btmesh_sensor_setup_server_send_cadence_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
buff_len,
buff_addr);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"cadence status");
}
} | [
"static",
"void",
"handle_sensor_setup_server_set_cadence_request",
"(",
"sl_btmesh_evt_sensor_setup_server_set_cadence_request_t",
"*",
"evt",
")",
"{",
"bool",
"param_validity",
"=",
"true",
";",
"uint16_t",
"buff_len",
"=",
"0",
";",
"uint8_t",
"*",
"buff_addr",
"=",
"NULL",
";",
"#if",
"SENSOR_THERMOMETER_CADENCE",
"||",
"SENSOR_PEOPLE_COUNT_CADENCE",
"\n",
"uint8_t",
"cadence_status_buf",
"[",
"SENSOR_CADENCE_BUF_LEN",
"]",
";",
"#endif",
"#if",
"SENSOR_THERMOMETER_CADENCE",
"\n",
"if",
"(",
"PRESENT_AMBIENT_TEMPERATURE",
"==",
"evt",
"->",
"property_id",
")",
"{",
"param_validity",
"=",
"sl_btmesh_sensor_thermometer_set_cadence",
"(",
"evt",
")",
";",
"if",
"(",
"(",
"SET_CADENCE_ACK_FLAG",
"==",
"(",
"evt",
"->",
"flags",
"&",
"SET_CADENCE_ACK_FLAG",
")",
")",
"&&",
"(",
"true",
"==",
"param_validity",
")",
")",
"{",
"buff_len",
"=",
"sl_btmesh_sensor_thermometer_get_cadence",
"(",
"SENSOR_CADENCE_BUF_LEN",
",",
"cadence_status_buf",
")",
";",
"buff_addr",
"=",
"cadence_status_buf",
";",
"}",
"}",
"#endif",
"#if",
"SENSOR_PEOPLE_COUNT_CADENCE",
"\n",
"if",
"(",
"PEOPLE_COUNT",
"==",
"evt",
"->",
"property_id",
")",
"{",
"param_validity",
"=",
"sl_btmesh_sensor_people_count_set_cadence",
"(",
"evt",
")",
";",
"if",
"(",
"(",
"SET_CADENCE_ACK_FLAG",
"==",
"(",
"evt",
"->",
"flags",
"&",
"SET_CADENCE_ACK_FLAG",
")",
")",
"&&",
"(",
"true",
"==",
"param_validity",
")",
")",
"{",
"buff_len",
"=",
"sl_btmesh_sensor_people_count_get_cadence",
"(",
"SENSOR_CADENCE_BUF_LEN",
",",
"cadence_status_buf",
")",
";",
"buff_addr",
"=",
"cadence_status_buf",
";",
"}",
"}",
"#endif",
"if",
"(",
"(",
"SET_CADENCE_ACK_FLAG",
"==",
"(",
"evt",
"->",
"flags",
"&",
"SET_CADENCE_ACK_FLAG",
")",
")",
"&&",
"(",
"true",
"==",
"param_validity",
")",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_btmesh_sensor_setup_server_send_cadence_status",
"(",
"evt",
"->",
"client_address",
",",
"BTMESH_SENSOR_SERVER_MAIN",
",",
"evt",
"->",
"appkey_index",
",",
"NO_FLAGS",
",",
"evt",
"->",
"property_id",
",",
"buff_len",
",",
"buff_addr",
")",
";",
"log_status_error_f",
"(",
"sc",
",",
"SENSOR_SETUP_SERVER_SEND_FAILED_TEXT",
",",
"\"",
"\"",
")",
";",
"}",
"}"
] | Handling of sensor setup server set cadence request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"set",
"cadence",
"request",
"event",
"."
] | [
"// store incoming cadence parameters",
"// prepare buffer for cadence status response",
"// SENSOR_THERMOMETER_CADENCE",
"// store incoming cadence parameters",
"// prepare buffer for cadence status response",
"// SENSOR_PEOPLE_COUNT_CADENCE"
] | [
{
"param": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_set_cadence_request_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_set_cadence_request_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | handle_sensor_setup_server_get_settings_request | void | static void handle_sensor_setup_server_get_settings_request(
sl_btmesh_evt_sensor_setup_server_get_settings_request_t *evt)
{
sl_status_t sc;
sc = sl_btmesh_sensor_setup_server_send_settings_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
0,
NULL);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"settings status");
} | /***************************************************************************/
/**
* Handling of sensor setup server get settings request event.
* Settings are not supported now, so reply has only Property ID
* according to specification.
*
* @param[in] evt Pointer to sensor server get settings request event.
******************************************************************************/ | Handling of sensor setup server get settings request event.
Settings are not supported now, so reply has only Property ID
according to specification.
@param[in] evt Pointer to sensor server get settings request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"get",
"settings",
"request",
"event",
".",
"Settings",
"are",
"not",
"supported",
"now",
"so",
"reply",
"has",
"only",
"Property",
"ID",
"according",
"to",
"specification",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"sensor",
"server",
"get",
"settings",
"request",
"event",
"."
] | static void handle_sensor_setup_server_get_settings_request(
sl_btmesh_evt_sensor_setup_server_get_settings_request_t *evt)
{
sl_status_t sc;
sc = sl_btmesh_sensor_setup_server_send_settings_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
0,
NULL);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"settings status");
} | [
"static",
"void",
"handle_sensor_setup_server_get_settings_request",
"(",
"sl_btmesh_evt_sensor_setup_server_get_settings_request_t",
"*",
"evt",
")",
"{",
"sl_status_t",
"sc",
";",
"sc",
"=",
"sl_btmesh_sensor_setup_server_send_settings_status",
"(",
"evt",
"->",
"client_address",
",",
"BTMESH_SENSOR_SERVER_MAIN",
",",
"evt",
"->",
"appkey_index",
",",
"NO_FLAGS",
",",
"evt",
"->",
"property_id",
",",
"0",
",",
"NULL",
")",
";",
"log_status_error_f",
"(",
"sc",
",",
"SENSOR_SETUP_SERVER_SEND_FAILED_TEXT",
",",
"\"",
"\"",
")",
";",
"}"
] | Handling of sensor setup server get settings request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"get",
"settings",
"request",
"event",
"."
] | [] | [
{
"param": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_get_settings_request_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_get_settings_request_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | handle_sensor_setup_server_get_setting_request | void | static void handle_sensor_setup_server_get_setting_request(
sl_btmesh_evt_sensor_setup_server_get_setting_request_t *evt)
{
sl_status_t sc;
sc = sl_btmesh_sensor_setup_server_send_setting_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
evt->setting_id,
0,
NULL);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"setting status");
} | /***************************************************************************/
/**
* Handling of sensor setup server get setting request event.
* Settings are not supported now, so reply has only Property ID
* and Sensor Property ID according to specification.
*
* @param[in] evt Pointer to sensor server get setting request event.
******************************************************************************/ | Handling of sensor setup server get setting request event.
Settings are not supported now, so reply has only Property ID
and Sensor Property ID according to specification.
@param[in] evt Pointer to sensor server get setting request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"get",
"setting",
"request",
"event",
".",
"Settings",
"are",
"not",
"supported",
"now",
"so",
"reply",
"has",
"only",
"Property",
"ID",
"and",
"Sensor",
"Property",
"ID",
"according",
"to",
"specification",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"sensor",
"server",
"get",
"setting",
"request",
"event",
"."
] | static void handle_sensor_setup_server_get_setting_request(
sl_btmesh_evt_sensor_setup_server_get_setting_request_t *evt)
{
sl_status_t sc;
sc = sl_btmesh_sensor_setup_server_send_setting_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
evt->setting_id,
0,
NULL);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"setting status");
} | [
"static",
"void",
"handle_sensor_setup_server_get_setting_request",
"(",
"sl_btmesh_evt_sensor_setup_server_get_setting_request_t",
"*",
"evt",
")",
"{",
"sl_status_t",
"sc",
";",
"sc",
"=",
"sl_btmesh_sensor_setup_server_send_setting_status",
"(",
"evt",
"->",
"client_address",
",",
"BTMESH_SENSOR_SERVER_MAIN",
",",
"evt",
"->",
"appkey_index",
",",
"NO_FLAGS",
",",
"evt",
"->",
"property_id",
",",
"evt",
"->",
"setting_id",
",",
"0",
",",
"NULL",
")",
";",
"log_status_error_f",
"(",
"sc",
",",
"SENSOR_SETUP_SERVER_SEND_FAILED_TEXT",
",",
"\"",
"\"",
")",
";",
"}"
] | Handling of sensor setup server get setting request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"get",
"setting",
"request",
"event",
"."
] | [] | [
{
"param": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_get_setting_request_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_get_setting_request_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | handle_sensor_setup_server_set_setting_request | void | static void handle_sensor_setup_server_set_setting_request(
sl_btmesh_evt_sensor_setup_server_set_setting_request_t *evt)
{
sl_status_t sc;
sc = sl_btmesh_sensor_setup_server_send_setting_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
evt->setting_id,
0,
NULL);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"setting status");
} | /***************************************************************************/
/**
* Handling of sensor setup server set setting request event.
* Settings are not supported now, so reply has only Property ID
* and Sensor Property ID according to specification.
*
* @param[in] evt Pointer to sensor server set setting request event.
******************************************************************************/ | Handling of sensor setup server set setting request event.
Settings are not supported now, so reply has only Property ID
and Sensor Property ID according to specification.
@param[in] evt Pointer to sensor server set setting request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"set",
"setting",
"request",
"event",
".",
"Settings",
"are",
"not",
"supported",
"now",
"so",
"reply",
"has",
"only",
"Property",
"ID",
"and",
"Sensor",
"Property",
"ID",
"according",
"to",
"specification",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"sensor",
"server",
"set",
"setting",
"request",
"event",
"."
] | static void handle_sensor_setup_server_set_setting_request(
sl_btmesh_evt_sensor_setup_server_set_setting_request_t *evt)
{
sl_status_t sc;
sc = sl_btmesh_sensor_setup_server_send_setting_status(evt->client_address,
BTMESH_SENSOR_SERVER_MAIN,
evt->appkey_index,
NO_FLAGS,
evt->property_id,
evt->setting_id,
0,
NULL);
log_status_error_f(sc,
SENSOR_SETUP_SERVER_SEND_FAILED_TEXT,
"setting status");
} | [
"static",
"void",
"handle_sensor_setup_server_set_setting_request",
"(",
"sl_btmesh_evt_sensor_setup_server_set_setting_request_t",
"*",
"evt",
")",
"{",
"sl_status_t",
"sc",
";",
"sc",
"=",
"sl_btmesh_sensor_setup_server_send_setting_status",
"(",
"evt",
"->",
"client_address",
",",
"BTMESH_SENSOR_SERVER_MAIN",
",",
"evt",
"->",
"appkey_index",
",",
"NO_FLAGS",
",",
"evt",
"->",
"property_id",
",",
"evt",
"->",
"setting_id",
",",
"0",
",",
"NULL",
")",
";",
"log_status_error_f",
"(",
"sc",
",",
"SENSOR_SETUP_SERVER_SEND_FAILED_TEXT",
",",
"\"",
"\"",
")",
";",
"}"
] | Handling of sensor setup server set setting request event. | [
"Handling",
"of",
"sensor",
"setup",
"server",
"set",
"setting",
"request",
"event",
"."
] | [] | [
{
"param": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_set_setting_request_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_sensor_setup_server_set_setting_request_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | sl_btmesh_handle_sensor_server_events | void | void sl_btmesh_handle_sensor_server_events(sl_btmesh_msg_t* evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
if (evt->data.evt_node_initialized.provisioned) {
sl_btmesh_sensor_server_node_init();
}
break;
case sl_btmesh_evt_node_provisioned_id:
sl_btmesh_sensor_server_node_init();
break;
case sl_btmesh_evt_sensor_server_get_request_id:
handle_sensor_server_get_request(
&(evt->data.evt_sensor_server_get_request));
break;
case sl_btmesh_evt_sensor_server_get_column_request_id:
handle_sensor_server_get_column_request(
&(evt->data.evt_sensor_server_get_column_request));
break;
case sl_btmesh_evt_sensor_server_get_series_request_id:
handle_sensor_server_get_series_request(
&(evt->data.evt_sensor_server_get_series_request));
break;
case sl_btmesh_evt_sensor_server_publish_id:
handle_sensor_server_publish_event(
&(evt->data.evt_sensor_server_publish));
break;
case sl_btmesh_evt_sensor_setup_server_get_cadence_request_id:
handle_sensor_setup_server_get_cadence_request(
&(evt->data.evt_sensor_setup_server_get_cadence_request));
break;
case sl_btmesh_evt_sensor_setup_server_set_cadence_request_id:
handle_sensor_setup_server_set_cadence_request(
&(evt->data.evt_sensor_setup_server_set_cadence_request));
break;
case sl_btmesh_evt_sensor_setup_server_get_settings_request_id:
handle_sensor_setup_server_get_settings_request(
&(evt->data.evt_sensor_setup_server_get_settings_request));
break;
case sl_btmesh_evt_sensor_setup_server_get_setting_request_id:
handle_sensor_setup_server_get_setting_request(
&(evt->data.evt_sensor_setup_server_get_setting_request));
break;
case sl_btmesh_evt_sensor_setup_server_set_setting_request_id:
handle_sensor_setup_server_set_setting_request(
&(evt->data.evt_sensor_setup_server_set_setting_request));
break;
default:
break;
}
} | /***************************************************************************/
/**
* Handling of mesh events by sensor server component.
* It handles:
* - node_initialized
* - node_provisioned
* - sensor_server_get_request
* - sensor_server_get_column_request
* - sensor_server_get_series_request
* - sensor_setup_server_get_cadence_request
* - sensor_setup_server_set_cadence_request
* - sensor_setup_server_get_settings_request
* - sensor_setup_server_get_setting_request
* - sensor_setup_server_set_setting_request
*
* @param[in] evt Pointer to incoming sensor server event.
******************************************************************************/ | Handling of mesh events by sensor server component.
@param[in] evt Pointer to incoming sensor server event. | [
"Handling",
"of",
"mesh",
"events",
"by",
"sensor",
"server",
"component",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"incoming",
"sensor",
"server",
"event",
"."
] | void sl_btmesh_handle_sensor_server_events(sl_btmesh_msg_t* evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
if (evt->data.evt_node_initialized.provisioned) {
sl_btmesh_sensor_server_node_init();
}
break;
case sl_btmesh_evt_node_provisioned_id:
sl_btmesh_sensor_server_node_init();
break;
case sl_btmesh_evt_sensor_server_get_request_id:
handle_sensor_server_get_request(
&(evt->data.evt_sensor_server_get_request));
break;
case sl_btmesh_evt_sensor_server_get_column_request_id:
handle_sensor_server_get_column_request(
&(evt->data.evt_sensor_server_get_column_request));
break;
case sl_btmesh_evt_sensor_server_get_series_request_id:
handle_sensor_server_get_series_request(
&(evt->data.evt_sensor_server_get_series_request));
break;
case sl_btmesh_evt_sensor_server_publish_id:
handle_sensor_server_publish_event(
&(evt->data.evt_sensor_server_publish));
break;
case sl_btmesh_evt_sensor_setup_server_get_cadence_request_id:
handle_sensor_setup_server_get_cadence_request(
&(evt->data.evt_sensor_setup_server_get_cadence_request));
break;
case sl_btmesh_evt_sensor_setup_server_set_cadence_request_id:
handle_sensor_setup_server_set_cadence_request(
&(evt->data.evt_sensor_setup_server_set_cadence_request));
break;
case sl_btmesh_evt_sensor_setup_server_get_settings_request_id:
handle_sensor_setup_server_get_settings_request(
&(evt->data.evt_sensor_setup_server_get_settings_request));
break;
case sl_btmesh_evt_sensor_setup_server_get_setting_request_id:
handle_sensor_setup_server_get_setting_request(
&(evt->data.evt_sensor_setup_server_get_setting_request));
break;
case sl_btmesh_evt_sensor_setup_server_set_setting_request_id:
handle_sensor_setup_server_set_setting_request(
&(evt->data.evt_sensor_setup_server_set_setting_request));
break;
default:
break;
}
} | [
"void",
"sl_btmesh_handle_sensor_server_events",
"(",
"sl_btmesh_msg_t",
"*",
"evt",
")",
"{",
"switch",
"(",
"SL_BT_MSG_ID",
"(",
"evt",
"->",
"header",
")",
")",
"{",
"case",
"sl_btmesh_evt_node_initialized_id",
":",
"if",
"(",
"evt",
"->",
"data",
".",
"evt_node_initialized",
".",
"provisioned",
")",
"{",
"sl_btmesh_sensor_server_node_init",
"(",
")",
";",
"}",
"break",
";",
"case",
"sl_btmesh_evt_node_provisioned_id",
":",
"sl_btmesh_sensor_server_node_init",
"(",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_server_get_request_id",
":",
"handle_sensor_server_get_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_server_get_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_server_get_column_request_id",
":",
"handle_sensor_server_get_column_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_server_get_column_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_server_get_series_request_id",
":",
"handle_sensor_server_get_series_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_server_get_series_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_server_publish_id",
":",
"handle_sensor_server_publish_event",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_server_publish",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_setup_server_get_cadence_request_id",
":",
"handle_sensor_setup_server_get_cadence_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_setup_server_get_cadence_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_setup_server_set_cadence_request_id",
":",
"handle_sensor_setup_server_set_cadence_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_setup_server_set_cadence_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_setup_server_get_settings_request_id",
":",
"handle_sensor_setup_server_get_settings_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_setup_server_get_settings_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_setup_server_get_setting_request_id",
":",
"handle_sensor_setup_server_get_setting_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_setup_server_get_setting_request",
")",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_sensor_setup_server_set_setting_request_id",
":",
"handle_sensor_setup_server_set_setting_request",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_sensor_setup_server_set_setting_request",
")",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Handling of mesh events by sensor server component. | [
"Handling",
"of",
"mesh",
"events",
"by",
"sensor",
"server",
"component",
"."
] | [] | [
{
"param": "evt",
"type": "sl_btmesh_msg_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_msg_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | sensor_server_data_timer_cb | void | static void sensor_server_data_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
uint32_t publ_timer_thermometer = publish_period.period_ms;
uint32_t publ_timer_people_count = publish_period.period_ms;
uint32_t publ_timeout;
sl_status_t sc;
#if SENSOR_THERMOMETER_CADENCE
publ_timer_thermometer = sl_btmesh_sensor_thermometer_handle_cadence(get_temperature(), publish_period);
#endif // SENSOR_THERMOMETER_CADENCE
#if SENSOR_PEOPLE_COUNT_CADENCE
publ_timer_people_count = sl_btmesh_sensor_people_count_handle_cadence(sl_btmesh_get_people_count(), publish_period);
#endif // SENSOR_PEOPLE_COUNT_CADENCE
if (publ_timer_thermometer > publ_timer_people_count) {
publ_timeout = publ_timer_people_count;
} else {
publ_timeout = publ_timer_thermometer;
}
if (prev_publish_timeout != publ_timeout) {
log_info("Publishing period: %d ms\r\n", publ_timeout);
//Stop publish timer
sc = sl_simple_timer_stop(&sensor_server_publish_timer);
app_assert_status_f(sc, "Failed to stop periodic sensor_server_publish_timer\r\n");
//Restart publishing timer with the new timer value
sc = sl_simple_timer_start(&sensor_server_publish_timer,
publ_timeout,
sensor_server_publish_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic sensor_server_publish_timer\r\n");
}
prev_publish_timeout = publ_timeout;
} | /***************************************************************************/
/**
* Get measured value from sensors and analyze cadence conditions timer callback
*
* @param[in] handle Pointer to the timer handle
* @param[in] data Pointer to callback data
*
* @return none
******************************************************************************/ | Get measured value from sensors and analyze cadence conditions timer callback
@param[in] handle Pointer to the timer handle
@param[in] data Pointer to callback data
@return none | [
"Get",
"measured",
"value",
"from",
"sensors",
"and",
"analyze",
"cadence",
"conditions",
"timer",
"callback",
"@param",
"[",
"in",
"]",
"handle",
"Pointer",
"to",
"the",
"timer",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Pointer",
"to",
"callback",
"data",
"@return",
"none"
] | static void sensor_server_data_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
uint32_t publ_timer_thermometer = publish_period.period_ms;
uint32_t publ_timer_people_count = publish_period.period_ms;
uint32_t publ_timeout;
sl_status_t sc;
#if SENSOR_THERMOMETER_CADENCE
publ_timer_thermometer = sl_btmesh_sensor_thermometer_handle_cadence(get_temperature(), publish_period);
#endif
#if SENSOR_PEOPLE_COUNT_CADENCE
publ_timer_people_count = sl_btmesh_sensor_people_count_handle_cadence(sl_btmesh_get_people_count(), publish_period);
#endif
if (publ_timer_thermometer > publ_timer_people_count) {
publ_timeout = publ_timer_people_count;
} else {
publ_timeout = publ_timer_thermometer;
}
if (prev_publish_timeout != publ_timeout) {
log_info("Publishing period: %d ms\r\n", publ_timeout);
sc = sl_simple_timer_stop(&sensor_server_publish_timer);
app_assert_status_f(sc, "Failed to stop periodic sensor_server_publish_timer\r\n");
sc = sl_simple_timer_start(&sensor_server_publish_timer,
publ_timeout,
sensor_server_publish_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic sensor_server_publish_timer\r\n");
}
prev_publish_timeout = publ_timeout;
} | [
"static",
"void",
"sensor_server_data_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"uint32_t",
"publ_timer_thermometer",
"=",
"publish_period",
".",
"period_ms",
";",
"uint32_t",
"publ_timer_people_count",
"=",
"publish_period",
".",
"period_ms",
";",
"uint32_t",
"publ_timeout",
";",
"sl_status_t",
"sc",
";",
"#if",
"SENSOR_THERMOMETER_CADENCE",
"\n",
"publ_timer_thermometer",
"=",
"sl_btmesh_sensor_thermometer_handle_cadence",
"(",
"get_temperature",
"(",
")",
",",
"publish_period",
")",
";",
"#endif",
"#if",
"SENSOR_PEOPLE_COUNT_CADENCE",
"\n",
"publ_timer_people_count",
"=",
"sl_btmesh_sensor_people_count_handle_cadence",
"(",
"sl_btmesh_get_people_count",
"(",
")",
",",
"publish_period",
")",
";",
"#endif",
"if",
"(",
"publ_timer_thermometer",
">",
"publ_timer_people_count",
")",
"{",
"publ_timeout",
"=",
"publ_timer_people_count",
";",
"}",
"else",
"{",
"publ_timeout",
"=",
"publ_timer_thermometer",
";",
"}",
"if",
"(",
"prev_publish_timeout",
"!=",
"publ_timeout",
")",
"{",
"log_info",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"publ_timeout",
")",
";",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"sensor_server_publish_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sc",
"=",
"sl_simple_timer_start",
"(",
"&",
"sensor_server_publish_timer",
",",
"publ_timeout",
",",
"sensor_server_publish_timer_cb",
",",
"NO_CALLBACK_DATA",
",",
"true",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"}",
"prev_publish_timeout",
"=",
"publ_timeout",
";",
"}"
] | Get measured value from sensors and analyze cadence conditions timer callback
@param[in] handle Pointer to the timer handle
@param[in] data Pointer to callback data | [
"Get",
"measured",
"value",
"from",
"sensors",
"and",
"analyze",
"cadence",
"conditions",
"timer",
"callback",
"@param",
"[",
"in",
"]",
"handle",
"Pointer",
"to",
"the",
"timer",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Pointer",
"to",
"callback",
"data"
] | [
"// SENSOR_THERMOMETER_CADENCE",
"// SENSOR_PEOPLE_COUNT_CADENCE",
"//Stop publish timer",
"//Restart publishing timer with the new timer value"
] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e61c4cf2f5164fb5de5a81edcd96f5c0e5da64c | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_sensor_server/sl_btmesh_sensor_server.c | [
"Zlib"
] | C | sensor_server_publish_timer_cb | void | static void sensor_server_publish_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
sensor_server_publish();
} | /***************************************************************************/
/**
* Publish sensor status timer callback
*
* @param[in] handle Pointer to the timer handle
* @param[in] data Pointer to callback data
*
* @return none
******************************************************************************/ | Publish sensor status timer callback
@param[in] handle Pointer to the timer handle
@param[in] data Pointer to callback data
@return none | [
"Publish",
"sensor",
"status",
"timer",
"callback",
"@param",
"[",
"in",
"]",
"handle",
"Pointer",
"to",
"the",
"timer",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Pointer",
"to",
"callback",
"data",
"@return",
"none"
] | static void sensor_server_publish_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
sensor_server_publish();
} | [
"static",
"void",
"sensor_server_publish_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"sensor_server_publish",
"(",
")",
";",
"}"
] | Publish sensor status timer callback
@param[in] handle Pointer to the timer handle
@param[in] data Pointer to callback data | [
"Publish",
"sensor",
"status",
"timer",
"callback",
"@param",
"[",
"in",
"]",
"handle",
"Pointer",
"to",
"the",
"timer",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Pointer",
"to",
"callback",
"data"
] | [] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | change_buttons_to_leds | void | void change_buttons_to_leds(void)
{
app_button_press_disable();
// Disable button and enable led
sl_simple_button_disable(&sl_button_btn0);
sl_simple_led_init(sl_led_led0.context);
// Disable button and enable led
#ifndef SINGLE_BUTTON
sl_simple_button_disable(&sl_button_btn1);
#endif // SINGLE_BUTTON
#ifndef SINGLE_LED
sl_simple_led_init(sl_led_led1.context);
#endif // SINGLE_LED
} | /***************************************************************************/
/**
* Change buttons to LEDs in case of shared pin
*
******************************************************************************/ | Change buttons to LEDs in case of shared pin | [
"Change",
"buttons",
"to",
"LEDs",
"in",
"case",
"of",
"shared",
"pin"
] | void change_buttons_to_leds(void)
{
app_button_press_disable();
sl_simple_button_disable(&sl_button_btn0);
sl_simple_led_init(sl_led_led0.context);
#ifndef SINGLE_BUTTON
sl_simple_button_disable(&sl_button_btn1);
#endif
#ifndef SINGLE_LED
sl_simple_led_init(sl_led_led1.context);
#endif
} | [
"void",
"change_buttons_to_leds",
"(",
"void",
")",
"{",
"app_button_press_disable",
"(",
")",
";",
"sl_simple_button_disable",
"(",
"&",
"sl_button_btn0",
")",
";",
"sl_simple_led_init",
"(",
"sl_led_led0",
".",
"context",
")",
";",
"#ifndef",
"SINGLE_BUTTON",
"sl_simple_button_disable",
"(",
"&",
"sl_button_btn1",
")",
";",
"#endif",
"#ifndef",
"SINGLE_LED",
"sl_simple_led_init",
"(",
"sl_led_led1",
".",
"context",
")",
";",
"#endif",
"}"
] | Change buttons to LEDs in case of shared pin | [
"Change",
"buttons",
"to",
"LEDs",
"in",
"case",
"of",
"shared",
"pin"
] | [
"// Disable button and enable led",
"// Disable button and enable led",
"// SINGLE_BUTTON",
"// SINGLE_LED"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | change_leds_to_buttons | void | void change_leds_to_buttons(void)
{
// Enable buttons
sl_simple_button_enable(&sl_button_btn0);
#ifndef SINGLE_BUTTON
sl_simple_button_enable(&sl_button_btn1);
#endif // SINGLE_BUTTON
// Wait
sl_sleeptimer_delay_millisecond(1);
// Enable button presses
app_button_press_enable();
} | /***************************************************************************/
/**
* Change LEDs to buttons in case of shared pin
*
******************************************************************************/ | Change LEDs to buttons in case of shared pin | [
"Change",
"LEDs",
"to",
"buttons",
"in",
"case",
"of",
"shared",
"pin"
] | void change_leds_to_buttons(void)
{
sl_simple_button_enable(&sl_button_btn0);
#ifndef SINGLE_BUTTON
sl_simple_button_enable(&sl_button_btn1);
#endif
sl_sleeptimer_delay_millisecond(1);
app_button_press_enable();
} | [
"void",
"change_leds_to_buttons",
"(",
"void",
")",
"{",
"sl_simple_button_enable",
"(",
"&",
"sl_button_btn0",
")",
";",
"#ifndef",
"SINGLE_BUTTON",
"sl_simple_button_enable",
"(",
"&",
"sl_button_btn1",
")",
";",
"#endif",
"sl_sleeptimer_delay_millisecond",
"(",
"1",
")",
";",
"app_button_press_enable",
"(",
")",
";",
"}"
] | Change LEDs to buttons in case of shared pin | [
"Change",
"LEDs",
"to",
"buttons",
"in",
"case",
"of",
"shared",
"pin"
] | [
"// Enable buttons",
"// SINGLE_BUTTON",
"// Wait",
"// Enable button presses"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | handle_reset_conditions | bool | bool handle_reset_conditions(void)
{
// If PB0 is held down then do full factory reset
if (sl_simple_button_get_state(&sl_button_btn0)
== SL_SIMPLE_BUTTON_PRESSED) {
// Disable button presses
app_button_press_disable();
// Full factory reset
sl_btmesh_initiate_full_reset();
return false;
}
#ifndef SINGLE_BUTTON
// If PB1 is held down then do node factory reset
if (sl_simple_button_get_state(&sl_button_btn1)
== SL_SIMPLE_BUTTON_PRESSED) {
// Disable button presses
app_button_press_disable();
// Node factory reset
sl_btmesh_initiate_node_reset();
return false;
}
#endif // SL_CATALOG_BTN1_PRESENT
return true;
} | /***************************************************************************/
/**
* Handles button press and does a factory reset
*
* @return true if there is no button press
******************************************************************************/ | Handles button press and does a factory reset
@return true if there is no button press | [
"Handles",
"button",
"press",
"and",
"does",
"a",
"factory",
"reset",
"@return",
"true",
"if",
"there",
"is",
"no",
"button",
"press"
] | bool handle_reset_conditions(void)
{
if (sl_simple_button_get_state(&sl_button_btn0)
== SL_SIMPLE_BUTTON_PRESSED) {
app_button_press_disable();
sl_btmesh_initiate_full_reset();
return false;
}
#ifndef SINGLE_BUTTON
if (sl_simple_button_get_state(&sl_button_btn1)
== SL_SIMPLE_BUTTON_PRESSED) {
app_button_press_disable();
sl_btmesh_initiate_node_reset();
return false;
}
#endif
return true;
} | [
"bool",
"handle_reset_conditions",
"(",
"void",
")",
"{",
"if",
"(",
"sl_simple_button_get_state",
"(",
"&",
"sl_button_btn0",
")",
"==",
"SL_SIMPLE_BUTTON_PRESSED",
")",
"{",
"app_button_press_disable",
"(",
")",
";",
"sl_btmesh_initiate_full_reset",
"(",
")",
";",
"return",
"false",
";",
"}",
"#ifndef",
"SINGLE_BUTTON",
"if",
"(",
"sl_simple_button_get_state",
"(",
"&",
"sl_button_btn1",
")",
"==",
"SL_SIMPLE_BUTTON_PRESSED",
")",
"{",
"app_button_press_disable",
"(",
")",
";",
"sl_btmesh_initiate_node_reset",
"(",
")",
";",
"return",
"false",
";",
"}",
"#endif",
"return",
"true",
";",
"}"
] | Handles button press and does a factory reset
@return true if there is no button press | [
"Handles",
"button",
"press",
"and",
"does",
"a",
"factory",
"reset",
"@return",
"true",
"if",
"there",
"is",
"no",
"button",
"press"
] | [
"// If PB0 is held down then do full factory reset",
"// Disable button presses",
"// Full factory reset",
"// If PB1 is held down then do node factory reset",
"// Disable button presses",
"// Node factory reset",
"// SL_CATALOG_BTN1_PRESENT"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | handle_boot_event | void | static void handle_boot_event(void)
{
sl_status_t sc;
bd_addr address;
uint8_t address_type;
char buf[BOOT_ERR_MSG_BUF_LEN];
// Check reset conditions and continue if not reset.
if (handle_reset_conditions()) {
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_status_f(sc, "Failed to get Bluetooth address\n");
set_device_name(&address);
// Initialize Mesh stack in Node operation mode, wait for initialized event
sc = sl_btmesh_node_init();
if (sc) {
snprintf(buf, BOOT_ERR_MSG_BUF_LEN, "init failed (0x%lx)", sc);
lcd_print(buf, BTMESH_WSTK_LCD_ROW_STATUS);
}
}
} | /***************************************************************************/
/**
* Handling of boot event.
* If needed it performs factory reset. In other case it sets device name
* and initialize mesh node.
******************************************************************************/ | Handling of boot event.
If needed it performs factory reset. In other case it sets device name
and initialize mesh node. | [
"Handling",
"of",
"boot",
"event",
".",
"If",
"needed",
"it",
"performs",
"factory",
"reset",
".",
"In",
"other",
"case",
"it",
"sets",
"device",
"name",
"and",
"initialize",
"mesh",
"node",
"."
] | static void handle_boot_event(void)
{
sl_status_t sc;
bd_addr address;
uint8_t address_type;
char buf[BOOT_ERR_MSG_BUF_LEN];
if (handle_reset_conditions()) {
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_status_f(sc, "Failed to get Bluetooth address\n");
set_device_name(&address);
sc = sl_btmesh_node_init();
if (sc) {
snprintf(buf, BOOT_ERR_MSG_BUF_LEN, "init failed (0x%lx)", sc);
lcd_print(buf, BTMESH_WSTK_LCD_ROW_STATUS);
}
}
} | [
"static",
"void",
"handle_boot_event",
"(",
"void",
")",
"{",
"sl_status_t",
"sc",
";",
"bd_addr",
"address",
";",
"uint8_t",
"address_type",
";",
"char",
"buf",
"[",
"BOOT_ERR_MSG_BUF_LEN",
"]",
";",
"if",
"(",
"handle_reset_conditions",
"(",
")",
")",
"{",
"sc",
"=",
"sl_bt_system_get_identity_address",
"(",
"&",
"address",
",",
"&",
"address_type",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"set_device_name",
"(",
"&",
"address",
")",
";",
"sc",
"=",
"sl_btmesh_node_init",
"(",
")",
";",
"if",
"(",
"sc",
")",
"{",
"snprintf",
"(",
"buf",
",",
"BOOT_ERR_MSG_BUF_LEN",
",",
"\"",
"\"",
",",
"sc",
")",
";",
"lcd_print",
"(",
"buf",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"}",
"}",
"}"
] | Handling of boot event. | [
"Handling",
"of",
"boot",
"event",
"."
] | [
"// Check reset conditions and continue if not reset.",
"// Initialize Mesh stack in Node operation mode, wait for initialized event"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | handle_le_connection_events | void | static void handle_le_connection_events(sl_bt_msg_t *evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_bt_evt_connection_opened_id:
num_connections++;
lcd_print("connected", BTMESH_WSTK_LCD_ROW_CONNECTION);
app_log("Connected\r\n");
break;
case sl_bt_evt_connection_closed_id:
if (num_connections > 0) {
if (--num_connections == 0) {
lcd_print("", BTMESH_WSTK_LCD_ROW_CONNECTION);
app_log("Disconnected\r\n");
}
}
break;
default:
break;
}
} | /***************************************************************************/
/**
* Handling of le connection events.
* It handles:
* - le_connection_opened
* - le_connection_parameters
* - le_connection_closed
*
* @param[in] evt Pointer to incoming connection event.
******************************************************************************/ | Handling of le connection events.
@param[in] evt Pointer to incoming connection event. | [
"Handling",
"of",
"le",
"connection",
"events",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"incoming",
"connection",
"event",
"."
] | static void handle_le_connection_events(sl_bt_msg_t *evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_bt_evt_connection_opened_id:
num_connections++;
lcd_print("connected", BTMESH_WSTK_LCD_ROW_CONNECTION);
app_log("Connected\r\n");
break;
case sl_bt_evt_connection_closed_id:
if (num_connections > 0) {
if (--num_connections == 0) {
lcd_print("", BTMESH_WSTK_LCD_ROW_CONNECTION);
app_log("Disconnected\r\n");
}
}
break;
default:
break;
}
} | [
"static",
"void",
"handle_le_connection_events",
"(",
"sl_bt_msg_t",
"*",
"evt",
")",
"{",
"switch",
"(",
"SL_BT_MSG_ID",
"(",
"evt",
"->",
"header",
")",
")",
"{",
"case",
"sl_bt_evt_connection_opened_id",
":",
"num_connections",
"++",
";",
"lcd_print",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_CONNECTION",
")",
";",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"break",
";",
"case",
"sl_bt_evt_connection_closed_id",
":",
"if",
"(",
"num_connections",
">",
"0",
")",
"{",
"if",
"(",
"--",
"num_connections",
"==",
"0",
")",
"{",
"lcd_print",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_CONNECTION",
")",
";",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"}",
"}",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Handling of le connection events. | [
"Handling",
"of",
"le",
"connection",
"events",
"."
] | [] | [
{
"param": "evt",
"type": "sl_bt_msg_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_bt_msg_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | sl_bt_on_event | void | void sl_bt_on_event(sl_bt_msg_t *evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_bt_evt_system_boot_id:
handle_boot_event();
break;
case sl_bt_evt_connection_opened_id:
case sl_bt_evt_connection_parameters_id:
case sl_bt_evt_connection_closed_id:
handle_le_connection_events(evt);
break;
default:
break;
}
} | /***************************************************************************/
/**
* Handling of stack events. Both Bluetooth LE and Bluetooth mesh events
* are handled here.
* @param[in] evt Pointer to incoming event.
******************************************************************************/ | Handling of stack events. Both Bluetooth LE and Bluetooth mesh events
are handled here.
@param[in] evt Pointer to incoming event. | [
"Handling",
"of",
"stack",
"events",
".",
"Both",
"Bluetooth",
"LE",
"and",
"Bluetooth",
"mesh",
"events",
"are",
"handled",
"here",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"incoming",
"event",
"."
] | void sl_bt_on_event(sl_bt_msg_t *evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_bt_evt_system_boot_id:
handle_boot_event();
break;
case sl_bt_evt_connection_opened_id:
case sl_bt_evt_connection_parameters_id:
case sl_bt_evt_connection_closed_id:
handle_le_connection_events(evt);
break;
default:
break;
}
} | [
"void",
"sl_bt_on_event",
"(",
"sl_bt_msg_t",
"*",
"evt",
")",
"{",
"switch",
"(",
"SL_BT_MSG_ID",
"(",
"evt",
"->",
"header",
")",
")",
"{",
"case",
"sl_bt_evt_system_boot_id",
":",
"handle_boot_event",
"(",
")",
";",
"break",
";",
"case",
"sl_bt_evt_connection_opened_id",
":",
"case",
"sl_bt_evt_connection_parameters_id",
":",
"case",
"sl_bt_evt_connection_closed_id",
":",
"handle_le_connection_events",
"(",
"evt",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Handling of stack events. | [
"Handling",
"of",
"stack",
"events",
"."
] | [] | [
{
"param": "evt",
"type": "sl_bt_msg_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_bt_msg_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | sl_btmesh_on_event | void | void sl_btmesh_on_event(sl_btmesh_msg_t *evt)
{
sl_status_t sc;
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
if (!(evt->data.evt_node_initialized.provisioned)) {
// Enable ADV and GATT provisioning bearer
sc = sl_btmesh_node_start_unprov_beaconing(PB_ADV | PB_GATT);
app_assert_status_f(sc, "Failed to start unprovisioned beaconing\n");
}
break;
default:
break;
}
} | /***************************************************************************/
/**
* Bluetooth Mesh stack event handler.
* This overrides the dummy weak implementation.
*
* @param[in] evt Pointer to incoming event from the Bluetooth Mesh stack.
******************************************************************************/ | Bluetooth Mesh stack event handler.
This overrides the dummy weak implementation.
@param[in] evt Pointer to incoming event from the Bluetooth Mesh stack. | [
"Bluetooth",
"Mesh",
"stack",
"event",
"handler",
".",
"This",
"overrides",
"the",
"dummy",
"weak",
"implementation",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"incoming",
"event",
"from",
"the",
"Bluetooth",
"Mesh",
"stack",
"."
] | void sl_btmesh_on_event(sl_btmesh_msg_t *evt)
{
sl_status_t sc;
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
if (!(evt->data.evt_node_initialized.provisioned)) {
sc = sl_btmesh_node_start_unprov_beaconing(PB_ADV | PB_GATT);
app_assert_status_f(sc, "Failed to start unprovisioned beaconing\n");
}
break;
default:
break;
}
} | [
"void",
"sl_btmesh_on_event",
"(",
"sl_btmesh_msg_t",
"*",
"evt",
")",
"{",
"sl_status_t",
"sc",
";",
"switch",
"(",
"SL_BT_MSG_ID",
"(",
"evt",
"->",
"header",
")",
")",
"{",
"case",
"sl_btmesh_evt_node_initialized_id",
":",
"if",
"(",
"!",
"(",
"evt",
"->",
"data",
".",
"evt_node_initialized",
".",
"provisioned",
")",
")",
"{",
"sc",
"=",
"sl_btmesh_node_start_unprov_beaconing",
"(",
"PB_ADV",
"|",
"PB_GATT",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Bluetooth Mesh stack event handler. | [
"Bluetooth",
"Mesh",
"stack",
"event",
"handler",
"."
] | [
"// Enable ADV and GATT provisioning bearer"
] | [
{
"param": "evt",
"type": "sl_btmesh_msg_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_msg_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26849750dff82a31f50f319f640cd1cafcffad7 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app.c | [
"Zlib"
] | C | sl_btmesh_on_node_provisioned | void | void sl_btmesh_on_node_provisioned(uint16_t address,
uint32_t iv_index)
{
sl_status_t sc = sl_simple_timer_stop(&app_led_blinking_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
// Turn off LED
init_done = true;
sl_simple_led_turn_off(sl_led_led0.context);
#ifndef SINGLE_LED
sl_simple_led_turn_off(sl_led_led1.context);
#endif // SINGLE_LED
change_leds_to_buttons();
#if defined(SL_CATALOG_BTMESH_WSTK_LCD_PRESENT) || defined(SL_CATALOG_APP_LOG_PRESENT)
app_show_btmesh_node_provisioned(address, iv_index);
#else
(void)address;
(void)iv_index;
#endif // defined(SL_CATALOG_BTMESH_WSTK_LCD_PRESENT) || defined(SL_CATALOG_APP_LOG_PRESENT)
} | // Called when the Provisioning finishes successfully | Called when the Provisioning finishes successfully | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully"
] | void sl_btmesh_on_node_provisioned(uint16_t address,
uint32_t iv_index)
{
sl_status_t sc = sl_simple_timer_stop(&app_led_blinking_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
init_done = true;
sl_simple_led_turn_off(sl_led_led0.context);
#ifndef SINGLE_LED
sl_simple_led_turn_off(sl_led_led1.context);
#endif
change_leds_to_buttons();
#if defined(SL_CATALOG_BTMESH_WSTK_LCD_PRESENT) || defined(SL_CATALOG_APP_LOG_PRESENT)
app_show_btmesh_node_provisioned(address, iv_index);
#else
(void)address;
(void)iv_index;
#endif
} | [
"void",
"sl_btmesh_on_node_provisioned",
"(",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"app_led_blinking_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"init_done",
"=",
"true",
";",
"sl_simple_led_turn_off",
"(",
"sl_led_led0",
".",
"context",
")",
";",
"#ifndef",
"SINGLE_LED",
"sl_simple_led_turn_off",
"(",
"sl_led_led1",
".",
"context",
")",
";",
"#endif",
"change_leds_to_buttons",
"(",
")",
";",
"#if",
"defined",
"(",
"SL_CATALOG_BTMESH_WSTK_LCD_PRESENT",
")",
"||",
"defined",
"(",
"SL_CATALOG_APP_LOG_PRESENT",
")",
"\n",
"app_show_btmesh_node_provisioned",
"(",
"address",
",",
"iv_index",
")",
";",
"#else",
"(",
"void",
")",
"address",
";",
"(",
"void",
")",
"iv_index",
";",
"#endif",
"}"
] | Called when the Provisioning finishes successfully | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully"
] | [
"// Turn off LED",
"// SINGLE_LED",
"// defined(SL_CATALOG_BTMESH_WSTK_LCD_PRESENT) || defined(SL_CATALOG_APP_LOG_PRESENT)"
] | [
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
903b3ab1c18e7491352d2e9209401b22cb6023b8 | SiliconLabs/Gecko_SDK | platform/radio/rail_lib/apps/railtest/app_main.c | [
"Zlib"
] | C | changeTxPayload | void | static void changeTxPayload(uint32_t offset,
uint8_t *src,
uint16_t srcLen,
uint16_t pktLen)
{
if (offset + srcLen <= sizeof(txData)) { // be sure it fits
memcpy(&txData[offset], &src[0], srcLen);
txDataLen = pktLen;
} else {
responsePrintError("changeTxPayload",
0xF0,
"New packet data overflows the txData buffer size.");
while (1) ;
}
} | // Copy src bytes into txData array starting at offset, and update txDataLength. | Copy src bytes into txData array starting at offset, and update txDataLength. | [
"Copy",
"src",
"bytes",
"into",
"txData",
"array",
"starting",
"at",
"offset",
"and",
"update",
"txDataLength",
"."
] | static void changeTxPayload(uint32_t offset,
uint8_t *src,
uint16_t srcLen,
uint16_t pktLen)
{
if (offset + srcLen <= sizeof(txData)) {
memcpy(&txData[offset], &src[0], srcLen);
txDataLen = pktLen;
} else {
responsePrintError("changeTxPayload",
0xF0,
"New packet data overflows the txData buffer size.");
while (1) ;
}
} | [
"static",
"void",
"changeTxPayload",
"(",
"uint32_t",
"offset",
",",
"uint8_t",
"*",
"src",
",",
"uint16_t",
"srcLen",
",",
"uint16_t",
"pktLen",
")",
"{",
"if",
"(",
"offset",
"+",
"srcLen",
"<=",
"sizeof",
"(",
"txData",
")",
")",
"{",
"memcpy",
"(",
"&",
"txData",
"[",
"offset",
"]",
",",
"&",
"src",
"[",
"0",
"]",
",",
"srcLen",
")",
";",
"txDataLen",
"=",
"pktLen",
";",
"}",
"else",
"{",
"responsePrintError",
"(",
"\"",
"\"",
",",
"0xF0",
",",
"\"",
"\"",
")",
";",
"while",
"(",
"1",
")",
";",
"}",
"}"
] | Copy src bytes into txData array starting at offset, and update txDataLength. | [
"Copy",
"src",
"bytes",
"into",
"txData",
"array",
"starting",
"at",
"offset",
"and",
"update",
"txDataLength",
"."
] | [
"// be sure it fits"
] | [
{
"param": "offset",
"type": "uint32_t"
},
{
"param": "src",
"type": "uint8_t"
},
{
"param": "srcLen",
"type": "uint16_t"
},
{
"param": "pktLen",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "offset",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcLen",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pktLen",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
903b3ab1c18e7491352d2e9209401b22cb6023b8 | SiliconLabs/Gecko_SDK | platform/radio/rail_lib/apps/railtest/app_main.c | [
"Zlib"
] | C | sl_rail_util_on_rf_ready | void | void sl_rail_util_on_rf_ready(RAIL_Handle_t railHandle)
{
(void)railHandle;
LedSet(0);
LedSet(1);
} | // Override weak function called by callback sli_rail_util_on_rf_ready. | Override weak function called by callback sli_rail_util_on_rf_ready. | [
"Override",
"weak",
"function",
"called",
"by",
"callback",
"sli_rail_util_on_rf_ready",
"."
] | void sl_rail_util_on_rf_ready(RAIL_Handle_t railHandle)
{
(void)railHandle;
LedSet(0);
LedSet(1);
} | [
"void",
"sl_rail_util_on_rf_ready",
"(",
"RAIL_Handle_t",
"railHandle",
")",
"{",
"(",
"void",
")",
"railHandle",
";",
"LedSet",
"(",
"0",
")",
";",
"LedSet",
"(",
"1",
")",
";",
"}"
] | Override weak function called by callback sli_rail_util_on_rf_ready. | [
"Override",
"weak",
"function",
"called",
"by",
"callback",
"sli_rail_util_on_rf_ready",
"."
] | [] | [
{
"param": "railHandle",
"type": "RAIL_Handle_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "railHandle",
"type": "RAIL_Handle_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
903b3ab1c18e7491352d2e9209401b22cb6023b8 | SiliconLabs/Gecko_SDK | platform/radio/rail_lib/apps/railtest/app_main.c | [
"Zlib"
] | C | sl_rail_util_on_assert_failed | void | void sl_rail_util_on_assert_failed(RAIL_Handle_t railHandle, uint32_t errorCode)
{
(void)railHandle;
static const char* railErrorMessages[] = RAIL_ASSERT_ERROR_MESSAGES;
const char *errorMessage = "Unknown";
// If this error code is within the range of known error messages then use
// the appropriate error message.
if (errorCode < (sizeof(railErrorMessages) / sizeof(char*))) {
errorMessage = railErrorMessages[errorCode];
}
// Print a message about the assert that triggered
extern volatile int RAIL_AssertLineNumber;
responsePrint("assert",
"code:%d,line:%d,message:%s",
errorCode,
RAIL_AssertLineNumber,
errorMessage);
serialWaitForTxIdle();
// Reset the chip since an assert is a fatal error
NVIC_SystemReset();
} | // Override weak function called by callback RAILCb_AssertFailed. | Override weak function called by callback RAILCb_AssertFailed. | [
"Override",
"weak",
"function",
"called",
"by",
"callback",
"RAILCb_AssertFailed",
"."
] | void sl_rail_util_on_assert_failed(RAIL_Handle_t railHandle, uint32_t errorCode)
{
(void)railHandle;
static const char* railErrorMessages[] = RAIL_ASSERT_ERROR_MESSAGES;
const char *errorMessage = "Unknown";
if (errorCode < (sizeof(railErrorMessages) / sizeof(char*))) {
errorMessage = railErrorMessages[errorCode];
}
extern volatile int RAIL_AssertLineNumber;
responsePrint("assert",
"code:%d,line:%d,message:%s",
errorCode,
RAIL_AssertLineNumber,
errorMessage);
serialWaitForTxIdle();
NVIC_SystemReset();
} | [
"void",
"sl_rail_util_on_assert_failed",
"(",
"RAIL_Handle_t",
"railHandle",
",",
"uint32_t",
"errorCode",
")",
"{",
"(",
"void",
")",
"railHandle",
";",
"static",
"const",
"char",
"*",
"railErrorMessages",
"[",
"]",
"=",
"RAIL_ASSERT_ERROR_MESSAGES",
";",
"const",
"char",
"*",
"errorMessage",
"=",
"\"",
"\"",
";",
"if",
"(",
"errorCode",
"<",
"(",
"sizeof",
"(",
"railErrorMessages",
")",
"/",
"sizeof",
"(",
"char",
"*",
")",
")",
")",
"{",
"errorMessage",
"=",
"railErrorMessages",
"[",
"errorCode",
"]",
";",
"}",
"extern",
"volatile",
"int",
"RAIL_AssertLineNumber",
";",
"responsePrint",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"errorCode",
",",
"RAIL_AssertLineNumber",
",",
"errorMessage",
")",
";",
"serialWaitForTxIdle",
"(",
")",
";",
"NVIC_SystemReset",
"(",
")",
";",
"}"
] | Override weak function called by callback RAILCb_AssertFailed. | [
"Override",
"weak",
"function",
"called",
"by",
"callback",
"RAILCb_AssertFailed",
"."
] | [
"// If this error code is within the range of known error messages then use",
"// the appropriate error message.",
"// Print a message about the assert that triggered",
"// Reset the chip since an assert is a fatal error"
] | [
{
"param": "railHandle",
"type": "RAIL_Handle_t"
},
{
"param": "errorCode",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "railHandle",
"type": "RAIL_Handle_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "errorCode",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
903b3ab1c18e7491352d2e9209401b22cb6023b8 | SiliconLabs/Gecko_SDK | platform/radio/rail_lib/apps/railtest/app_main.c | [
"Zlib"
] | C | sl_rail_util_on_event | void | void sl_rail_util_on_event(RAIL_Handle_t railHandle, RAIL_Events_t events)
{
enqueueEvents(events);
if (events & RAIL_EVENT_CAL_NEEDED) {
calibrateRadio = true;
}
if (events & RAIL_EVENT_RSSI_AVERAGE_DONE) {
RAILCb_RssiAverageDone(railHandle);
}
// RX Events
if (events & RAIL_EVENT_RX_TIMING_DETECT) {
counters.timingDetect++;
}
if (events & RAIL_EVENT_RX_TIMING_LOST) {
counters.timingLost++;
}
if (events & RAIL_EVENT_RX_PREAMBLE_LOST) {
counters.preambleLost++;
}
if (events & RAIL_EVENT_RX_PREAMBLE_DETECT) {
counters.preambleDetect++;
}
if (events & (RAIL_EVENT_RX_SYNC1_DETECT | RAIL_EVENT_RX_SYNC2_DETECT)) {
receivingPacket = true;
counters.syncDetect++;
rxFifoPrep();
if (printRxFreqOffsetData) {
rxFreqOffset = RAIL_GetRxFreqOffset(railHandle);
}
if (abortRxDelay != 0) {
RAIL_SetTimer(railHandle, abortRxDelay, RAIL_TIME_DELAY, &RAILCb_TimerExpired);
}
}
if (events & RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND) {
if (RAIL_IEEE802154_IsEnabled(railHandle)) {
counters.dataRequests++;
RAILCb_IEEE802154_DataRequestCommand(railHandle);
}
#if RAIL_FEAT_ZWAVE_SUPPORTED
else if (RAIL_ZWAVE_IsEnabled(railHandle)) {
RAILCb_ZWAVE_LrAckData(railHandle);
}
#endif //RAIL_FEAT_ZWAVE_SUPPORTED
else {
// Other protocols ignore this event
}
}
#if RAIL_FEAT_ZWAVE_SUPPORTED
if (events & RAIL_EVENT_ZWAVE_BEAM) {
if (RAIL_ZWAVE_IsEnabled(railHandle)) {
counters.rxBeams++;
RAILCb_ZWAVE_BeamFrame(railHandle);
}
}
#endif //RAIL_FEAT_ZWAVE_SUPPORTED
if (events & RAIL_EVENT_RX_FIFO_ALMOST_FULL) {
counters.rxFifoAlmostFull++;
RAILCb_RxFifoAlmostFull(railHandle);
}
if (events & RAIL_EVENT_RX_FIFO_FULL) {
if (rxHeld) {
rxProcessHeld = true; // Try to avoid overflow by processing held packets
}
counters.rxFifoFull++;
}
if (events & (RAIL_EVENT_RX_FIFO_OVERFLOW
| RAIL_EVENT_RX_ADDRESS_FILTERED
| RAIL_EVENT_RX_PACKET_ABORTED
| RAIL_EVENT_RX_FRAME_ERROR
| RAIL_EVENT_RX_PACKET_RECEIVED)) {
// All of the above events cause a packet to not be received
receivingPacket = false;
if (events & RAIL_EVENT_RX_PACKET_RECEIVED) {
RAILCb_RxPacketReceived(railHandle);
}
if (rxFifoManual && (railDataConfig.rxMethod != PACKET_MODE)) {
(void)RAIL_HoldRxPacket(railHandle);
}
if (events & RAIL_EVENT_RX_FIFO_OVERFLOW) {
counters.rxOfEvent++;
if (railDataConfig.rxSource == RX_PACKET_DATA) {
RAILCb_RxPacketAborted(railHandle);
} else {
// Treat similar to RX_FIFO_ALMOST_FULL: consume RX data
RAILCb_RxFifoAlmostFull(railHandle);
// Since we disable RX after a overflow, go ahead and
// turn RX back on to continue collecting data.
if (receiveModeEnabled) {
RAIL_StartRx(railHandle, channel, NULL);
}
}
}
if (events & RAIL_EVENT_RX_ADDRESS_FILTERED) {
counters.addrFilterEvent++;
RAILCb_RxPacketAborted(railHandle);
}
if (events & RAIL_EVENT_RX_PACKET_ABORTED) {
counters.rxFail++;
RAILCb_RxPacketAborted(railHandle);
}
if (events & RAIL_EVENT_RX_FRAME_ERROR) {
counters.frameError++;
RAILCb_RxPacketAborted(railHandle);
}
}
if (events & RAIL_EVENT_RX_ACK_TIMEOUT) {
counters.ackTimeout++;
rxAckTimeout = true;
//TODO: packetTime depends on txTimePosition;
// this code assumes default position (PACKET_END).
ackTimeoutDuration = RAIL_GetTime()
- previousTxAppendedInfo.timeSent.packetTime;
}
// End scheduled receive mode if an appropriate end or error event is received
if ((events & (RAIL_EVENT_RX_SCHEDULED_RX_END
| RAIL_EVENT_RX_SCHEDULED_RX_MISSED))
|| ((schRxStopOnRxEvent && inAppMode(RX_SCHEDULED, NULL))
&& (events & (RAIL_EVENT_RX_ADDRESS_FILTERED
| RAIL_EVENT_RX_PACKET_ABORTED
| RAIL_EVENT_RX_FIFO_OVERFLOW
| RAIL_EVENT_RX_FRAME_ERROR)))) {
// N.B. RAIL_EVENT_RX_PACKET_RECEIVED was handled in its callback already
enableAppMode(RX_SCHEDULED, false, NULL);
}
// TX Events
if (events & RAIL_EVENT_TX_START_CCA) {
counters.lbtStartCca++;
}
if (events & RAIL_EVENT_TX_CCA_RETRY) {
counters.lbtRetry++;
}
if (events & RAIL_EVENT_TX_CHANNEL_CLEAR) {
counters.lbtSuccess++;
ccaSuccesses++;
if ((txOptions & RAIL_TX_OPTION_CCA_ONLY) != 0U) {
lastTxStatus = events;
newTxError = true; // This is a 'pretend error'; see printNewTxError()
// This doesn't counters.userTx++;
//@TODO: Should we instead initiate an immediate transmit here?
scheduleNextTx();
}
}
#if RAIL_SUPPORTS_MFM
if (events & RAIL_EVENT_MFM_TX_BUFFER_DONE) {
if (railDataConfig.txSource == TX_MFM_DATA) {
counters.userTx++;
}
}
#endif
if (events & RAIL_EVENT_TX_STARTED) {
counters.userTxStarted++;
(void) RAIL_GetTxTimePreambleStart(railHandle, RAIL_TX_STARTED_BYTES,
&txStartTime);
}
if (events & RAIL_EVENT_TX_FIFO_ALMOST_EMPTY) {
RAILCb_TxFifoAlmostEmpty(railHandle);
}
// Process TX success before any failures in case an auto-repeat fails
if (events & RAIL_EVENT_TX_PACKET_SENT) {
counters.userTx++;
txRemainingCount = RAIL_GetTxPacketsRemaining(railHandle);
if (txRemainingCount != txRepeatCount) {
counters.userTxRemainingErrors++;
}
if (txRemainingCount > 0) {
// Defer calling RAILCb_TxPacketSent() to last of auto-repeat transmits
internalTransmitCounter++;
if (txRepeatCount != RAIL_TX_REPEAT_INFINITE_ITERATIONS) {
txRepeatCount--;
}
} else {
txRepeatCount = 0;
RAILCb_TxPacketSent(railHandle, false);
}
}
if (events & (RAIL_EVENT_TX_ABORTED
| RAIL_EVENT_TX_BLOCKED
| RAIL_EVENT_TX_UNDERFLOW
| RAIL_EVENT_TX_CHANNEL_BUSY
| RAIL_EVENT_TX_SCHEDULED_TX_MISSED)) {
lastTxStatus = events;
txRemainingCount = RAIL_GetTxPacketsRemaining(railHandle);
if ((txRepeatCount != RAIL_TX_REPEAT_INFINITE_ITERATIONS)
&& (txRepeatCount > 0)
&& ((events & (RAIL_EVENT_TX_ABORTED | RAIL_EVENT_TX_UNDERFLOW)) == 0U)) {
txRepeatCount++; // A transmit never happened
}
if (txRemainingCount != txRepeatCount) {
counters.userTxRemainingErrors++;
}
txRepeatCount = 0;
newTxError = true;
failPackets++;
scheduleNextTx();
// Increment counters for TX events
if (events & RAIL_EVENT_TX_ABORTED) {
counters.userTxAborted++;
}
if (events & RAIL_EVENT_TX_BLOCKED) {
counters.userTxBlocked++;
}
if (events & RAIL_EVENT_TX_UNDERFLOW) {
counters.userTxUnderflow++;
}
}
// Put this here too so that we do these things twice
// in the case that an ack and a non ack have completed
if (events & RAIL_EVENT_TXACK_PACKET_SENT) {
counters.ackTx++;
RAILCb_TxPacketSent(railHandle, true);
}
if (events & (RAIL_EVENT_TXACK_ABORTED
| RAIL_EVENT_TXACK_BLOCKED
| RAIL_EVENT_TXACK_UNDERFLOW)) {
lastTxAckStatus = events;
failAckPackets++;
pendFinishTxAckSequence();
// Increment counters for TXACK events
if (events & RAIL_EVENT_TXACK_ABORTED) {
counters.ackTxAborted++;
}
if (events & RAIL_EVENT_TXACK_BLOCKED) {
counters.ackTxBlocked++;
}
if (events & RAIL_EVENT_TXACK_UNDERFLOW) {
counters.ackTxUnderflow++;
}
}
if (events & RAIL_EVENT_RX_CHANNEL_HOPPING_COMPLETE) {
RAILCb_RxChannelHoppingComplete(railHandle);
}
if (events & RAIL_EVENT_PA_PROTECTION) {
counters.paProtect++;
}
} | // Override weak function called by callback sli_rail_util_on_event. | Override weak function called by callback sli_rail_util_on_event. | [
"Override",
"weak",
"function",
"called",
"by",
"callback",
"sli_rail_util_on_event",
"."
] | void sl_rail_util_on_event(RAIL_Handle_t railHandle, RAIL_Events_t events)
{
enqueueEvents(events);
if (events & RAIL_EVENT_CAL_NEEDED) {
calibrateRadio = true;
}
if (events & RAIL_EVENT_RSSI_AVERAGE_DONE) {
RAILCb_RssiAverageDone(railHandle);
}
if (events & RAIL_EVENT_RX_TIMING_DETECT) {
counters.timingDetect++;
}
if (events & RAIL_EVENT_RX_TIMING_LOST) {
counters.timingLost++;
}
if (events & RAIL_EVENT_RX_PREAMBLE_LOST) {
counters.preambleLost++;
}
if (events & RAIL_EVENT_RX_PREAMBLE_DETECT) {
counters.preambleDetect++;
}
if (events & (RAIL_EVENT_RX_SYNC1_DETECT | RAIL_EVENT_RX_SYNC2_DETECT)) {
receivingPacket = true;
counters.syncDetect++;
rxFifoPrep();
if (printRxFreqOffsetData) {
rxFreqOffset = RAIL_GetRxFreqOffset(railHandle);
}
if (abortRxDelay != 0) {
RAIL_SetTimer(railHandle, abortRxDelay, RAIL_TIME_DELAY, &RAILCb_TimerExpired);
}
}
if (events & RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND) {
if (RAIL_IEEE802154_IsEnabled(railHandle)) {
counters.dataRequests++;
RAILCb_IEEE802154_DataRequestCommand(railHandle);
}
#if RAIL_FEAT_ZWAVE_SUPPORTED
else if (RAIL_ZWAVE_IsEnabled(railHandle)) {
RAILCb_ZWAVE_LrAckData(railHandle);
}
#endif
else {
}
}
#if RAIL_FEAT_ZWAVE_SUPPORTED
if (events & RAIL_EVENT_ZWAVE_BEAM) {
if (RAIL_ZWAVE_IsEnabled(railHandle)) {
counters.rxBeams++;
RAILCb_ZWAVE_BeamFrame(railHandle);
}
}
#endif
if (events & RAIL_EVENT_RX_FIFO_ALMOST_FULL) {
counters.rxFifoAlmostFull++;
RAILCb_RxFifoAlmostFull(railHandle);
}
if (events & RAIL_EVENT_RX_FIFO_FULL) {
if (rxHeld) {
rxProcessHeld = true;
}
counters.rxFifoFull++;
}
if (events & (RAIL_EVENT_RX_FIFO_OVERFLOW
| RAIL_EVENT_RX_ADDRESS_FILTERED
| RAIL_EVENT_RX_PACKET_ABORTED
| RAIL_EVENT_RX_FRAME_ERROR
| RAIL_EVENT_RX_PACKET_RECEIVED)) {
receivingPacket = false;
if (events & RAIL_EVENT_RX_PACKET_RECEIVED) {
RAILCb_RxPacketReceived(railHandle);
}
if (rxFifoManual && (railDataConfig.rxMethod != PACKET_MODE)) {
(void)RAIL_HoldRxPacket(railHandle);
}
if (events & RAIL_EVENT_RX_FIFO_OVERFLOW) {
counters.rxOfEvent++;
if (railDataConfig.rxSource == RX_PACKET_DATA) {
RAILCb_RxPacketAborted(railHandle);
} else {
RAILCb_RxFifoAlmostFull(railHandle);
if (receiveModeEnabled) {
RAIL_StartRx(railHandle, channel, NULL);
}
}
}
if (events & RAIL_EVENT_RX_ADDRESS_FILTERED) {
counters.addrFilterEvent++;
RAILCb_RxPacketAborted(railHandle);
}
if (events & RAIL_EVENT_RX_PACKET_ABORTED) {
counters.rxFail++;
RAILCb_RxPacketAborted(railHandle);
}
if (events & RAIL_EVENT_RX_FRAME_ERROR) {
counters.frameError++;
RAILCb_RxPacketAborted(railHandle);
}
}
if (events & RAIL_EVENT_RX_ACK_TIMEOUT) {
counters.ackTimeout++;
rxAckTimeout = true;
ackTimeoutDuration = RAIL_GetTime()
- previousTxAppendedInfo.timeSent.packetTime;
}
if ((events & (RAIL_EVENT_RX_SCHEDULED_RX_END
| RAIL_EVENT_RX_SCHEDULED_RX_MISSED))
|| ((schRxStopOnRxEvent && inAppMode(RX_SCHEDULED, NULL))
&& (events & (RAIL_EVENT_RX_ADDRESS_FILTERED
| RAIL_EVENT_RX_PACKET_ABORTED
| RAIL_EVENT_RX_FIFO_OVERFLOW
| RAIL_EVENT_RX_FRAME_ERROR)))) {
enableAppMode(RX_SCHEDULED, false, NULL);
}
if (events & RAIL_EVENT_TX_START_CCA) {
counters.lbtStartCca++;
}
if (events & RAIL_EVENT_TX_CCA_RETRY) {
counters.lbtRetry++;
}
if (events & RAIL_EVENT_TX_CHANNEL_CLEAR) {
counters.lbtSuccess++;
ccaSuccesses++;
if ((txOptions & RAIL_TX_OPTION_CCA_ONLY) != 0U) {
lastTxStatus = events;
newTxError = true;
scheduleNextTx();
}
}
#if RAIL_SUPPORTS_MFM
if (events & RAIL_EVENT_MFM_TX_BUFFER_DONE) {
if (railDataConfig.txSource == TX_MFM_DATA) {
counters.userTx++;
}
}
#endif
if (events & RAIL_EVENT_TX_STARTED) {
counters.userTxStarted++;
(void) RAIL_GetTxTimePreambleStart(railHandle, RAIL_TX_STARTED_BYTES,
&txStartTime);
}
if (events & RAIL_EVENT_TX_FIFO_ALMOST_EMPTY) {
RAILCb_TxFifoAlmostEmpty(railHandle);
}
if (events & RAIL_EVENT_TX_PACKET_SENT) {
counters.userTx++;
txRemainingCount = RAIL_GetTxPacketsRemaining(railHandle);
if (txRemainingCount != txRepeatCount) {
counters.userTxRemainingErrors++;
}
if (txRemainingCount > 0) {
internalTransmitCounter++;
if (txRepeatCount != RAIL_TX_REPEAT_INFINITE_ITERATIONS) {
txRepeatCount--;
}
} else {
txRepeatCount = 0;
RAILCb_TxPacketSent(railHandle, false);
}
}
if (events & (RAIL_EVENT_TX_ABORTED
| RAIL_EVENT_TX_BLOCKED
| RAIL_EVENT_TX_UNDERFLOW
| RAIL_EVENT_TX_CHANNEL_BUSY
| RAIL_EVENT_TX_SCHEDULED_TX_MISSED)) {
lastTxStatus = events;
txRemainingCount = RAIL_GetTxPacketsRemaining(railHandle);
if ((txRepeatCount != RAIL_TX_REPEAT_INFINITE_ITERATIONS)
&& (txRepeatCount > 0)
&& ((events & (RAIL_EVENT_TX_ABORTED | RAIL_EVENT_TX_UNDERFLOW)) == 0U)) {
txRepeatCount++;
}
if (txRemainingCount != txRepeatCount) {
counters.userTxRemainingErrors++;
}
txRepeatCount = 0;
newTxError = true;
failPackets++;
scheduleNextTx();
if (events & RAIL_EVENT_TX_ABORTED) {
counters.userTxAborted++;
}
if (events & RAIL_EVENT_TX_BLOCKED) {
counters.userTxBlocked++;
}
if (events & RAIL_EVENT_TX_UNDERFLOW) {
counters.userTxUnderflow++;
}
}
if (events & RAIL_EVENT_TXACK_PACKET_SENT) {
counters.ackTx++;
RAILCb_TxPacketSent(railHandle, true);
}
if (events & (RAIL_EVENT_TXACK_ABORTED
| RAIL_EVENT_TXACK_BLOCKED
| RAIL_EVENT_TXACK_UNDERFLOW)) {
lastTxAckStatus = events;
failAckPackets++;
pendFinishTxAckSequence();
if (events & RAIL_EVENT_TXACK_ABORTED) {
counters.ackTxAborted++;
}
if (events & RAIL_EVENT_TXACK_BLOCKED) {
counters.ackTxBlocked++;
}
if (events & RAIL_EVENT_TXACK_UNDERFLOW) {
counters.ackTxUnderflow++;
}
}
if (events & RAIL_EVENT_RX_CHANNEL_HOPPING_COMPLETE) {
RAILCb_RxChannelHoppingComplete(railHandle);
}
if (events & RAIL_EVENT_PA_PROTECTION) {
counters.paProtect++;
}
} | [
"void",
"sl_rail_util_on_event",
"(",
"RAIL_Handle_t",
"railHandle",
",",
"RAIL_Events_t",
"events",
")",
"{",
"enqueueEvents",
"(",
"events",
")",
";",
"if",
"(",
"events",
"&",
"RAIL_EVENT_CAL_NEEDED",
")",
"{",
"calibrateRadio",
"=",
"true",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RSSI_AVERAGE_DONE",
")",
"{",
"RAILCb_RssiAverageDone",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_TIMING_DETECT",
")",
"{",
"counters",
".",
"timingDetect",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_TIMING_LOST",
")",
"{",
"counters",
".",
"timingLost",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_PREAMBLE_LOST",
")",
"{",
"counters",
".",
"preambleLost",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_PREAMBLE_DETECT",
")",
"{",
"counters",
".",
"preambleDetect",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"(",
"RAIL_EVENT_RX_SYNC1_DETECT",
"|",
"RAIL_EVENT_RX_SYNC2_DETECT",
")",
")",
"{",
"receivingPacket",
"=",
"true",
";",
"counters",
".",
"syncDetect",
"++",
";",
"rxFifoPrep",
"(",
")",
";",
"if",
"(",
"printRxFreqOffsetData",
")",
"{",
"rxFreqOffset",
"=",
"RAIL_GetRxFreqOffset",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"abortRxDelay",
"!=",
"0",
")",
"{",
"RAIL_SetTimer",
"(",
"railHandle",
",",
"abortRxDelay",
",",
"RAIL_TIME_DELAY",
",",
"&",
"RAILCb_TimerExpired",
")",
";",
"}",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND",
")",
"{",
"if",
"(",
"RAIL_IEEE802154_IsEnabled",
"(",
"railHandle",
")",
")",
"{",
"counters",
".",
"dataRequests",
"++",
";",
"RAILCb_IEEE802154_DataRequestCommand",
"(",
"railHandle",
")",
";",
"}",
"#if",
"RAIL_FEAT_ZWAVE_SUPPORTED",
"\n",
"else",
"if",
"(",
"RAIL_ZWAVE_IsEnabled",
"(",
"railHandle",
")",
")",
"{",
"RAILCb_ZWAVE_LrAckData",
"(",
"railHandle",
")",
";",
"}",
"#endif",
"else",
"",
"{",
"}",
"}",
"#if",
"RAIL_FEAT_ZWAVE_SUPPORTED",
"\n",
"if",
"(",
"events",
"&",
"RAIL_EVENT_ZWAVE_BEAM",
")",
"{",
"if",
"(",
"RAIL_ZWAVE_IsEnabled",
"(",
"railHandle",
")",
")",
"{",
"counters",
".",
"rxBeams",
"++",
";",
"RAILCb_ZWAVE_BeamFrame",
"(",
"railHandle",
")",
";",
"}",
"}",
"#endif",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_FIFO_ALMOST_FULL",
")",
"{",
"counters",
".",
"rxFifoAlmostFull",
"++",
";",
"RAILCb_RxFifoAlmostFull",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_FIFO_FULL",
")",
"{",
"if",
"(",
"rxHeld",
")",
"{",
"rxProcessHeld",
"=",
"true",
";",
"}",
"counters",
".",
"rxFifoFull",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"(",
"RAIL_EVENT_RX_FIFO_OVERFLOW",
"|",
"RAIL_EVENT_RX_ADDRESS_FILTERED",
"|",
"RAIL_EVENT_RX_PACKET_ABORTED",
"|",
"RAIL_EVENT_RX_FRAME_ERROR",
"|",
"RAIL_EVENT_RX_PACKET_RECEIVED",
")",
")",
"{",
"receivingPacket",
"=",
"false",
";",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_PACKET_RECEIVED",
")",
"{",
"RAILCb_RxPacketReceived",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"rxFifoManual",
"&&",
"(",
"railDataConfig",
".",
"rxMethod",
"!=",
"PACKET_MODE",
")",
")",
"{",
"(",
"void",
")",
"RAIL_HoldRxPacket",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_FIFO_OVERFLOW",
")",
"{",
"counters",
".",
"rxOfEvent",
"++",
";",
"if",
"(",
"railDataConfig",
".",
"rxSource",
"==",
"RX_PACKET_DATA",
")",
"{",
"RAILCb_RxPacketAborted",
"(",
"railHandle",
")",
";",
"}",
"else",
"{",
"RAILCb_RxFifoAlmostFull",
"(",
"railHandle",
")",
";",
"if",
"(",
"receiveModeEnabled",
")",
"{",
"RAIL_StartRx",
"(",
"railHandle",
",",
"channel",
",",
"NULL",
")",
";",
"}",
"}",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_ADDRESS_FILTERED",
")",
"{",
"counters",
".",
"addrFilterEvent",
"++",
";",
"RAILCb_RxPacketAborted",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_PACKET_ABORTED",
")",
"{",
"counters",
".",
"rxFail",
"++",
";",
"RAILCb_RxPacketAborted",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_FRAME_ERROR",
")",
"{",
"counters",
".",
"frameError",
"++",
";",
"RAILCb_RxPacketAborted",
"(",
"railHandle",
")",
";",
"}",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_ACK_TIMEOUT",
")",
"{",
"counters",
".",
"ackTimeout",
"++",
";",
"rxAckTimeout",
"=",
"true",
";",
"ackTimeoutDuration",
"=",
"RAIL_GetTime",
"(",
")",
"-",
"previousTxAppendedInfo",
".",
"timeSent",
".",
"packetTime",
";",
"}",
"if",
"(",
"(",
"events",
"&",
"(",
"RAIL_EVENT_RX_SCHEDULED_RX_END",
"|",
"RAIL_EVENT_RX_SCHEDULED_RX_MISSED",
")",
")",
"||",
"(",
"(",
"schRxStopOnRxEvent",
"&&",
"inAppMode",
"(",
"RX_SCHEDULED",
",",
"NULL",
")",
")",
"&&",
"(",
"events",
"&",
"(",
"RAIL_EVENT_RX_ADDRESS_FILTERED",
"|",
"RAIL_EVENT_RX_PACKET_ABORTED",
"|",
"RAIL_EVENT_RX_FIFO_OVERFLOW",
"|",
"RAIL_EVENT_RX_FRAME_ERROR",
")",
")",
")",
")",
"{",
"enableAppMode",
"(",
"RX_SCHEDULED",
",",
"false",
",",
"NULL",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_START_CCA",
")",
"{",
"counters",
".",
"lbtStartCca",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_CCA_RETRY",
")",
"{",
"counters",
".",
"lbtRetry",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_CHANNEL_CLEAR",
")",
"{",
"counters",
".",
"lbtSuccess",
"++",
";",
"ccaSuccesses",
"++",
";",
"if",
"(",
"(",
"txOptions",
"&",
"RAIL_TX_OPTION_CCA_ONLY",
")",
"!=",
"0U",
")",
"{",
"lastTxStatus",
"=",
"events",
";",
"newTxError",
"=",
"true",
";",
"scheduleNextTx",
"(",
")",
";",
"}",
"}",
"#if",
"RAIL_SUPPORTS_MFM",
"\n",
"if",
"(",
"events",
"&",
"RAIL_EVENT_MFM_TX_BUFFER_DONE",
")",
"{",
"if",
"(",
"railDataConfig",
".",
"txSource",
"==",
"TX_MFM_DATA",
")",
"{",
"counters",
".",
"userTx",
"++",
";",
"}",
"}",
"#endif",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_STARTED",
")",
"{",
"counters",
".",
"userTxStarted",
"++",
";",
"(",
"void",
")",
"RAIL_GetTxTimePreambleStart",
"(",
"railHandle",
",",
"RAIL_TX_STARTED_BYTES",
",",
"&",
"txStartTime",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_FIFO_ALMOST_EMPTY",
")",
"{",
"RAILCb_TxFifoAlmostEmpty",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_PACKET_SENT",
")",
"{",
"counters",
".",
"userTx",
"++",
";",
"txRemainingCount",
"=",
"RAIL_GetTxPacketsRemaining",
"(",
"railHandle",
")",
";",
"if",
"(",
"txRemainingCount",
"!=",
"txRepeatCount",
")",
"{",
"counters",
".",
"userTxRemainingErrors",
"++",
";",
"}",
"if",
"(",
"txRemainingCount",
">",
"0",
")",
"{",
"internalTransmitCounter",
"++",
";",
"if",
"(",
"txRepeatCount",
"!=",
"RAIL_TX_REPEAT_INFINITE_ITERATIONS",
")",
"{",
"txRepeatCount",
"--",
";",
"}",
"}",
"else",
"{",
"txRepeatCount",
"=",
"0",
";",
"RAILCb_TxPacketSent",
"(",
"railHandle",
",",
"false",
")",
";",
"}",
"}",
"if",
"(",
"events",
"&",
"(",
"RAIL_EVENT_TX_ABORTED",
"|",
"RAIL_EVENT_TX_BLOCKED",
"|",
"RAIL_EVENT_TX_UNDERFLOW",
"|",
"RAIL_EVENT_TX_CHANNEL_BUSY",
"|",
"RAIL_EVENT_TX_SCHEDULED_TX_MISSED",
")",
")",
"{",
"lastTxStatus",
"=",
"events",
";",
"txRemainingCount",
"=",
"RAIL_GetTxPacketsRemaining",
"(",
"railHandle",
")",
";",
"if",
"(",
"(",
"txRepeatCount",
"!=",
"RAIL_TX_REPEAT_INFINITE_ITERATIONS",
")",
"&&",
"(",
"txRepeatCount",
">",
"0",
")",
"&&",
"(",
"(",
"events",
"&",
"(",
"RAIL_EVENT_TX_ABORTED",
"|",
"RAIL_EVENT_TX_UNDERFLOW",
")",
")",
"==",
"0U",
")",
")",
"{",
"txRepeatCount",
"++",
";",
"}",
"if",
"(",
"txRemainingCount",
"!=",
"txRepeatCount",
")",
"{",
"counters",
".",
"userTxRemainingErrors",
"++",
";",
"}",
"txRepeatCount",
"=",
"0",
";",
"newTxError",
"=",
"true",
";",
"failPackets",
"++",
";",
"scheduleNextTx",
"(",
")",
";",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_ABORTED",
")",
"{",
"counters",
".",
"userTxAborted",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_BLOCKED",
")",
"{",
"counters",
".",
"userTxBlocked",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TX_UNDERFLOW",
")",
"{",
"counters",
".",
"userTxUnderflow",
"++",
";",
"}",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TXACK_PACKET_SENT",
")",
"{",
"counters",
".",
"ackTx",
"++",
";",
"RAILCb_TxPacketSent",
"(",
"railHandle",
",",
"true",
")",
";",
"}",
"if",
"(",
"events",
"&",
"(",
"RAIL_EVENT_TXACK_ABORTED",
"|",
"RAIL_EVENT_TXACK_BLOCKED",
"|",
"RAIL_EVENT_TXACK_UNDERFLOW",
")",
")",
"{",
"lastTxAckStatus",
"=",
"events",
";",
"failAckPackets",
"++",
";",
"pendFinishTxAckSequence",
"(",
")",
";",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TXACK_ABORTED",
")",
"{",
"counters",
".",
"ackTxAborted",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TXACK_BLOCKED",
")",
"{",
"counters",
".",
"ackTxBlocked",
"++",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_TXACK_UNDERFLOW",
")",
"{",
"counters",
".",
"ackTxUnderflow",
"++",
";",
"}",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_RX_CHANNEL_HOPPING_COMPLETE",
")",
"{",
"RAILCb_RxChannelHoppingComplete",
"(",
"railHandle",
")",
";",
"}",
"if",
"(",
"events",
"&",
"RAIL_EVENT_PA_PROTECTION",
")",
"{",
"counters",
".",
"paProtect",
"++",
";",
"}",
"}"
] | Override weak function called by callback sli_rail_util_on_event. | [
"Override",
"weak",
"function",
"called",
"by",
"callback",
"sli_rail_util_on_event",
"."
] | [
"// RX Events",
"//RAIL_FEAT_ZWAVE_SUPPORTED",
"// Other protocols ignore this event",
"//RAIL_FEAT_ZWAVE_SUPPORTED",
"// Try to avoid overflow by processing held packets",
"// All of the above events cause a packet to not be received",
"// Treat similar to RX_FIFO_ALMOST_FULL: consume RX data",
"// Since we disable RX after a overflow, go ahead and",
"// turn RX back on to continue collecting data.",
"//TODO: packetTime depends on txTimePosition;",
"// this code assumes default position (PACKET_END).",
"// End scheduled receive mode if an appropriate end or error event is received",
"// N.B. RAIL_EVENT_RX_PACKET_RECEIVED was handled in its callback already",
"// TX Events",
"// This is a 'pretend error'; see printNewTxError()",
"// This doesn't counters.userTx++;",
"//@TODO: Should we instead initiate an immediate transmit here?",
"// Process TX success before any failures in case an auto-repeat fails",
"// Defer calling RAILCb_TxPacketSent() to last of auto-repeat transmits",
"// A transmit never happened",
"// Increment counters for TX events",
"// Put this here too so that we do these things twice",
"// in the case that an ack and a non ack have completed",
"// Increment counters for TXACK events"
] | [
{
"param": "railHandle",
"type": "RAIL_Handle_t"
},
{
"param": "events",
"type": "RAIL_Events_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "railHandle",
"type": "RAIL_Handle_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "events",
"type": "RAIL_Events_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73aedf4c18a15193a4e25846fc6edcb2d751e795 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_client/sl_btmesh_lighting_client.c | [
"Zlib"
] | C | send_onoff_request | void | static void send_onoff_request(uint8_t retrans)
{
struct mesh_generic_request req;
const uint32_t transtime = 0; // using zero transition time by default
sl_status_t sc;
req.kind = mesh_generic_request_on_off;
req.on_off = switch_pos ? MESH_GENERIC_ON_OFF_STATE_ON : MESH_GENERIC_ON_OFF_STATE_OFF;
// Increment transaction ID for each request, unless it's a retransmission
if (retrans == 0) {
onoff_trid++;
}
// Delay for the request is calculated so that the last request will have
// a zero delay and each of the previous request have delay that increases
// in 50 ms steps. For example, when using three on/off requests
// per button press the delays are set as 100, 50, 0 ms
uint16_t delay = (onoff_request_count - 1) * REQ_DELAY_MS;
sc = mesh_lib_generic_client_publish(MESH_GENERIC_ON_OFF_CLIENT_MODEL_ID,
BTMESH_LIGHTING_CLIENT_MAIN,
onoff_trid,
&req,
transtime, // transition time in ms
delay,
NO_FLAGS // flags
);
if (sc == SL_STATUS_OK) {
log_info(LIGHTING_ONOFF_LOGGING_CLIENT_PUBLISH_SUCCESS, onoff_trid, delay);
} else {
log_btmesh_status_f(sc, LIGHTING_ONOFF_LOGGING_CLIENT_PUBLISH_FAIL);
}
// Keep track of how many requests has been sent
if (onoff_request_count > 0) {
onoff_request_count--;
}
} | /***************************************************************************/
/**
* This function publishes one generic on/off request to change the state
* of light(s) in the group. Global variable switch_pos holds the latest
* desired light state, possible values are:
* switch_pos = 1 -> PB1 was pressed long (above 1s), turn lights on
* switch_pos = 0 -> PB0 was pressed long (above 1s), turn lights off
*
* param[in] retrans Indicates if this is the first request or a retransmission,
* possible values are 0 = first request, 1 = retransmission.
*
* @note This application sends multiple generic on/off requests for each
* long button press to improve reliability.
* The transaction ID is not incremented in case of a retransmission.
******************************************************************************/ | This function publishes one generic on/off request to change the state
of light(s) in the group. Global variable switch_pos holds the latest
desired light state, possible values are:
switch_pos = 1 -> PB1 was pressed long (above 1s), turn lights on
switch_pos = 0 -> PB0 was pressed long (above 1s), turn lights off
param[in] retrans Indicates if this is the first request or a retransmission,
possible values are 0 = first request, 1 = retransmission.
@note This application sends multiple generic on/off requests for each
long button press to improve reliability.
The transaction ID is not incremented in case of a retransmission. | [
"This",
"function",
"publishes",
"one",
"generic",
"on",
"/",
"off",
"request",
"to",
"change",
"the",
"state",
"of",
"light",
"(",
"s",
")",
"in",
"the",
"group",
".",
"Global",
"variable",
"switch_pos",
"holds",
"the",
"latest",
"desired",
"light",
"state",
"possible",
"values",
"are",
":",
"switch_pos",
"=",
"1",
"-",
">",
"PB1",
"was",
"pressed",
"long",
"(",
"above",
"1s",
")",
"turn",
"lights",
"on",
"switch_pos",
"=",
"0",
"-",
">",
"PB0",
"was",
"pressed",
"long",
"(",
"above",
"1s",
")",
"turn",
"lights",
"off",
"param",
"[",
"in",
"]",
"retrans",
"Indicates",
"if",
"this",
"is",
"the",
"first",
"request",
"or",
"a",
"retransmission",
"possible",
"values",
"are",
"0",
"=",
"first",
"request",
"1",
"=",
"retransmission",
".",
"@note",
"This",
"application",
"sends",
"multiple",
"generic",
"on",
"/",
"off",
"requests",
"for",
"each",
"long",
"button",
"press",
"to",
"improve",
"reliability",
".",
"The",
"transaction",
"ID",
"is",
"not",
"incremented",
"in",
"case",
"of",
"a",
"retransmission",
"."
] | static void send_onoff_request(uint8_t retrans)
{
struct mesh_generic_request req;
const uint32_t transtime = 0;
sl_status_t sc;
req.kind = mesh_generic_request_on_off;
req.on_off = switch_pos ? MESH_GENERIC_ON_OFF_STATE_ON : MESH_GENERIC_ON_OFF_STATE_OFF;
if (retrans == 0) {
onoff_trid++;
}
uint16_t delay = (onoff_request_count - 1) * REQ_DELAY_MS;
sc = mesh_lib_generic_client_publish(MESH_GENERIC_ON_OFF_CLIENT_MODEL_ID,
BTMESH_LIGHTING_CLIENT_MAIN,
onoff_trid,
&req,
transtime,
delay,
NO_FLAGS
);
if (sc == SL_STATUS_OK) {
log_info(LIGHTING_ONOFF_LOGGING_CLIENT_PUBLISH_SUCCESS, onoff_trid, delay);
} else {
log_btmesh_status_f(sc, LIGHTING_ONOFF_LOGGING_CLIENT_PUBLISH_FAIL);
}
if (onoff_request_count > 0) {
onoff_request_count--;
}
} | [
"static",
"void",
"send_onoff_request",
"(",
"uint8_t",
"retrans",
")",
"{",
"struct",
"mesh_generic_request",
"req",
";",
"const",
"uint32_t",
"transtime",
"=",
"0",
";",
"sl_status_t",
"sc",
";",
"req",
".",
"kind",
"=",
"mesh_generic_request_on_off",
";",
"req",
".",
"on_off",
"=",
"switch_pos",
"?",
"MESH_GENERIC_ON_OFF_STATE_ON",
":",
"MESH_GENERIC_ON_OFF_STATE_OFF",
";",
"if",
"(",
"retrans",
"==",
"0",
")",
"{",
"onoff_trid",
"++",
";",
"}",
"uint16_t",
"delay",
"=",
"(",
"onoff_request_count",
"-",
"1",
")",
"*",
"REQ_DELAY_MS",
";",
"sc",
"=",
"mesh_lib_generic_client_publish",
"(",
"MESH_GENERIC_ON_OFF_CLIENT_MODEL_ID",
",",
"BTMESH_LIGHTING_CLIENT_MAIN",
",",
"onoff_trid",
",",
"&",
"req",
",",
"transtime",
",",
"delay",
",",
"NO_FLAGS",
")",
";",
"if",
"(",
"sc",
"==",
"SL_STATUS_OK",
")",
"{",
"log_info",
"(",
"LIGHTING_ONOFF_LOGGING_CLIENT_PUBLISH_SUCCESS",
",",
"onoff_trid",
",",
"delay",
")",
";",
"}",
"else",
"{",
"log_btmesh_status_f",
"(",
"sc",
",",
"LIGHTING_ONOFF_LOGGING_CLIENT_PUBLISH_FAIL",
")",
";",
"}",
"if",
"(",
"onoff_request_count",
">",
"0",
")",
"{",
"onoff_request_count",
"--",
";",
"}",
"}"
] | This function publishes one generic on/off request to change the state
of light(s) in the group. | [
"This",
"function",
"publishes",
"one",
"generic",
"on",
"/",
"off",
"request",
"to",
"change",
"the",
"state",
"of",
"light",
"(",
"s",
")",
"in",
"the",
"group",
"."
] | [
"// using zero transition time by default",
"// Increment transaction ID for each request, unless it's a retransmission",
"// Delay for the request is calculated so that the last request will have",
"// a zero delay and each of the previous request have delay that increases",
"// in 50 ms steps. For example, when using three on/off requests",
"// per button press the delays are set as 100, 50, 0 ms",
"// transition time in ms",
"// flags",
"// Keep track of how many requests has been sent"
] | [
{
"param": "retrans",
"type": "uint8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "retrans",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73aedf4c18a15193a4e25846fc6edcb2d751e795 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_client/sl_btmesh_lighting_client.c | [
"Zlib"
] | C | send_lightness_request | void | static void send_lightness_request(uint8_t retrans)
{
struct mesh_generic_request req;
sl_status_t sc;
req.kind = mesh_lighting_request_lightness_actual;
req.lightness = lightness_level;
// Increment transaction ID for each request, unless it's a retransmission
if (retrans == 0) {
lightness_trid++;
}
// Delay for the request is calculated so that the last request will have
// a zero delay and each of the previous request have delay that increases
// in 50 ms steps. For example, when using three lightness requests
// per button press the delays are set as 100, 50, 0 ms
uint16_t delay = (lightness_request_count - 1) * REQ_DELAY_MS;
sc = mesh_lib_generic_client_publish(MESH_LIGHTING_LIGHTNESS_CLIENT_MODEL_ID,
BTMESH_LIGHTING_CLIENT_MAIN,
lightness_trid,
&req,
IMMEDIATE, // transition
delay,
NO_FLAGS // flags
);
if (sc == SL_STATUS_OK) {
log_info(LIGHTING_LOGGING_CLIENT_PUBLISH_SUCCESS,
lightness_trid,
delay);
} else {
log_btmesh_status_f(sc, LIGHTING_LOGGING_CLIENT_PUBLISH_FAIL);
}
// Keep track of how many requests has been sent
if (lightness_request_count > 0) {
lightness_request_count--;
}
} | /***************************************************************************/
/**
* This function publishes one light lightness request to change the lightness
* level of light(s) in the group. Global variable lightness_level holds
* the latest desired light level.
*
* param[in] retrans Indicates if this is the first request or a retransmission,
* possible values are 0 = first request, 1 = retransmission.
*
* @note This application sends multiple lightness requests for each
* short button press to improve reliability.
* The transaction ID is not incremented in case of a retransmission.
******************************************************************************/ | This function publishes one light lightness request to change the lightness
level of light(s) in the group. Global variable lightness_level holds
the latest desired light level.
param[in] retrans Indicates if this is the first request or a retransmission,
possible values are 0 = first request, 1 = retransmission.
@note This application sends multiple lightness requests for each
short button press to improve reliability.
The transaction ID is not incremented in case of a retransmission. | [
"This",
"function",
"publishes",
"one",
"light",
"lightness",
"request",
"to",
"change",
"the",
"lightness",
"level",
"of",
"light",
"(",
"s",
")",
"in",
"the",
"group",
".",
"Global",
"variable",
"lightness_level",
"holds",
"the",
"latest",
"desired",
"light",
"level",
".",
"param",
"[",
"in",
"]",
"retrans",
"Indicates",
"if",
"this",
"is",
"the",
"first",
"request",
"or",
"a",
"retransmission",
"possible",
"values",
"are",
"0",
"=",
"first",
"request",
"1",
"=",
"retransmission",
".",
"@note",
"This",
"application",
"sends",
"multiple",
"lightness",
"requests",
"for",
"each",
"short",
"button",
"press",
"to",
"improve",
"reliability",
".",
"The",
"transaction",
"ID",
"is",
"not",
"incremented",
"in",
"case",
"of",
"a",
"retransmission",
"."
] | static void send_lightness_request(uint8_t retrans)
{
struct mesh_generic_request req;
sl_status_t sc;
req.kind = mesh_lighting_request_lightness_actual;
req.lightness = lightness_level;
if (retrans == 0) {
lightness_trid++;
}
uint16_t delay = (lightness_request_count - 1) * REQ_DELAY_MS;
sc = mesh_lib_generic_client_publish(MESH_LIGHTING_LIGHTNESS_CLIENT_MODEL_ID,
BTMESH_LIGHTING_CLIENT_MAIN,
lightness_trid,
&req,
IMMEDIATE,
delay,
NO_FLAGS
);
if (sc == SL_STATUS_OK) {
log_info(LIGHTING_LOGGING_CLIENT_PUBLISH_SUCCESS,
lightness_trid,
delay);
} else {
log_btmesh_status_f(sc, LIGHTING_LOGGING_CLIENT_PUBLISH_FAIL);
}
if (lightness_request_count > 0) {
lightness_request_count--;
}
} | [
"static",
"void",
"send_lightness_request",
"(",
"uint8_t",
"retrans",
")",
"{",
"struct",
"mesh_generic_request",
"req",
";",
"sl_status_t",
"sc",
";",
"req",
".",
"kind",
"=",
"mesh_lighting_request_lightness_actual",
";",
"req",
".",
"lightness",
"=",
"lightness_level",
";",
"if",
"(",
"retrans",
"==",
"0",
")",
"{",
"lightness_trid",
"++",
";",
"}",
"uint16_t",
"delay",
"=",
"(",
"lightness_request_count",
"-",
"1",
")",
"*",
"REQ_DELAY_MS",
";",
"sc",
"=",
"mesh_lib_generic_client_publish",
"(",
"MESH_LIGHTING_LIGHTNESS_CLIENT_MODEL_ID",
",",
"BTMESH_LIGHTING_CLIENT_MAIN",
",",
"lightness_trid",
",",
"&",
"req",
",",
"IMMEDIATE",
",",
"delay",
",",
"NO_FLAGS",
")",
";",
"if",
"(",
"sc",
"==",
"SL_STATUS_OK",
")",
"{",
"log_info",
"(",
"LIGHTING_LOGGING_CLIENT_PUBLISH_SUCCESS",
",",
"lightness_trid",
",",
"delay",
")",
";",
"}",
"else",
"{",
"log_btmesh_status_f",
"(",
"sc",
",",
"LIGHTING_LOGGING_CLIENT_PUBLISH_FAIL",
")",
";",
"}",
"if",
"(",
"lightness_request_count",
">",
"0",
")",
"{",
"lightness_request_count",
"--",
";",
"}",
"}"
] | This function publishes one light lightness request to change the lightness
level of light(s) in the group. | [
"This",
"function",
"publishes",
"one",
"light",
"lightness",
"request",
"to",
"change",
"the",
"lightness",
"level",
"of",
"light",
"(",
"s",
")",
"in",
"the",
"group",
"."
] | [
"// Increment transaction ID for each request, unless it's a retransmission",
"// Delay for the request is calculated so that the last request will have",
"// a zero delay and each of the previous request have delay that increases",
"// in 50 ms steps. For example, when using three lightness requests",
"// per button press the delays are set as 100, 50, 0 ms",
"// transition",
"// flags",
"// Keep track of how many requests has been sent"
] | [
{
"param": "retrans",
"type": "uint8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "retrans",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73aedf4c18a15193a4e25846fc6edcb2d751e795 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_client/sl_btmesh_lighting_client.c | [
"Zlib"
] | C | sl_btmesh_change_lightness | void | void sl_btmesh_change_lightness(int8_t change_percentage)
{
// Adjust light brightness, using Light Lightness model
if (change_percentage > 0) {
lightness_percent += change_percentage;
if (lightness_percent > LIGHTNESS_PCT_MAX) {
#if (LIGHT_LIGHTNESS_WRAP_ENABLED != 0)
lightness_percent = 0;
#else
lightness_percent = LIGHTNESS_PCT_MAX;
#endif
}
} else {
if (lightness_percent < (-change_percentage)) {
#if (LIGHT_LIGHTNESS_WRAP_ENABLED != 0)
lightness_percent = LIGHTNESS_PCT_MAX;
#else
lightness_percent = 0;
#endif
} else {
lightness_percent += change_percentage;
}
}
sl_btmesh_set_lightness(lightness_percent);
} | /*******************************************************************************
* This function change the lightness and sends it to the server.
*
* @param[in] change_percentage Defines lightness percentage change,
* possible values are -100% - + 100%.
*
******************************************************************************/ | This function change the lightness and sends it to the server.
@param[in] change_percentage Defines lightness percentage change,
possible values are -100% - + 100%. | [
"This",
"function",
"change",
"the",
"lightness",
"and",
"sends",
"it",
"to",
"the",
"server",
".",
"@param",
"[",
"in",
"]",
"change_percentage",
"Defines",
"lightness",
"percentage",
"change",
"possible",
"values",
"are",
"-",
"100%",
"-",
"+",
"100%",
"."
] | void sl_btmesh_change_lightness(int8_t change_percentage)
{
if (change_percentage > 0) {
lightness_percent += change_percentage;
if (lightness_percent > LIGHTNESS_PCT_MAX) {
#if (LIGHT_LIGHTNESS_WRAP_ENABLED != 0)
lightness_percent = 0;
#else
lightness_percent = LIGHTNESS_PCT_MAX;
#endif
}
} else {
if (lightness_percent < (-change_percentage)) {
#if (LIGHT_LIGHTNESS_WRAP_ENABLED != 0)
lightness_percent = LIGHTNESS_PCT_MAX;
#else
lightness_percent = 0;
#endif
} else {
lightness_percent += change_percentage;
}
}
sl_btmesh_set_lightness(lightness_percent);
} | [
"void",
"sl_btmesh_change_lightness",
"(",
"int8_t",
"change_percentage",
")",
"{",
"if",
"(",
"change_percentage",
">",
"0",
")",
"{",
"lightness_percent",
"+=",
"change_percentage",
";",
"if",
"(",
"lightness_percent",
">",
"LIGHTNESS_PCT_MAX",
")",
"{",
"#if",
"(",
"LIGHT_LIGHTNESS_WRAP_ENABLED",
"!=",
"0",
")",
"\n",
"lightness_percent",
"=",
"0",
";",
"#else",
"lightness_percent",
"=",
"LIGHTNESS_PCT_MAX",
";",
"#endif",
"}",
"}",
"else",
"{",
"if",
"(",
"lightness_percent",
"<",
"(",
"-",
"change_percentage",
")",
")",
"{",
"#if",
"(",
"LIGHT_LIGHTNESS_WRAP_ENABLED",
"!=",
"0",
")",
"\n",
"lightness_percent",
"=",
"LIGHTNESS_PCT_MAX",
";",
"#else",
"lightness_percent",
"=",
"0",
";",
"#endif",
"}",
"else",
"{",
"lightness_percent",
"+=",
"change_percentage",
";",
"}",
"}",
"sl_btmesh_set_lightness",
"(",
"lightness_percent",
")",
";",
"}"
] | This function change the lightness and sends it to the server. | [
"This",
"function",
"change",
"the",
"lightness",
"and",
"sends",
"it",
"to",
"the",
"server",
"."
] | [
"// Adjust light brightness, using Light Lightness model"
] | [
{
"param": "change_percentage",
"type": "int8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "change_percentage",
"type": "int8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73aedf4c18a15193a4e25846fc6edcb2d751e795 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_client/sl_btmesh_lighting_client.c | [
"Zlib"
] | C | sl_btmesh_set_lightness | void | void sl_btmesh_set_lightness(uint8_t new_lightness_percentage)
{
// Adjust light brightness, using Light Lightness model
if (new_lightness_percentage <= LIGHTNESS_PCT_MAX) {
lightness_percent = new_lightness_percentage;
} else {
return;
}
lightness_level = lightness_percent * 0xFFFF / LIGHTNESS_PCT_MAX;
log(LIGHTING_LOGGING_NEW_LIGHTNESS_SET, lightness_percent, lightness_level);
// Request is sent multiple times to improve reliability
lightness_request_count = LIGHT_RETRANSMISSION_COUNT;
send_lightness_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 (lightness_request_count > 0) {
sl_status_t sc = sl_simple_timer_start(&light_retransmission_timer,
LIGHT_RETRANSMISSION_TIMEOUT,
light_retransmission_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic timer\n");
}
} | /*******************************************************************************
* This function change the lightness and send it to the server.
*
* @param[in] new_lightness_percentage Defines new lightness value as percentage
* Valid values 0-100 %
*
*
******************************************************************************/ | This function change the lightness and send it to the server.
@param[in] new_lightness_percentage Defines new lightness value as percentage
Valid values 0-100 % | [
"This",
"function",
"change",
"the",
"lightness",
"and",
"send",
"it",
"to",
"the",
"server",
".",
"@param",
"[",
"in",
"]",
"new_lightness_percentage",
"Defines",
"new",
"lightness",
"value",
"as",
"percentage",
"Valid",
"values",
"0",
"-",
"100",
"%"
] | void sl_btmesh_set_lightness(uint8_t new_lightness_percentage)
{
if (new_lightness_percentage <= LIGHTNESS_PCT_MAX) {
lightness_percent = new_lightness_percentage;
} else {
return;
}
lightness_level = lightness_percent * 0xFFFF / LIGHTNESS_PCT_MAX;
log(LIGHTING_LOGGING_NEW_LIGHTNESS_SET, lightness_percent, lightness_level);
lightness_request_count = LIGHT_RETRANSMISSION_COUNT;
send_lightness_request(0);
if (lightness_request_count > 0) {
sl_status_t sc = sl_simple_timer_start(&light_retransmission_timer,
LIGHT_RETRANSMISSION_TIMEOUT,
light_retransmission_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic timer\n");
}
} | [
"void",
"sl_btmesh_set_lightness",
"(",
"uint8_t",
"new_lightness_percentage",
")",
"{",
"if",
"(",
"new_lightness_percentage",
"<=",
"LIGHTNESS_PCT_MAX",
")",
"{",
"lightness_percent",
"=",
"new_lightness_percentage",
";",
"}",
"else",
"{",
"return",
";",
"}",
"lightness_level",
"=",
"lightness_percent",
"*",
"0xFFFF",
"/",
"LIGHTNESS_PCT_MAX",
";",
"log",
"(",
"LIGHTING_LOGGING_NEW_LIGHTNESS_SET",
",",
"lightness_percent",
",",
"lightness_level",
")",
";",
"lightness_request_count",
"=",
"LIGHT_RETRANSMISSION_COUNT",
";",
"send_lightness_request",
"(",
"0",
")",
";",
"if",
"(",
"lightness_request_count",
">",
"0",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_start",
"(",
"&",
"light_retransmission_timer",
",",
"LIGHT_RETRANSMISSION_TIMEOUT",
",",
"light_retransmission_timer_cb",
",",
"NO_CALLBACK_DATA",
",",
"true",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"}"
] | This function change the lightness and send it to the server. | [
"This",
"function",
"change",
"the",
"lightness",
"and",
"send",
"it",
"to",
"the",
"server",
"."
] | [
"// Adjust light brightness, using Light Lightness model",
"// Request is sent multiple times to improve reliability",
"// 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"
] | [
{
"param": "new_lightness_percentage",
"type": "uint8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "new_lightness_percentage",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73aedf4c18a15193a4e25846fc6edcb2d751e795 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_client/sl_btmesh_lighting_client.c | [
"Zlib"
] | C | onoff_retransmission_timer_cb | void | static void onoff_retransmission_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
send_onoff_request(1); // param 1 indicates that this is a retransmission
// stop retransmission timer if it was the last attempt
if (onoff_request_count == 0) {
sl_status_t sc = sl_simple_timer_stop(&onoff_retransmission_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
}
} | /***************************************************************************/
/**
* Switch position retransmission function
* @param[in] handle pointer to handle instance
* @param[in] data pointer to input data
******************************************************************************/ | Switch position retransmission function
@param[in] handle pointer to handle instance
@param[in] data pointer to input data | [
"Switch",
"position",
"retransmission",
"function",
"@param",
"[",
"in",
"]",
"handle",
"pointer",
"to",
"handle",
"instance",
"@param",
"[",
"in",
"]",
"data",
"pointer",
"to",
"input",
"data"
] | static void onoff_retransmission_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
send_onoff_request(1);
if (onoff_request_count == 0) {
sl_status_t sc = sl_simple_timer_stop(&onoff_retransmission_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
}
} | [
"static",
"void",
"onoff_retransmission_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"send_onoff_request",
"(",
"1",
")",
";",
"if",
"(",
"onoff_request_count",
"==",
"0",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"onoff_retransmission_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"}"
] | Switch position retransmission function
@param[in] handle pointer to handle instance
@param[in] data pointer to input data | [
"Switch",
"position",
"retransmission",
"function",
"@param",
"[",
"in",
"]",
"handle",
"pointer",
"to",
"handle",
"instance",
"@param",
"[",
"in",
"]",
"data",
"pointer",
"to",
"input",
"data"
] | [
"// param 1 indicates that this is a retransmission",
"// stop retransmission timer if it was the last attempt"
] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
73aedf4c18a15193a4e25846fc6edcb2d751e795 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_client/sl_btmesh_lighting_client.c | [
"Zlib"
] | C | light_retransmission_timer_cb | void | static void light_retransmission_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
send_lightness_request(1); // Retransmit lightness message
// Stop retransmission timer if it was the last attempt
if (lightness_request_count == 0) {
sl_status_t sc = sl_simple_timer_stop(&light_retransmission_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
}
} | /***************************************************************************/
/**
* Lightness value retransmission function
* @param[in] handle pointer to handle instance
* @param[in] data pointer to input data
******************************************************************************/ | Lightness value retransmission function
@param[in] handle pointer to handle instance
@param[in] data pointer to input data | [
"Lightness",
"value",
"retransmission",
"function",
"@param",
"[",
"in",
"]",
"handle",
"pointer",
"to",
"handle",
"instance",
"@param",
"[",
"in",
"]",
"data",
"pointer",
"to",
"input",
"data"
] | static void light_retransmission_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
send_lightness_request(1);
if (lightness_request_count == 0) {
sl_status_t sc = sl_simple_timer_stop(&light_retransmission_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
}
} | [
"static",
"void",
"light_retransmission_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"send_lightness_request",
"(",
"1",
")",
";",
"if",
"(",
"lightness_request_count",
"==",
"0",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"light_retransmission_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"}"
] | Lightness value retransmission function
@param[in] handle pointer to handle instance
@param[in] data pointer to input data | [
"Lightness",
"value",
"retransmission",
"function",
"@param",
"[",
"in",
"]",
"handle",
"pointer",
"to",
"handle",
"instance",
"@param",
"[",
"in",
"]",
"data",
"pointer",
"to",
"input",
"data"
] | [
"// Retransmit lightness message",
"// Stop retransmission timer if it was the last attempt"
] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
97002716dfddb369cf4e63269dc933da289ceb56 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_led.c | [
"Zlib"
] | C | app_led_change_buttons_to_leds | void | void app_led_change_buttons_to_leds(void)
{
sl_simple_button_disable(&sl_button_btn0);
sl_pwm_config_t pwm_led0_config = {
.frequency = SL_PWM_LED0_FREQUENCY,
.polarity = SL_PWM_LED0_POLARITY,
};
sl_pwm_init(&sl_pwm_led0, &pwm_led0_config);
sl_pwm_start(&sl_pwm_led0);
sl_simple_button_disable(&sl_button_btn1);
sl_pwm_config_t pwm_led1_config = {
.frequency = SL_PWM_LED1_FREQUENCY,
.polarity = SL_PWM_LED1_POLARITY,
};
sl_pwm_init(&sl_pwm_led1, &pwm_led1_config);
sl_pwm_start(&sl_pwm_led1);
} | /*******************************************************************************
* Change buttons to leds in case of shared pin
*
******************************************************************************/ | Change buttons to leds in case of shared pin | [
"Change",
"buttons",
"to",
"leds",
"in",
"case",
"of",
"shared",
"pin"
] | void app_led_change_buttons_to_leds(void)
{
sl_simple_button_disable(&sl_button_btn0);
sl_pwm_config_t pwm_led0_config = {
.frequency = SL_PWM_LED0_FREQUENCY,
.polarity = SL_PWM_LED0_POLARITY,
};
sl_pwm_init(&sl_pwm_led0, &pwm_led0_config);
sl_pwm_start(&sl_pwm_led0);
sl_simple_button_disable(&sl_button_btn1);
sl_pwm_config_t pwm_led1_config = {
.frequency = SL_PWM_LED1_FREQUENCY,
.polarity = SL_PWM_LED1_POLARITY,
};
sl_pwm_init(&sl_pwm_led1, &pwm_led1_config);
sl_pwm_start(&sl_pwm_led1);
} | [
"void",
"app_led_change_buttons_to_leds",
"(",
"void",
")",
"{",
"sl_simple_button_disable",
"(",
"&",
"sl_button_btn0",
")",
";",
"sl_pwm_config_t",
"pwm_led0_config",
"=",
"{",
".",
"frequency",
"=",
"SL_PWM_LED0_FREQUENCY",
",",
".",
"polarity",
"=",
"SL_PWM_LED0_POLARITY",
",",
"}",
";",
"sl_pwm_init",
"(",
"&",
"sl_pwm_led0",
",",
"&",
"pwm_led0_config",
")",
";",
"sl_pwm_start",
"(",
"&",
"sl_pwm_led0",
")",
";",
"sl_simple_button_disable",
"(",
"&",
"sl_button_btn1",
")",
";",
"sl_pwm_config_t",
"pwm_led1_config",
"=",
"{",
".",
"frequency",
"=",
"SL_PWM_LED1_FREQUENCY",
",",
".",
"polarity",
"=",
"SL_PWM_LED1_POLARITY",
",",
"}",
";",
"sl_pwm_init",
"(",
"&",
"sl_pwm_led1",
",",
"&",
"pwm_led1_config",
")",
";",
"sl_pwm_start",
"(",
"&",
"sl_pwm_led1",
")",
";",
"}"
] | Change buttons to leds in case of shared pin | [
"Change",
"buttons",
"to",
"leds",
"in",
"case",
"of",
"shared",
"pin"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a89b5901237b7c2850028dcab0de145aabea758b | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_provisioning_decorator/sl_btmesh_provisioning_decorator.c | [
"Zlib"
] | C | sl_btmesh_handle_provisioning_decorator_event | void | void sl_btmesh_handle_provisioning_decorator_event(sl_btmesh_msg_t *evt)
{
if (NULL == evt) {
return;
}
// Handle events
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
sl_btmesh_on_provision_init_status(evt->data.evt_node_initialized.provisioned,
evt->data.evt_node_initialized.address,
evt->data.evt_node_initialized.iv_index);
break;
case sl_btmesh_evt_node_provisioning_started_id:
sl_btmesh_on_node_provisioning_started(evt->data.evt_node_provisioning_started.result);
break;
case sl_btmesh_evt_node_provisioned_id:
sl_btmesh_on_node_provisioned(evt->data.evt_node_provisioned.address,
evt->data.evt_node_provisioned.iv_index);
break;
case sl_btmesh_evt_node_provisioning_failed_id: {
sl_btmesh_on_node_provisioning_failed(evt->data.evt_node_provisioning_failed.result);
log("BT mesh system reset timer is started with %d ms timeout.\r\n",
PROVISIONING_DECORATOR_RESTART_TIMER_TIMEOUT);
sl_status_t sc =
sl_simple_timer_start(&restart_timer,
PROVISIONING_DECORATOR_RESTART_TIMER_TIMEOUT,
prov_decor_restart_timer_cb,
NO_CALLBACK_DATA,
false);
app_assert_status_f(sc, "Failed to start timer\n");
break;
}
default:
break;
}
} | /*******************************************************************************
* Handling of Provisioning Decorator stack events.
*
* @param[in] evt Event type
******************************************************************************/ | Handling of Provisioning Decorator stack events.
@param[in] evt Event type | [
"Handling",
"of",
"Provisioning",
"Decorator",
"stack",
"events",
".",
"@param",
"[",
"in",
"]",
"evt",
"Event",
"type"
] | void sl_btmesh_handle_provisioning_decorator_event(sl_btmesh_msg_t *evt)
{
if (NULL == evt) {
return;
}
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
sl_btmesh_on_provision_init_status(evt->data.evt_node_initialized.provisioned,
evt->data.evt_node_initialized.address,
evt->data.evt_node_initialized.iv_index);
break;
case sl_btmesh_evt_node_provisioning_started_id:
sl_btmesh_on_node_provisioning_started(evt->data.evt_node_provisioning_started.result);
break;
case sl_btmesh_evt_node_provisioned_id:
sl_btmesh_on_node_provisioned(evt->data.evt_node_provisioned.address,
evt->data.evt_node_provisioned.iv_index);
break;
case sl_btmesh_evt_node_provisioning_failed_id: {
sl_btmesh_on_node_provisioning_failed(evt->data.evt_node_provisioning_failed.result);
log("BT mesh system reset timer is started with %d ms timeout.\r\n",
PROVISIONING_DECORATOR_RESTART_TIMER_TIMEOUT);
sl_status_t sc =
sl_simple_timer_start(&restart_timer,
PROVISIONING_DECORATOR_RESTART_TIMER_TIMEOUT,
prov_decor_restart_timer_cb,
NO_CALLBACK_DATA,
false);
app_assert_status_f(sc, "Failed to start timer\n");
break;
}
default:
break;
}
} | [
"void",
"sl_btmesh_handle_provisioning_decorator_event",
"(",
"sl_btmesh_msg_t",
"*",
"evt",
")",
"{",
"if",
"(",
"NULL",
"==",
"evt",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"SL_BT_MSG_ID",
"(",
"evt",
"->",
"header",
")",
")",
"{",
"case",
"sl_btmesh_evt_node_initialized_id",
":",
"sl_btmesh_on_provision_init_status",
"(",
"evt",
"->",
"data",
".",
"evt_node_initialized",
".",
"provisioned",
",",
"evt",
"->",
"data",
".",
"evt_node_initialized",
".",
"address",
",",
"evt",
"->",
"data",
".",
"evt_node_initialized",
".",
"iv_index",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_node_provisioning_started_id",
":",
"sl_btmesh_on_node_provisioning_started",
"(",
"evt",
"->",
"data",
".",
"evt_node_provisioning_started",
".",
"result",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_node_provisioned_id",
":",
"sl_btmesh_on_node_provisioned",
"(",
"evt",
"->",
"data",
".",
"evt_node_provisioned",
".",
"address",
",",
"evt",
"->",
"data",
".",
"evt_node_provisioned",
".",
"iv_index",
")",
";",
"break",
";",
"case",
"sl_btmesh_evt_node_provisioning_failed_id",
":",
"{",
"sl_btmesh_on_node_provisioning_failed",
"(",
"evt",
"->",
"data",
".",
"evt_node_provisioning_failed",
".",
"result",
")",
";",
"log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"PROVISIONING_DECORATOR_RESTART_TIMER_TIMEOUT",
")",
";",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_start",
"(",
"&",
"restart_timer",
",",
"PROVISIONING_DECORATOR_RESTART_TIMER_TIMEOUT",
",",
"prov_decor_restart_timer_cb",
",",
"NO_CALLBACK_DATA",
",",
"false",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"break",
";",
"}",
"default",
":",
"break",
";",
"}",
"}"
] | Handling of Provisioning Decorator stack events. | [
"Handling",
"of",
"Provisioning",
"Decorator",
"stack",
"events",
"."
] | [
"// Handle events"
] | [
{
"param": "evt",
"type": "sl_btmesh_msg_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_msg_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a89b5901237b7c2850028dcab0de145aabea758b | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_provisioning_decorator/sl_btmesh_provisioning_decorator.c | [
"Zlib"
] | C | prov_decor_restart_timer_cb | void | static void prov_decor_restart_timer_cb(sl_simple_timer_t *handle,
void *data)
{
(void)data;
(void)handle;
sl_bt_system_reset(0);
} | /***************************************************************************/
/**
* Called when the restart timer expires.
*
* @param[in] handle Pointer to the timer handle
* @param[in] data Pointer to callback data
******************************************************************************/ | Called when the restart timer expires.
@param[in] handle Pointer to the timer handle
@param[in] data Pointer to callback data | [
"Called",
"when",
"the",
"restart",
"timer",
"expires",
".",
"@param",
"[",
"in",
"]",
"handle",
"Pointer",
"to",
"the",
"timer",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Pointer",
"to",
"callback",
"data"
] | static void prov_decor_restart_timer_cb(sl_simple_timer_t *handle,
void *data)
{
(void)data;
(void)handle;
sl_bt_system_reset(0);
} | [
"static",
"void",
"prov_decor_restart_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"sl_bt_system_reset",
"(",
"0",
")",
";",
"}"
] | Called when the restart timer expires. | [
"Called",
"when",
"the",
"restart",
"timer",
"expires",
"."
] | [] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_friend_on_friendship_established | void | void sl_btmesh_friend_on_friendship_established(uint16_t netkey_index,
uint16_t lpn_address)
{
app_log("BT mesh Friendship established with LPN (netkey idx: %d, lpn addr: 0x%04x)\r\n",
"(netkey idx: %d, lpn addr: 0x%04x)\r\n",
netkey_index,
lpn_address);
sl_status_t status = sl_btmesh_LCD_write("FRIEND",
BTMESH_WSTK_LCD_ROW_FRIEND);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
(void)netkey_index;
(void)lpn_address;
} | /*******************************************************************************
* Called when the Friend Node establishes friendship with another node.
*
* @param[in] netkey_index Index of the network key used in friendship
* @param[in] lpn_address Low Power Node address
******************************************************************************/ | Called when the Friend Node establishes friendship with another node.
@param[in] netkey_index Index of the network key used in friendship
@param[in] lpn_address Low Power Node address | [
"Called",
"when",
"the",
"Friend",
"Node",
"establishes",
"friendship",
"with",
"another",
"node",
".",
"@param",
"[",
"in",
"]",
"netkey_index",
"Index",
"of",
"the",
"network",
"key",
"used",
"in",
"friendship",
"@param",
"[",
"in",
"]",
"lpn_address",
"Low",
"Power",
"Node",
"address"
] | void sl_btmesh_friend_on_friendship_established(uint16_t netkey_index,
uint16_t lpn_address)
{
app_log("BT mesh Friendship established with LPN (netkey idx: %d, lpn addr: 0x%04x)\r\n",
"(netkey idx: %d, lpn addr: 0x%04x)\r\n",
netkey_index,
lpn_address);
sl_status_t status = sl_btmesh_LCD_write("FRIEND",
BTMESH_WSTK_LCD_ROW_FRIEND);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
(void)netkey_index;
(void)lpn_address;
} | [
"void",
"sl_btmesh_friend_on_friendship_established",
"(",
"uint16_t",
"netkey_index",
",",
"uint16_t",
"lpn_address",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"\"",
"\\r",
"\\n",
"\"",
",",
"netkey_index",
",",
"lpn_address",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_FRIEND",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"(",
"void",
")",
"netkey_index",
";",
"(",
"void",
")",
"lpn_address",
";",
"}"
] | Called when the Friend Node establishes friendship with another node. | [
"Called",
"when",
"the",
"Friend",
"Node",
"establishes",
"friendship",
"with",
"another",
"node",
"."
] | [] | [
{
"param": "netkey_index",
"type": "uint16_t"
},
{
"param": "lpn_address",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "netkey_index",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lpn_address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_friend_on_friendship_terminated | void | void sl_btmesh_friend_on_friendship_terminated(uint16_t netkey_index,
uint16_t lpn_address,
uint16_t reason)
{
app_log("BT mesh Friendship terminated with LPN "
"(netkey idx: %d, lpn addr: 0x%04x, reason: 0x%04x)\r\n",
netkey_index,
lpn_address,
reason);
sl_status_t status = sl_btmesh_LCD_write("NO LPN",
BTMESH_WSTK_LCD_ROW_FRIEND);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
(void)netkey_index;
(void)lpn_address;
(void)reason;
} | /*******************************************************************************
* Called when the friendship that was successfully established with a Low Power
* Node has been terminated.
*
* @param[in] netkey_index Index of the network key used in friendship
* @param[in] lpn_address Low Power Node address
* @param[in] reason Reason for friendship termination
******************************************************************************/ | Called when the friendship that was successfully established with a Low Power
Node has been terminated.
@param[in] netkey_index Index of the network key used in friendship
@param[in] lpn_address Low Power Node address
@param[in] reason Reason for friendship termination | [
"Called",
"when",
"the",
"friendship",
"that",
"was",
"successfully",
"established",
"with",
"a",
"Low",
"Power",
"Node",
"has",
"been",
"terminated",
".",
"@param",
"[",
"in",
"]",
"netkey_index",
"Index",
"of",
"the",
"network",
"key",
"used",
"in",
"friendship",
"@param",
"[",
"in",
"]",
"lpn_address",
"Low",
"Power",
"Node",
"address",
"@param",
"[",
"in",
"]",
"reason",
"Reason",
"for",
"friendship",
"termination"
] | void sl_btmesh_friend_on_friendship_terminated(uint16_t netkey_index,
uint16_t lpn_address,
uint16_t reason)
{
app_log("BT mesh Friendship terminated with LPN "
"(netkey idx: %d, lpn addr: 0x%04x, reason: 0x%04x)\r\n",
netkey_index,
lpn_address,
reason);
sl_status_t status = sl_btmesh_LCD_write("NO LPN",
BTMESH_WSTK_LCD_ROW_FRIEND);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
(void)netkey_index;
(void)lpn_address;
(void)reason;
} | [
"void",
"sl_btmesh_friend_on_friendship_terminated",
"(",
"uint16_t",
"netkey_index",
",",
"uint16_t",
"lpn_address",
",",
"uint16_t",
"reason",
")",
"{",
"app_log",
"(",
"\"",
"\"",
"\"",
"\\r",
"\\n",
"\"",
",",
"netkey_index",
",",
"lpn_address",
",",
"reason",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_FRIEND",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"(",
"void",
")",
"netkey_index",
";",
"(",
"void",
")",
"lpn_address",
";",
"(",
"void",
")",
"reason",
";",
"}"
] | Called when the friendship that was successfully established with a Low Power
Node has been terminated. | [
"Called",
"when",
"the",
"friendship",
"that",
"was",
"successfully",
"established",
"with",
"a",
"Low",
"Power",
"Node",
"has",
"been",
"terminated",
"."
] | [] | [
{
"param": "netkey_index",
"type": "uint16_t"
},
{
"param": "lpn_address",
"type": "uint16_t"
},
{
"param": "reason",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "netkey_index",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lpn_address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reason",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_hsl_hue_on_ui_update | void | void sl_btmesh_hsl_hue_on_ui_update(uint16_t hue)
{
// Temporary buffer to format the LCD output text
char tmp_str[LCD_ROW_LEN];
uint16_t hue_degree = UINT16_TO_DEGREE(hue);
app_log("BT mesh HSL Hue: %4udeg\r\n", hue_degree);
snprintf(tmp_str, LCD_ROW_LEN, "Hue: %4udeg", hue_degree);
sl_status_t status = sl_btmesh_LCD_write(tmp_str,
BTMESH_WSTK_LCD_ROW_HUE);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the UI shall be updated with the changed HSL Model state during
* a transition. The rate of this callback can be controlled by changing the
* HSL_SERVER_HUE_UI_UPDATE_PERIOD macro.
*
* @param[in] hue Hue value.
******************************************************************************/ | Called when the UI shall be updated with the changed HSL Model state during
a transition. The rate of this callback can be controlled by changing the
HSL_SERVER_HUE_UI_UPDATE_PERIOD macro.
@param[in] hue Hue value. | [
"Called",
"when",
"the",
"UI",
"shall",
"be",
"updated",
"with",
"the",
"changed",
"HSL",
"Model",
"state",
"during",
"a",
"transition",
".",
"The",
"rate",
"of",
"this",
"callback",
"can",
"be",
"controlled",
"by",
"changing",
"the",
"HSL_SERVER_HUE_UI_UPDATE_PERIOD",
"macro",
".",
"@param",
"[",
"in",
"]",
"hue",
"Hue",
"value",
"."
] | void sl_btmesh_hsl_hue_on_ui_update(uint16_t hue)
{
char tmp_str[LCD_ROW_LEN];
uint16_t hue_degree = UINT16_TO_DEGREE(hue);
app_log("BT mesh HSL Hue: %4udeg\r\n", hue_degree);
snprintf(tmp_str, LCD_ROW_LEN, "Hue: %4udeg", hue_degree);
sl_status_t status = sl_btmesh_LCD_write(tmp_str,
BTMESH_WSTK_LCD_ROW_HUE);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_hsl_hue_on_ui_update",
"(",
"uint16_t",
"hue",
")",
"{",
"char",
"tmp_str",
"[",
"LCD_ROW_LEN",
"]",
";",
"uint16_t",
"hue_degree",
"=",
"UINT16_TO_DEGREE",
"(",
"hue",
")",
";",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"hue_degree",
")",
";",
"snprintf",
"(",
"tmp_str",
",",
"LCD_ROW_LEN",
",",
"\"",
"\"",
",",
"hue_degree",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"tmp_str",
",",
"BTMESH_WSTK_LCD_ROW_HUE",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the UI shall be updated with the changed HSL Model state during
a transition. | [
"Called",
"when",
"the",
"UI",
"shall",
"be",
"updated",
"with",
"the",
"changed",
"HSL",
"Model",
"state",
"during",
"a",
"transition",
"."
] | [
"// Temporary buffer to format the LCD output text"
] | [
{
"param": "hue",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hue",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_hsl_saturation_on_ui_update | void | void sl_btmesh_hsl_saturation_on_ui_update(uint16_t saturation)
{
// Temporary buffer to format the LCD output text
char tmp_str[LCD_ROW_LEN];
uint16_t saturation_percent = UINT16_TO_PERCENTAGE(saturation);
app_log("BT mesh HSL Saturation: %4u%%\r\n", saturation_percent);
snprintf(tmp_str, LCD_ROW_LEN, "Saturation: %4u%%", saturation_percent);
sl_status_t status = sl_btmesh_LCD_write(tmp_str,
BTMESH_WSTK_LCD_ROW_SATURATION);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the UI shall be updated with the changed HSL Model state during
* a transition. The rate of this callback can be controlled by changing the
* HSL_SERVER_SATURATION_UI_UPDATE_PERIOD macro.
*
* @param[in] saturation Saturation value.
******************************************************************************/ | Called when the UI shall be updated with the changed HSL Model state during
a transition. The rate of this callback can be controlled by changing the
HSL_SERVER_SATURATION_UI_UPDATE_PERIOD macro.
@param[in] saturation Saturation value. | [
"Called",
"when",
"the",
"UI",
"shall",
"be",
"updated",
"with",
"the",
"changed",
"HSL",
"Model",
"state",
"during",
"a",
"transition",
".",
"The",
"rate",
"of",
"this",
"callback",
"can",
"be",
"controlled",
"by",
"changing",
"the",
"HSL_SERVER_SATURATION_UI_UPDATE_PERIOD",
"macro",
".",
"@param",
"[",
"in",
"]",
"saturation",
"Saturation",
"value",
"."
] | void sl_btmesh_hsl_saturation_on_ui_update(uint16_t saturation)
{
char tmp_str[LCD_ROW_LEN];
uint16_t saturation_percent = UINT16_TO_PERCENTAGE(saturation);
app_log("BT mesh HSL Saturation: %4u%%\r\n", saturation_percent);
snprintf(tmp_str, LCD_ROW_LEN, "Saturation: %4u%%", saturation_percent);
sl_status_t status = sl_btmesh_LCD_write(tmp_str,
BTMESH_WSTK_LCD_ROW_SATURATION);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_hsl_saturation_on_ui_update",
"(",
"uint16_t",
"saturation",
")",
"{",
"char",
"tmp_str",
"[",
"LCD_ROW_LEN",
"]",
";",
"uint16_t",
"saturation_percent",
"=",
"UINT16_TO_PERCENTAGE",
"(",
"saturation",
")",
";",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"saturation_percent",
")",
";",
"snprintf",
"(",
"tmp_str",
",",
"LCD_ROW_LEN",
",",
"\"",
"\"",
",",
"saturation_percent",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"tmp_str",
",",
"BTMESH_WSTK_LCD_ROW_SATURATION",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the UI shall be updated with the changed HSL Model state during
a transition. | [
"Called",
"when",
"the",
"UI",
"shall",
"be",
"updated",
"with",
"the",
"changed",
"HSL",
"Model",
"state",
"during",
"a",
"transition",
"."
] | [
"// Temporary buffer to format the LCD output text"
] | [
{
"param": "saturation",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "saturation",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_lighting_server_on_ui_update | void | void sl_btmesh_lighting_server_on_ui_update(uint16_t lightness_level)
{
// Temporary buffer to format the LCD output text
char tmp_str[LCD_ROW_LEN];
uint16_t lightness_percent = UINT16_TO_PERCENTAGE(lightness_level);
app_log("BT mesh Lightness: %5u%%\r\n", lightness_percent);
snprintf(tmp_str, LCD_ROW_LEN, "Lightness: %5u%%", lightness_percent);
sl_status_t status = sl_btmesh_LCD_write(tmp_str,
BTMESH_WSTK_LCD_ROW_LIGHTNESS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the UI shall be updated with the changed state of
* lightning server during a transition. The rate of this callback can be
* controlled by changing the LIGHTING_SERVER_UI_UPDATE_PERIOD macro.
*
* @param[in] lightness_level lightness level (0x0001 - FFFE)
******************************************************************************/ | Called when the UI shall be updated with the changed state of
lightning server during a transition. The rate of this callback can be
controlled by changing the LIGHTING_SERVER_UI_UPDATE_PERIOD macro.
@param[in] lightness_level lightness level (0x0001 - FFFE) | [
"Called",
"when",
"the",
"UI",
"shall",
"be",
"updated",
"with",
"the",
"changed",
"state",
"of",
"lightning",
"server",
"during",
"a",
"transition",
".",
"The",
"rate",
"of",
"this",
"callback",
"can",
"be",
"controlled",
"by",
"changing",
"the",
"LIGHTING_SERVER_UI_UPDATE_PERIOD",
"macro",
".",
"@param",
"[",
"in",
"]",
"lightness_level",
"lightness",
"level",
"(",
"0x0001",
"-",
"FFFE",
")"
] | void sl_btmesh_lighting_server_on_ui_update(uint16_t lightness_level)
{
char tmp_str[LCD_ROW_LEN];
uint16_t lightness_percent = UINT16_TO_PERCENTAGE(lightness_level);
app_log("BT mesh Lightness: %5u%%\r\n", lightness_percent);
snprintf(tmp_str, LCD_ROW_LEN, "Lightness: %5u%%", lightness_percent);
sl_status_t status = sl_btmesh_LCD_write(tmp_str,
BTMESH_WSTK_LCD_ROW_LIGHTNESS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_lighting_server_on_ui_update",
"(",
"uint16_t",
"lightness_level",
")",
"{",
"char",
"tmp_str",
"[",
"LCD_ROW_LEN",
"]",
";",
"uint16_t",
"lightness_percent",
"=",
"UINT16_TO_PERCENTAGE",
"(",
"lightness_level",
")",
";",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"lightness_percent",
")",
";",
"snprintf",
"(",
"tmp_str",
",",
"LCD_ROW_LEN",
",",
"\"",
"\"",
",",
"lightness_percent",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"tmp_str",
",",
"BTMESH_WSTK_LCD_ROW_LIGHTNESS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the UI shall be updated with the changed state of
lightning server during a transition. | [
"Called",
"when",
"the",
"UI",
"shall",
"be",
"updated",
"with",
"the",
"changed",
"state",
"of",
"lightning",
"server",
"during",
"a",
"transition",
"."
] | [
"// Temporary buffer to format the LCD output text"
] | [
{
"param": "lightness_level",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lightness_level",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_on_provision_init_status | void | void sl_btmesh_on_provision_init_status(bool provisioned,
uint16_t address,
uint32_t iv_index)
{
if (provisioned) {
app_show_btmesh_node_provisioned(address, iv_index);
} else {
app_log("BT mesh node is unprovisioned, "
"started unprovisioned beaconing...\r\n");
sl_status_t status = sl_btmesh_LCD_write("unprovisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
}
} | /*******************************************************************************
* Called at node initialization time to provide provisioning information
*
* @param[in] provisioned true: provisioned, false: unprovisioned
* @param[in] address Unicast address of the primary element of the node.
Ignored if unprovisioned.
* @param[in] iv_index IV index for the first network of the node
Ignored if unprovisioned.
******************************************************************************/ | Called at node initialization time to provide provisioning information
@param[in] provisioned true: provisioned, false: unprovisioned
@param[in] address Unicast address of the primary element of the node.
Ignored if unprovisioned.
@param[in] iv_index IV index for the first network of the node
Ignored if unprovisioned. | [
"Called",
"at",
"node",
"initialization",
"time",
"to",
"provide",
"provisioning",
"information",
"@param",
"[",
"in",
"]",
"provisioned",
"true",
":",
"provisioned",
"false",
":",
"unprovisioned",
"@param",
"[",
"in",
"]",
"address",
"Unicast",
"address",
"of",
"the",
"primary",
"element",
"of",
"the",
"node",
".",
"Ignored",
"if",
"unprovisioned",
".",
"@param",
"[",
"in",
"]",
"iv_index",
"IV",
"index",
"for",
"the",
"first",
"network",
"of",
"the",
"node",
"Ignored",
"if",
"unprovisioned",
"."
] | void sl_btmesh_on_provision_init_status(bool provisioned,
uint16_t address,
uint32_t iv_index)
{
if (provisioned) {
app_show_btmesh_node_provisioned(address, iv_index);
} else {
app_log("BT mesh node is unprovisioned, "
"started unprovisioned beaconing...\r\n");
sl_status_t status = sl_btmesh_LCD_write("unprovisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
}
} | [
"void",
"sl_btmesh_on_provision_init_status",
"(",
"bool",
"provisioned",
",",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"if",
"(",
"provisioned",
")",
"{",
"app_show_btmesh_node_provisioned",
"(",
"address",
",",
"iv_index",
")",
";",
"}",
"else",
"{",
"app_log",
"(",
"\"",
"\"",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}",
"}"
] | Called at node initialization time to provide provisioning information
@param[in] provisioned true: provisioned, false: unprovisioned
@param[in] address Unicast address of the primary element of the node. | [
"Called",
"at",
"node",
"initialization",
"time",
"to",
"provide",
"provisioning",
"information",
"@param",
"[",
"in",
"]",
"provisioned",
"true",
":",
"provisioned",
"false",
":",
"unprovisioned",
"@param",
"[",
"in",
"]",
"address",
"Unicast",
"address",
"of",
"the",
"primary",
"element",
"of",
"the",
"node",
"."
] | [] | [
{
"param": "provisioned",
"type": "bool"
},
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "provisioned",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | app_show_btmesh_node_provisioned | void | void app_show_btmesh_node_provisioned(uint16_t address,
uint32_t iv_index)
{
app_log("BT mesh node is provisioned (address: 0x%04x, iv_index: 0x%x)\r\n",
address,
iv_index);
sl_status_t status = sl_btmesh_LCD_write("provisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
(void)address;
(void)iv_index;
} | /*******************************************************************************
* Called when the Provisioning finishes successfully
*
* @param[in] address Unicast address of the primary element of the node.
Ignored if unprovisioned.
* @param[in] iv_index IV index for the first network of the node
Ignored if unprovisioned.
******************************************************************************/ | Called when the Provisioning finishes successfully
@param[in] address Unicast address of the primary element of the node.
Ignored if unprovisioned.
@param[in] iv_index IV index for the first network of the node
Ignored if unprovisioned. | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully",
"@param",
"[",
"in",
"]",
"address",
"Unicast",
"address",
"of",
"the",
"primary",
"element",
"of",
"the",
"node",
".",
"Ignored",
"if",
"unprovisioned",
".",
"@param",
"[",
"in",
"]",
"iv_index",
"IV",
"index",
"for",
"the",
"first",
"network",
"of",
"the",
"node",
"Ignored",
"if",
"unprovisioned",
"."
] | void app_show_btmesh_node_provisioned(uint16_t address,
uint32_t iv_index)
{
app_log("BT mesh node is provisioned (address: 0x%04x, iv_index: 0x%x)\r\n",
address,
iv_index);
sl_status_t status = sl_btmesh_LCD_write("provisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
(void)address;
(void)iv_index;
} | [
"void",
"app_show_btmesh_node_provisioned",
"(",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"address",
",",
"iv_index",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"(",
"void",
")",
"address",
";",
"(",
"void",
")",
"iv_index",
";",
"}"
] | Called when the Provisioning finishes successfully
@param[in] address Unicast address of the primary element of the node. | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully",
"@param",
"[",
"in",
"]",
"address",
"Unicast",
"address",
"of",
"the",
"primary",
"element",
"of",
"the",
"node",
"."
] | [] | [
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42137e5735a6480ee1b07eff822acace334b5d26 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_hsl/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_factory_reset_on_full_reset | void | void sl_btmesh_factory_reset_on_full_reset(void)
{
app_log("Factory reset\r\n");
sl_status_t status = sl_btmesh_LCD_write("Factory reset",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when full reset is established, before system reset
******************************************************************************/ | Called when full reset is established, before system reset | [
"Called",
"when",
"full",
"reset",
"is",
"established",
"before",
"system",
"reset"
] | void sl_btmesh_factory_reset_on_full_reset(void)
{
app_log("Factory reset\r\n");
sl_status_t status = sl_btmesh_LCD_write("Factory reset",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_factory_reset_on_full_reset",
"(",
"void",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when full reset is established, before system reset | [
"Called",
"when",
"full",
"reset",
"is",
"established",
"before",
"system",
"reset"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4218ae49a594f7f0c2048326d5195fef81ad6f40 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_light/app.c | [
"Zlib"
] | C | handle_reset_conditions | bool | bool handle_reset_conditions(void)
{
// If PB0 is held down then do full factory reset
if (sl_simple_button_get_state(&sl_button_btn0)
== SL_SIMPLE_BUTTON_PRESSED) {
// Full factory reset
sl_btmesh_initiate_full_reset();
return false;
}
#ifndef SINGLE_BUTTON
// If PB1 is held down then do node factory reset
if (sl_simple_button_get_state(&sl_button_btn1)
== SL_SIMPLE_BUTTON_PRESSED) {
// Node factory reset
sl_btmesh_initiate_node_reset();
return false;
}
#endif // SL_CATALOG_BTN1_PRESENT
return true;
} | /***************************************************************************/
/**
* Handles button press and does a factory reset
*
* @return true if there is no button press
******************************************************************************/ | Handles button press and does a factory reset
@return true if there is no button press | [
"Handles",
"button",
"press",
"and",
"does",
"a",
"factory",
"reset",
"@return",
"true",
"if",
"there",
"is",
"no",
"button",
"press"
] | bool handle_reset_conditions(void)
{
if (sl_simple_button_get_state(&sl_button_btn0)
== SL_SIMPLE_BUTTON_PRESSED) {
sl_btmesh_initiate_full_reset();
return false;
}
#ifndef SINGLE_BUTTON
if (sl_simple_button_get_state(&sl_button_btn1)
== SL_SIMPLE_BUTTON_PRESSED) {
sl_btmesh_initiate_node_reset();
return false;
}
#endif
return true;
} | [
"bool",
"handle_reset_conditions",
"(",
"void",
")",
"{",
"if",
"(",
"sl_simple_button_get_state",
"(",
"&",
"sl_button_btn0",
")",
"==",
"SL_SIMPLE_BUTTON_PRESSED",
")",
"{",
"sl_btmesh_initiate_full_reset",
"(",
")",
";",
"return",
"false",
";",
"}",
"#ifndef",
"SINGLE_BUTTON",
"if",
"(",
"sl_simple_button_get_state",
"(",
"&",
"sl_button_btn1",
")",
"==",
"SL_SIMPLE_BUTTON_PRESSED",
")",
"{",
"sl_btmesh_initiate_node_reset",
"(",
")",
";",
"return",
"false",
";",
"}",
"#endif",
"return",
"true",
";",
"}"
] | Handles button press and does a factory reset
@return true if there is no button press | [
"Handles",
"button",
"press",
"and",
"does",
"a",
"factory",
"reset",
"@return",
"true",
"if",
"there",
"is",
"no",
"button",
"press"
] | [
"// If PB0 is held down then do full factory reset",
"// Full factory reset",
"// If PB1 is held down then do node factory reset",
"// Node factory reset",
"// SL_CATALOG_BTN1_PRESENT"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4218ae49a594f7f0c2048326d5195fef81ad6f40 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_light/app.c | [
"Zlib"
] | C | handle_boot_event | void | static void handle_boot_event(void)
{
sl_status_t sc;
bd_addr address;
uint8_t address_type;
char buf[BOOT_ERR_MSG_BUF_LEN];
// Check reset conditions and continue if not reset.
if (handle_reset_conditions()) {
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_status_f(sc, "Failed to get Bluetooth address\n");
set_device_name(&address);
// Initialize Mesh stack in Node operation mode, wait for initialized event
sc = sl_btmesh_node_init();
if (sc) {
snprintf(buf, BOOT_ERR_MSG_BUF_LEN, "init failed (0x%lx)", sc);
lcd_print(buf, BTMESH_WSTK_LCD_ROW_STATUS);
app_log("Initialization failed (0x%x)\r\n", sc);
}
}
} | /***************************************************************************/
/**
* Handling of boot event.
* If needed it performs factory reset. In other case it sets device name
* and initialize mesh node.
******************************************************************************/ | Handling of boot event.
If needed it performs factory reset. In other case it sets device name
and initialize mesh node. | [
"Handling",
"of",
"boot",
"event",
".",
"If",
"needed",
"it",
"performs",
"factory",
"reset",
".",
"In",
"other",
"case",
"it",
"sets",
"device",
"name",
"and",
"initialize",
"mesh",
"node",
"."
] | static void handle_boot_event(void)
{
sl_status_t sc;
bd_addr address;
uint8_t address_type;
char buf[BOOT_ERR_MSG_BUF_LEN];
if (handle_reset_conditions()) {
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_status_f(sc, "Failed to get Bluetooth address\n");
set_device_name(&address);
sc = sl_btmesh_node_init();
if (sc) {
snprintf(buf, BOOT_ERR_MSG_BUF_LEN, "init failed (0x%lx)", sc);
lcd_print(buf, BTMESH_WSTK_LCD_ROW_STATUS);
app_log("Initialization failed (0x%x)\r\n", sc);
}
}
} | [
"static",
"void",
"handle_boot_event",
"(",
"void",
")",
"{",
"sl_status_t",
"sc",
";",
"bd_addr",
"address",
";",
"uint8_t",
"address_type",
";",
"char",
"buf",
"[",
"BOOT_ERR_MSG_BUF_LEN",
"]",
";",
"if",
"(",
"handle_reset_conditions",
"(",
")",
")",
"{",
"sc",
"=",
"sl_bt_system_get_identity_address",
"(",
"&",
"address",
",",
"&",
"address_type",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"set_device_name",
"(",
"&",
"address",
")",
";",
"sc",
"=",
"sl_btmesh_node_init",
"(",
")",
";",
"if",
"(",
"sc",
")",
"{",
"snprintf",
"(",
"buf",
",",
"BOOT_ERR_MSG_BUF_LEN",
",",
"\"",
"\"",
",",
"sc",
")",
";",
"lcd_print",
"(",
"buf",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"sc",
")",
";",
"}",
"}",
"}"
] | Handling of boot event. | [
"Handling",
"of",
"boot",
"event",
"."
] | [
"// Check reset conditions and continue if not reset.",
"// Initialize Mesh stack in Node operation mode, wait for initialized event"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4218ae49a594f7f0c2048326d5195fef81ad6f40 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_light/app.c | [
"Zlib"
] | C | sl_btmesh_on_node_provisioned | void | void sl_btmesh_on_node_provisioned(uint16_t address,
uint32_t iv_index)
{
sl_status_t sc = sl_simple_timer_stop(&app_led_blinking_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
// Turn off LED
init_done = true;
app_led_set_level(LED_LEVEL_OFF);
app_show_btmesh_node_provisioned(address, iv_index);
} | // Called when the Provisioning finishes successfully | Called when the Provisioning finishes successfully | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully"
] | void sl_btmesh_on_node_provisioned(uint16_t address,
uint32_t iv_index)
{
sl_status_t sc = sl_simple_timer_stop(&app_led_blinking_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\n");
init_done = true;
app_led_set_level(LED_LEVEL_OFF);
app_show_btmesh_node_provisioned(address, iv_index);
} | [
"void",
"sl_btmesh_on_node_provisioned",
"(",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"app_led_blinking_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"init_done",
"=",
"true",
";",
"app_led_set_level",
"(",
"LED_LEVEL_OFF",
")",
";",
"app_show_btmesh_node_provisioned",
"(",
"address",
",",
"iv_index",
")",
";",
"}"
] | Called when the Provisioning finishes successfully | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully"
] | [
"// Turn off LED"
] | [
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sl_power_manager_sleep | void | void sl_power_manager_sleep(void)
{
sl_power_manager_em_t lowest_em;
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
sli_power_manager_suspend_log_transmission();
if (sl_power_manager_is_ok_to_sleep() != true) {
sli_power_manager_resume_log_transmission();
CORE_EXIT_CRITICAL();
return;
}
// Go to another energy mode (same, higher to lower or lower to higher)
do {
// Remove any previous EM1 requirement added internally by the power manager itself
if (requirement_on_em1_added) {
update_em1_requirement(false);
requirement_on_em1_added = false;
}
lowest_em = get_lowest_em();
evaluate_wakeup(lowest_em);
lowest_em = get_lowest_em(); // Reevaluate as a requirement can be added from evaluate_wakeup()
if ((lowest_em >= SL_POWER_MANAGER_EM2)
&& (is_states_saved == false)) {
sli_power_manager_save_states();
}
// Notify listeners if transition to another energy mode
if (lowest_em != current_em) {
#ifdef SLI_DEVICE_SUPPORTS_EM1P
requirement_high_accuracy_hf_clock_back_to_zero = false;
#endif
if (is_sleeping_waiting_for_clock_restore == false) {
// But only notify if we are not in the process of waiting for the HF oscillators restore.
power_manager_notify_em_transition(current_em, lowest_em);
}
current_em = lowest_em; // Keep new active energy mode
}
#ifdef SLI_DEVICE_SUPPORTS_EM1P
// Notification for possible transition from EM1P to EM2
// For internal Silicon Labs use only
if (requirement_high_accuracy_hf_clock_back_to_zero
&& current_em == SL_POWER_MANAGER_EM2) {
requirement_high_accuracy_hf_clock_back_to_zero = false;
sli_power_manager_em1p_to_em2_notification();
}
#endif
// Pre-sleep operations if any are necessary
if ((lowest_em >= SL_POWER_MANAGER_EM2)
&& (is_states_saved == false)) {
// Only do pre-sleep operations if there is no requirement on High Accuracy Clock.
// Else we must not touch the clock tree.
if (requirement_high_accuracy_hf_clock_counter == 0) {
sli_power_manager_handle_pre_deepsleep_operations();
is_hf_x_oscillator_not_preserved = true;
}
is_states_saved = true;
}
// Apply lowest reachable energy mode
sli_power_manager_apply_em(current_em);
// In case we are waiting for the restore from an early wake-up,
// we put back the current EM to the one before the early wake-up to do the next notification correctly.
if (is_sleeping_waiting_for_clock_restore == true) {
current_em = waiting_clock_restore_from_em;
}
// Notify consumer of wakeup while interrupts are still off
// For internal Silicon Labs use only
sli_power_manager_on_wakeup();
CORE_EXIT_CRITICAL();
CORE_ENTER_CRITICAL();
// Stop the internal power manager sleeptimer.
sl_sleeptimer_stop_timer(&clock_wakeup_timer_handle);
} while (sl_power_manager_sleep_on_isr_exit() == true);
#ifdef SLI_DEVICE_SUPPORTS_EM1P
requirement_high_accuracy_hf_clock_back_to_zero = false;
#endif
if (is_states_saved == true) {
is_sleeping_waiting_for_clock_restore = false;
// Restore clocks
if (is_hf_x_oscillator_not_preserved) {
sli_power_manager_restore_high_freq_accuracy_clk();
is_hf_x_oscillator_not_preserved = false;
}
// If possible, go back to sleep in EM1 while waiting for HF accuracy restore
while (!sli_power_manager_is_high_freq_accuracy_clk_ready(false)) {
sli_power_manager_apply_em(SL_POWER_MANAGER_EM1);
CORE_EXIT_CRITICAL();
CORE_ENTER_CRITICAL();
}
sli_power_manager_restore_states();
is_states_saved = false;
}
evaluate_wakeup(SL_POWER_MANAGER_EM0);
// Indicate back to EM0
power_manager_notify_em_transition(current_em, SL_POWER_MANAGER_EM0);
current_em = SL_POWER_MANAGER_EM0;
sli_power_manager_resume_log_transmission();
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Sleep at the lowest allowed energy mode.
******************************************************************************/ | Sleep at the lowest allowed energy mode. | [
"Sleep",
"at",
"the",
"lowest",
"allowed",
"energy",
"mode",
"."
] | void sl_power_manager_sleep(void)
{
sl_power_manager_em_t lowest_em;
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
sli_power_manager_suspend_log_transmission();
if (sl_power_manager_is_ok_to_sleep() != true) {
sli_power_manager_resume_log_transmission();
CORE_EXIT_CRITICAL();
return;
}
do {
if (requirement_on_em1_added) {
update_em1_requirement(false);
requirement_on_em1_added = false;
}
lowest_em = get_lowest_em();
evaluate_wakeup(lowest_em);
lowest_em = get_lowest_em();
if ((lowest_em >= SL_POWER_MANAGER_EM2)
&& (is_states_saved == false)) {
sli_power_manager_save_states();
}
if (lowest_em != current_em) {
#ifdef SLI_DEVICE_SUPPORTS_EM1P
requirement_high_accuracy_hf_clock_back_to_zero = false;
#endif
if (is_sleeping_waiting_for_clock_restore == false) {
power_manager_notify_em_transition(current_em, lowest_em);
}
current_em = lowest_em;
}
#ifdef SLI_DEVICE_SUPPORTS_EM1P
if (requirement_high_accuracy_hf_clock_back_to_zero
&& current_em == SL_POWER_MANAGER_EM2) {
requirement_high_accuracy_hf_clock_back_to_zero = false;
sli_power_manager_em1p_to_em2_notification();
}
#endif
if ((lowest_em >= SL_POWER_MANAGER_EM2)
&& (is_states_saved == false)) {
if (requirement_high_accuracy_hf_clock_counter == 0) {
sli_power_manager_handle_pre_deepsleep_operations();
is_hf_x_oscillator_not_preserved = true;
}
is_states_saved = true;
}
sli_power_manager_apply_em(current_em);
if (is_sleeping_waiting_for_clock_restore == true) {
current_em = waiting_clock_restore_from_em;
}
sli_power_manager_on_wakeup();
CORE_EXIT_CRITICAL();
CORE_ENTER_CRITICAL();
sl_sleeptimer_stop_timer(&clock_wakeup_timer_handle);
} while (sl_power_manager_sleep_on_isr_exit() == true);
#ifdef SLI_DEVICE_SUPPORTS_EM1P
requirement_high_accuracy_hf_clock_back_to_zero = false;
#endif
if (is_states_saved == true) {
is_sleeping_waiting_for_clock_restore = false;
if (is_hf_x_oscillator_not_preserved) {
sli_power_manager_restore_high_freq_accuracy_clk();
is_hf_x_oscillator_not_preserved = false;
}
while (!sli_power_manager_is_high_freq_accuracy_clk_ready(false)) {
sli_power_manager_apply_em(SL_POWER_MANAGER_EM1);
CORE_EXIT_CRITICAL();
CORE_ENTER_CRITICAL();
}
sli_power_manager_restore_states();
is_states_saved = false;
}
evaluate_wakeup(SL_POWER_MANAGER_EM0);
power_manager_notify_em_transition(current_em, SL_POWER_MANAGER_EM0);
current_em = SL_POWER_MANAGER_EM0;
sli_power_manager_resume_log_transmission();
CORE_EXIT_CRITICAL();
} | [
"void",
"sl_power_manager_sleep",
"(",
"void",
")",
"{",
"sl_power_manager_em_t",
"lowest_em",
";",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"sli_power_manager_suspend_log_transmission",
"(",
")",
";",
"if",
"(",
"sl_power_manager_is_ok_to_sleep",
"(",
")",
"!=",
"true",
")",
"{",
"sli_power_manager_resume_log_transmission",
"(",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"return",
";",
"}",
"do",
"{",
"if",
"(",
"requirement_on_em1_added",
")",
"{",
"update_em1_requirement",
"(",
"false",
")",
";",
"requirement_on_em1_added",
"=",
"false",
";",
"}",
"lowest_em",
"=",
"get_lowest_em",
"(",
")",
";",
"evaluate_wakeup",
"(",
"lowest_em",
")",
";",
"lowest_em",
"=",
"get_lowest_em",
"(",
")",
";",
"if",
"(",
"(",
"lowest_em",
">=",
"SL_POWER_MANAGER_EM2",
")",
"&&",
"(",
"is_states_saved",
"==",
"false",
")",
")",
"{",
"sli_power_manager_save_states",
"(",
")",
";",
"}",
"if",
"(",
"lowest_em",
"!=",
"current_em",
")",
"{",
"#ifdef",
"SLI_DEVICE_SUPPORTS_EM1P",
"requirement_high_accuracy_hf_clock_back_to_zero",
"=",
"false",
";",
"#endif",
"if",
"(",
"is_sleeping_waiting_for_clock_restore",
"==",
"false",
")",
"{",
"power_manager_notify_em_transition",
"(",
"current_em",
",",
"lowest_em",
")",
";",
"}",
"current_em",
"=",
"lowest_em",
";",
"}",
"#ifdef",
"SLI_DEVICE_SUPPORTS_EM1P",
"if",
"(",
"requirement_high_accuracy_hf_clock_back_to_zero",
"&&",
"current_em",
"==",
"SL_POWER_MANAGER_EM2",
")",
"{",
"requirement_high_accuracy_hf_clock_back_to_zero",
"=",
"false",
";",
"sli_power_manager_em1p_to_em2_notification",
"(",
")",
";",
"}",
"#endif",
"if",
"(",
"(",
"lowest_em",
">=",
"SL_POWER_MANAGER_EM2",
")",
"&&",
"(",
"is_states_saved",
"==",
"false",
")",
")",
"{",
"if",
"(",
"requirement_high_accuracy_hf_clock_counter",
"==",
"0",
")",
"{",
"sli_power_manager_handle_pre_deepsleep_operations",
"(",
")",
";",
"is_hf_x_oscillator_not_preserved",
"=",
"true",
";",
"}",
"is_states_saved",
"=",
"true",
";",
"}",
"sli_power_manager_apply_em",
"(",
"current_em",
")",
";",
"if",
"(",
"is_sleeping_waiting_for_clock_restore",
"==",
"true",
")",
"{",
"current_em",
"=",
"waiting_clock_restore_from_em",
";",
"}",
"sli_power_manager_on_wakeup",
"(",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"sl_sleeptimer_stop_timer",
"(",
"&",
"clock_wakeup_timer_handle",
")",
";",
"}",
"while",
"(",
"sl_power_manager_sleep_on_isr_exit",
"(",
")",
"==",
"true",
")",
";",
"#ifdef",
"SLI_DEVICE_SUPPORTS_EM1P",
"requirement_high_accuracy_hf_clock_back_to_zero",
"=",
"false",
";",
"#endif",
"if",
"(",
"is_states_saved",
"==",
"true",
")",
"{",
"is_sleeping_waiting_for_clock_restore",
"=",
"false",
";",
"if",
"(",
"is_hf_x_oscillator_not_preserved",
")",
"{",
"sli_power_manager_restore_high_freq_accuracy_clk",
"(",
")",
";",
"is_hf_x_oscillator_not_preserved",
"=",
"false",
";",
"}",
"while",
"(",
"!",
"sli_power_manager_is_high_freq_accuracy_clk_ready",
"(",
"false",
")",
")",
"{",
"sli_power_manager_apply_em",
"(",
"SL_POWER_MANAGER_EM1",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"}",
"sli_power_manager_restore_states",
"(",
")",
";",
"is_states_saved",
"=",
"false",
";",
"}",
"evaluate_wakeup",
"(",
"SL_POWER_MANAGER_EM0",
")",
";",
"power_manager_notify_em_transition",
"(",
"current_em",
",",
"SL_POWER_MANAGER_EM0",
")",
";",
"current_em",
"=",
"SL_POWER_MANAGER_EM0",
";",
"sli_power_manager_resume_log_transmission",
"(",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Sleep at the lowest allowed energy mode. | [
"Sleep",
"at",
"the",
"lowest",
"allowed",
"energy",
"mode",
"."
] | [
"// Go to another energy mode (same, higher to lower or lower to higher)",
"// Remove any previous EM1 requirement added internally by the power manager itself",
"// Reevaluate as a requirement can be added from evaluate_wakeup()",
"// Notify listeners if transition to another energy mode",
"// But only notify if we are not in the process of waiting for the HF oscillators restore.",
"// Keep new active energy mode",
"// Notification for possible transition from EM1P to EM2",
"// For internal Silicon Labs use only",
"// Pre-sleep operations if any are necessary",
"// Only do pre-sleep operations if there is no requirement on High Accuracy Clock.",
"// Else we must not touch the clock tree.",
"// Apply lowest reachable energy mode",
"// In case we are waiting for the restore from an early wake-up,",
"// we put back the current EM to the one before the early wake-up to do the next notification correctly.",
"// Notify consumer of wakeup while interrupts are still off",
"// For internal Silicon Labs use only",
"// Stop the internal power manager sleeptimer.",
"// Restore clocks",
"// If possible, go back to sleep in EM1 while waiting for HF accuracy restore",
"// Indicate back to EM0"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sli_power_manager_update_hf_clock_settings_preservation_requirement | void | void sli_power_manager_update_hf_clock_settings_preservation_requirement(bool add)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
// Cannot increment above 255 (wraparound not allowed)
EFM_ASSERT(!((requirement_high_accuracy_hf_clock_counter == UINT8_MAX) && (add == true)));
// Cannot decrement below 0 (wraparound not allowed)
EFM_ASSERT(!((requirement_high_accuracy_hf_clock_counter == 0) && (add == false)));
// Cannot add requirement if the "normal" clock settings are not currently applied
EFM_ASSERT(!((current_em > SL_POWER_MANAGER_EM2) && (add == true)));
// Increment (add) or decrement (remove) energy mode counter.
requirement_high_accuracy_hf_clock_counter += (add) ? 1 : -1;
// Save if the requirement is back to zero.
requirement_high_accuracy_hf_clock_back_to_zero = (requirement_high_accuracy_hf_clock_counter == 0) ? true : false;
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Updates requirement on preservation of High Frequency Clocks settings.
*
* @param add Flag indicating if requirement is added (true) or removed
* (false).
******************************************************************************/ | Updates requirement on preservation of High Frequency Clocks settings.
@param add Flag indicating if requirement is added (true) or removed
(false). | [
"Updates",
"requirement",
"on",
"preservation",
"of",
"High",
"Frequency",
"Clocks",
"settings",
".",
"@param",
"add",
"Flag",
"indicating",
"if",
"requirement",
"is",
"added",
"(",
"true",
")",
"or",
"removed",
"(",
"false",
")",
"."
] | void sli_power_manager_update_hf_clock_settings_preservation_requirement(bool add)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
EFM_ASSERT(!((requirement_high_accuracy_hf_clock_counter == UINT8_MAX) && (add == true)));
EFM_ASSERT(!((requirement_high_accuracy_hf_clock_counter == 0) && (add == false)));
EFM_ASSERT(!((current_em > SL_POWER_MANAGER_EM2) && (add == true)));
requirement_high_accuracy_hf_clock_counter += (add) ? 1 : -1;
requirement_high_accuracy_hf_clock_back_to_zero = (requirement_high_accuracy_hf_clock_counter == 0) ? true : false;
CORE_EXIT_CRITICAL();
} | [
"void",
"sli_power_manager_update_hf_clock_settings_preservation_requirement",
"(",
"bool",
"add",
")",
"{",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"EFM_ASSERT",
"(",
"!",
"(",
"(",
"requirement_high_accuracy_hf_clock_counter",
"==",
"UINT8_MAX",
")",
"&&",
"(",
"add",
"==",
"true",
")",
")",
")",
";",
"EFM_ASSERT",
"(",
"!",
"(",
"(",
"requirement_high_accuracy_hf_clock_counter",
"==",
"0",
")",
"&&",
"(",
"add",
"==",
"false",
")",
")",
")",
";",
"EFM_ASSERT",
"(",
"!",
"(",
"(",
"current_em",
">",
"SL_POWER_MANAGER_EM2",
")",
"&&",
"(",
"add",
"==",
"true",
")",
")",
")",
";",
"requirement_high_accuracy_hf_clock_counter",
"+=",
"(",
"add",
")",
"?",
"1",
":",
"-1",
";",
"requirement_high_accuracy_hf_clock_back_to_zero",
"=",
"(",
"requirement_high_accuracy_hf_clock_counter",
"==",
"0",
")",
"?",
"true",
":",
"false",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Updates requirement on preservation of High Frequency Clocks settings. | [
"Updates",
"requirement",
"on",
"preservation",
"of",
"High",
"Frequency",
"Clocks",
"settings",
"."
] | [
"// Cannot increment above 255 (wraparound not allowed)",
"// Cannot decrement below 0 (wraparound not allowed)",
"// Cannot add requirement if the \"normal\" clock settings are not currently applied",
"// Increment (add) or decrement (remove) energy mode counter.",
"// Save if the requirement is back to zero."
] | [
{
"param": "add",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "add",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sli_power_manager_get_restore_delay | uint32_t | uint32_t sli_power_manager_get_restore_delay(void)
{
uint32_t wakeup_delay = 0;
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
// If we are not currently in deepsleep, not need for any clock restore
if (current_em <= SL_POWER_MANAGER_EM1) {
CORE_EXIT_CRITICAL();
return wakeup_delay;
}
// Get the clock restore delay
wakeup_delay = sl_power_manager_schedule_wakeup_get_restore_overhead_tick();
wakeup_delay += sli_power_manager_get_wakeup_process_time_overhead();
CORE_EXIT_CRITICAL();
return wakeup_delay;
} | /***************************************************************************/
/**
* Gets the wake-up restore process time.
* If we are not in the context of a deepsleep and therefore don't need to
* do a restore, the return value is 0.
*
*
* @return Wake-up restore process time.
******************************************************************************/ | Gets the wake-up restore process time.
If we are not in the context of a deepsleep and therefore don't need to
do a restore, the return value is 0.
@return Wake-up restore process time. | [
"Gets",
"the",
"wake",
"-",
"up",
"restore",
"process",
"time",
".",
"If",
"we",
"are",
"not",
"in",
"the",
"context",
"of",
"a",
"deepsleep",
"and",
"therefore",
"don",
"'",
"t",
"need",
"to",
"do",
"a",
"restore",
"the",
"return",
"value",
"is",
"0",
".",
"@return",
"Wake",
"-",
"up",
"restore",
"process",
"time",
"."
] | uint32_t sli_power_manager_get_restore_delay(void)
{
uint32_t wakeup_delay = 0;
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
if (current_em <= SL_POWER_MANAGER_EM1) {
CORE_EXIT_CRITICAL();
return wakeup_delay;
}
wakeup_delay = sl_power_manager_schedule_wakeup_get_restore_overhead_tick();
wakeup_delay += sli_power_manager_get_wakeup_process_time_overhead();
CORE_EXIT_CRITICAL();
return wakeup_delay;
} | [
"uint32_t",
"sli_power_manager_get_restore_delay",
"(",
"void",
")",
"{",
"uint32_t",
"wakeup_delay",
"=",
"0",
";",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"if",
"(",
"current_em",
"<=",
"SL_POWER_MANAGER_EM1",
")",
"{",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"return",
"wakeup_delay",
";",
"}",
"wakeup_delay",
"=",
"sl_power_manager_schedule_wakeup_get_restore_overhead_tick",
"(",
")",
";",
"wakeup_delay",
"+=",
"sli_power_manager_get_wakeup_process_time_overhead",
"(",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"return",
"wakeup_delay",
";",
"}"
] | Gets the wake-up restore process time. | [
"Gets",
"the",
"wake",
"-",
"up",
"restore",
"process",
"time",
"."
] | [
"// If we are not currently in deepsleep, not need for any clock restore",
"// Get the clock restore delay"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sli_power_manager_initiate_restore | void | void sli_power_manager_initiate_restore(void)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
// Start restore process
clock_restore();
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Initiates the wake-up restore process.
******************************************************************************/ | Initiates the wake-up restore process. | [
"Initiates",
"the",
"wake",
"-",
"up",
"restore",
"process",
"."
] | void sli_power_manager_initiate_restore(void)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
clock_restore();
CORE_EXIT_CRITICAL();
} | [
"void",
"sli_power_manager_initiate_restore",
"(",
"void",
")",
"{",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"clock_restore",
"(",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Initiates the wake-up restore process. | [
"Initiates",
"the",
"wake",
"-",
"up",
"restore",
"process",
"."
] | [
"// Start restore process"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sl_power_manager_subscribe_em_transition_event | void | void sl_power_manager_subscribe_em_transition_event(sl_power_manager_em_transition_event_handle_t *event_handle,
const sl_power_manager_em_transition_event_info_t *event_info)
{
CORE_DECLARE_IRQ_STATE;
event_handle->info = (sl_power_manager_em_transition_event_info_t *)event_info;
CORE_ENTER_CRITICAL();
sl_slist_push(&power_manager_em_transition_event_list, &event_handle->node);
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Registers a callback to be called on given Energy Mode transition(s).
*
* @note Adding/Removing requirement(s) from the callback is not supported.
******************************************************************************/ | Registers a callback to be called on given Energy Mode transition(s).
@note Adding/Removing requirement(s) from the callback is not supported. | [
"Registers",
"a",
"callback",
"to",
"be",
"called",
"on",
"given",
"Energy",
"Mode",
"transition",
"(",
"s",
")",
".",
"@note",
"Adding",
"/",
"Removing",
"requirement",
"(",
"s",
")",
"from",
"the",
"callback",
"is",
"not",
"supported",
"."
] | void sl_power_manager_subscribe_em_transition_event(sl_power_manager_em_transition_event_handle_t *event_handle,
const sl_power_manager_em_transition_event_info_t *event_info)
{
CORE_DECLARE_IRQ_STATE;
event_handle->info = (sl_power_manager_em_transition_event_info_t *)event_info;
CORE_ENTER_CRITICAL();
sl_slist_push(&power_manager_em_transition_event_list, &event_handle->node);
CORE_EXIT_CRITICAL();
} | [
"void",
"sl_power_manager_subscribe_em_transition_event",
"(",
"sl_power_manager_em_transition_event_handle_t",
"*",
"event_handle",
",",
"const",
"sl_power_manager_em_transition_event_info_t",
"*",
"event_info",
")",
"{",
"CORE_DECLARE_IRQ_STATE",
";",
"event_handle",
"->",
"info",
"=",
"(",
"sl_power_manager_em_transition_event_info_t",
"*",
")",
"event_info",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"sl_slist_push",
"(",
"&",
"power_manager_em_transition_event_list",
",",
"&",
"event_handle",
"->",
"node",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Registers a callback to be called on given Energy Mode transition(s). | [
"Registers",
"a",
"callback",
"to",
"be",
"called",
"on",
"given",
"Energy",
"Mode",
"transition",
"(",
"s",
")",
"."
] | [] | [
{
"param": "event_handle",
"type": "sl_power_manager_em_transition_event_handle_t"
},
{
"param": "event_info",
"type": "sl_power_manager_em_transition_event_info_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "event_handle",
"type": "sl_power_manager_em_transition_event_handle_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event_info",
"type": "sl_power_manager_em_transition_event_info_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sl_power_manager_unsubscribe_em_transition_event | void | void sl_power_manager_unsubscribe_em_transition_event(sl_power_manager_em_transition_event_handle_t *event_handle)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
sl_slist_remove(&power_manager_em_transition_event_list, &event_handle->node);
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Unregisters an event callback handle on Energy mode transition.
******************************************************************************/ | Unregisters an event callback handle on Energy mode transition. | [
"Unregisters",
"an",
"event",
"callback",
"handle",
"on",
"Energy",
"mode",
"transition",
"."
] | void sl_power_manager_unsubscribe_em_transition_event(sl_power_manager_em_transition_event_handle_t *event_handle)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
sl_slist_remove(&power_manager_em_transition_event_list, &event_handle->node);
CORE_EXIT_CRITICAL();
} | [
"void",
"sl_power_manager_unsubscribe_em_transition_event",
"(",
"sl_power_manager_em_transition_event_handle_t",
"*",
"event_handle",
")",
"{",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"sl_slist_remove",
"(",
"&",
"power_manager_em_transition_event_list",
",",
"&",
"event_handle",
"->",
"node",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Unregisters an event callback handle on Energy mode transition. | [
"Unregisters",
"an",
"event",
"callback",
"handle",
"on",
"Energy",
"mode",
"transition",
"."
] | [] | [
{
"param": "event_handle",
"type": "sl_power_manager_em_transition_event_handle_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "event_handle",
"type": "sl_power_manager_em_transition_event_handle_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sl_power_manager_schedule_wakeup_get_restore_overhead_tick | int32_t | int32_t sl_power_manager_schedule_wakeup_get_restore_overhead_tick(void)
{
int32_t overhead_tick;
sl_atomic_load(overhead_tick, wakeup_time_config_overhead_tick);
return overhead_tick;
} | /***************************************************************************/
/**
* Get configurable overhead value for early restore time in Sleeptimer ticks
* when a schedule wake-up is set.
*
* @return Current overhead value for early wake-up time.
******************************************************************************/ | Get configurable overhead value for early restore time in Sleeptimer ticks
when a schedule wake-up is set.
@return Current overhead value for early wake-up time. | [
"Get",
"configurable",
"overhead",
"value",
"for",
"early",
"restore",
"time",
"in",
"Sleeptimer",
"ticks",
"when",
"a",
"schedule",
"wake",
"-",
"up",
"is",
"set",
".",
"@return",
"Current",
"overhead",
"value",
"for",
"early",
"wake",
"-",
"up",
"time",
"."
] | int32_t sl_power_manager_schedule_wakeup_get_restore_overhead_tick(void)
{
int32_t overhead_tick;
sl_atomic_load(overhead_tick, wakeup_time_config_overhead_tick);
return overhead_tick;
} | [
"int32_t",
"sl_power_manager_schedule_wakeup_get_restore_overhead_tick",
"(",
"void",
")",
"{",
"int32_t",
"overhead_tick",
";",
"sl_atomic_load",
"(",
"overhead_tick",
",",
"wakeup_time_config_overhead_tick",
")",
";",
"return",
"overhead_tick",
";",
"}"
] | Get configurable overhead value for early restore time in Sleeptimer ticks
when a schedule wake-up is set. | [
"Get",
"configurable",
"overhead",
"value",
"for",
"early",
"restore",
"time",
"in",
"Sleeptimer",
"ticks",
"when",
"a",
"schedule",
"wake",
"-",
"up",
"is",
"set",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sl_power_manager_schedule_wakeup_get_minimum_offtime_tick | uint32_t | uint32_t sl_power_manager_schedule_wakeup_get_minimum_offtime_tick(void)
{
uint32_t offtime_tick;
sl_atomic_load(offtime_tick, high_frequency_min_offtime_tick);
return offtime_tick;
} | /***************************************************************************/
/**
* Get configurable minimum off-time value for schedule wake-up in Sleeptimer
* ticks.
*
* @return Current minimum off-time value for schedule wake-up.
*
* @note Turning on external high frequency oscillator, such as HFXO, requires
* more energy since we must supply higher current for the wake-up.
* Therefore, when an 'external high frequency oscillator enable' is
* scheduled in 'x' time, there is a threshold 'x' value where turning
* off the oscillator is not worthwhile since the energy consumed by
* taking into account the wake-up will be greater than if we just keep
* the oscillator on until the next scheduled oscillator enabled. This
* threshold value is what we refer as the minimum off-time.
******************************************************************************/ | Get configurable minimum off-time value for schedule wake-up in Sleeptimer
ticks.
@return Current minimum off-time value for schedule wake-up.
@note Turning on external high frequency oscillator, such as HFXO, requires
more energy since we must supply higher current for the wake-up. | [
"Get",
"configurable",
"minimum",
"off",
"-",
"time",
"value",
"for",
"schedule",
"wake",
"-",
"up",
"in",
"Sleeptimer",
"ticks",
".",
"@return",
"Current",
"minimum",
"off",
"-",
"time",
"value",
"for",
"schedule",
"wake",
"-",
"up",
".",
"@note",
"Turning",
"on",
"external",
"high",
"frequency",
"oscillator",
"such",
"as",
"HFXO",
"requires",
"more",
"energy",
"since",
"we",
"must",
"supply",
"higher",
"current",
"for",
"the",
"wake",
"-",
"up",
"."
] | uint32_t sl_power_manager_schedule_wakeup_get_minimum_offtime_tick(void)
{
uint32_t offtime_tick;
sl_atomic_load(offtime_tick, high_frequency_min_offtime_tick);
return offtime_tick;
} | [
"uint32_t",
"sl_power_manager_schedule_wakeup_get_minimum_offtime_tick",
"(",
"void",
")",
"{",
"uint32_t",
"offtime_tick",
";",
"sl_atomic_load",
"(",
"offtime_tick",
",",
"high_frequency_min_offtime_tick",
")",
";",
"return",
"offtime_tick",
";",
"}"
] | Get configurable minimum off-time value for schedule wake-up in Sleeptimer
ticks. | [
"Get",
"configurable",
"minimum",
"off",
"-",
"time",
"value",
"for",
"schedule",
"wake",
"-",
"up",
"in",
"Sleeptimer",
"ticks",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | power_manager_notify_em_transition | void | static void power_manager_notify_em_transition(sl_power_manager_em_t from,
sl_power_manager_em_t to)
{
sl_power_manager_em_transition_event_handle_t *handle;
sl_power_manager_em_transition_event_t transition = 0;
switch (to) {
case SL_POWER_MANAGER_EM0:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM0;
break;
case SL_POWER_MANAGER_EM1:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM1;
break;
case SL_POWER_MANAGER_EM2:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM2;
break;
case SL_POWER_MANAGER_EM3:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM3;
break;
default:
EFM_ASSERT(0);
}
switch (from) {
case SL_POWER_MANAGER_EM0:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM0;
break;
case SL_POWER_MANAGER_EM1:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM1;
break;
case SL_POWER_MANAGER_EM2:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM2;
break;
case SL_POWER_MANAGER_EM3:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM3;
break;
default:
EFM_ASSERT(0);
}
SL_SLIST_FOR_EACH_ENTRY(power_manager_em_transition_event_list, handle, sl_power_manager_em_transition_event_handle_t, node) {
if ((handle->info->event_mask & transition) > 0) {
handle->info->on_event(from, to);
}
}
} | /***************************************************************************/
/**
* Notify subscribers about energy mode transition.
*
* @param from Energy mode from which CPU comes from.
*
* @param to Energy mode to which CPU is going to.
******************************************************************************/ | Notify subscribers about energy mode transition.
@param to Energy mode to which CPU is going to. | [
"Notify",
"subscribers",
"about",
"energy",
"mode",
"transition",
".",
"@param",
"to",
"Energy",
"mode",
"to",
"which",
"CPU",
"is",
"going",
"to",
"."
] | static void power_manager_notify_em_transition(sl_power_manager_em_t from,
sl_power_manager_em_t to)
{
sl_power_manager_em_transition_event_handle_t *handle;
sl_power_manager_em_transition_event_t transition = 0;
switch (to) {
case SL_POWER_MANAGER_EM0:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM0;
break;
case SL_POWER_MANAGER_EM1:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM1;
break;
case SL_POWER_MANAGER_EM2:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM2;
break;
case SL_POWER_MANAGER_EM3:
transition = SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM3;
break;
default:
EFM_ASSERT(0);
}
switch (from) {
case SL_POWER_MANAGER_EM0:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM0;
break;
case SL_POWER_MANAGER_EM1:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM1;
break;
case SL_POWER_MANAGER_EM2:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM2;
break;
case SL_POWER_MANAGER_EM3:
transition |= SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM3;
break;
default:
EFM_ASSERT(0);
}
SL_SLIST_FOR_EACH_ENTRY(power_manager_em_transition_event_list, handle, sl_power_manager_em_transition_event_handle_t, node) {
if ((handle->info->event_mask & transition) > 0) {
handle->info->on_event(from, to);
}
}
} | [
"static",
"void",
"power_manager_notify_em_transition",
"(",
"sl_power_manager_em_t",
"from",
",",
"sl_power_manager_em_t",
"to",
")",
"{",
"sl_power_manager_em_transition_event_handle_t",
"*",
"handle",
";",
"sl_power_manager_em_transition_event_t",
"transition",
"=",
"0",
";",
"switch",
"(",
"to",
")",
"{",
"case",
"SL_POWER_MANAGER_EM0",
":",
"transition",
"=",
"SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM0",
";",
"break",
";",
"case",
"SL_POWER_MANAGER_EM1",
":",
"transition",
"=",
"SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM1",
";",
"break",
";",
"case",
"SL_POWER_MANAGER_EM2",
":",
"transition",
"=",
"SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM2",
";",
"break",
";",
"case",
"SL_POWER_MANAGER_EM3",
":",
"transition",
"=",
"SL_POWER_MANAGER_EVENT_TRANSITION_ENTERING_EM3",
";",
"break",
";",
"default",
":",
"EFM_ASSERT",
"(",
"0",
")",
";",
"}",
"switch",
"(",
"from",
")",
"{",
"case",
"SL_POWER_MANAGER_EM0",
":",
"transition",
"|=",
"SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM0",
";",
"break",
";",
"case",
"SL_POWER_MANAGER_EM1",
":",
"transition",
"|=",
"SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM1",
";",
"break",
";",
"case",
"SL_POWER_MANAGER_EM2",
":",
"transition",
"|=",
"SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM2",
";",
"break",
";",
"case",
"SL_POWER_MANAGER_EM3",
":",
"transition",
"|=",
"SL_POWER_MANAGER_EVENT_TRANSITION_LEAVING_EM3",
";",
"break",
";",
"default",
":",
"EFM_ASSERT",
"(",
"0",
")",
";",
"}",
"SL_SLIST_FOR_EACH_ENTRY",
"(",
"power_manager_em_transition_event_list",
",",
"handle",
",",
"sl_power_manager_em_transition_event_handle_t",
",",
"node",
")",
"",
"{",
"if",
"(",
"(",
"handle",
"->",
"info",
"->",
"event_mask",
"&",
"transition",
")",
">",
"0",
")",
"{",
"handle",
"->",
"info",
"->",
"on_event",
"(",
"from",
",",
"to",
")",
";",
"}",
"}",
"}"
] | Notify subscribers about energy mode transition. | [
"Notify",
"subscribers",
"about",
"energy",
"mode",
"transition",
"."
] | [] | [
{
"param": "from",
"type": "sl_power_manager_em_t"
},
{
"param": "to",
"type": "sl_power_manager_em_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "from",
"type": "sl_power_manager_em_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "to",
"type": "sl_power_manager_em_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | evaluate_wakeup | void | static void evaluate_wakeup(sl_power_manager_em_t to)
{
sl_status_t status;
uint32_t tick_remaining;
switch (to) {
case SL_POWER_MANAGER_EM0:
// Coming back from Sleep.
if (requirement_on_em1_added) {
update_em1_requirement(false);
requirement_on_em1_added = false;
}
break;
case SL_POWER_MANAGER_EM1:
// External high frequency clock, such as HFXO, already enabled; No wakeup delay
break;
case SL_POWER_MANAGER_EM2:
case SL_POWER_MANAGER_EM3:
// Get the time remaining until the next sleeptimer requiring early wake-up
status = sl_sleeptimer_get_remaining_time_of_first_timer(0, &tick_remaining);
if (status == SL_STATUS_OK) {
if (tick_remaining <= high_frequency_min_offtime_tick) {
// Add EM1 requirement if time remaining is to short to be energy efficient
// if going back to deepsleep.
update_em1_requirement(true);
requirement_on_em1_added = true;
} else {
int32_t wakeup_delay = 0;
int32_t cfg_overhead_tick = 0;
// Calculate overall wake-up delay.
sl_atomic_load(cfg_overhead_tick, wakeup_time_config_overhead_tick);
wakeup_delay += cfg_overhead_tick;
wakeup_delay += sli_power_manager_get_wakeup_process_time_overhead();
EFM_ASSERT(wakeup_delay >= 0);
if (tick_remaining <= (uint32_t)wakeup_delay) {
// Add EM1 requirement if time remaining is smaller than wake-up delay.
update_em1_requirement(true);
requirement_on_em1_added = true;
} else {
// Start internal sleeptimer to do the early wake-up.
sl_sleeptimer_restart_timer(&clock_wakeup_timer_handle,
(tick_remaining - (uint32_t)wakeup_delay),
on_clock_wakeup_timeout,
NULL,
0,
SLI_SLEEPTIMER_POWER_MANAGER_EARLY_WAKEUP_TIMER_FLAG);
}
}
}
break;
default:
EFM_ASSERT(false);
}
} | /***************************************************************************/
/**
* Evaluates scheduled wakeup and restart timer based on the wakeup time.
* If the remaining time is shorter than the wakeup time then add a requirement
* on EM1 for avoiding the wakeup delay time.
*
* @note Must be called in a critical section.
******************************************************************************/ | Evaluates scheduled wakeup and restart timer based on the wakeup time.
If the remaining time is shorter than the wakeup time then add a requirement
on EM1 for avoiding the wakeup delay time.
@note Must be called in a critical section. | [
"Evaluates",
"scheduled",
"wakeup",
"and",
"restart",
"timer",
"based",
"on",
"the",
"wakeup",
"time",
".",
"If",
"the",
"remaining",
"time",
"is",
"shorter",
"than",
"the",
"wakeup",
"time",
"then",
"add",
"a",
"requirement",
"on",
"EM1",
"for",
"avoiding",
"the",
"wakeup",
"delay",
"time",
".",
"@note",
"Must",
"be",
"called",
"in",
"a",
"critical",
"section",
"."
] | static void evaluate_wakeup(sl_power_manager_em_t to)
{
sl_status_t status;
uint32_t tick_remaining;
switch (to) {
case SL_POWER_MANAGER_EM0:
if (requirement_on_em1_added) {
update_em1_requirement(false);
requirement_on_em1_added = false;
}
break;
case SL_POWER_MANAGER_EM1:
break;
case SL_POWER_MANAGER_EM2:
case SL_POWER_MANAGER_EM3:
status = sl_sleeptimer_get_remaining_time_of_first_timer(0, &tick_remaining);
if (status == SL_STATUS_OK) {
if (tick_remaining <= high_frequency_min_offtime_tick) {
update_em1_requirement(true);
requirement_on_em1_added = true;
} else {
int32_t wakeup_delay = 0;
int32_t cfg_overhead_tick = 0;
sl_atomic_load(cfg_overhead_tick, wakeup_time_config_overhead_tick);
wakeup_delay += cfg_overhead_tick;
wakeup_delay += sli_power_manager_get_wakeup_process_time_overhead();
EFM_ASSERT(wakeup_delay >= 0);
if (tick_remaining <= (uint32_t)wakeup_delay) {
update_em1_requirement(true);
requirement_on_em1_added = true;
} else {
sl_sleeptimer_restart_timer(&clock_wakeup_timer_handle,
(tick_remaining - (uint32_t)wakeup_delay),
on_clock_wakeup_timeout,
NULL,
0,
SLI_SLEEPTIMER_POWER_MANAGER_EARLY_WAKEUP_TIMER_FLAG);
}
}
}
break;
default:
EFM_ASSERT(false);
}
} | [
"static",
"void",
"evaluate_wakeup",
"(",
"sl_power_manager_em_t",
"to",
")",
"{",
"sl_status_t",
"status",
";",
"uint32_t",
"tick_remaining",
";",
"switch",
"(",
"to",
")",
"{",
"case",
"SL_POWER_MANAGER_EM0",
":",
"if",
"(",
"requirement_on_em1_added",
")",
"{",
"update_em1_requirement",
"(",
"false",
")",
";",
"requirement_on_em1_added",
"=",
"false",
";",
"}",
"break",
";",
"case",
"SL_POWER_MANAGER_EM1",
":",
"break",
";",
"case",
"SL_POWER_MANAGER_EM2",
":",
"case",
"SL_POWER_MANAGER_EM3",
":",
"status",
"=",
"sl_sleeptimer_get_remaining_time_of_first_timer",
"(",
"0",
",",
"&",
"tick_remaining",
")",
";",
"if",
"(",
"status",
"==",
"SL_STATUS_OK",
")",
"{",
"if",
"(",
"tick_remaining",
"<=",
"high_frequency_min_offtime_tick",
")",
"{",
"update_em1_requirement",
"(",
"true",
")",
";",
"requirement_on_em1_added",
"=",
"true",
";",
"}",
"else",
"{",
"int32_t",
"wakeup_delay",
"=",
"0",
";",
"int32_t",
"cfg_overhead_tick",
"=",
"0",
";",
"sl_atomic_load",
"(",
"cfg_overhead_tick",
",",
"wakeup_time_config_overhead_tick",
")",
";",
"wakeup_delay",
"+=",
"cfg_overhead_tick",
";",
"wakeup_delay",
"+=",
"sli_power_manager_get_wakeup_process_time_overhead",
"(",
")",
";",
"EFM_ASSERT",
"(",
"wakeup_delay",
">=",
"0",
")",
";",
"if",
"(",
"tick_remaining",
"<=",
"(",
"uint32_t",
")",
"wakeup_delay",
")",
"{",
"update_em1_requirement",
"(",
"true",
")",
";",
"requirement_on_em1_added",
"=",
"true",
";",
"}",
"else",
"{",
"sl_sleeptimer_restart_timer",
"(",
"&",
"clock_wakeup_timer_handle",
",",
"(",
"tick_remaining",
"-",
"(",
"uint32_t",
")",
"wakeup_delay",
")",
",",
"on_clock_wakeup_timeout",
",",
"NULL",
",",
"0",
",",
"SLI_SLEEPTIMER_POWER_MANAGER_EARLY_WAKEUP_TIMER_FLAG",
")",
";",
"}",
"}",
"}",
"break",
";",
"default",
":",
"EFM_ASSERT",
"(",
"false",
")",
";",
"}",
"}"
] | Evaluates scheduled wakeup and restart timer based on the wakeup time. | [
"Evaluates",
"scheduled",
"wakeup",
"and",
"restart",
"timer",
"based",
"on",
"the",
"wakeup",
"time",
"."
] | [
"// Coming back from Sleep.",
"// External high frequency clock, such as HFXO, already enabled; No wakeup delay",
"// Get the time remaining until the next sleeptimer requiring early wake-up",
"// Add EM1 requirement if time remaining is to short to be energy efficient",
"// if going back to deepsleep.",
"// Calculate overall wake-up delay.",
"// Add EM1 requirement if time remaining is smaller than wake-up delay.",
"// Start internal sleeptimer to do the early wake-up."
] | [
{
"param": "to",
"type": "sl_power_manager_em_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "to",
"type": "sl_power_manager_em_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | update_em1_requirement | void | static void update_em1_requirement(bool add)
{
// Cannot increment above 255 (wraparound not allowed)
EFM_ASSERT(!((requirement_em_table[SL_POWER_MANAGER_EM1 - 1] == UINT8_MAX) && (add == true)));
// Cannot decrement below 0 (wraparound not allowed)
EFM_ASSERT(!((requirement_em_table[SL_POWER_MANAGER_EM1 - 1] == 0) && (add == false)));
#if (SL_POWER_MANAGER_DEBUG == 1)
sli_power_manager_debug_log_em_requirement(SL_POWER_MANAGER_EM1, add, "PM_INTERNAL_EM1_REQUIREMENT");
#endif
// Increment (add) or decrement (remove) energy mode counter.
requirement_em_table[SL_POWER_MANAGER_EM1 - 1] += (add) ? 1 : -1;
// In rare occasions a clock restore must be started here:
// - An asynchronous event wake-up the system from deepsleep very near the early wake-up event,
// When we re-enter the sleep loop, we delete the internal early wake-up timer, but during
// the evaluation before sleep, it is calculated that not enough time is remains to go to
// deepsleep. In that case, since we deleted the early wake-up timer we must start the
// restore process here.
// - A synchronous event is added during an ISR, when we evaluate if the timeout is bigger
// than the clock restore time, it's barely bigger, so no clock restore process is started
// at that time. But when we do the evaluate before sleep, the remaining time is now smaller
// than the clock restore delay. So me must start the restore process here.
if (add == true
&& current_em >= SL_POWER_MANAGER_EM2
&& is_sleeping_waiting_for_clock_restore == false) {
clock_restore();
}
} | /***************************************************************************/
/**
* Updates internal EM1 requirement.
* We add an internal EM1 requirement when we would usually go into EM2/EM3
* but there is not enough time before the next schedule event requiring a
* clock restore. So we just go to sleep in EM1.
* We remove this internal EM1 requirement next time we wake-up.
*
* @param add true, to add EM1 requirement,
* false, to remove EM1 requirement.
*
* @note For internal use only.
*
* @note Need to be call inside a critical section.
******************************************************************************/ | Updates internal EM1 requirement.
We add an internal EM1 requirement when we would usually go into EM2/EM3
but there is not enough time before the next schedule event requiring a
clock restore. So we just go to sleep in EM1.
We remove this internal EM1 requirement next time we wake-up.
@param add true, to add EM1 requirement,
false, to remove EM1 requirement.
@note For internal use only.
@note Need to be call inside a critical section. | [
"Updates",
"internal",
"EM1",
"requirement",
".",
"We",
"add",
"an",
"internal",
"EM1",
"requirement",
"when",
"we",
"would",
"usually",
"go",
"into",
"EM2",
"/",
"EM3",
"but",
"there",
"is",
"not",
"enough",
"time",
"before",
"the",
"next",
"schedule",
"event",
"requiring",
"a",
"clock",
"restore",
".",
"So",
"we",
"just",
"go",
"to",
"sleep",
"in",
"EM1",
".",
"We",
"remove",
"this",
"internal",
"EM1",
"requirement",
"next",
"time",
"we",
"wake",
"-",
"up",
".",
"@param",
"add",
"true",
"to",
"add",
"EM1",
"requirement",
"false",
"to",
"remove",
"EM1",
"requirement",
".",
"@note",
"For",
"internal",
"use",
"only",
".",
"@note",
"Need",
"to",
"be",
"call",
"inside",
"a",
"critical",
"section",
"."
] | static void update_em1_requirement(bool add)
{
EFM_ASSERT(!((requirement_em_table[SL_POWER_MANAGER_EM1 - 1] == UINT8_MAX) && (add == true)));
EFM_ASSERT(!((requirement_em_table[SL_POWER_MANAGER_EM1 - 1] == 0) && (add == false)));
#if (SL_POWER_MANAGER_DEBUG == 1)
sli_power_manager_debug_log_em_requirement(SL_POWER_MANAGER_EM1, add, "PM_INTERNAL_EM1_REQUIREMENT");
#endif
requirement_em_table[SL_POWER_MANAGER_EM1 - 1] += (add) ? 1 : -1;
if (add == true
&& current_em >= SL_POWER_MANAGER_EM2
&& is_sleeping_waiting_for_clock_restore == false) {
clock_restore();
}
} | [
"static",
"void",
"update_em1_requirement",
"(",
"bool",
"add",
")",
"{",
"EFM_ASSERT",
"(",
"!",
"(",
"(",
"requirement_em_table",
"[",
"SL_POWER_MANAGER_EM1",
"-",
"1",
"]",
"==",
"UINT8_MAX",
")",
"&&",
"(",
"add",
"==",
"true",
")",
")",
")",
";",
"EFM_ASSERT",
"(",
"!",
"(",
"(",
"requirement_em_table",
"[",
"SL_POWER_MANAGER_EM1",
"-",
"1",
"]",
"==",
"0",
")",
"&&",
"(",
"add",
"==",
"false",
")",
")",
")",
";",
"#if",
"(",
"SL_POWER_MANAGER_DEBUG",
"==",
"1",
")",
"\n",
"sli_power_manager_debug_log_em_requirement",
"(",
"SL_POWER_MANAGER_EM1",
",",
"add",
",",
"\"",
"\"",
")",
";",
"#endif",
"requirement_em_table",
"[",
"SL_POWER_MANAGER_EM1",
"-",
"1",
"]",
"+=",
"(",
"add",
")",
"?",
"1",
":",
"-1",
";",
"if",
"(",
"add",
"==",
"true",
"&&",
"current_em",
">=",
"SL_POWER_MANAGER_EM2",
"&&",
"is_sleeping_waiting_for_clock_restore",
"==",
"false",
")",
"{",
"clock_restore",
"(",
")",
";",
"}",
"}"
] | Updates internal EM1 requirement. | [
"Updates",
"internal",
"EM1",
"requirement",
"."
] | [
"// Cannot increment above 255 (wraparound not allowed)",
"// Cannot decrement below 0 (wraparound not allowed)",
"// Increment (add) or decrement (remove) energy mode counter.",
"// In rare occasions a clock restore must be started here:",
"// - An asynchronous event wake-up the system from deepsleep very near the early wake-up event,",
"// When we re-enter the sleep loop, we delete the internal early wake-up timer, but during",
"// the evaluation before sleep, it is calculated that not enough time is remains to go to",
"// deepsleep. In that case, since we deleted the early wake-up timer we must start the",
"// restore process here.",
"// - A synchronous event is added during an ISR, when we evaluate if the timeout is bigger",
"// than the clock restore time, it's barely bigger, so no clock restore process is started",
"// at that time. But when we do the evaluate before sleep, the remaining time is now smaller",
"// than the clock restore delay. So me must start the restore process here."
] | [
{
"param": "add",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "add",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | clock_restore_and_wait | void | static void clock_restore_and_wait(void)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
if (is_states_saved == true) {
if (is_actively_waiting_for_clock_restore == false) {
is_actively_waiting_for_clock_restore = true;
// Since we will actively wait for clock restore, we cancel any current non-active wait.
is_sleeping_waiting_for_clock_restore = false;
}
if (is_hf_x_oscillator_not_preserved) {
sli_power_manager_restore_high_freq_accuracy_clk();
is_hf_x_oscillator_not_preserved = false;
}
CORE_EXIT_CRITICAL();
// We remove the critical section in case HFXO fails to startup and the HFXO Interrupt needs to run to handle the error.
sli_power_manager_is_high_freq_accuracy_clk_ready(true);
CORE_ENTER_CRITICAL();
if (is_actively_waiting_for_clock_restore) {
sli_power_manager_restore_states();
is_actively_waiting_for_clock_restore = false;
}
is_states_saved = false;
}
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Do clock restore process and wait for it to be completed.
******************************************************************************/ | Do clock restore process and wait for it to be completed. | [
"Do",
"clock",
"restore",
"process",
"and",
"wait",
"for",
"it",
"to",
"be",
"completed",
"."
] | static void clock_restore_and_wait(void)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
if (is_states_saved == true) {
if (is_actively_waiting_for_clock_restore == false) {
is_actively_waiting_for_clock_restore = true;
is_sleeping_waiting_for_clock_restore = false;
}
if (is_hf_x_oscillator_not_preserved) {
sli_power_manager_restore_high_freq_accuracy_clk();
is_hf_x_oscillator_not_preserved = false;
}
CORE_EXIT_CRITICAL();
sli_power_manager_is_high_freq_accuracy_clk_ready(true);
CORE_ENTER_CRITICAL();
if (is_actively_waiting_for_clock_restore) {
sli_power_manager_restore_states();
is_actively_waiting_for_clock_restore = false;
}
is_states_saved = false;
}
CORE_EXIT_CRITICAL();
} | [
"static",
"void",
"clock_restore_and_wait",
"(",
"void",
")",
"{",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"if",
"(",
"is_states_saved",
"==",
"true",
")",
"{",
"if",
"(",
"is_actively_waiting_for_clock_restore",
"==",
"false",
")",
"{",
"is_actively_waiting_for_clock_restore",
"=",
"true",
";",
"is_sleeping_waiting_for_clock_restore",
"=",
"false",
";",
"}",
"if",
"(",
"is_hf_x_oscillator_not_preserved",
")",
"{",
"sli_power_manager_restore_high_freq_accuracy_clk",
"(",
")",
";",
"is_hf_x_oscillator_not_preserved",
"=",
"false",
";",
"}",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"sli_power_manager_is_high_freq_accuracy_clk_ready",
"(",
"true",
")",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"if",
"(",
"is_actively_waiting_for_clock_restore",
")",
"{",
"sli_power_manager_restore_states",
"(",
")",
";",
"is_actively_waiting_for_clock_restore",
"=",
"false",
";",
"}",
"is_states_saved",
"=",
"false",
";",
"}",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Do clock restore process and wait for it to be completed. | [
"Do",
"clock",
"restore",
"process",
"and",
"wait",
"for",
"it",
"to",
"be",
"completed",
"."
] | [
"// Since we will actively wait for clock restore, we cancel any current non-active wait.",
"// We remove the critical section in case HFXO fails to startup and the HFXO Interrupt needs to run to handle the error."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | clock_restore | void | static void clock_restore(void)
{
// Check if we need to start the clock restore process
if (is_states_saved == true) {
if (is_hf_x_oscillator_not_preserved) {
sli_power_manager_restore_high_freq_accuracy_clk();
is_hf_x_oscillator_not_preserved = false;
}
if (sli_power_manager_is_high_freq_accuracy_clk_ready(false)) {
// Do the clock restore if the HF oscillator is already ready
sli_power_manager_restore_states();
is_states_saved = false;
// We do the notification only when the restore is completed.
power_manager_notify_em_transition(current_em, SL_POWER_MANAGER_EM1);
current_em = SL_POWER_MANAGER_EM1; // Keep new active energy mode
} else {
// If the HF oscillator is not yet ready, we will go back to sleep while waiting
is_sleeping_waiting_for_clock_restore = true;
// Save current EM to do the right notification later
waiting_clock_restore_from_em = current_em;
}
}
} | /***************************************************************************/
/**
* Start clock restore process.
*
* @note Need to be call inside a critical section.
******************************************************************************/ | Start clock restore process.
@note Need to be call inside a critical section. | [
"Start",
"clock",
"restore",
"process",
".",
"@note",
"Need",
"to",
"be",
"call",
"inside",
"a",
"critical",
"section",
"."
] | static void clock_restore(void)
{
if (is_states_saved == true) {
if (is_hf_x_oscillator_not_preserved) {
sli_power_manager_restore_high_freq_accuracy_clk();
is_hf_x_oscillator_not_preserved = false;
}
if (sli_power_manager_is_high_freq_accuracy_clk_ready(false)) {
sli_power_manager_restore_states();
is_states_saved = false;
power_manager_notify_em_transition(current_em, SL_POWER_MANAGER_EM1);
current_em = SL_POWER_MANAGER_EM1;
} else {
is_sleeping_waiting_for_clock_restore = true;
waiting_clock_restore_from_em = current_em;
}
}
} | [
"static",
"void",
"clock_restore",
"(",
"void",
")",
"{",
"if",
"(",
"is_states_saved",
"==",
"true",
")",
"{",
"if",
"(",
"is_hf_x_oscillator_not_preserved",
")",
"{",
"sli_power_manager_restore_high_freq_accuracy_clk",
"(",
")",
";",
"is_hf_x_oscillator_not_preserved",
"=",
"false",
";",
"}",
"if",
"(",
"sli_power_manager_is_high_freq_accuracy_clk_ready",
"(",
"false",
")",
")",
"{",
"sli_power_manager_restore_states",
"(",
")",
";",
"is_states_saved",
"=",
"false",
";",
"power_manager_notify_em_transition",
"(",
"current_em",
",",
"SL_POWER_MANAGER_EM1",
")",
";",
"current_em",
"=",
"SL_POWER_MANAGER_EM1",
";",
"}",
"else",
"{",
"is_sleeping_waiting_for_clock_restore",
"=",
"true",
";",
"waiting_clock_restore_from_em",
"=",
"current_em",
";",
"}",
"}",
"}"
] | Start clock restore process. | [
"Start",
"clock",
"restore",
"process",
"."
] | [
"// Check if we need to start the clock restore process",
"// Do the clock restore if the HF oscillator is already ready",
"// We do the notification only when the restore is completed.",
"// Keep new active energy mode",
"// If the HF oscillator is not yet ready, we will go back to sleep while waiting",
"// Save current EM to do the right notification later"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | on_clock_wakeup_timeout | void | static void on_clock_wakeup_timeout(sl_sleeptimer_timer_handle_t *handle,
void *data)
{
(void)handle;
(void)data;
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
if (is_actively_waiting_for_clock_restore) {
// In case we are already actively waiting for HFXO ready in another ISR, just exit
CORE_EXIT_CRITICAL();
return;
}
// If needed start the clock restore process
clock_restore();
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Callback for clock enable timer.
*
* @param handle Pointer to sleeptimer handle
*
* @param data Pointer to callback data
*
* @note We restore the HF clocks and go to EM1 here to be ready in time for the
* Application sleeptimer callback. But no EM1 requirement is added
* here. Since the time until the Application sleeptimer times out is <=
* than the wake-up delay, it protects us from going back to sleep lower
* than EM1. After that, it's up to the Application sleeptimer callback to
* put a EM1 requirement if still needed.
******************************************************************************/ | Callback for clock enable timer.
@param handle Pointer to sleeptimer handle
@param data Pointer to callback data
@note We restore the HF clocks and go to EM1 here to be ready in time for the
Application sleeptimer callback. But no EM1 requirement is added
here. Since the time until the Application sleeptimer times out is <
than the wake-up delay, it protects us from going back to sleep lower
than EM1. After that, it's up to the Application sleeptimer callback to
put a EM1 requirement if still needed. | [
"Callback",
"for",
"clock",
"enable",
"timer",
".",
"@param",
"handle",
"Pointer",
"to",
"sleeptimer",
"handle",
"@param",
"data",
"Pointer",
"to",
"callback",
"data",
"@note",
"We",
"restore",
"the",
"HF",
"clocks",
"and",
"go",
"to",
"EM1",
"here",
"to",
"be",
"ready",
"in",
"time",
"for",
"the",
"Application",
"sleeptimer",
"callback",
".",
"But",
"no",
"EM1",
"requirement",
"is",
"added",
"here",
".",
"Since",
"the",
"time",
"until",
"the",
"Application",
"sleeptimer",
"times",
"out",
"is",
"<",
"than",
"the",
"wake",
"-",
"up",
"delay",
"it",
"protects",
"us",
"from",
"going",
"back",
"to",
"sleep",
"lower",
"than",
"EM1",
".",
"After",
"that",
"it",
"'",
"s",
"up",
"to",
"the",
"Application",
"sleeptimer",
"callback",
"to",
"put",
"a",
"EM1",
"requirement",
"if",
"still",
"needed",
"."
] | static void on_clock_wakeup_timeout(sl_sleeptimer_timer_handle_t *handle,
void *data)
{
(void)handle;
(void)data;
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
if (is_actively_waiting_for_clock_restore) {
CORE_EXIT_CRITICAL();
return;
}
clock_restore();
CORE_EXIT_CRITICAL();
} | [
"static",
"void",
"on_clock_wakeup_timeout",
"(",
"sl_sleeptimer_timer_handle_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"handle",
";",
"(",
"void",
")",
"data",
";",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"if",
"(",
"is_actively_waiting_for_clock_restore",
")",
"{",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"return",
";",
"}",
"clock_restore",
"(",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Callback for clock enable timer. | [
"Callback",
"for",
"clock",
"enable",
"timer",
"."
] | [
"// In case we are already actively waiting for HFXO ready in another ISR, just exit",
"// If needed start the clock restore process"
] | [
{
"param": "handle",
"type": "sl_sleeptimer_timer_handle_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_sleeptimer_timer_handle_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sli_hfxo_manager_notify_ready_for_power_manager | void | void sli_hfxo_manager_notify_ready_for_power_manager(void)
{
// Notify transition to EM1 once HFXO is ready
// We should only notify here in the case of early wakeup, since we go back
// to sleep in EM1 during the wait for HFXO ready.
if (current_em != SL_POWER_MANAGER_EM0
&& is_sleeping_waiting_for_clock_restore == true) {
sli_power_manager_restore_states();
power_manager_notify_em_transition(waiting_clock_restore_from_em, SL_POWER_MANAGER_EM1);
current_em = SL_POWER_MANAGER_EM1;
is_sleeping_waiting_for_clock_restore = false;
is_states_saved = false;
is_restored_from_hfxo_isr = true;
}
} | /***************************************************************************/
/**
* HFXO ready notification callback for internal use with power manager
*
* @note Will only be used on series 2 devices when HFXO Manager is present.
******************************************************************************/ | HFXO ready notification callback for internal use with power manager
@note Will only be used on series 2 devices when HFXO Manager is present. | [
"HFXO",
"ready",
"notification",
"callback",
"for",
"internal",
"use",
"with",
"power",
"manager",
"@note",
"Will",
"only",
"be",
"used",
"on",
"series",
"2",
"devices",
"when",
"HFXO",
"Manager",
"is",
"present",
"."
] | void sli_hfxo_manager_notify_ready_for_power_manager(void)
{
if (current_em != SL_POWER_MANAGER_EM0
&& is_sleeping_waiting_for_clock_restore == true) {
sli_power_manager_restore_states();
power_manager_notify_em_transition(waiting_clock_restore_from_em, SL_POWER_MANAGER_EM1);
current_em = SL_POWER_MANAGER_EM1;
is_sleeping_waiting_for_clock_restore = false;
is_states_saved = false;
is_restored_from_hfxo_isr = true;
}
} | [
"void",
"sli_hfxo_manager_notify_ready_for_power_manager",
"(",
"void",
")",
"{",
"if",
"(",
"current_em",
"!=",
"SL_POWER_MANAGER_EM0",
"&&",
"is_sleeping_waiting_for_clock_restore",
"==",
"true",
")",
"{",
"sli_power_manager_restore_states",
"(",
")",
";",
"power_manager_notify_em_transition",
"(",
"waiting_clock_restore_from_em",
",",
"SL_POWER_MANAGER_EM1",
")",
";",
"current_em",
"=",
"SL_POWER_MANAGER_EM1",
";",
"is_sleeping_waiting_for_clock_restore",
"=",
"false",
";",
"is_states_saved",
"=",
"false",
";",
"is_restored_from_hfxo_isr",
"=",
"true",
";",
"}",
"}"
] | HFXO ready notification callback for internal use with power manager
@note Will only be used on series 2 devices when HFXO Manager is present. | [
"HFXO",
"ready",
"notification",
"callback",
"for",
"internal",
"use",
"with",
"power",
"manager",
"@note",
"Will",
"only",
"be",
"used",
"on",
"series",
"2",
"devices",
"when",
"HFXO",
"Manager",
"is",
"present",
"."
] | [
"// Notify transition to EM1 once HFXO is ready",
"// We should only notify here in the case of early wakeup, since we go back",
"// to sleep in EM1 during the wait for HFXO ready."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
466abd8b4ee1f1f51984ffb7dc6c26dadabc26b8 | SiliconLabs/Gecko_SDK | platform/service/power_manager/src/sl_power_manager.c | [
"Zlib"
] | C | sl_power_manager_em23_voltage_scaling_enable_fast_wakeup | void | void sl_power_manager_em23_voltage_scaling_enable_fast_wakeup(bool enable)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
sli_power_manager_em23_voltage_scaling_enable_fast_wakeup(enable);
CORE_EXIT_CRITICAL();
} | /***************************************************************************/
/**
* Enable or disable fast wake-up in EM2 and EM3
*
* @note Will also update the wake up time from EM2 to EM0.
******************************************************************************/ | Enable or disable fast wake-up in EM2 and EM3
@note Will also update the wake up time from EM2 to EM0. | [
"Enable",
"or",
"disable",
"fast",
"wake",
"-",
"up",
"in",
"EM2",
"and",
"EM3",
"@note",
"Will",
"also",
"update",
"the",
"wake",
"up",
"time",
"from",
"EM2",
"to",
"EM0",
"."
] | void sl_power_manager_em23_voltage_scaling_enable_fast_wakeup(bool enable)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
sli_power_manager_em23_voltage_scaling_enable_fast_wakeup(enable);
CORE_EXIT_CRITICAL();
} | [
"void",
"sl_power_manager_em23_voltage_scaling_enable_fast_wakeup",
"(",
"bool",
"enable",
")",
"{",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"sli_power_manager_em23_voltage_scaling_enable_fast_wakeup",
"(",
"enable",
")",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"}"
] | Enable or disable fast wake-up in EM2 and EM3
@note Will also update the wake up time from EM2 to EM0. | [
"Enable",
"or",
"disable",
"fast",
"wake",
"-",
"up",
"in",
"EM2",
"and",
"EM3",
"@note",
"Will",
"also",
"update",
"the",
"wake",
"up",
"time",
"from",
"EM2",
"to",
"EM0",
"."
] | [] | [
{
"param": "enable",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "enable",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4018bface0ebc61aef4578b186351cf89939ee88 | SiliconLabs/Gecko_SDK | app/bluetooth/common_host/host_comm/host_comm.c | [
"Zlib"
] | C | host_comm_set_option | sl_status_t | sl_status_t host_comm_set_option(char option, char *value)
{
sl_status_t sc = SL_STATUS_OK;
switch (option) {
// TCP/IP address.
case 't':
strncpy(tcp_address, value, MAX_OPT_LEN);
break;
// UART serial port.
case 'u':
strncpy(uart_port, value, MAX_OPT_LEN);
break;
// UART baud rate.
case 'b':
uart_baud_rate = atol(value);
break;
// UART flow control disable.
case 'f':
uart_flow_control = 1;
break;
#if defined(POSIX) && POSIX == 1
// AF socket descriptor
case 'n':
strncpy(named_socket_target_address, value, MAX_OPT_LEN);
break;
#endif // defined(POSIX) && POSIX == 1
// Unknown option.
default:
sc = SL_STATUS_NOT_FOUND;
break;
}
return sc;
} | /**************************************************************************/
/**
* Set low level host communication connection options.
*****************************************************************************/ | Set low level host communication connection options. | [
"Set",
"low",
"level",
"host",
"communication",
"connection",
"options",
"."
] | sl_status_t host_comm_set_option(char option, char *value)
{
sl_status_t sc = SL_STATUS_OK;
switch (option) {
case 't':
strncpy(tcp_address, value, MAX_OPT_LEN);
break;
case 'u':
strncpy(uart_port, value, MAX_OPT_LEN);
break;
case 'b':
uart_baud_rate = atol(value);
break;
case 'f':
uart_flow_control = 1;
break;
#if defined(POSIX) && POSIX == 1
case 'n':
strncpy(named_socket_target_address, value, MAX_OPT_LEN);
break;
#endif
default:
sc = SL_STATUS_NOT_FOUND;
break;
}
return sc;
} | [
"sl_status_t",
"host_comm_set_option",
"(",
"char",
"option",
",",
"char",
"*",
"value",
")",
"{",
"sl_status_t",
"sc",
"=",
"SL_STATUS_OK",
";",
"switch",
"(",
"option",
")",
"{",
"case",
"'",
"'",
":",
"strncpy",
"(",
"tcp_address",
",",
"value",
",",
"MAX_OPT_LEN",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"strncpy",
"(",
"uart_port",
",",
"value",
",",
"MAX_OPT_LEN",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"uart_baud_rate",
"=",
"atol",
"(",
"value",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"uart_flow_control",
"=",
"1",
";",
"break",
";",
"#if",
"defined",
"(",
"POSIX",
")",
"&&",
"POSIX",
"==",
"1",
"\n",
"case",
"'",
"'",
":",
"strncpy",
"(",
"named_socket_target_address",
",",
"value",
",",
"MAX_OPT_LEN",
")",
";",
"break",
";",
"#endif",
"default",
":",
"sc",
"=",
"SL_STATUS_NOT_FOUND",
";",
"break",
";",
"}",
"return",
"sc",
";",
"}"
] | Set low level host communication connection options. | [
"Set",
"low",
"level",
"host",
"communication",
"connection",
"options",
"."
] | [
"// TCP/IP address.",
"// UART serial port.",
"// UART baud rate.",
"// UART flow control disable.",
"// AF socket descriptor",
"// defined(POSIX) && POSIX == 1",
"// Unknown option."
] | [
{
"param": "option",
"type": "char"
},
{
"param": "value",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "option",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4018bface0ebc61aef4578b186351cf89939ee88 | SiliconLabs/Gecko_SDK | app/bluetooth/common_host/host_comm/host_comm.c | [
"Zlib"
] | C | host_comm_peek | int32_t | int32_t host_comm_peek(void)
{
int32_t len = 0;
pthread_mutex_lock(&mutex);
len = buf_in.len;
pthread_mutex_unlock(&mutex);
return len;
} | /**************************************************************************/
/**
* Peek if readable data exists.
*****************************************************************************/ | Peek if readable data exists. | [
"Peek",
"if",
"readable",
"data",
"exists",
"."
] | int32_t host_comm_peek(void)
{
int32_t len = 0;
pthread_mutex_lock(&mutex);
len = buf_in.len;
pthread_mutex_unlock(&mutex);
return len;
} | [
"int32_t",
"host_comm_peek",
"(",
"void",
")",
"{",
"int32_t",
"len",
"=",
"0",
";",
"pthread_mutex_lock",
"(",
"&",
"mutex",
")",
";",
"len",
"=",
"buf_in",
".",
"len",
";",
"pthread_mutex_unlock",
"(",
"&",
"mutex",
")",
";",
"return",
"len",
";",
"}"
] | Peek if readable data exists. | [
"Peek",
"if",
"readable",
"data",
"exists",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_lpn_on_init | void | void sl_btmesh_lpn_on_init(void)
{
app_log("BT mesh LPN on\r\n");
sl_status_t status = sl_btmesh_LCD_write("LPN on", BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the Low Power Node is initialized.
******************************************************************************/ | Called when the Low Power Node is initialized. | [
"Called",
"when",
"the",
"Low",
"Power",
"Node",
"is",
"initialized",
"."
] | void sl_btmesh_lpn_on_init(void)
{
app_log("BT mesh LPN on\r\n");
sl_status_t status = sl_btmesh_LCD_write("LPN on", BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_lpn_on_init",
"(",
"void",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_LPN",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the Low Power Node is initialized. | [
"Called",
"when",
"the",
"Low",
"Power",
"Node",
"is",
"initialized",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_lpn_on_deinit | void | void sl_btmesh_lpn_on_deinit(void)
{
app_log("BT mesh LPN off\r\n");
sl_status_t status = sl_btmesh_LCD_write("LPN off", BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the Low Power Node is deinitialized.
******************************************************************************/ | Called when the Low Power Node is deinitialized. | [
"Called",
"when",
"the",
"Low",
"Power",
"Node",
"is",
"deinitialized",
"."
] | void sl_btmesh_lpn_on_deinit(void)
{
app_log("BT mesh LPN off\r\n");
sl_status_t status = sl_btmesh_LCD_write("LPN off", BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_lpn_on_deinit",
"(",
"void",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_LPN",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the Low Power Node is deinitialized. | [
"Called",
"when",
"the",
"Low",
"Power",
"Node",
"is",
"deinitialized",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_lpn_on_friendship_established | void | void sl_btmesh_lpn_on_friendship_established(uint16_t node_address)
{
app_log("BT mesh LPN with friend (node address: 0x%04x)\r\n", node_address);
sl_status_t status = sl_btmesh_LCD_write("LPN with friend",
BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the Low Power Node establishes friendship with another node
******************************************************************************/ | Called when the Low Power Node establishes friendship with another node | [
"Called",
"when",
"the",
"Low",
"Power",
"Node",
"establishes",
"friendship",
"with",
"another",
"node"
] | void sl_btmesh_lpn_on_friendship_established(uint16_t node_address)
{
app_log("BT mesh LPN with friend (node address: 0x%04x)\r\n", node_address);
sl_status_t status = sl_btmesh_LCD_write("LPN with friend",
BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_lpn_on_friendship_established",
"(",
"uint16_t",
"node_address",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"node_address",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_LPN",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the Low Power Node establishes friendship with another node | [
"Called",
"when",
"the",
"Low",
"Power",
"Node",
"establishes",
"friendship",
"with",
"another",
"node"
] | [] | [
{
"param": "node_address",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node_address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_lpn_on_friendship_failed | void | void sl_btmesh_lpn_on_friendship_failed(uint16_t reason)
{
app_log("BT mesh No friend (reason: 0x%04x)\r\n", reason);
sl_status_t status = sl_btmesh_LCD_write("No friend",
BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when the friendship establishment attempt of Low Power Node fails
******************************************************************************/ | Called when the friendship establishment attempt of Low Power Node fails | [
"Called",
"when",
"the",
"friendship",
"establishment",
"attempt",
"of",
"Low",
"Power",
"Node",
"fails"
] | void sl_btmesh_lpn_on_friendship_failed(uint16_t reason)
{
app_log("BT mesh No friend (reason: 0x%04x)\r\n", reason);
sl_status_t status = sl_btmesh_LCD_write("No friend",
BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_lpn_on_friendship_failed",
"(",
"uint16_t",
"reason",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"reason",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_LPN",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when the friendship establishment attempt of Low Power Node fails | [
"Called",
"when",
"the",
"friendship",
"establishment",
"attempt",
"of",
"Low",
"Power",
"Node",
"fails"
] | [] | [
{
"param": "reason",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "reason",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_lpn_on_friendship_terminated | void | void sl_btmesh_lpn_on_friendship_terminated(uint16_t reason)
{
app_log("BT mesh Friend lost (reason: 0x%04x)\r\n", reason);
sl_status_t status = sl_btmesh_LCD_write("Friend lost",
BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when friendship that was successfully established has been terminated
******************************************************************************/ | Called when friendship that was successfully established has been terminated | [
"Called",
"when",
"friendship",
"that",
"was",
"successfully",
"established",
"has",
"been",
"terminated"
] | void sl_btmesh_lpn_on_friendship_terminated(uint16_t reason)
{
app_log("BT mesh Friend lost (reason: 0x%04x)\r\n", reason);
sl_status_t status = sl_btmesh_LCD_write("Friend lost",
BTMESH_WSTK_LCD_ROW_LPN);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_lpn_on_friendship_terminated",
"(",
"uint16_t",
"reason",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"reason",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_LPN",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when friendship that was successfully established has been terminated | [
"Called",
"when",
"friendship",
"that",
"was",
"successfully",
"established",
"has",
"been",
"terminated"
] | [] | [
{
"param": "reason",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "reason",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_on_provision_init_status | void | void sl_btmesh_on_provision_init_status(bool provisioned,
uint16_t address,
uint32_t iv_index)
{
if (provisioned) {
app_show_btmesh_node_provisioned(address, iv_index);
} else {
app_log("BT mesh node is unprovisioned, started unprovisioned beaconing...\r\n");
sl_status_t status = sl_btmesh_LCD_write("unprovisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
}
} | /*******************************************************************************
* Called at node initialization time to provide provisioning information
******************************************************************************/ | Called at node initialization time to provide provisioning information | [
"Called",
"at",
"node",
"initialization",
"time",
"to",
"provide",
"provisioning",
"information"
] | void sl_btmesh_on_provision_init_status(bool provisioned,
uint16_t address,
uint32_t iv_index)
{
if (provisioned) {
app_show_btmesh_node_provisioned(address, iv_index);
} else {
app_log("BT mesh node is unprovisioned, started unprovisioned beaconing...\r\n");
sl_status_t status = sl_btmesh_LCD_write("unprovisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
}
} | [
"void",
"sl_btmesh_on_provision_init_status",
"(",
"bool",
"provisioned",
",",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"if",
"(",
"provisioned",
")",
"{",
"app_show_btmesh_node_provisioned",
"(",
"address",
",",
"iv_index",
")",
";",
"}",
"else",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}",
"}"
] | Called at node initialization time to provide provisioning information | [
"Called",
"at",
"node",
"initialization",
"time",
"to",
"provide",
"provisioning",
"information"
] | [] | [
{
"param": "provisioned",
"type": "bool"
},
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "provisioned",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | app_show_btmesh_node_provisioning_started | void | void app_show_btmesh_node_provisioning_started(uint16_t result)
{
app_log("BT mesh node provisioning is started (result: 0x%04x)\r\n", result);
sl_status_t status = sl_btmesh_LCD_write("provisioning...",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called from sl_btmesh_on_node_provisioning_started callback in app.c
******************************************************************************/ | Called from sl_btmesh_on_node_provisioning_started callback in app.c | [
"Called",
"from",
"sl_btmesh_on_node_provisioning_started",
"callback",
"in",
"app",
".",
"c"
] | void app_show_btmesh_node_provisioning_started(uint16_t result)
{
app_log("BT mesh node provisioning is started (result: 0x%04x)\r\n", result);
sl_status_t status = sl_btmesh_LCD_write("provisioning...",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"app_show_btmesh_node_provisioning_started",
"(",
"uint16_t",
"result",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"result",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called from sl_btmesh_on_node_provisioning_started callback in app.c | [
"Called",
"from",
"sl_btmesh_on_node_provisioning_started",
"callback",
"in",
"app",
".",
"c"
] | [] | [
{
"param": "result",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "result",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | app_show_btmesh_node_provisioned | void | void app_show_btmesh_node_provisioned(uint16_t address,
uint32_t iv_index)
{
app_log("BT mesh node is provisioned (address: 0x%04x, iv_index: 0x%x)\r\n",
address,
iv_index);
sl_status_t status = sl_btmesh_LCD_write("provisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called from sl_btmesh_on_node_provisioned callback in app.c
******************************************************************************/ | Called from sl_btmesh_on_node_provisioned callback in app.c | [
"Called",
"from",
"sl_btmesh_on_node_provisioned",
"callback",
"in",
"app",
".",
"c"
] | void app_show_btmesh_node_provisioned(uint16_t address,
uint32_t iv_index)
{
app_log("BT mesh node is provisioned (address: 0x%04x, iv_index: 0x%x)\r\n",
address,
iv_index);
sl_status_t status = sl_btmesh_LCD_write("provisioned",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"app_show_btmesh_node_provisioned",
"(",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
",",
"address",
",",
"iv_index",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called from sl_btmesh_on_node_provisioned callback in app.c | [
"Called",
"from",
"sl_btmesh_on_node_provisioned",
"callback",
"in",
"app",
".",
"c"
] | [] | [
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
042f0fc09bdf8ec3a9cb885311cb0ae573313d13 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_switch/app_out_lcd.c | [
"Zlib"
] | C | sl_btmesh_factory_reset_on_node_reset | void | void sl_btmesh_factory_reset_on_node_reset(void)
{
app_log("Node reset\r\n");
sl_status_t status = sl_btmesh_LCD_write("Node reset",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | /*******************************************************************************
* Called when node reset is established, before system reset
******************************************************************************/ | Called when node reset is established, before system reset | [
"Called",
"when",
"node",
"reset",
"is",
"established",
"before",
"system",
"reset"
] | void sl_btmesh_factory_reset_on_node_reset(void)
{
app_log("Node reset\r\n");
sl_status_t status = sl_btmesh_LCD_write("Node reset",
BTMESH_WSTK_LCD_ROW_STATUS);
app_log_status_level_f(APP_LOG_LEVEL_ERROR, status, "LCD write failed");
} | [
"void",
"sl_btmesh_factory_reset_on_node_reset",
"(",
"void",
")",
"{",
"app_log",
"(",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"sl_status_t",
"status",
"=",
"sl_btmesh_LCD_write",
"(",
"\"",
"\"",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"app_log_status_level_f",
"(",
"APP_LOG_LEVEL_ERROR",
",",
"status",
",",
"\"",
"\"",
")",
";",
"}"
] | Called when node reset is established, before system reset | [
"Called",
"when",
"node",
"reset",
"is",
"established",
"before",
"system",
"reset"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | ApplicationInit | ZW_APPLICATION_STATUS | ZW_APPLICATION_STATUS
ApplicationInit(EResetReason_t eResetReason)
{
// NULL - We dont have the Application Task handle yet
AppTimerInit(EAPPLICATIONEVENT_TIMER, NULL);
/* hardware initialization */
Board_Init();
BRD420xBoardInit(RadioConfig.eRegion);
#ifdef DEBUGPRINT
#if BUILDING_WITH_UC
DebugPrintConfig(m_aDebugPrintBuffer, sizeof(m_aDebugPrintBuffer), DebugPrinter);
#else
static uint8_t m_aDebugPrintBuffer[96];
ZAF_UART0_enable(115200, true, false);
DebugPrintConfig(m_aDebugPrintBuffer, sizeof(m_aDebugPrintBuffer), ZAF_UART0_tx_send);
#endif // BUILDING_WITH_UC
#endif // DEBUGPRINT
/* Init state machine*/
currentState = STATE_APP_STARTUP;
uint8_t versionMajor = ZAF_GetAppVersionMajor();
uint8_t versionMinor = ZAF_GetAppVersionMinor();
uint8_t versionPatchLevel = ZAF_GetAppVersionPatchLevel();
DPRINT("\n\n-----------------------------\n");
DPRINT("Z-Wave Sample App: Multilevel Sensor \n");
DPRINTF("SDK: %d.%d.%d ZAF: %d.%d.%d.%d [Freq: %d]\n",
SDK_VERSION_MAJOR,
SDK_VERSION_MINOR,
SDK_VERSION_PATCH,
versionMajor,
versionMinor,
versionPatchLevel,
ZAF_BUILD_NO,
RadioConfig.eRegion);
DPRINT("-----------------------------\n");
DPRINTF("%s: Toggle learn mode\n", Board_GetButtonLabel(APP_BUTTON_LEARN_RESET));
DPRINT(" Hold 5 sec: Reset\n");
DPRINTF("%s: Activate event\n", Board_GetButtonLabel(EVENT_BTN));
DPRINT(" (leave deactivated to allow going to sleep)\n");
DPRINTF("%s: Learn mode + identify\n", Board_GetLedLabel(APP_LED_INDICATOR));
DPRINT("-----------------------------\n\n");
DPRINTF("ApplicationInit eResetReason = %d\n", eResetReason);
DPRINTF("Board_GetGpioEm4Flags() = 0b%08x\n", Board_GetGpioEm4Flags());
if (eResetReason == ERESETREASON_EM4_WUT || eResetReason == ERESETREASON_EM4_EXT_INT)
{
#ifdef DEBUGPRINT
Board_DebugPrintEm4WakeupFlags(Board_GetGpioEm4Flags());
#endif
}
CC_ZWavePlusInfo_Init(&CCZWavePlusInfo);
CC_Version_SetApplicationVersionInfo(versionMajor, versionMinor, versionPatchLevel, ZAF_BUILD_NO);
static sl_sensor_interface_t test_sensor_temperature;
sl_cc_multilevel_sensor_init_interface(&test_sensor_temperature, SL_SENSOR_NAME_AIR_TEMPERATURE);
sl_cc_multilevel_sensor_add_supported_scale_interface(&test_sensor_temperature, SL_SENSOR_SCALE_CELSIUS);
sl_cc_multilevel_sensor_add_supported_scale_interface(&test_sensor_temperature, SL_SENSOR_SCALE_FAHRENHEIT);
test_sensor_temperature.init = MultilevelSensor_interface_temperature_init;
test_sensor_temperature.deinit = MultilevelSensor_interface_temperature_deinit;
test_sensor_temperature.read_value = MultilevelSensor_interface_temperature_read;
static sl_sensor_interface_t test_sensor_humidity;
sl_cc_multilevel_sensor_init_interface(&test_sensor_humidity, SL_SENSOR_NAME_HUMIDITY);
sl_cc_multilevel_sensor_add_supported_scale_interface(&test_sensor_humidity, SL_SENSOR_SCALE_PERCENTAGE);
test_sensor_humidity.init = MultilevelSensor_interface_humidity_init;
test_sensor_humidity.deinit = MultilevelSensor_interface_humidity_deinit;
test_sensor_humidity.read_value = MultilevelSensor_interface_humidity_read;
sl_cc_multilevel_sensor_registration(&test_sensor_temperature);
sl_cc_multilevel_sensor_registration(&test_sensor_humidity);
/* Register task function */
/*************************************************************************************
* CREATE USER TASKS - ZW_ApplicationRegisterTask() and ZW_UserTask_CreateTask()
*************************************************************************************
* Register the main APP task function.
*
* ATTENTION: This function is the only task that can call ZAF aPI functions!!!
* Failure to follow guidelines will result in undefined behavior.
*
* This function further is the only way to register Event Notification Bit Numbers
* for associating to given event handlers.
*
* ZW_UserTask_CreateTask() can be used to create additional tasks.
* @see Sensor_MultiThread example for more info.
*************************************************************************************/
bool bWasTaskCreated = ZW_ApplicationRegisterTask(
ApplicationTask,
EAPPLICATIONEVENT_ZWRX,
EAPPLICATIONEVENT_ZWCOMMANDSTATUS,
&ProtocolConfig
);
ASSERT(bWasTaskCreated);
/*****************************************************
* This is an multi-threaded application example!
*
* This next section creates the additional threads
* by using ZW_UserTask.h API.
*
* If a multi-threaded application is not needed,
* this next section can be removed by setting the
* macro CREATE_USER_TASK to zero.
****************************************************/
#if CREATE_USER_TASK
// Create the buffer bundle!
ZW_UserTask_Buffer_t mainAppTaskBuffer;
mainAppTaskBuffer.taskBuffer = &DataAcquisitionTaskBuffer;
mainAppTaskBuffer.stackBuffer = DataAcquisitionStackBuffer;
mainAppTaskBuffer.stackBufferLength = TASK_STACK_SIZE_DATA_ACQUISITION;
// Create the task setting-structure!
ZW_UserTask_t task;
task.pTaskFunc = (TaskFunction_t)Sensor_DataAcquisitionTask;
task.pTaskName = "DataAcqu";
task.pUserTaskParam = NULL; // We pass nothing here, as the EventHelper is already initialized and can be used for task IPC!
task.priority = USERTASK_PRIORITY_HIGHEST; // The difficult example is with the HIGHEST priority.
task.taskBuffer = &mainAppTaskBuffer;
// Create the task!
ZW_UserTask_CreateTask(&task, &m_xTaskHandleDataAcquisition);
#endif //CREATE_USER_TASK
return(APPLICATION_RUNNING);
} | /**
* @brief See description for function prototype in ZW_basis_api.h.
*/ | @brief See description for function prototype in ZW_basis_api.h. | [
"@brief",
"See",
"description",
"for",
"function",
"prototype",
"in",
"ZW_basis_api",
".",
"h",
"."
] | ZW_APPLICATION_STATUS
ApplicationInit(EResetReason_t eResetReason)
{
AppTimerInit(EAPPLICATIONEVENT_TIMER, NULL);
Board_Init();
BRD420xBoardInit(RadioConfig.eRegion);
#ifdef DEBUGPRINT
#if BUILDING_WITH_UC
DebugPrintConfig(m_aDebugPrintBuffer, sizeof(m_aDebugPrintBuffer), DebugPrinter);
#else
static uint8_t m_aDebugPrintBuffer[96];
ZAF_UART0_enable(115200, true, false);
DebugPrintConfig(m_aDebugPrintBuffer, sizeof(m_aDebugPrintBuffer), ZAF_UART0_tx_send);
#endif
#endif
currentState = STATE_APP_STARTUP;
uint8_t versionMajor = ZAF_GetAppVersionMajor();
uint8_t versionMinor = ZAF_GetAppVersionMinor();
uint8_t versionPatchLevel = ZAF_GetAppVersionPatchLevel();
DPRINT("\n\n-----------------------------\n");
DPRINT("Z-Wave Sample App: Multilevel Sensor \n");
DPRINTF("SDK: %d.%d.%d ZAF: %d.%d.%d.%d [Freq: %d]\n",
SDK_VERSION_MAJOR,
SDK_VERSION_MINOR,
SDK_VERSION_PATCH,
versionMajor,
versionMinor,
versionPatchLevel,
ZAF_BUILD_NO,
RadioConfig.eRegion);
DPRINT("-----------------------------\n");
DPRINTF("%s: Toggle learn mode\n", Board_GetButtonLabel(APP_BUTTON_LEARN_RESET));
DPRINT(" Hold 5 sec: Reset\n");
DPRINTF("%s: Activate event\n", Board_GetButtonLabel(EVENT_BTN));
DPRINT(" (leave deactivated to allow going to sleep)\n");
DPRINTF("%s: Learn mode + identify\n", Board_GetLedLabel(APP_LED_INDICATOR));
DPRINT("-----------------------------\n\n");
DPRINTF("ApplicationInit eResetReason = %d\n", eResetReason);
DPRINTF("Board_GetGpioEm4Flags() = 0b%08x\n", Board_GetGpioEm4Flags());
if (eResetReason == ERESETREASON_EM4_WUT || eResetReason == ERESETREASON_EM4_EXT_INT)
{
#ifdef DEBUGPRINT
Board_DebugPrintEm4WakeupFlags(Board_GetGpioEm4Flags());
#endif
}
CC_ZWavePlusInfo_Init(&CCZWavePlusInfo);
CC_Version_SetApplicationVersionInfo(versionMajor, versionMinor, versionPatchLevel, ZAF_BUILD_NO);
static sl_sensor_interface_t test_sensor_temperature;
sl_cc_multilevel_sensor_init_interface(&test_sensor_temperature, SL_SENSOR_NAME_AIR_TEMPERATURE);
sl_cc_multilevel_sensor_add_supported_scale_interface(&test_sensor_temperature, SL_SENSOR_SCALE_CELSIUS);
sl_cc_multilevel_sensor_add_supported_scale_interface(&test_sensor_temperature, SL_SENSOR_SCALE_FAHRENHEIT);
test_sensor_temperature.init = MultilevelSensor_interface_temperature_init;
test_sensor_temperature.deinit = MultilevelSensor_interface_temperature_deinit;
test_sensor_temperature.read_value = MultilevelSensor_interface_temperature_read;
static sl_sensor_interface_t test_sensor_humidity;
sl_cc_multilevel_sensor_init_interface(&test_sensor_humidity, SL_SENSOR_NAME_HUMIDITY);
sl_cc_multilevel_sensor_add_supported_scale_interface(&test_sensor_humidity, SL_SENSOR_SCALE_PERCENTAGE);
test_sensor_humidity.init = MultilevelSensor_interface_humidity_init;
test_sensor_humidity.deinit = MultilevelSensor_interface_humidity_deinit;
test_sensor_humidity.read_value = MultilevelSensor_interface_humidity_read;
sl_cc_multilevel_sensor_registration(&test_sensor_temperature);
sl_cc_multilevel_sensor_registration(&test_sensor_humidity);
bool bWasTaskCreated = ZW_ApplicationRegisterTask(
ApplicationTask,
EAPPLICATIONEVENT_ZWRX,
EAPPLICATIONEVENT_ZWCOMMANDSTATUS,
&ProtocolConfig
);
ASSERT(bWasTaskCreated);
#if CREATE_USER_TASK
ZW_UserTask_Buffer_t mainAppTaskBuffer;
mainAppTaskBuffer.taskBuffer = &DataAcquisitionTaskBuffer;
mainAppTaskBuffer.stackBuffer = DataAcquisitionStackBuffer;
mainAppTaskBuffer.stackBufferLength = TASK_STACK_SIZE_DATA_ACQUISITION;
ZW_UserTask_t task;
task.pTaskFunc = (TaskFunction_t)Sensor_DataAcquisitionTask;
task.pTaskName = "DataAcqu";
task.pUserTaskParam = NULL;
task.priority = USERTASK_PRIORITY_HIGHEST;
task.taskBuffer = &mainAppTaskBuffer;
ZW_UserTask_CreateTask(&task, &m_xTaskHandleDataAcquisition);
#endif
return(APPLICATION_RUNNING);
} | [
"ZW_APPLICATION_STATUS",
"ApplicationInit",
"(",
"EResetReason_t",
"eResetReason",
")",
"{",
"AppTimerInit",
"(",
"EAPPLICATIONEVENT_TIMER",
",",
"NULL",
")",
";",
"Board_Init",
"(",
")",
";",
"BRD420xBoardInit",
"(",
"RadioConfig",
".",
"eRegion",
")",
";",
"#ifdef",
"DEBUGPRINT",
"#if",
"BUILDING_WITH_UC",
"\n",
"DebugPrintConfig",
"(",
"m_aDebugPrintBuffer",
",",
"sizeof",
"(",
"m_aDebugPrintBuffer",
")",
",",
"DebugPrinter",
")",
";",
"#else",
"static",
"uint8_t",
"m_aDebugPrintBuffer",
"[",
"96",
"]",
";",
"ZAF_UART0_enable",
"(",
"115200",
",",
"true",
",",
"false",
")",
";",
"DebugPrintConfig",
"(",
"m_aDebugPrintBuffer",
",",
"sizeof",
"(",
"m_aDebugPrintBuffer",
")",
",",
"ZAF_UART0_tx_send",
")",
";",
"#endif",
"#endif",
"currentState",
"=",
"STATE_APP_STARTUP",
";",
"uint8_t",
"versionMajor",
"=",
"ZAF_GetAppVersionMajor",
"(",
")",
";",
"uint8_t",
"versionMinor",
"=",
"ZAF_GetAppVersionMinor",
"(",
")",
";",
"uint8_t",
"versionPatchLevel",
"=",
"ZAF_GetAppVersionPatchLevel",
"(",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\\n",
"\\n",
"\"",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"SDK_VERSION_MAJOR",
",",
"SDK_VERSION_MINOR",
",",
"SDK_VERSION_PATCH",
",",
"versionMajor",
",",
"versionMinor",
",",
"versionPatchLevel",
",",
"ZAF_BUILD_NO",
",",
"RadioConfig",
".",
"eRegion",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"Board_GetButtonLabel",
"(",
"APP_BUTTON_LEARN_RESET",
")",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"Board_GetButtonLabel",
"(",
"EVENT_BTN",
")",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"Board_GetLedLabel",
"(",
"APP_LED_INDICATOR",
")",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"eResetReason",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"Board_GetGpioEm4Flags",
"(",
")",
")",
";",
"if",
"(",
"eResetReason",
"==",
"ERESETREASON_EM4_WUT",
"||",
"eResetReason",
"==",
"ERESETREASON_EM4_EXT_INT",
")",
"{",
"#ifdef",
"DEBUGPRINT",
"Board_DebugPrintEm4WakeupFlags",
"(",
"Board_GetGpioEm4Flags",
"(",
")",
")",
";",
"#endif",
"}",
"CC_ZWavePlusInfo_Init",
"(",
"&",
"CCZWavePlusInfo",
")",
";",
"CC_Version_SetApplicationVersionInfo",
"(",
"versionMajor",
",",
"versionMinor",
",",
"versionPatchLevel",
",",
"ZAF_BUILD_NO",
")",
";",
"static",
"sl_sensor_interface_t",
"test_sensor_temperature",
";",
"sl_cc_multilevel_sensor_init_interface",
"(",
"&",
"test_sensor_temperature",
",",
"SL_SENSOR_NAME_AIR_TEMPERATURE",
")",
";",
"sl_cc_multilevel_sensor_add_supported_scale_interface",
"(",
"&",
"test_sensor_temperature",
",",
"SL_SENSOR_SCALE_CELSIUS",
")",
";",
"sl_cc_multilevel_sensor_add_supported_scale_interface",
"(",
"&",
"test_sensor_temperature",
",",
"SL_SENSOR_SCALE_FAHRENHEIT",
")",
";",
"test_sensor_temperature",
".",
"init",
"=",
"MultilevelSensor_interface_temperature_init",
";",
"test_sensor_temperature",
".",
"deinit",
"=",
"MultilevelSensor_interface_temperature_deinit",
";",
"test_sensor_temperature",
".",
"read_value",
"=",
"MultilevelSensor_interface_temperature_read",
";",
"static",
"sl_sensor_interface_t",
"test_sensor_humidity",
";",
"sl_cc_multilevel_sensor_init_interface",
"(",
"&",
"test_sensor_humidity",
",",
"SL_SENSOR_NAME_HUMIDITY",
")",
";",
"sl_cc_multilevel_sensor_add_supported_scale_interface",
"(",
"&",
"test_sensor_humidity",
",",
"SL_SENSOR_SCALE_PERCENTAGE",
")",
";",
"test_sensor_humidity",
".",
"init",
"=",
"MultilevelSensor_interface_humidity_init",
";",
"test_sensor_humidity",
".",
"deinit",
"=",
"MultilevelSensor_interface_humidity_deinit",
";",
"test_sensor_humidity",
".",
"read_value",
"=",
"MultilevelSensor_interface_humidity_read",
";",
"sl_cc_multilevel_sensor_registration",
"(",
"&",
"test_sensor_temperature",
")",
";",
"sl_cc_multilevel_sensor_registration",
"(",
"&",
"test_sensor_humidity",
")",
";",
"bool",
"bWasTaskCreated",
"=",
"ZW_ApplicationRegisterTask",
"(",
"ApplicationTask",
",",
"EAPPLICATIONEVENT_ZWRX",
",",
"EAPPLICATIONEVENT_ZWCOMMANDSTATUS",
",",
"&",
"ProtocolConfig",
")",
";",
"ASSERT",
"(",
"bWasTaskCreated",
")",
";",
"#if",
"CREATE_USER_TASK",
"\n\n",
"ZW_UserTask_Buffer_t",
"mainAppTaskBuffer",
";",
"mainAppTaskBuffer",
".",
"taskBuffer",
"=",
"&",
"DataAcquisitionTaskBuffer",
";",
"mainAppTaskBuffer",
".",
"stackBuffer",
"=",
"DataAcquisitionStackBuffer",
";",
"mainAppTaskBuffer",
".",
"stackBufferLength",
"=",
"TASK_STACK_SIZE_DATA_ACQUISITION",
";",
"ZW_UserTask_t",
"task",
";",
"task",
".",
"pTaskFunc",
"=",
"(",
"TaskFunction_t",
")",
"Sensor_DataAcquisitionTask",
";",
"task",
".",
"pTaskName",
"=",
"\"",
"\"",
";",
"task",
".",
"pUserTaskParam",
"=",
"NULL",
";",
"task",
".",
"priority",
"=",
"USERTASK_PRIORITY_HIGHEST",
";",
"task",
".",
"taskBuffer",
"=",
"&",
"mainAppTaskBuffer",
";",
"ZW_UserTask_CreateTask",
"(",
"&",
"task",
",",
"&",
"m_xTaskHandleDataAcquisition",
")",
";",
"#endif",
"return",
"(",
"APPLICATION_RUNNING",
")",
";",
"}"
] | @brief See description for function prototype in ZW_basis_api.h. | [
"@brief",
"See",
"description",
"for",
"function",
"prototype",
"in",
"ZW_basis_api",
".",
"h",
"."
] | [
"// NULL - We dont have the Application Task handle yet",
"/* hardware initialization */",
"// BUILDING_WITH_UC",
"// DEBUGPRINT",
"/* Init state machine*/",
"/* Register task function */",
"/*************************************************************************************\n * CREATE USER TASKS - ZW_ApplicationRegisterTask() and ZW_UserTask_CreateTask()\n *************************************************************************************\n * Register the main APP task function.\n *\n * ATTENTION: This function is the only task that can call ZAF aPI functions!!!\n * Failure to follow guidelines will result in undefined behavior.\n *\n * This function further is the only way to register Event Notification Bit Numbers\n * for associating to given event handlers.\n *\n * ZW_UserTask_CreateTask() can be used to create additional tasks.\n * @see Sensor_MultiThread example for more info.\n *************************************************************************************/",
"/*****************************************************\n * This is an multi-threaded application example!\n *\n * This next section creates the additional threads\n * by using ZW_UserTask.h API.\n *\n * If a multi-threaded application is not needed,\n * this next section can be removed by setting the\n * macro CREATE_USER_TASK to zero.\n ****************************************************/",
"// Create the buffer bundle!",
"// Create the task setting-structure!",
"// We pass nothing here, as the EventHelper is already initialized and can be used for task IPC!",
"// The difficult example is with the HIGHEST priority.",
"// Create the task!",
"//CREATE_USER_TASK"
] | [
{
"param": "eResetReason",
"type": "EResetReason_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eResetReason",
"type": "EResetReason_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | ApplicationTask | void | static void
ApplicationTask(SApplicationHandles* pAppHandles)
{
DPRINT("Multilevel Sensor Main App/Task started!\n");
// Init
DPRINT("Enabling watchdog\n");
WDOGn_Enable(DEFAULT_WDOG, true);
g_AppTaskHandle = xTaskGetCurrentTaskHandle();
g_pAppHandles = pAppHandles;
ZAF_Init(g_AppTaskHandle, pAppHandles, &ProtocolConfig, CC_WakeUp_stayAwakeIfActive);
sl_cc_multilevel_sensor_init();
AppTimerSetReceiverTask(g_AppTaskHandle);
/* Make sure to call AppTimerEm4PersistentRegister() _after_ ZAF_Init().
* It will access the app handles */
AppTimerEm4PersistentRegister(&EventJobsTimer, false, ZCB_EventJobsTimer); // register for event jobs timeout event
// Initialize CC Wake Up
CC_WakeUp_setConfiguration(WAKEUP_PAR_DEFAULT_SLEEP_TIME, DEFAULT_SLEEP_TIME);
CC_WakeUp_setConfiguration(WAKEUP_PAR_MAX_SLEEP_TIME, MAX_SLEEP_TIME);
CC_WakeUp_setConfiguration(WAKEUP_PAR_MIN_SLEEP_TIME, MIN_SLEEP_TIME);
CC_WakeUp_setConfiguration(WAKEUP_PAR_SLEEP_STEP, STEP_SLEEP_TIME);
ZAF_PM_Register(&m_RadioPowerLock, PM_TYPE_RADIO);
/*
* Create an initialize some of the modules regarding queue and event handling and passing.
* The UserTask that is dependent on modules initialized here, must be able to detect and wait
* before using these modules. Specially if it has higher priority than this task!
*
* Currently, the UserTask is checking whether zaf_event_helper.h module is ready.
* This module is the last to be initialized!
*/
EventQueueInit();
// Generate event that says the APP is initialized
ZAF_EventHelperEventEnqueue(EVENT_APP_INIT);
//Enables events on test board
Board_EnableButton(APP_BUTTON_LEARN_RESET);
Board_EnableButton(EVENT_BTN);
Board_IndicatorInit(APP_LED_INDICATOR);
Board_IndicateStatus(BOARD_STATUS_IDLE);
CommandClassSupervisionInit(
CC_SUPERVISION_STATUS_UPDATES_NOT_SUPPORTED,
NULL,
NULL);
EventDistributorConfig(
&g_EventDistributor,
sizeof_array(g_aEventHandlerTable),
g_aEventHandlerTable,
NULL
);
DPRINTF("IsWakeupCausedByRtccTimeout=%s\n", (IsWakeupCausedByRtccTimeout()) ? "true" : "false");
DPRINTF("CompletedSleepDurationMs =%u\n", GetCompletedSleepDurationMs());
// Wait for and process events
DPRINT("Multilevel Sensor Event Distributor Started\n");
uint32_t iMaxTaskSleep = 0xFFFFFFFF; // Block forever
for (;;)
{
EventDistributorDistribute(&g_EventDistributor, iMaxTaskSleep, 0);
}
} | /**
* A pointer to this function is passed to ZW_ApplicationRegisterTask() making it the FreeRTOS
* application task.
*/ | A pointer to this function is passed to ZW_ApplicationRegisterTask() making it the FreeRTOS
application task. | [
"A",
"pointer",
"to",
"this",
"function",
"is",
"passed",
"to",
"ZW_ApplicationRegisterTask",
"()",
"making",
"it",
"the",
"FreeRTOS",
"application",
"task",
"."
] | static void
ApplicationTask(SApplicationHandles* pAppHandles)
{
DPRINT("Multilevel Sensor Main App/Task started!\n");
DPRINT("Enabling watchdog\n");
WDOGn_Enable(DEFAULT_WDOG, true);
g_AppTaskHandle = xTaskGetCurrentTaskHandle();
g_pAppHandles = pAppHandles;
ZAF_Init(g_AppTaskHandle, pAppHandles, &ProtocolConfig, CC_WakeUp_stayAwakeIfActive);
sl_cc_multilevel_sensor_init();
AppTimerSetReceiverTask(g_AppTaskHandle);
AppTimerEm4PersistentRegister(&EventJobsTimer, false, ZCB_EventJobsTimer);
ialize CC Wake Up
CC_WakeUp_setConfiguration(WAKEUP_PAR_DEFAULT_SLEEP_TIME, DEFAULT_SLEEP_TIME);
CC_WakeUp_setConfiguration(WAKEUP_PAR_MAX_SLEEP_TIME, MAX_SLEEP_TIME);
CC_WakeUp_setConfiguration(WAKEUP_PAR_MIN_SLEEP_TIME, MIN_SLEEP_TIME);
CC_WakeUp_setConfiguration(WAKEUP_PAR_SLEEP_STEP, STEP_SLEEP_TIME);
ZAF_PM_Register(&m_RadioPowerLock, PM_TYPE_RADIO);
EventQueueInit();
ZAF_EventHelperEventEnqueue(EVENT_APP_INIT);
Board_EnableButton(APP_BUTTON_LEARN_RESET);
Board_EnableButton(EVENT_BTN);
Board_IndicatorInit(APP_LED_INDICATOR);
Board_IndicateStatus(BOARD_STATUS_IDLE);
CommandClassSupervisionInit(
CC_SUPERVISION_STATUS_UPDATES_NOT_SUPPORTED,
NULL,
NULL);
EventDistributorConfig(
&g_EventDistributor,
sizeof_array(g_aEventHandlerTable),
g_aEventHandlerTable,
NULL
);
DPRINTF("IsWakeupCausedByRtccTimeout=%s\n", (IsWakeupCausedByRtccTimeout()) ? "true" : "false");
DPRINTF("CompletedSleepDurationMs =%u\n", GetCompletedSleepDurationMs());
DPRINT("Multilevel Sensor Event Distributor Started\n");
uint32_t iMaxTaskSleep = 0xFFFFFFFF;
for (;;)
{
EventDistributorDistribute(&g_EventDistributor, iMaxTaskSleep, 0);
}
} | [
"static",
"void",
"ApplicationTask",
"(",
"SApplicationHandles",
"*",
"pAppHandles",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"WDOGn_Enable",
"(",
"DEFAULT_WDOG",
",",
"true",
")",
";",
"g_AppTaskHandle",
"=",
"xTaskGetCurrentTaskHandle",
"(",
")",
";",
"g_pAppHandles",
"=",
"pAppHandles",
";",
"ZAF_Init",
"(",
"g_AppTaskHandle",
",",
"pAppHandles",
",",
"&",
"ProtocolConfig",
",",
"CC_WakeUp_stayAwakeIfActive",
")",
";",
"sl_cc_multilevel_sensor_init",
"(",
")",
";",
"AppTimerSetReceiverTask",
"(",
"g_AppTaskHandle",
")",
";",
"AppTimerEm4PersistentRegister",
"(",
"&",
"EventJobsTimer",
",",
"false",
",",
"ZCB_EventJobsTimer",
")",
";",
"CC_WakeUp_setConfiguration",
"(",
"WAKEUP_PAR_DEFAULT_SLEEP_TIME",
",",
"DEFAULT_SLEEP_TIME",
")",
";",
"CC_WakeUp_setConfiguration",
"(",
"WAKEUP_PAR_MAX_SLEEP_TIME",
",",
"MAX_SLEEP_TIME",
")",
";",
"CC_WakeUp_setConfiguration",
"(",
"WAKEUP_PAR_MIN_SLEEP_TIME",
",",
"MIN_SLEEP_TIME",
")",
";",
"CC_WakeUp_setConfiguration",
"(",
"WAKEUP_PAR_SLEEP_STEP",
",",
"STEP_SLEEP_TIME",
")",
";",
"ZAF_PM_Register",
"(",
"&",
"m_RadioPowerLock",
",",
"PM_TYPE_RADIO",
")",
";",
"EventQueueInit",
"(",
")",
";",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_INIT",
")",
";",
"Board_EnableButton",
"(",
"APP_BUTTON_LEARN_RESET",
")",
";",
"Board_EnableButton",
"(",
"EVENT_BTN",
")",
";",
"Board_IndicatorInit",
"(",
"APP_LED_INDICATOR",
")",
";",
"Board_IndicateStatus",
"(",
"BOARD_STATUS_IDLE",
")",
";",
"CommandClassSupervisionInit",
"(",
"CC_SUPERVISION_STATUS_UPDATES_NOT_SUPPORTED",
",",
"NULL",
",",
"NULL",
")",
";",
"EventDistributorConfig",
"(",
"&",
"g_EventDistributor",
",",
"sizeof_array",
"(",
"g_aEventHandlerTable",
")",
",",
"g_aEventHandlerTable",
",",
"NULL",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"IsWakeupCausedByRtccTimeout",
"(",
")",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"GetCompletedSleepDurationMs",
"(",
")",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"uint32_t",
"iMaxTaskSleep",
"=",
"0xFFFFFFFF",
";",
"for",
"(",
";",
";",
")",
"{",
"EventDistributorDistribute",
"(",
"&",
"g_EventDistributor",
",",
"iMaxTaskSleep",
",",
"0",
")",
";",
"}",
"}"
] | A pointer to this function is passed to ZW_ApplicationRegisterTask() making it the FreeRTOS
application task. | [
"A",
"pointer",
"to",
"this",
"function",
"is",
"passed",
"to",
"ZW_ApplicationRegisterTask",
"()",
"making",
"it",
"the",
"FreeRTOS",
"application",
"task",
"."
] | [
"// Init",
"/* Make sure to call AppTimerEm4PersistentRegister() _after_ ZAF_Init().\n * It will access the app handles */",
"// register for event jobs timeout event",
"// Initialize CC Wake Up",
"/*\n * Create an initialize some of the modules regarding queue and event handling and passing.\n * The UserTask that is dependent on modules initialized here, must be able to detect and wait\n * before using these modules. Specially if it has higher priority than this task!\n *\n * Currently, the UserTask is checking whether zaf_event_helper.h module is ready.\n * This module is the last to be initialized!\n */",
"// Generate event that says the APP is initialized",
"//Enables events on test board",
"// Wait for and process events",
"// Block forever"
] | [
{
"param": "pAppHandles",
"type": "SApplicationHandles"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pAppHandles",
"type": "SApplicationHandles",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | AppStateManager | void | void
AppStateManager(EVENT_APP event)
{
DPRINTF("AppStateManager St: %d, Ev: 0x%02x\n", currentState, event);
/*
* Here we handle events that are not evaluated in the context of the app state.
*/
notAppStateDependentActivity(event);
switch(currentState)
{
case STATE_APP_STARTUP:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
}
if (EVENT_APP_INIT == event)
{
/*
* This approach makes it possible to do less initialization before the scheduler starts.
* Hence, this was made to reduce the boot-up time.
*/
doRemainingInitialization();
break;
}
ChangeState(STATE_APP_IDLE);
break;
case STATE_APP_IDLE:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
LoadConfiguration();
}
if (EVENT_APP_SMARTSTART_IN_PROGRESS == event)
{
ChangeState(STATE_APP_LEARN_MODE);
}
if ((BTN_EVENT_SHORT_PRESS(APP_BUTTON_LEARN_RESET) == (BUTTON_EVENT)event) ||
(EVENT_SYSTEM_LEARNMODE_START == (EVENT_SYSTEM)event))
{
if (EINCLUSIONSTATE_EXCLUDED != g_pAppHandles->pNetworkInfo->eInclusionState){
DPRINT("LEARN_MODE_EXCLUSION\n");
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_EXCLUSION_NWE);
}
else{
DPRINT("LEARN_MODE_INCLUSION\n");
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_INCLUSION);
}
Board_IndicateStatus(BOARD_STATUS_LEARNMODE_ACTIVE);
ChangeState(STATE_APP_LEARN_MODE);
}
// Handle received event
if (EVENT_TRANSITION_TO_ACTIVE(event))
{
ZAF_PM_StayAwake(&m_RadioPowerLock, 0);
DPRINT("\n");
DPRINT(" *!*!**!*!**!*!**!*!**!*!**!*!**!*!**!*!*\n");
DPRINT(" *!*!* EVENT ACTIVE *!*!*\n");
DPRINT(" *!*!**!*!**!*!**!*!**!*!**!*!**!*!**!*!*\n");
DPRINT("\n");
ChangeState(STATE_APP_TRANSMIT_DATA);
if (false == ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB))
{
DPRINT("** EVENT_APP_NEXT_EVENT_JOB fail\n");
}
/*Add event's on job-queue*/
ZAF_JobHelperJobEnqueue(EVENT_APP_BASIC_START_JOB);
ZAF_JobHelperJobEnqueue(EVENT_APP_START_TIMER_EVENTJOB_STOP);
}
break;
case STATE_APP_LEARN_MODE:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
LoadConfiguration();
}
if ((BTN_EVENT_SHORT_PRESS(APP_BUTTON_LEARN_RESET) == (BUTTON_EVENT)event) ||
(EVENT_SYSTEM_LEARNMODE_STOP == (EVENT_SYSTEM)event))
{
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_DISABLE);
//Go back to smart start if the node was never included.
//Protocol will not commence SmartStart if the node is already included in the network.
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART);
Board_IndicateStatus(BOARD_STATUS_IDLE);
ChangeState(STATE_APP_IDLE);
/* If we are in a network and the Identify LED state was changed to idle due to learn mode, report it to lifeline */
CC_Indicator_RefreshIndicatorProperties();
ZAF_TSE_Trigger(CC_Indicator_report_stx,
(void *)&ZAF_TSE_localActuationIdentifyData,
true);
}
if (EVENT_SYSTEM_LEARNMODE_FINISHED == (EVENT_SYSTEM)event)
{
//Make sure that the application stays awake for 10 s after learn mode finished
//to wait for more messages from the controller
CC_WakeUp_stayAwake10s();
/* Also tell application to automatically extend the stay awake period by 10
* seconds on message activities - even though we did not get here by a proper
* wakeup from EM4
*/
CC_WakeUp_AutoStayAwakeAfterInclusion();
//Go back to smart start if the node was excluded.
//Protocol will not commence SmartStart if the node is already included in the network.
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART);
Board_IndicateStatus(BOARD_STATUS_IDLE);
ChangeState(STATE_APP_IDLE);
/* If we are in a network and the Identify LED state was changed to idle due to learn mode, report it to lifeline */
CC_Indicator_RefreshIndicatorProperties();
ZAF_TSE_Trigger(CC_Indicator_report_stx,
(void *)&ZAF_TSE_localActuationIdentifyData,
true);
// Start the wakeup timer if the learn mode operation finished in Included state
if (EINCLUSIONSTATE_EXCLUDED != g_pAppHandles->pNetworkInfo->eInclusionState)
{
CC_WakeUp_startWakeUpNotificationTimer();
}
}
break;
case STATE_APP_RESET:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
/* Soft reset */
Board_ResetHandler();
}
break;
case STATE_APP_TRANSMIT_DATA:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
LoadConfiguration();
}
if (EVENT_APP_NEXT_EVENT_JOB == event)
{
uint8_t event;
/*check job-queue*/
if (true == ZAF_JobHelperJobDequeue(&event))
{
/*Let the event scheduler fire the event on state event machine*/
ZAF_EventHelperEventEnqueue(event);
}
else
{
DPRINT(" Enqueuing event: EVENT_APP_FINISH_EVENT_JOB\n");
ZAF_EventHelperEventEnqueue(EVENT_APP_FINISH_EVENT_JOB);
}
}
if (EVENT_APP_BASIC_START_JOB == event)
{
if (JOB_STATUS_SUCCESS != CC_Basic_Set_tx( &agiTableRootDeviceGroups[0].profile, ENDPOINT_ROOT, BASIC_SET_TRIGGER_VALUE, ZCB_JobStatus))
{
DPRINT("EVENT_APP_BASIC_START_JOB failed\n");
basicValue = BASIC_SET_TRIGGER_VALUE;
/*Kick next job*/
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
}
if (EVENT_APP_BASIC_STOP_JOB == event)
{
if (JOB_STATUS_SUCCESS != CC_Basic_Set_tx( &agiTableRootDeviceGroups[0].profile, ENDPOINT_ROOT, 0, ZCB_JobStatus))
{
DPRINT("EVENT_APP_BASIC_STOP_JOB failed\n");
basicValue = 0;
/*Kick next job*/
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
}
if (EVENT_APP_START_TIMER_EVENTJOB_STOP== event)
{
DPRINT("#EVENT_APP_START_TIMER_EVENTJOB_STOP\n");
AppTimerEm4PersistentStart(&EventJobsTimer, BASIC_SET_TIMEOUT);
}
if (EVENT_APP_FINISH_EVENT_JOB == event)
{
ChangeState(STATE_APP_IDLE);
}
DPRINTF("STATE_APP_TRANSMIT_DATA done (state: %d)\n", currentState);
break;
default:
// Do nothing.
DPRINT("AppStateHandler(): Case is not handled!!!\n");
break;
}
} | /**
* @brief The core state machine of this sample application.
* @param event The event that triggered the call of AppStateManager.
*/ | @brief The core state machine of this sample application.
@param event The event that triggered the call of AppStateManager. | [
"@brief",
"The",
"core",
"state",
"machine",
"of",
"this",
"sample",
"application",
".",
"@param",
"event",
"The",
"event",
"that",
"triggered",
"the",
"call",
"of",
"AppStateManager",
"."
] | void
AppStateManager(EVENT_APP event)
{
DPRINTF("AppStateManager St: %d, Ev: 0x%02x\n", currentState, event);
notAppStateDependentActivity(event);
switch(currentState)
{
case STATE_APP_STARTUP:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
}
if (EVENT_APP_INIT == event)
{
doRemainingInitialization();
break;
}
ChangeState(STATE_APP_IDLE);
break;
case STATE_APP_IDLE:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
LoadConfiguration();
}
if (EVENT_APP_SMARTSTART_IN_PROGRESS == event)
{
ChangeState(STATE_APP_LEARN_MODE);
}
if ((BTN_EVENT_SHORT_PRESS(APP_BUTTON_LEARN_RESET) == (BUTTON_EVENT)event) ||
(EVENT_SYSTEM_LEARNMODE_START == (EVENT_SYSTEM)event))
{
if (EINCLUSIONSTATE_EXCLUDED != g_pAppHandles->pNetworkInfo->eInclusionState){
DPRINT("LEARN_MODE_EXCLUSION\n");
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_EXCLUSION_NWE);
}
else{
DPRINT("LEARN_MODE_INCLUSION\n");
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_INCLUSION);
}
Board_IndicateStatus(BOARD_STATUS_LEARNMODE_ACTIVE);
ChangeState(STATE_APP_LEARN_MODE);
}
if (EVENT_TRANSITION_TO_ACTIVE(event))
{
ZAF_PM_StayAwake(&m_RadioPowerLock, 0);
DPRINT("\n");
DPRINT(" *!*!**!*!**!*!**!*!**!*!**!*!**!*!**!*!*\n");
DPRINT(" *!*!* EVENT ACTIVE *!*!*\n");
DPRINT(" *!*!**!*!**!*!**!*!**!*!**!*!**!*!**!*!*\n");
DPRINT("\n");
ChangeState(STATE_APP_TRANSMIT_DATA);
if (false == ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB))
{
DPRINT("** EVENT_APP_NEXT_EVENT_JOB fail\n");
}
ZAF_JobHelperJobEnqueue(EVENT_APP_BASIC_START_JOB);
ZAF_JobHelperJobEnqueue(EVENT_APP_START_TIMER_EVENTJOB_STOP);
}
break;
case STATE_APP_LEARN_MODE:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
LoadConfiguration();
}
if ((BTN_EVENT_SHORT_PRESS(APP_BUTTON_LEARN_RESET) == (BUTTON_EVENT)event) ||
(EVENT_SYSTEM_LEARNMODE_STOP == (EVENT_SYSTEM)event))
{
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_DISABLE);
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART);
Board_IndicateStatus(BOARD_STATUS_IDLE);
ChangeState(STATE_APP_IDLE);
CC_Indicator_RefreshIndicatorProperties();
ZAF_TSE_Trigger(CC_Indicator_report_stx,
(void *)&ZAF_TSE_localActuationIdentifyData,
true);
}
if (EVENT_SYSTEM_LEARNMODE_FINISHED == (EVENT_SYSTEM)event)
{
CC_WakeUp_stayAwake10s();
CC_WakeUp_AutoStayAwakeAfterInclusion();
ZAF_setNetworkLearnMode(E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART);
Board_IndicateStatus(BOARD_STATUS_IDLE);
ChangeState(STATE_APP_IDLE);
CC_Indicator_RefreshIndicatorProperties();
ZAF_TSE_Trigger(CC_Indicator_report_stx,
(void *)&ZAF_TSE_localActuationIdentifyData,
true);
if (EINCLUSIONSTATE_EXCLUDED != g_pAppHandles->pNetworkInfo->eInclusionState)
{
CC_WakeUp_startWakeUpNotificationTimer();
}
}
break;
case STATE_APP_RESET:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
Board_ResetHandler();
}
break;
case STATE_APP_TRANSMIT_DATA:
if(EVENT_APP_FLUSHMEM_READY == event)
{
AppResetNvm();
LoadConfiguration();
}
if (EVENT_APP_NEXT_EVENT_JOB == event)
{
uint8_t event;
if (true == ZAF_JobHelperJobDequeue(&event))
{
ZAF_EventHelperEventEnqueue(event);
}
else
{
DPRINT(" Enqueuing event: EVENT_APP_FINISH_EVENT_JOB\n");
ZAF_EventHelperEventEnqueue(EVENT_APP_FINISH_EVENT_JOB);
}
}
if (EVENT_APP_BASIC_START_JOB == event)
{
if (JOB_STATUS_SUCCESS != CC_Basic_Set_tx( &agiTableRootDeviceGroups[0].profile, ENDPOINT_ROOT, BASIC_SET_TRIGGER_VALUE, ZCB_JobStatus))
{
DPRINT("EVENT_APP_BASIC_START_JOB failed\n");
basicValue = BASIC_SET_TRIGGER_VALUE;
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
}
if (EVENT_APP_BASIC_STOP_JOB == event)
{
if (JOB_STATUS_SUCCESS != CC_Basic_Set_tx( &agiTableRootDeviceGroups[0].profile, ENDPOINT_ROOT, 0, ZCB_JobStatus))
{
DPRINT("EVENT_APP_BASIC_STOP_JOB failed\n");
basicValue = 0;
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
}
if (EVENT_APP_START_TIMER_EVENTJOB_STOP== event)
{
DPRINT("#EVENT_APP_START_TIMER_EVENTJOB_STOP\n");
AppTimerEm4PersistentStart(&EventJobsTimer, BASIC_SET_TIMEOUT);
}
if (EVENT_APP_FINISH_EVENT_JOB == event)
{
ChangeState(STATE_APP_IDLE);
}
DPRINTF("STATE_APP_TRANSMIT_DATA done (state: %d)\n", currentState);
break;
default:
DPRINT("AppStateHandler(): Case is not handled!!!\n");
break;
}
} | [
"void",
"AppStateManager",
"(",
"EVENT_APP",
"event",
")",
"{",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"currentState",
",",
"event",
")",
";",
"notAppStateDependentActivity",
"(",
"event",
")",
";",
"switch",
"(",
"currentState",
")",
"{",
"case",
"STATE_APP_STARTUP",
":",
"if",
"(",
"EVENT_APP_FLUSHMEM_READY",
"==",
"event",
")",
"{",
"AppResetNvm",
"(",
")",
";",
"}",
"if",
"(",
"EVENT_APP_INIT",
"==",
"event",
")",
"{",
"doRemainingInitialization",
"(",
")",
";",
"break",
";",
"}",
"ChangeState",
"(",
"STATE_APP_IDLE",
")",
";",
"break",
";",
"case",
"STATE_APP_IDLE",
":",
"if",
"(",
"EVENT_APP_FLUSHMEM_READY",
"==",
"event",
")",
"{",
"AppResetNvm",
"(",
")",
";",
"LoadConfiguration",
"(",
")",
";",
"}",
"if",
"(",
"EVENT_APP_SMARTSTART_IN_PROGRESS",
"==",
"event",
")",
"{",
"ChangeState",
"(",
"STATE_APP_LEARN_MODE",
")",
";",
"}",
"if",
"(",
"(",
"BTN_EVENT_SHORT_PRESS",
"(",
"APP_BUTTON_LEARN_RESET",
")",
"==",
"(",
"BUTTON_EVENT",
")",
"event",
")",
"||",
"(",
"EVENT_SYSTEM_LEARNMODE_START",
"==",
"(",
"EVENT_SYSTEM",
")",
"event",
")",
")",
"{",
"if",
"(",
"EINCLUSIONSTATE_EXCLUDED",
"!=",
"g_pAppHandles",
"->",
"pNetworkInfo",
"->",
"eInclusionState",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"ZAF_setNetworkLearnMode",
"(",
"E_NETWORK_LEARN_MODE_EXCLUSION_NWE",
")",
";",
"}",
"else",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"ZAF_setNetworkLearnMode",
"(",
"E_NETWORK_LEARN_MODE_INCLUSION",
")",
";",
"}",
"Board_IndicateStatus",
"(",
"BOARD_STATUS_LEARNMODE_ACTIVE",
")",
";",
"ChangeState",
"(",
"STATE_APP_LEARN_MODE",
")",
";",
"}",
"if",
"(",
"EVENT_TRANSITION_TO_ACTIVE",
"(",
"event",
")",
")",
"{",
"ZAF_PM_StayAwake",
"(",
"&",
"m_RadioPowerLock",
",",
"0",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"ChangeState",
"(",
"STATE_APP_TRANSMIT_DATA",
")",
";",
"if",
"(",
"false",
"==",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_NEXT_EVENT_JOB",
")",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"}",
"ZAF_JobHelperJobEnqueue",
"(",
"EVENT_APP_BASIC_START_JOB",
")",
";",
"ZAF_JobHelperJobEnqueue",
"(",
"EVENT_APP_START_TIMER_EVENTJOB_STOP",
")",
";",
"}",
"break",
";",
"case",
"STATE_APP_LEARN_MODE",
":",
"if",
"(",
"EVENT_APP_FLUSHMEM_READY",
"==",
"event",
")",
"{",
"AppResetNvm",
"(",
")",
";",
"LoadConfiguration",
"(",
")",
";",
"}",
"if",
"(",
"(",
"BTN_EVENT_SHORT_PRESS",
"(",
"APP_BUTTON_LEARN_RESET",
")",
"==",
"(",
"BUTTON_EVENT",
")",
"event",
")",
"||",
"(",
"EVENT_SYSTEM_LEARNMODE_STOP",
"==",
"(",
"EVENT_SYSTEM",
")",
"event",
")",
")",
"{",
"ZAF_setNetworkLearnMode",
"(",
"E_NETWORK_LEARN_MODE_DISABLE",
")",
";",
"ZAF_setNetworkLearnMode",
"(",
"E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART",
")",
";",
"Board_IndicateStatus",
"(",
"BOARD_STATUS_IDLE",
")",
";",
"ChangeState",
"(",
"STATE_APP_IDLE",
")",
";",
"CC_Indicator_RefreshIndicatorProperties",
"(",
")",
";",
"ZAF_TSE_Trigger",
"(",
"CC_Indicator_report_stx",
",",
"(",
"void",
"*",
")",
"&",
"ZAF_TSE_localActuationIdentifyData",
",",
"true",
")",
";",
"}",
"if",
"(",
"EVENT_SYSTEM_LEARNMODE_FINISHED",
"==",
"(",
"EVENT_SYSTEM",
")",
"event",
")",
"{",
"CC_WakeUp_stayAwake10s",
"(",
")",
";",
"CC_WakeUp_AutoStayAwakeAfterInclusion",
"(",
")",
";",
"ZAF_setNetworkLearnMode",
"(",
"E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART",
")",
";",
"Board_IndicateStatus",
"(",
"BOARD_STATUS_IDLE",
")",
";",
"ChangeState",
"(",
"STATE_APP_IDLE",
")",
";",
"CC_Indicator_RefreshIndicatorProperties",
"(",
")",
";",
"ZAF_TSE_Trigger",
"(",
"CC_Indicator_report_stx",
",",
"(",
"void",
"*",
")",
"&",
"ZAF_TSE_localActuationIdentifyData",
",",
"true",
")",
";",
"if",
"(",
"EINCLUSIONSTATE_EXCLUDED",
"!=",
"g_pAppHandles",
"->",
"pNetworkInfo",
"->",
"eInclusionState",
")",
"{",
"CC_WakeUp_startWakeUpNotificationTimer",
"(",
")",
";",
"}",
"}",
"break",
";",
"case",
"STATE_APP_RESET",
":",
"if",
"(",
"EVENT_APP_FLUSHMEM_READY",
"==",
"event",
")",
"{",
"AppResetNvm",
"(",
")",
";",
"Board_ResetHandler",
"(",
")",
";",
"}",
"break",
";",
"case",
"STATE_APP_TRANSMIT_DATA",
":",
"if",
"(",
"EVENT_APP_FLUSHMEM_READY",
"==",
"event",
")",
"{",
"AppResetNvm",
"(",
")",
";",
"LoadConfiguration",
"(",
")",
";",
"}",
"if",
"(",
"EVENT_APP_NEXT_EVENT_JOB",
"==",
"event",
")",
"{",
"uint8_t",
"event",
";",
"if",
"(",
"true",
"==",
"ZAF_JobHelperJobDequeue",
"(",
"&",
"event",
")",
")",
"{",
"ZAF_EventHelperEventEnqueue",
"(",
"event",
")",
";",
"}",
"else",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_FINISH_EVENT_JOB",
")",
";",
"}",
"}",
"if",
"(",
"EVENT_APP_BASIC_START_JOB",
"==",
"event",
")",
"{",
"if",
"(",
"JOB_STATUS_SUCCESS",
"!=",
"CC_Basic_Set_tx",
"(",
"&",
"agiTableRootDeviceGroups",
"[",
"0",
"]",
".",
"profile",
",",
"ENDPOINT_ROOT",
",",
"BASIC_SET_TRIGGER_VALUE",
",",
"ZCB_JobStatus",
")",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"basicValue",
"=",
"BASIC_SET_TRIGGER_VALUE",
";",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_NEXT_EVENT_JOB",
")",
";",
"}",
"}",
"if",
"(",
"EVENT_APP_BASIC_STOP_JOB",
"==",
"event",
")",
"{",
"if",
"(",
"JOB_STATUS_SUCCESS",
"!=",
"CC_Basic_Set_tx",
"(",
"&",
"agiTableRootDeviceGroups",
"[",
"0",
"]",
".",
"profile",
",",
"ENDPOINT_ROOT",
",",
"0",
",",
"ZCB_JobStatus",
")",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"basicValue",
"=",
"0",
";",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_NEXT_EVENT_JOB",
")",
";",
"}",
"}",
"if",
"(",
"EVENT_APP_START_TIMER_EVENTJOB_STOP",
"==",
"event",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"AppTimerEm4PersistentStart",
"(",
"&",
"EventJobsTimer",
",",
"BASIC_SET_TIMEOUT",
")",
";",
"}",
"if",
"(",
"EVENT_APP_FINISH_EVENT_JOB",
"==",
"event",
")",
"{",
"ChangeState",
"(",
"STATE_APP_IDLE",
")",
";",
"}",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"currentState",
")",
";",
"break",
";",
"default",
":",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"break",
";",
"}",
"}"
] | @brief The core state machine of this sample application. | [
"@brief",
"The",
"core",
"state",
"machine",
"of",
"this",
"sample",
"application",
"."
] | [
"/*\n * Here we handle events that are not evaluated in the context of the app state.\n */",
"/*\n * This approach makes it possible to do less initialization before the scheduler starts.\n * Hence, this was made to reduce the boot-up time.\n */",
"// Handle received event",
"/*Add event's on job-queue*/",
"//Go back to smart start if the node was never included.",
"//Protocol will not commence SmartStart if the node is already included in the network.",
"/* If we are in a network and the Identify LED state was changed to idle due to learn mode, report it to lifeline */",
"//Make sure that the application stays awake for 10 s after learn mode finished",
"//to wait for more messages from the controller",
"/* Also tell application to automatically extend the stay awake period by 10\n * seconds on message activities - even though we did not get here by a proper\n * wakeup from EM4\n */",
"//Go back to smart start if the node was excluded.",
"//Protocol will not commence SmartStart if the node is already included in the network.",
"/* If we are in a network and the Identify LED state was changed to idle due to learn mode, report it to lifeline */",
"// Start the wakeup timer if the learn mode operation finished in Included state",
"/* Soft reset */",
"/*check job-queue*/",
"/*Let the event scheduler fire the event on state event machine*/",
"/*Kick next job*/",
"/*Kick next job*/",
"// Do nothing."
] | [
{
"param": "event",
"type": "EVENT_APP"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "event",
"type": "EVENT_APP",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | ChangeState | void | static void
ChangeState(STATE_APP newState)
{
DPRINTF("State changed: %d -> %d\n", currentState, newState);
currentState = newState;
} | /**
* @brief Sets the current state to a new, given state.
* @param newState New state.
*/ | @brief Sets the current state to a new, given state.
@param newState New state. | [
"@brief",
"Sets",
"the",
"current",
"state",
"to",
"a",
"new",
"given",
"state",
".",
"@param",
"newState",
"New",
"state",
"."
] | static void
ChangeState(STATE_APP newState)
{
DPRINTF("State changed: %d -> %d\n", currentState, newState);
currentState = newState;
} | [
"static",
"void",
"ChangeState",
"(",
"STATE_APP",
"newState",
")",
"{",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"currentState",
",",
"newState",
")",
";",
"currentState",
"=",
"newState",
";",
"}"
] | @brief Sets the current state to a new, given state. | [
"@brief",
"Sets",
"the",
"current",
"state",
"to",
"a",
"new",
"given",
"state",
"."
] | [] | [
{
"param": "newState",
"type": "STATE_APP"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "newState",
"type": "STATE_APP",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | ZCB_JobStatus | void | void
ZCB_JobStatus(TRANSMISSION_RESULT * pTransmissionResult)
{
DPRINT("Callback: ZCB_JobStatus()\n");
if (TRANSMISSION_RESULT_FINISHED == pTransmissionResult->isFinished)
{
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
} | /**
* @brief Callback function used for unsolicited commands.
* @param pTransmissionResult Result of each transmission.
*/ | @brief Callback function used for unsolicited commands.
@param pTransmissionResult Result of each transmission. | [
"@brief",
"Callback",
"function",
"used",
"for",
"unsolicited",
"commands",
".",
"@param",
"pTransmissionResult",
"Result",
"of",
"each",
"transmission",
"."
] | void
ZCB_JobStatus(TRANSMISSION_RESULT * pTransmissionResult)
{
DPRINT("Callback: ZCB_JobStatus()\n");
if (TRANSMISSION_RESULT_FINISHED == pTransmissionResult->isFinished)
{
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
} | [
"void",
"ZCB_JobStatus",
"(",
"TRANSMISSION_RESULT",
"*",
"pTransmissionResult",
")",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"TRANSMISSION_RESULT_FINISHED",
"==",
"pTransmissionResult",
"->",
"isFinished",
")",
"{",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_NEXT_EVENT_JOB",
")",
";",
"}",
"}"
] | @brief Callback function used for unsolicited commands. | [
"@brief",
"Callback",
"function",
"used",
"for",
"unsolicited",
"commands",
"."
] | [] | [
{
"param": "pTransmissionResult",
"type": "TRANSMISSION_RESULT"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pTransmissionResult",
"type": "TRANSMISSION_RESULT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | SetDefaultConfiguration | void | void
SetDefaultConfiguration(void)
{
Ecode_t errCode;
cc_configuration_t const* cc_configuration_defaults;
DPRINT("Set Default Configuration\n");
AssociationInit(true, pFileSystemApplication);
CC_WakeUp_notificationMemorySetDefault(pFileSystemApplication);
DPRINT("Ended Set Default Configuration\n");
loadInitStatusPowerLevel();
cc_configuration_defaults = sl_configuration_get_configuration_pool();
sl_cc_configuration_init(cc_configuration_defaults, &configuration_io_interface);
uint32_t appVersion = ZAF_GetAppVersion();
errCode = nvm3_writeData(pFileSystemApplication, ZAF_FILE_ID_APP_VERSION, &appVersion, ZAF_FILE_SIZE_APP_VERSION);
ASSERT(ECODE_NVM3_OK == errCode); //Assert has been kept for debugging , can be removed from production code if this error can only be caused by some internal flash HW failure
} | /**
* @brief Function resets configuration to default values.
*
* Add application specific functions here to initialize configuration values stored in persistent memory.
* Will be called at any of the following events:
* - Network Exclusion
* - Network Secure Inclusion (after S2 bootstrapping complete)
* - Device Reset Locally
*/ | @brief Function resets configuration to default values.
Add application specific functions here to initialize configuration values stored in persistent memory.
Will be called at any of the following events:
- Network Exclusion
- Network Secure Inclusion (after S2 bootstrapping complete)
- Device Reset Locally | [
"@brief",
"Function",
"resets",
"configuration",
"to",
"default",
"values",
".",
"Add",
"application",
"specific",
"functions",
"here",
"to",
"initialize",
"configuration",
"values",
"stored",
"in",
"persistent",
"memory",
".",
"Will",
"be",
"called",
"at",
"any",
"of",
"the",
"following",
"events",
":",
"-",
"Network",
"Exclusion",
"-",
"Network",
"Secure",
"Inclusion",
"(",
"after",
"S2",
"bootstrapping",
"complete",
")",
"-",
"Device",
"Reset",
"Locally"
] | void
SetDefaultConfiguration(void)
{
Ecode_t errCode;
cc_configuration_t const* cc_configuration_defaults;
DPRINT("Set Default Configuration\n");
AssociationInit(true, pFileSystemApplication);
CC_WakeUp_notificationMemorySetDefault(pFileSystemApplication);
DPRINT("Ended Set Default Configuration\n");
loadInitStatusPowerLevel();
cc_configuration_defaults = sl_configuration_get_configuration_pool();
sl_cc_configuration_init(cc_configuration_defaults, &configuration_io_interface);
uint32_t appVersion = ZAF_GetAppVersion();
errCode = nvm3_writeData(pFileSystemApplication, ZAF_FILE_ID_APP_VERSION, &appVersion, ZAF_FILE_SIZE_APP_VERSION);
ASSERT(ECODE_NVM3_OK == errCode);
} | [
"void",
"SetDefaultConfiguration",
"(",
"void",
")",
"{",
"Ecode_t",
"errCode",
";",
"cc_configuration_t",
"const",
"*",
"cc_configuration_defaults",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"AssociationInit",
"(",
"true",
",",
"pFileSystemApplication",
")",
";",
"CC_WakeUp_notificationMemorySetDefault",
"(",
"pFileSystemApplication",
")",
";",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"loadInitStatusPowerLevel",
"(",
")",
";",
"cc_configuration_defaults",
"=",
"sl_configuration_get_configuration_pool",
"(",
")",
";",
"sl_cc_configuration_init",
"(",
"cc_configuration_defaults",
",",
"&",
"configuration_io_interface",
")",
";",
"uint32_t",
"appVersion",
"=",
"ZAF_GetAppVersion",
"(",
")",
";",
"errCode",
"=",
"nvm3_writeData",
"(",
"pFileSystemApplication",
",",
"ZAF_FILE_ID_APP_VERSION",
",",
"&",
"appVersion",
",",
"ZAF_FILE_SIZE_APP_VERSION",
")",
";",
"ASSERT",
"(",
"ECODE_NVM3_OK",
"==",
"errCode",
")",
";",
"}"
] | @brief Function resets configuration to default values. | [
"@brief",
"Function",
"resets",
"configuration",
"to",
"default",
"values",
"."
] | [
"//Assert has been kept for debugging , can be removed from production code if this error can only be caused by some internal flash HW failure"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | LoadConfiguration | bool | bool
LoadConfiguration(void)
{
cc_configuration_t const* cc_configuration_defaults;
cc_configuration_defaults = sl_configuration_get_configuration_pool();
sl_cc_configuration_init(cc_configuration_defaults, &configuration_io_interface);
uint32_t appVersion;
Ecode_t versionFileStatus = nvm3_readData(pFileSystemApplication, ZAF_FILE_ID_APP_VERSION, &appVersion, ZAF_FILE_SIZE_APP_VERSION);
if (ECODE_NVM3_OK == versionFileStatus)
{
if (ZAF_GetAppVersion() != appVersion)
{
// Add code for migration of file system to higher version here.
}
/* Initialize association module */
AssociationInit(false, pFileSystemApplication);
loadStatusPowerLevel();
return true;
}
else
{
DPRINT("Application FileSystem Verify failed\n");
loadInitStatusPowerLevel();
// Reset the file system if ZAF_FILE_ID_APP_VERSION is missing since this indicates
// corrupt or missing file system.
AppResetNvm();
return false;
}
} | /**
* @brief This function loads the application settings from non-volatile memory.
* If no settings are found, default values are used and saved.
*/ | @brief This function loads the application settings from non-volatile memory.
If no settings are found, default values are used and saved. | [
"@brief",
"This",
"function",
"loads",
"the",
"application",
"settings",
"from",
"non",
"-",
"volatile",
"memory",
".",
"If",
"no",
"settings",
"are",
"found",
"default",
"values",
"are",
"used",
"and",
"saved",
"."
] | bool
LoadConfiguration(void)
{
cc_configuration_t const* cc_configuration_defaults;
cc_configuration_defaults = sl_configuration_get_configuration_pool();
sl_cc_configuration_init(cc_configuration_defaults, &configuration_io_interface);
uint32_t appVersion;
Ecode_t versionFileStatus = nvm3_readData(pFileSystemApplication, ZAF_FILE_ID_APP_VERSION, &appVersion, ZAF_FILE_SIZE_APP_VERSION);
if (ECODE_NVM3_OK == versionFileStatus)
{
if (ZAF_GetAppVersion() != appVersion)
{
}
AssociationInit(false, pFileSystemApplication);
loadStatusPowerLevel();
return true;
}
else
{
DPRINT("Application FileSystem Verify failed\n");
loadInitStatusPowerLevel();
AppResetNvm();
return false;
}
} | [
"bool",
"LoadConfiguration",
"(",
"void",
")",
"{",
"cc_configuration_t",
"const",
"*",
"cc_configuration_defaults",
";",
"cc_configuration_defaults",
"=",
"sl_configuration_get_configuration_pool",
"(",
")",
";",
"sl_cc_configuration_init",
"(",
"cc_configuration_defaults",
",",
"&",
"configuration_io_interface",
")",
";",
"uint32_t",
"appVersion",
";",
"Ecode_t",
"versionFileStatus",
"=",
"nvm3_readData",
"(",
"pFileSystemApplication",
",",
"ZAF_FILE_ID_APP_VERSION",
",",
"&",
"appVersion",
",",
"ZAF_FILE_SIZE_APP_VERSION",
")",
";",
"if",
"(",
"ECODE_NVM3_OK",
"==",
"versionFileStatus",
")",
"{",
"if",
"(",
"ZAF_GetAppVersion",
"(",
")",
"!=",
"appVersion",
")",
"{",
"}",
"AssociationInit",
"(",
"false",
",",
"pFileSystemApplication",
")",
";",
"loadStatusPowerLevel",
"(",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"DPRINT",
"(",
"\"",
"\\n",
"\"",
")",
";",
"loadInitStatusPowerLevel",
"(",
")",
";",
"AppResetNvm",
"(",
")",
";",
"return",
"false",
";",
"}",
"}"
] | @brief This function loads the application settings from non-volatile memory. | [
"@brief",
"This",
"function",
"loads",
"the",
"application",
"settings",
"from",
"non",
"-",
"volatile",
"memory",
"."
] | [
"// Add code for migration of file system to higher version here.",
"/* Initialize association module */",
"// Reset the file system if ZAF_FILE_ID_APP_VERSION is missing since this indicates",
"// corrupt or missing file system."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | ZCB_EventJobsTimer | void | void
ZCB_EventJobsTimer(SSwTimer *pTimer)
{
DPRINTF("Timer callback: ZCB_EventJobsTimer() pTimer->Id=%d\n", pTimer->Id);
/* If the node has been woken up from EM4 because the event job timer timed out
* the app will now be in the state STATE_APP_STARTUP. Need to switch to
* STATE_APP_TRANSMIT_DATA to properly process the job events
*/
ZAF_JobHelperJobEnqueue(EVENT_APP_BASIC_STOP_JOB);
if (STATE_APP_TRANSMIT_DATA != currentState)
{
ChangeState(STATE_APP_TRANSMIT_DATA);
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
UNUSED(pTimer);
} | /**
* @brief event jobs timeout event
*
* @param pTimer Timer connected to this method
*/ | @brief event jobs timeout event
@param pTimer Timer connected to this method | [
"@brief",
"event",
"jobs",
"timeout",
"event",
"@param",
"pTimer",
"Timer",
"connected",
"to",
"this",
"method"
] | void
ZCB_EventJobsTimer(SSwTimer *pTimer)
{
DPRINTF("Timer callback: ZCB_EventJobsTimer() pTimer->Id=%d\n", pTimer->Id);
ZAF_JobHelperJobEnqueue(EVENT_APP_BASIC_STOP_JOB);
if (STATE_APP_TRANSMIT_DATA != currentState)
{
ChangeState(STATE_APP_TRANSMIT_DATA);
ZAF_EventHelperEventEnqueue(EVENT_APP_NEXT_EVENT_JOB);
}
UNUSED(pTimer);
} | [
"void",
"ZCB_EventJobsTimer",
"(",
"SSwTimer",
"*",
"pTimer",
")",
"{",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"pTimer",
"->",
"Id",
")",
";",
"ZAF_JobHelperJobEnqueue",
"(",
"EVENT_APP_BASIC_STOP_JOB",
")",
";",
"if",
"(",
"STATE_APP_TRANSMIT_DATA",
"!=",
"currentState",
")",
"{",
"ChangeState",
"(",
"STATE_APP_TRANSMIT_DATA",
")",
";",
"ZAF_EventHelperEventEnqueue",
"(",
"EVENT_APP_NEXT_EVENT_JOB",
")",
";",
"}",
"UNUSED",
"(",
"pTimer",
")",
";",
"}"
] | @brief event jobs timeout event
@param pTimer Timer connected to this method | [
"@brief",
"event",
"jobs",
"timeout",
"event",
"@param",
"pTimer",
"Timer",
"connected",
"to",
"this",
"method"
] | [
"/* If the node has been woken up from EM4 because the event job timer timed out\n * the app will now be in the state STATE_APP_STARTUP. Need to switch to\n * STATE_APP_TRANSMIT_DATA to properly process the job events\n */"
] | [
{
"param": "pTimer",
"type": "SSwTimer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pTimer",
"type": "SSwTimer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8f85761482c8b5101e81e08e3d9df6f49317217 | SiliconLabs/Gecko_SDK | protocol/z-wave/NonCertified_Apps/MultilevelSensor/MultilevelSensor.c | [
"Zlib"
] | C | CC_ManufacturerSpecific_DeviceSpecificGet_handler | void | void CC_ManufacturerSpecific_DeviceSpecificGet_handler(device_id_type_t * pDeviceIDType,
device_id_format_t * pDeviceIDDataFormat,
uint8_t * pDeviceIDDataLength,
uint8_t * pDeviceIDData)
{
*pDeviceIDType = DEVICE_ID_TYPE_SERIAL_NUMBER;
*pDeviceIDDataFormat = DEVICE_ID_FORMAT_BINARY;
*pDeviceIDDataLength = 8;
uint64_t uuID = SYSTEM_GetUnique();
DPRINTF(" uuID: %x\n", (uint32_t)uuID);
*(pDeviceIDData + 0) = (uint8_t)(uuID >> 56);
*(pDeviceIDData + 1) = (uint8_t)(uuID >> 48);
*(pDeviceIDData + 2) = (uint8_t)(uuID >> 40);
*(pDeviceIDData + 3) = (uint8_t)(uuID >> 32);
*(pDeviceIDData + 4) = (uint8_t)(uuID >> 24);
*(pDeviceIDData + 5) = (uint8_t)(uuID >> 16);
*(pDeviceIDData + 6) = (uint8_t)(uuID >> 8);
*(pDeviceIDData + 7) = (uint8_t)(uuID >> 0);
} | /*
* This function will report a serial number in a binary format according to the specification.
* The serial number is the chip serial number and can be verified using the Simplicity Commander.
* The choice of reporting can be changed in accordance with the Manufacturer Specific
* Command Class specification.
*/ | This function will report a serial number in a binary format according to the specification.
The serial number is the chip serial number and can be verified using the Simplicity Commander.
The choice of reporting can be changed in accordance with the Manufacturer Specific
Command Class specification. | [
"This",
"function",
"will",
"report",
"a",
"serial",
"number",
"in",
"a",
"binary",
"format",
"according",
"to",
"the",
"specification",
".",
"The",
"serial",
"number",
"is",
"the",
"chip",
"serial",
"number",
"and",
"can",
"be",
"verified",
"using",
"the",
"Simplicity",
"Commander",
".",
"The",
"choice",
"of",
"reporting",
"can",
"be",
"changed",
"in",
"accordance",
"with",
"the",
"Manufacturer",
"Specific",
"Command",
"Class",
"specification",
"."
] | void CC_ManufacturerSpecific_DeviceSpecificGet_handler(device_id_type_t * pDeviceIDType,
device_id_format_t * pDeviceIDDataFormat,
uint8_t * pDeviceIDDataLength,
uint8_t * pDeviceIDData)
{
*pDeviceIDType = DEVICE_ID_TYPE_SERIAL_NUMBER;
*pDeviceIDDataFormat = DEVICE_ID_FORMAT_BINARY;
*pDeviceIDDataLength = 8;
uint64_t uuID = SYSTEM_GetUnique();
DPRINTF(" uuID: %x\n", (uint32_t)uuID);
*(pDeviceIDData + 0) = (uint8_t)(uuID >> 56);
*(pDeviceIDData + 1) = (uint8_t)(uuID >> 48);
*(pDeviceIDData + 2) = (uint8_t)(uuID >> 40);
*(pDeviceIDData + 3) = (uint8_t)(uuID >> 32);
*(pDeviceIDData + 4) = (uint8_t)(uuID >> 24);
*(pDeviceIDData + 5) = (uint8_t)(uuID >> 16);
*(pDeviceIDData + 6) = (uint8_t)(uuID >> 8);
*(pDeviceIDData + 7) = (uint8_t)(uuID >> 0);
} | [
"void",
"CC_ManufacturerSpecific_DeviceSpecificGet_handler",
"(",
"device_id_type_t",
"*",
"pDeviceIDType",
",",
"device_id_format_t",
"*",
"pDeviceIDDataFormat",
",",
"uint8_t",
"*",
"pDeviceIDDataLength",
",",
"uint8_t",
"*",
"pDeviceIDData",
")",
"{",
"*",
"pDeviceIDType",
"=",
"DEVICE_ID_TYPE_SERIAL_NUMBER",
";",
"*",
"pDeviceIDDataFormat",
"=",
"DEVICE_ID_FORMAT_BINARY",
";",
"*",
"pDeviceIDDataLength",
"=",
"8",
";",
"uint64_t",
"uuID",
"=",
"SYSTEM_GetUnique",
"(",
")",
";",
"DPRINTF",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"uint32_t",
")",
"uuID",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"0",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"56",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"1",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"48",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"2",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"40",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"3",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"32",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"4",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"24",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"5",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"16",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"6",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"8",
")",
";",
"*",
"(",
"pDeviceIDData",
"+",
"7",
")",
"=",
"(",
"uint8_t",
")",
"(",
"uuID",
">>",
"0",
")",
";",
"}"
] | This function will report a serial number in a binary format according to the specification. | [
"This",
"function",
"will",
"report",
"a",
"serial",
"number",
"in",
"a",
"binary",
"format",
"according",
"to",
"the",
"specification",
"."
] | [] | [
{
"param": "pDeviceIDType",
"type": "device_id_type_t"
},
{
"param": "pDeviceIDDataFormat",
"type": "device_id_format_t"
},
{
"param": "pDeviceIDDataLength",
"type": "uint8_t"
},
{
"param": "pDeviceIDData",
"type": "uint8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pDeviceIDType",
"type": "device_id_type_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pDeviceIDDataFormat",
"type": "device_id_format_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pDeviceIDDataLength",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pDeviceIDData",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a3e3953499303babf5d73a06d8a8ac1135968e3 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_ctl_server/sl_btmesh_ctl_signal_transition_handler.c | [
"Zlib"
] | C | transition_timer_cb | void | static void transition_timer_cb(sl_simple_timer_t *timer, void *data)
{
(void)data;
(void)timer;
// Initialize the variable to UI update period in order to trigger a UI update
// at the beginning of the transition.
static uint16_t time_elapsed_since_ui_update = CTL_SERVER_UI_UPDATE_PERIOD;
if (!temp_transitioning) {
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
return;
} else {
temp_transtime_elapsed++;
if (temp_transtime_elapsed >= temp_transtime_ticks) {
// transition complete
temp_transitioning = 0;
current_temperature = target_temperature;
current_deltauv = target_deltauv;
// Set the variable to UI update period in order to trigger a UI update
// at the beginning of the next transition.
time_elapsed_since_ui_update = CTL_SERVER_UI_UPDATE_PERIOD;
// Trigger a UI update in order to provide the target values at the end
// of the current transition
sl_btmesh_ctl_on_ui_update(current_temperature, current_deltauv);
} else {
// calculate current temperature based on elapsed transition time
if (target_temperature >= start_temperature) {
current_temperature = start_temperature
+ (target_temperature - start_temperature)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
} else {
current_temperature = start_temperature
- (start_temperature - target_temperature)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
}
if (target_deltauv >= start_deltauv) {
current_deltauv = start_deltauv
+ (target_deltauv - start_deltauv)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
} else {
current_deltauv = start_deltauv
- (start_deltauv - target_deltauv)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
}
// When transition is ongoing generate an event to application once every
// CTL_SERVER_UI_UPDATE_PERIOD ms because the event is used to update
// display status and therefore the rate should not be too high
time_elapsed_since_ui_update += CTL_SERVER_PWM_UPDATE_PERIOD;
if (CTL_SERVER_UI_UPDATE_PERIOD <= time_elapsed_since_ui_update) {
time_elapsed_since_ui_update -= CTL_SERVER_UI_UPDATE_PERIOD;
sl_btmesh_ctl_on_ui_update(current_temperature, current_deltauv);
}
}
}
sl_btmesh_lighting_color_pwm_cb(current_temperature);
} | /***************************************************************************/
/**
* Handler for Transition Timer, which manages LEDs transitions.
******************************************************************************/ | Handler for Transition Timer, which manages LEDs transitions. | [
"Handler",
"for",
"Transition",
"Timer",
"which",
"manages",
"LEDs",
"transitions",
"."
] | static void transition_timer_cb(sl_simple_timer_t *timer, void *data)
{
(void)data;
(void)timer;
static uint16_t time_elapsed_since_ui_update = CTL_SERVER_UI_UPDATE_PERIOD;
if (!temp_transitioning) {
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
return;
} else {
temp_transtime_elapsed++;
if (temp_transtime_elapsed >= temp_transtime_ticks) {
temp_transitioning = 0;
current_temperature = target_temperature;
current_deltauv = target_deltauv;
time_elapsed_since_ui_update = CTL_SERVER_UI_UPDATE_PERIOD;
sl_btmesh_ctl_on_ui_update(current_temperature, current_deltauv);
} else {
if (target_temperature >= start_temperature) {
current_temperature = start_temperature
+ (target_temperature - start_temperature)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
} else {
current_temperature = start_temperature
- (start_temperature - target_temperature)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
}
if (target_deltauv >= start_deltauv) {
current_deltauv = start_deltauv
+ (target_deltauv - start_deltauv)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
} else {
current_deltauv = start_deltauv
- (start_deltauv - target_deltauv)
* (uint64_t)temp_transtime_elapsed
/ temp_transtime_ticks;
}
time_elapsed_since_ui_update += CTL_SERVER_PWM_UPDATE_PERIOD;
if (CTL_SERVER_UI_UPDATE_PERIOD <= time_elapsed_since_ui_update) {
time_elapsed_since_ui_update -= CTL_SERVER_UI_UPDATE_PERIOD;
sl_btmesh_ctl_on_ui_update(current_temperature, current_deltauv);
}
}
}
sl_btmesh_lighting_color_pwm_cb(current_temperature);
} | [
"static",
"void",
"transition_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"timer",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"timer",
";",
"static",
"uint16_t",
"time_elapsed_since_ui_update",
"=",
"CTL_SERVER_UI_UPDATE_PERIOD",
";",
"if",
"(",
"!",
"temp_transitioning",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"transition_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}",
"else",
"{",
"temp_transtime_elapsed",
"++",
";",
"if",
"(",
"temp_transtime_elapsed",
">=",
"temp_transtime_ticks",
")",
"{",
"temp_transitioning",
"=",
"0",
";",
"current_temperature",
"=",
"target_temperature",
";",
"current_deltauv",
"=",
"target_deltauv",
";",
"time_elapsed_since_ui_update",
"=",
"CTL_SERVER_UI_UPDATE_PERIOD",
";",
"sl_btmesh_ctl_on_ui_update",
"(",
"current_temperature",
",",
"current_deltauv",
")",
";",
"}",
"else",
"{",
"if",
"(",
"target_temperature",
">=",
"start_temperature",
")",
"{",
"current_temperature",
"=",
"start_temperature",
"+",
"(",
"target_temperature",
"-",
"start_temperature",
")",
"*",
"(",
"uint64_t",
")",
"temp_transtime_elapsed",
"/",
"temp_transtime_ticks",
";",
"}",
"else",
"{",
"current_temperature",
"=",
"start_temperature",
"-",
"(",
"start_temperature",
"-",
"target_temperature",
")",
"*",
"(",
"uint64_t",
")",
"temp_transtime_elapsed",
"/",
"temp_transtime_ticks",
";",
"}",
"if",
"(",
"target_deltauv",
">=",
"start_deltauv",
")",
"{",
"current_deltauv",
"=",
"start_deltauv",
"+",
"(",
"target_deltauv",
"-",
"start_deltauv",
")",
"*",
"(",
"uint64_t",
")",
"temp_transtime_elapsed",
"/",
"temp_transtime_ticks",
";",
"}",
"else",
"{",
"current_deltauv",
"=",
"start_deltauv",
"-",
"(",
"start_deltauv",
"-",
"target_deltauv",
")",
"*",
"(",
"uint64_t",
")",
"temp_transtime_elapsed",
"/",
"temp_transtime_ticks",
";",
"}",
"time_elapsed_since_ui_update",
"+=",
"CTL_SERVER_PWM_UPDATE_PERIOD",
";",
"if",
"(",
"CTL_SERVER_UI_UPDATE_PERIOD",
"<=",
"time_elapsed_since_ui_update",
")",
"{",
"time_elapsed_since_ui_update",
"-=",
"CTL_SERVER_UI_UPDATE_PERIOD",
";",
"sl_btmesh_ctl_on_ui_update",
"(",
"current_temperature",
",",
"current_deltauv",
")",
";",
"}",
"}",
"}",
"sl_btmesh_lighting_color_pwm_cb",
"(",
"current_temperature",
")",
";",
"}"
] | Handler for Transition Timer, which manages LEDs transitions. | [
"Handler",
"for",
"Transition",
"Timer",
"which",
"manages",
"LEDs",
"transitions",
"."
] | [
"// Initialize the variable to UI update period in order to trigger a UI update",
"// at the beginning of the transition.",
"// transition complete",
"// Set the variable to UI update period in order to trigger a UI update",
"// at the beginning of the next transition.",
"// Trigger a UI update in order to provide the target values at the end",
"// of the current transition",
"// calculate current temperature based on elapsed transition time",
"// When transition is ongoing generate an event to application once every",
"// CTL_SERVER_UI_UPDATE_PERIOD ms because the event is used to update",
"// display status and therefore the rate should not be too high"
] | [
{
"param": "timer",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "timer",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a3e3953499303babf5d73a06d8a8ac1135968e3 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_ctl_server/sl_btmesh_ctl_signal_transition_handler.c | [
"Zlib"
] | C | sl_btmesh_ctl_set_temperature_deltauv_level | void | void sl_btmesh_ctl_set_temperature_deltauv_level(uint16_t temperature,
int16_t deltauv,
uint32_t transition_ms)
{
if (temperature < CTL_SERVER_MINIMUM_TEMPERATURE) {
temperature = CTL_SERVER_MINIMUM_TEMPERATURE;
} else if (temperature > CTL_SERVER_MAXIMUM_TEMPERATURE) {
temperature = CTL_SERVER_MAXIMUM_TEMPERATURE;
}
if (transition_ms == 0) {
current_temperature = temperature;
current_deltauv = deltauv;
sl_btmesh_lighting_color_pwm_cb(current_temperature);
/* if a transition was in progress, cancel it */
if (temp_transitioning) {
temp_transitioning = 0;
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
}
sl_btmesh_ctl_on_ui_update(current_temperature, current_deltauv);
return;
}
temp_transtime_ticks = transition_ms;
start_temperature = current_temperature;
target_temperature = temperature;
start_deltauv = current_deltauv;
target_deltauv = deltauv;
temp_transtime_elapsed = 0;
temp_transitioning = 1;
// enabling timer IRQ -> the temperature is adjusted in timer interrupt
// gradually until target temperature is reached.
sl_status_t sc = sl_simple_timer_start(&transition_timer,
CTL_SERVER_PWM_UPDATE_PERIOD,
transition_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic Transition Timer\n");
return;
} | /*******************************************************************************
* Set LED temperature and delta UV in given transition time.
*
* @param[in] temperature Temperature of color.
* @param[in] deltauv Delta UV value.
* @param[in] transition_ms Transition time in milliseconds.
******************************************************************************/ | Set LED temperature and delta UV in given transition time.
@param[in] temperature Temperature of color.
@param[in] deltauv Delta UV value.
@param[in] transition_ms Transition time in milliseconds. | [
"Set",
"LED",
"temperature",
"and",
"delta",
"UV",
"in",
"given",
"transition",
"time",
".",
"@param",
"[",
"in",
"]",
"temperature",
"Temperature",
"of",
"color",
".",
"@param",
"[",
"in",
"]",
"deltauv",
"Delta",
"UV",
"value",
".",
"@param",
"[",
"in",
"]",
"transition_ms",
"Transition",
"time",
"in",
"milliseconds",
"."
] | void sl_btmesh_ctl_set_temperature_deltauv_level(uint16_t temperature,
int16_t deltauv,
uint32_t transition_ms)
{
if (temperature < CTL_SERVER_MINIMUM_TEMPERATURE) {
temperature = CTL_SERVER_MINIMUM_TEMPERATURE;
} else if (temperature > CTL_SERVER_MAXIMUM_TEMPERATURE) {
temperature = CTL_SERVER_MAXIMUM_TEMPERATURE;
}
if (transition_ms == 0) {
current_temperature = temperature;
current_deltauv = deltauv;
sl_btmesh_lighting_color_pwm_cb(current_temperature);
if (temp_transitioning) {
temp_transitioning = 0;
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
}
sl_btmesh_ctl_on_ui_update(current_temperature, current_deltauv);
return;
}
temp_transtime_ticks = transition_ms;
start_temperature = current_temperature;
target_temperature = temperature;
start_deltauv = current_deltauv;
target_deltauv = deltauv;
temp_transtime_elapsed = 0;
temp_transitioning = 1;
sl_status_t sc = sl_simple_timer_start(&transition_timer,
CTL_SERVER_PWM_UPDATE_PERIOD,
transition_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic Transition Timer\n");
return;
} | [
"void",
"sl_btmesh_ctl_set_temperature_deltauv_level",
"(",
"uint16_t",
"temperature",
",",
"int16_t",
"deltauv",
",",
"uint32_t",
"transition_ms",
")",
"{",
"if",
"(",
"temperature",
"<",
"CTL_SERVER_MINIMUM_TEMPERATURE",
")",
"{",
"temperature",
"=",
"CTL_SERVER_MINIMUM_TEMPERATURE",
";",
"}",
"else",
"if",
"(",
"temperature",
">",
"CTL_SERVER_MAXIMUM_TEMPERATURE",
")",
"{",
"temperature",
"=",
"CTL_SERVER_MAXIMUM_TEMPERATURE",
";",
"}",
"if",
"(",
"transition_ms",
"==",
"0",
")",
"{",
"current_temperature",
"=",
"temperature",
";",
"current_deltauv",
"=",
"deltauv",
";",
"sl_btmesh_lighting_color_pwm_cb",
"(",
"current_temperature",
")",
";",
"if",
"(",
"temp_transitioning",
")",
"{",
"temp_transitioning",
"=",
"0",
";",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"transition_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"sl_btmesh_ctl_on_ui_update",
"(",
"current_temperature",
",",
"current_deltauv",
")",
";",
"return",
";",
"}",
"temp_transtime_ticks",
"=",
"transition_ms",
";",
"start_temperature",
"=",
"current_temperature",
";",
"target_temperature",
"=",
"temperature",
";",
"start_deltauv",
"=",
"current_deltauv",
";",
"target_deltauv",
"=",
"deltauv",
";",
"temp_transtime_elapsed",
"=",
"0",
";",
"temp_transitioning",
"=",
"1",
";",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_start",
"(",
"&",
"transition_timer",
",",
"CTL_SERVER_PWM_UPDATE_PERIOD",
",",
"transition_timer_cb",
",",
"NO_CALLBACK_DATA",
",",
"true",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | Set LED temperature and delta UV in given transition time. | [
"Set",
"LED",
"temperature",
"and",
"delta",
"UV",
"in",
"given",
"transition",
"time",
"."
] | [
"/* if a transition was in progress, cancel it */",
"// enabling timer IRQ -> the temperature is adjusted in timer interrupt",
"// gradually until target temperature is reached."
] | [
{
"param": "temperature",
"type": "uint16_t"
},
{
"param": "deltauv",
"type": "int16_t"
},
{
"param": "transition_ms",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "temperature",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "deltauv",
"type": "int16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transition_ms",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a3e3953499303babf5d73a06d8a8ac1135968e3 | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_ctl_server/sl_btmesh_ctl_signal_transition_handler.c | [
"Zlib"
] | C | sl_btmesh_ctl_server_snprint_deltauv | int | int sl_btmesh_ctl_server_snprint_deltauv(char *buffer,
uint16_t buffer_size,
uint16_t deltauv_raw)
{
// Additive variable for rounding to 0.01 precision (2^15 / 100 / 2)
const uint32_t round_value = ((1UL << FIXED_POINT_Q15_FRAC_BITS) / 2)
/ DELTA_UV_SIGNIFICANT_DIGITS_MUL;
uint32_t raw = deltauv_raw;
uint16_t integer_part, fractional_part;
char sign_char;
// The deltauv_raw is a 2s complement signed fixed point value 16bit (Q15)
// which uses 15 bit to code the fractional part therefore:
// delta UV raw: 0x8000 => delta UV: -1.0000000 --> -1.00
// delta UV raw: 0x7fff => delta UV: +0,9999695 --> ~ +1.00
if (SIGNED_INT_16BIT_MAX_POSITIVE < raw) {
// Convert the negative value to positive and round it
raw = ( (1UL << 16) - raw) + round_value;
// Store that the value was negative
sign_char = '-';
} else {
// Round the raw value to 0.01 precision
raw += round_value;
// Store that the value was not negative
sign_char = ' ';
}
// Division by 2^15 to calculate the integer part
integer_part = raw >> FIXED_POINT_Q15_FRAC_BITS;
// Calculate the significant number of fractional decimal digits
fractional_part = DELTA_UV_SIGNIFICANT_DIGITS_MUL
* (raw & SIGNED_INT_16BIT_MAX_POSITIVE)
>> FIXED_POINT_Q15_FRAC_BITS;
// Handle the corner case when a negative value was rounded to zero
if ((integer_part == 0) && (fractional_part == 0)) {
sign_char = ' ';
}
// Print the formatted delta UV value to the character buffer
return snprintf(buffer, buffer_size, "%c%d.%02d",
sign_char,
integer_part,
fractional_part);
} | /***************************************************************************/
/**
* Utility function to print the delta UV raw value into the passed character
* buffer in the <sign>X.XX format.
*
* @param[out] buffer Character buffer where the formatted delta UV
* is stored
* @param[in] buffer_size Size of the character buffer
* @param[in] deltauv_raw Raw value of the Delta UV CTL parameter
*
* @return same as snprintf
******************************************************************************/ | Utility function to print the delta UV raw value into the passed character
buffer in the X.XX format.
@param[out] buffer Character buffer where the formatted delta UV
is stored
@param[in] buffer_size Size of the character buffer
@param[in] deltauv_raw Raw value of the Delta UV CTL parameter
@return same as snprintf | [
"Utility",
"function",
"to",
"print",
"the",
"delta",
"UV",
"raw",
"value",
"into",
"the",
"passed",
"character",
"buffer",
"in",
"the",
"X",
".",
"XX",
"format",
".",
"@param",
"[",
"out",
"]",
"buffer",
"Character",
"buffer",
"where",
"the",
"formatted",
"delta",
"UV",
"is",
"stored",
"@param",
"[",
"in",
"]",
"buffer_size",
"Size",
"of",
"the",
"character",
"buffer",
"@param",
"[",
"in",
"]",
"deltauv_raw",
"Raw",
"value",
"of",
"the",
"Delta",
"UV",
"CTL",
"parameter",
"@return",
"same",
"as",
"snprintf"
] | int sl_btmesh_ctl_server_snprint_deltauv(char *buffer,
uint16_t buffer_size,
uint16_t deltauv_raw)
{
const uint32_t round_value = ((1UL << FIXED_POINT_Q15_FRAC_BITS) / 2)
/ DELTA_UV_SIGNIFICANT_DIGITS_MUL;
uint32_t raw = deltauv_raw;
uint16_t integer_part, fractional_part;
char sign_char;
if (SIGNED_INT_16BIT_MAX_POSITIVE < raw) {
raw = ( (1UL << 16) - raw) + round_value;
sign_char = '-';
} else {
raw += round_value;
sign_char = ' ';
}
integer_part = raw >> FIXED_POINT_Q15_FRAC_BITS;
fractional_part = DELTA_UV_SIGNIFICANT_DIGITS_MUL
* (raw & SIGNED_INT_16BIT_MAX_POSITIVE)
>> FIXED_POINT_Q15_FRAC_BITS;
if ((integer_part == 0) && (fractional_part == 0)) {
sign_char = ' ';
}
return snprintf(buffer, buffer_size, "%c%d.%02d",
sign_char,
integer_part,
fractional_part);
} | [
"int",
"sl_btmesh_ctl_server_snprint_deltauv",
"(",
"char",
"*",
"buffer",
",",
"uint16_t",
"buffer_size",
",",
"uint16_t",
"deltauv_raw",
")",
"{",
"const",
"uint32_t",
"round_value",
"=",
"(",
"(",
"1UL",
"<<",
"FIXED_POINT_Q15_FRAC_BITS",
")",
"/",
"2",
")",
"/",
"DELTA_UV_SIGNIFICANT_DIGITS_MUL",
";",
"uint32_t",
"raw",
"=",
"deltauv_raw",
";",
"uint16_t",
"integer_part",
",",
"fractional_part",
";",
"char",
"sign_char",
";",
"if",
"(",
"SIGNED_INT_16BIT_MAX_POSITIVE",
"<",
"raw",
")",
"{",
"raw",
"=",
"(",
"(",
"1UL",
"<<",
"16",
")",
"-",
"raw",
")",
"+",
"round_value",
";",
"sign_char",
"=",
"'",
"'",
";",
"}",
"else",
"{",
"raw",
"+=",
"round_value",
";",
"sign_char",
"=",
"'",
"'",
";",
"}",
"integer_part",
"=",
"raw",
">>",
"FIXED_POINT_Q15_FRAC_BITS",
";",
"fractional_part",
"=",
"DELTA_UV_SIGNIFICANT_DIGITS_MUL",
"*",
"(",
"raw",
"&",
"SIGNED_INT_16BIT_MAX_POSITIVE",
")",
">>",
"FIXED_POINT_Q15_FRAC_BITS",
";",
"if",
"(",
"(",
"integer_part",
"==",
"0",
")",
"&&",
"(",
"fractional_part",
"==",
"0",
")",
")",
"{",
"sign_char",
"=",
"'",
"'",
";",
"}",
"return",
"snprintf",
"(",
"buffer",
",",
"buffer_size",
",",
"\"",
"\"",
",",
"sign_char",
",",
"integer_part",
",",
"fractional_part",
")",
";",
"}"
] | Utility function to print the delta UV raw value into the passed character
buffer in the <sign>X.XX format. | [
"Utility",
"function",
"to",
"print",
"the",
"delta",
"UV",
"raw",
"value",
"into",
"the",
"passed",
"character",
"buffer",
"in",
"the",
"<sign",
">",
"X",
".",
"XX",
"format",
"."
] | [
"// Additive variable for rounding to 0.01 precision (2^15 / 100 / 2)",
"// The deltauv_raw is a 2s complement signed fixed point value 16bit (Q15)",
"// which uses 15 bit to code the fractional part therefore:",
"// delta UV raw: 0x8000 => delta UV: -1.0000000 --> -1.00",
"// delta UV raw: 0x7fff => delta UV: +0,9999695 --> ~ +1.00",
"// Convert the negative value to positive and round it",
"// Store that the value was negative",
"// Round the raw value to 0.01 precision",
"// Store that the value was not negative",
"// Division by 2^15 to calculate the integer part",
"// Calculate the significant number of fractional decimal digits",
"// Handle the corner case when a negative value was rounded to zero",
"// Print the formatted delta UV value to the character buffer"
] | [
{
"param": "buffer",
"type": "char"
},
{
"param": "buffer_size",
"type": "uint16_t"
},
{
"param": "deltauv_raw",
"type": "uint16_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer_size",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "deltauv_raw",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
72e0f225ae7f227c2c2057591255f1e922fb23ef | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_server/sl_btmesh_lighting_level_transition_handler.c | [
"Zlib"
] | C | transition_timer_cb | void | static void transition_timer_cb(sl_simple_timer_t *handle,
void *data)
{
(void)data;
(void)handle;
// Initialize the variable to UI update period in order to trigger a UI update
// at the beginning of the transition.
static uint16_t time_elapsed_since_ui_update =
LIGHTING_SERVER_UI_UPDATE_PERIOD;
if (!level_transitioning) {
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
return;
} else {
level_transtime_elapsed++;
if (level_transtime_elapsed >= level_transtime_ticks) {
// transition complete
level_transitioning = 0;
current_level = target_level;
// Set the variable to UI update period in order to trigger a UI update
// at the beginning of the next transition.
time_elapsed_since_ui_update = LIGHTING_SERVER_UI_UPDATE_PERIOD;
// Trigger a UI update in order to provide the target values at the end
// of the current transition
sl_btmesh_lighting_server_on_ui_update(current_level);
} else {
// calculate current PWM duty cycle based on elapsed transition time
if (target_level >= start_level) {
current_level = start_level
+ (target_level - start_level)
* (uint64_t)level_transtime_elapsed
/ level_transtime_ticks;
} else {
current_level = start_level
- (start_level - target_level)
* (uint64_t)level_transtime_elapsed
/ level_transtime_ticks;
}
// When transition is ongoing generate an event to application once every
// CTL_SERVER_UI_UPDATE_PERIOD ms because the event is used to update display
// status and therefore the rate should not be too high
time_elapsed_since_ui_update += LIGHTING_SERVER_PWM_UPDATE_PERIOD;
if (LIGHTING_SERVER_UI_UPDATE_PERIOD <= time_elapsed_since_ui_update) {
time_elapsed_since_ui_update -= LIGHTING_SERVER_UI_UPDATE_PERIOD;
sl_btmesh_lighting_server_on_ui_update(current_level);
}
}
}
sl_btmesh_lighting_level_pwm_cb(current_level);
} | /***************************************************************************/
/**
* Timer Callback for LEDs transitions.
******************************************************************************/ | Timer Callback for LEDs transitions. | [
"Timer",
"Callback",
"for",
"LEDs",
"transitions",
"."
] | static void transition_timer_cb(sl_simple_timer_t *handle,
void *data)
{
(void)data;
(void)handle;
static uint16_t time_elapsed_since_ui_update =
LIGHTING_SERVER_UI_UPDATE_PERIOD;
if (!level_transitioning) {
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
return;
} else {
level_transtime_elapsed++;
if (level_transtime_elapsed >= level_transtime_ticks) {
level_transitioning = 0;
current_level = target_level;
time_elapsed_since_ui_update = LIGHTING_SERVER_UI_UPDATE_PERIOD;
sl_btmesh_lighting_server_on_ui_update(current_level);
} else {
if (target_level >= start_level) {
current_level = start_level
+ (target_level - start_level)
* (uint64_t)level_transtime_elapsed
/ level_transtime_ticks;
} else {
current_level = start_level
- (start_level - target_level)
* (uint64_t)level_transtime_elapsed
/ level_transtime_ticks;
}
time_elapsed_since_ui_update += LIGHTING_SERVER_PWM_UPDATE_PERIOD;
if (LIGHTING_SERVER_UI_UPDATE_PERIOD <= time_elapsed_since_ui_update) {
time_elapsed_since_ui_update -= LIGHTING_SERVER_UI_UPDATE_PERIOD;
sl_btmesh_lighting_server_on_ui_update(current_level);
}
}
}
sl_btmesh_lighting_level_pwm_cb(current_level);
} | [
"static",
"void",
"transition_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"static",
"uint16_t",
"time_elapsed_since_ui_update",
"=",
"LIGHTING_SERVER_UI_UPDATE_PERIOD",
";",
"if",
"(",
"!",
"level_transitioning",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"transition_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}",
"else",
"{",
"level_transtime_elapsed",
"++",
";",
"if",
"(",
"level_transtime_elapsed",
">=",
"level_transtime_ticks",
")",
"{",
"level_transitioning",
"=",
"0",
";",
"current_level",
"=",
"target_level",
";",
"time_elapsed_since_ui_update",
"=",
"LIGHTING_SERVER_UI_UPDATE_PERIOD",
";",
"sl_btmesh_lighting_server_on_ui_update",
"(",
"current_level",
")",
";",
"}",
"else",
"{",
"if",
"(",
"target_level",
">=",
"start_level",
")",
"{",
"current_level",
"=",
"start_level",
"+",
"(",
"target_level",
"-",
"start_level",
")",
"*",
"(",
"uint64_t",
")",
"level_transtime_elapsed",
"/",
"level_transtime_ticks",
";",
"}",
"else",
"{",
"current_level",
"=",
"start_level",
"-",
"(",
"start_level",
"-",
"target_level",
")",
"*",
"(",
"uint64_t",
")",
"level_transtime_elapsed",
"/",
"level_transtime_ticks",
";",
"}",
"time_elapsed_since_ui_update",
"+=",
"LIGHTING_SERVER_PWM_UPDATE_PERIOD",
";",
"if",
"(",
"LIGHTING_SERVER_UI_UPDATE_PERIOD",
"<=",
"time_elapsed_since_ui_update",
")",
"{",
"time_elapsed_since_ui_update",
"-=",
"LIGHTING_SERVER_UI_UPDATE_PERIOD",
";",
"sl_btmesh_lighting_server_on_ui_update",
"(",
"current_level",
")",
";",
"}",
"}",
"}",
"sl_btmesh_lighting_level_pwm_cb",
"(",
"current_level",
")",
";",
"}"
] | Timer Callback for LEDs transitions. | [
"Timer",
"Callback",
"for",
"LEDs",
"transitions",
"."
] | [
"// Initialize the variable to UI update period in order to trigger a UI update",
"// at the beginning of the transition.",
"// transition complete",
"// Set the variable to UI update period in order to trigger a UI update",
"// at the beginning of the next transition.",
"// Trigger a UI update in order to provide the target values at the end",
"// of the current transition",
"// calculate current PWM duty cycle based on elapsed transition time",
"// When transition is ongoing generate an event to application once every",
"// CTL_SERVER_UI_UPDATE_PERIOD ms because the event is used to update display",
"// status and therefore the rate should not be too high"
] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
72e0f225ae7f227c2c2057591255f1e922fb23ef | SiliconLabs/Gecko_SDK | app/bluetooth/common/btmesh_lighting_server/sl_btmesh_lighting_level_transition_handler.c | [
"Zlib"
] | C | sl_btmesh_lighting_set_level | void | void sl_btmesh_lighting_set_level(uint16_t level, uint32_t transition_ms)
{
if (transition_ms == 0) {
current_level = level;
sl_btmesh_lighting_level_pwm_cb(current_level);
/* if a transition was in progress, cancel it */
if (level_transitioning) {
level_transitioning = 0;
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
}
sl_btmesh_lighting_server_on_ui_update(current_level);
return;
}
level_transtime_ticks = transition_ms;
start_level = current_level;
target_level = level;
level_transtime_elapsed = 0;
level_transitioning = 1;
// enabling timer IRQ -> the PWM level is adjusted in timer interrupt
// gradually until target level is reached.
sl_status_t sc = sl_simple_timer_start(&transition_timer,
LIGHTING_SERVER_PWM_UPDATE_PERIOD,
transition_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic Transition Timer\n");
return;
} | /*******************************************************************************
* Set LED lightness level in given transition time.
*
* @param[in] level Lightness level.
* @param[in] transition_ms Transition time in milliseconds.
******************************************************************************/ | Set LED lightness level in given transition time.
@param[in] level Lightness level.
@param[in] transition_ms Transition time in milliseconds. | [
"Set",
"LED",
"lightness",
"level",
"in",
"given",
"transition",
"time",
".",
"@param",
"[",
"in",
"]",
"level",
"Lightness",
"level",
".",
"@param",
"[",
"in",
"]",
"transition_ms",
"Transition",
"time",
"in",
"milliseconds",
"."
] | void sl_btmesh_lighting_set_level(uint16_t level, uint32_t transition_ms)
{
if (transition_ms == 0) {
current_level = level;
sl_btmesh_lighting_level_pwm_cb(current_level);
if (level_transitioning) {
level_transitioning = 0;
sl_status_t sc = sl_simple_timer_stop(&transition_timer);
app_assert_status_f(sc, "Failed to stop Periodic Level Transition Timer\n");
}
sl_btmesh_lighting_server_on_ui_update(current_level);
return;
}
level_transtime_ticks = transition_ms;
start_level = current_level;
target_level = level;
level_transtime_elapsed = 0;
level_transitioning = 1;
sl_status_t sc = sl_simple_timer_start(&transition_timer,
LIGHTING_SERVER_PWM_UPDATE_PERIOD,
transition_timer_cb,
NO_CALLBACK_DATA,
true);
app_assert_status_f(sc, "Failed to start periodic Transition Timer\n");
return;
} | [
"void",
"sl_btmesh_lighting_set_level",
"(",
"uint16_t",
"level",
",",
"uint32_t",
"transition_ms",
")",
"{",
"if",
"(",
"transition_ms",
"==",
"0",
")",
"{",
"current_level",
"=",
"level",
";",
"sl_btmesh_lighting_level_pwm_cb",
"(",
"current_level",
")",
";",
"if",
"(",
"level_transitioning",
")",
"{",
"level_transitioning",
"=",
"0",
";",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"transition_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"sl_btmesh_lighting_server_on_ui_update",
"(",
"current_level",
")",
";",
"return",
";",
"}",
"level_transtime_ticks",
"=",
"transition_ms",
";",
"start_level",
"=",
"current_level",
";",
"target_level",
"=",
"level",
";",
"level_transtime_elapsed",
"=",
"0",
";",
"level_transitioning",
"=",
"1",
";",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_start",
"(",
"&",
"transition_timer",
",",
"LIGHTING_SERVER_PWM_UPDATE_PERIOD",
",",
"transition_timer_cb",
",",
"NO_CALLBACK_DATA",
",",
"true",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | Set LED lightness level in given transition time. | [
"Set",
"LED",
"lightness",
"level",
"in",
"given",
"transition",
"time",
"."
] | [
"/* if a transition was in progress, cancel it */",
"// enabling timer IRQ -> the PWM level is adjusted in timer interrupt",
"// gradually until target level is reached."
] | [
{
"param": "level",
"type": "uint16_t"
},
{
"param": "transition_ms",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "level",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transition_ms",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | ble_protocol_change | bool | bool ble_protocol_change(void)
{
bool is_supported = false;
RAIL_Status_t status = RAIL_STATUS_NO_ERROR;
// Idle
RAIL_Idle(rail_handles[PROT_BLE], RAIL_IDLE, true);
switch (current_phy_standard_value()) {
#if RAIL_BLE_SUPPORTS_CODED_PHY
case BLE_125KBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhyCoded(rail_handles[PROT_BLE],
RAIL_BLE_Coding_125kbps);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_Coding_125kbps failed with %d\n", status);
}
}
break;
case BLE_500KBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhyCoded(rail_handles[PROT_BLE],
RAIL_BLE_Coding_500kbps);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_Coding_500kbps failed with %d\n", status);
}
}
break;
#endif
#if RAIL_BLE_SUPPORTS_1MBPS
case BLE_1MBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhy1MbpsViterbi(rail_handles[PROT_BLE]);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_ConfigPhy1MbpsViterbi failed with %d\n", status);
}
}
break;
#endif
#if RAIL_BLE_SUPPORTS_2MBPS
case BLE_2MBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhy2MbpsViterbi(rail_handles[PROT_BLE]);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_ConfigPhy2MbpsViterbi failed with %d\n", status);
}
}
break;
#endif
default:
break;
}
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
if (status == RAIL_STATUS_NO_ERROR) {
is_supported = true;
} else {
is_supported = false;
range_test_std_phys[current_phy_standard_value()].is_supported =
false;
}
}
status = RAIL_BLE_ConfigChannelRadioParams(rail_handles[PROT_BLE],
BLE_CRC_INIT,
BLE_ACCESS_ADDRESS,
BLE_LOGICAL_CH,
DISABLE_WHITENING);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_ConfigChannelRadioParams failed");
}
return is_supported;
} | /*******************************************************************************
* @brief Change the protocol on the BLE handler
*
* @param None
*
* @returns is_supported: true if the radio can use this protocol
******************************************************************************/ | @brief Change the protocol on the BLE handler
@param None
@returns is_supported: true if the radio can use this protocol | [
"@brief",
"Change",
"the",
"protocol",
"on",
"the",
"BLE",
"handler",
"@param",
"None",
"@returns",
"is_supported",
":",
"true",
"if",
"the",
"radio",
"can",
"use",
"this",
"protocol"
] | bool ble_protocol_change(void)
{
bool is_supported = false;
RAIL_Status_t status = RAIL_STATUS_NO_ERROR;
RAIL_Idle(rail_handles[PROT_BLE], RAIL_IDLE, true);
switch (current_phy_standard_value()) {
#if RAIL_BLE_SUPPORTS_CODED_PHY
case BLE_125KBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhyCoded(rail_handles[PROT_BLE],
RAIL_BLE_Coding_125kbps);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_Coding_125kbps failed with %d\n", status);
}
}
break;
case BLE_500KBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhyCoded(rail_handles[PROT_BLE],
RAIL_BLE_Coding_500kbps);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_Coding_500kbps failed with %d\n", status);
}
}
break;
#endif
#if RAIL_BLE_SUPPORTS_1MBPS
case BLE_1MBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhy1MbpsViterbi(rail_handles[PROT_BLE]);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_ConfigPhy1MbpsViterbi failed with %d\n", status);
}
}
break;
#endif
#if RAIL_BLE_SUPPORTS_2MBPS
case BLE_2MBPS:
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
status = RAIL_BLE_ConfigPhy2MbpsViterbi(rail_handles[PROT_BLE]);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_ConfigPhy2MbpsViterbi failed with %d\n", status);
}
}
break;
#endif
default:
break;
}
if (range_test_std_phys[current_phy_standard_value()].is_supported) {
if (status == RAIL_STATUS_NO_ERROR) {
is_supported = true;
} else {
is_supported = false;
range_test_std_phys[current_phy_standard_value()].is_supported =
false;
}
}
status = RAIL_BLE_ConfigChannelRadioParams(rail_handles[PROT_BLE],
BLE_CRC_INIT,
BLE_ACCESS_ADDRESS,
BLE_LOGICAL_CH,
DISABLE_WHITENING);
if (status != RAIL_STATUS_NO_ERROR) {
app_log_error("RAIL_BLE_ConfigChannelRadioParams failed");
}
return is_supported;
} | [
"bool",
"ble_protocol_change",
"(",
"void",
")",
"{",
"bool",
"is_supported",
"=",
"false",
";",
"RAIL_Status_t",
"status",
"=",
"RAIL_STATUS_NO_ERROR",
";",
"RAIL_Idle",
"(",
"rail_handles",
"[",
"PROT_BLE",
"]",
",",
"RAIL_IDLE",
",",
"true",
")",
";",
"switch",
"(",
"current_phy_standard_value",
"(",
")",
")",
"{",
"#if",
"RAIL_BLE_SUPPORTS_CODED_PHY",
"\n",
"case",
"BLE_125KBPS",
":",
"if",
"(",
"range_test_std_phys",
"[",
"current_phy_standard_value",
"(",
")",
"]",
".",
"is_supported",
")",
"{",
"status",
"=",
"RAIL_BLE_ConfigPhyCoded",
"(",
"rail_handles",
"[",
"PROT_BLE",
"]",
",",
"RAIL_BLE_Coding_125kbps",
")",
";",
"if",
"(",
"status",
"!=",
"RAIL_STATUS_NO_ERROR",
")",
"{",
"app_log_error",
"(",
"\"",
"\\n",
"\"",
",",
"status",
")",
";",
"}",
"}",
"break",
";",
"case",
"BLE_500KBPS",
":",
"if",
"(",
"range_test_std_phys",
"[",
"current_phy_standard_value",
"(",
")",
"]",
".",
"is_supported",
")",
"{",
"status",
"=",
"RAIL_BLE_ConfigPhyCoded",
"(",
"rail_handles",
"[",
"PROT_BLE",
"]",
",",
"RAIL_BLE_Coding_500kbps",
")",
";",
"if",
"(",
"status",
"!=",
"RAIL_STATUS_NO_ERROR",
")",
"{",
"app_log_error",
"(",
"\"",
"\\n",
"\"",
",",
"status",
")",
";",
"}",
"}",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_1MBPS",
"\n",
"case",
"BLE_1MBPS",
":",
"if",
"(",
"range_test_std_phys",
"[",
"current_phy_standard_value",
"(",
")",
"]",
".",
"is_supported",
")",
"{",
"status",
"=",
"RAIL_BLE_ConfigPhy1MbpsViterbi",
"(",
"rail_handles",
"[",
"PROT_BLE",
"]",
")",
";",
"if",
"(",
"status",
"!=",
"RAIL_STATUS_NO_ERROR",
")",
"{",
"app_log_error",
"(",
"\"",
"\\n",
"\"",
",",
"status",
")",
";",
"}",
"}",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_2MBPS",
"\n",
"case",
"BLE_2MBPS",
":",
"if",
"(",
"range_test_std_phys",
"[",
"current_phy_standard_value",
"(",
")",
"]",
".",
"is_supported",
")",
"{",
"status",
"=",
"RAIL_BLE_ConfigPhy2MbpsViterbi",
"(",
"rail_handles",
"[",
"PROT_BLE",
"]",
")",
";",
"if",
"(",
"status",
"!=",
"RAIL_STATUS_NO_ERROR",
")",
"{",
"app_log_error",
"(",
"\"",
"\\n",
"\"",
",",
"status",
")",
";",
"}",
"}",
"break",
";",
"#endif",
"default",
":",
"break",
";",
"}",
"if",
"(",
"range_test_std_phys",
"[",
"current_phy_standard_value",
"(",
")",
"]",
".",
"is_supported",
")",
"{",
"if",
"(",
"status",
"==",
"RAIL_STATUS_NO_ERROR",
")",
"{",
"is_supported",
"=",
"true",
";",
"}",
"else",
"{",
"is_supported",
"=",
"false",
";",
"range_test_std_phys",
"[",
"current_phy_standard_value",
"(",
")",
"]",
".",
"is_supported",
"=",
"false",
";",
"}",
"}",
"status",
"=",
"RAIL_BLE_ConfigChannelRadioParams",
"(",
"rail_handles",
"[",
"PROT_BLE",
"]",
",",
"BLE_CRC_INIT",
",",
"BLE_ACCESS_ADDRESS",
",",
"BLE_LOGICAL_CH",
",",
"DISABLE_WHITENING",
")",
";",
"if",
"(",
"status",
"!=",
"RAIL_STATUS_NO_ERROR",
")",
"{",
"app_log_error",
"(",
"\"",
"\"",
")",
";",
"}",
"return",
"is_supported",
";",
"}"
] | @brief Change the protocol on the BLE handler
@param None | [
"@brief",
"Change",
"the",
"protocol",
"on",
"the",
"BLE",
"handler",
"@param",
"None"
] | [
"// Idle"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | is_current_phy_ble | bool | bool is_current_phy_ble(void)
{
if (current_phy_standard_value() > IEEE802154_250KBPS) {
return true;
} else {
return false;
}
} | /*******************************************************************************
* @brief Checks if the current phy is BLE or IEEE
*
* @param None
*
* @returns bool: true if current phy is a BLE protocol phy
******************************************************************************/ | @brief Checks if the current phy is BLE or IEEE
@param None
@returns bool: true if current phy is a BLE protocol phy | [
"@brief",
"Checks",
"if",
"the",
"current",
"phy",
"is",
"BLE",
"or",
"IEEE",
"@param",
"None",
"@returns",
"bool",
":",
"true",
"if",
"current",
"phy",
"is",
"a",
"BLE",
"protocol",
"phy"
] | bool is_current_phy_ble(void)
{
if (current_phy_standard_value() > IEEE802154_250KBPS) {
return true;
} else {
return false;
}
} | [
"bool",
"is_current_phy_ble",
"(",
"void",
")",
"{",
"if",
"(",
"current_phy_standard_value",
"(",
")",
">",
"IEEE802154_250KBPS",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | @brief Checks if the current phy is BLE or IEEE
@param None | [
"@brief",
"Checks",
"if",
"the",
"current",
"phy",
"is",
"BLE",
"or",
"IEEE",
"@param",
"None"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | handle_payload_length_for_standard | void | void handle_payload_length_for_standard(void)
{
if (current_phy_standard_value() == IEEE802154_250KBPS) {
if (range_test_settings.payload_length > IEEE802154_PAYLOAD_LEN_MAX) {
reset_payload_length_for_standard();
}
} else {
// BLE
if (range_test_settings.payload_length > BLE_PAYLOAD_LEN_MAX) {
reset_payload_length_for_standard();
}
}
} | /*******************************************************************************
* @brief The function handles payload length overflow of BLE and IEEE802154
*
* @param None
*
* @returns None
******************************************************************************/ | @brief The function handles payload length overflow of BLE and IEEE802154
@param None
@returns None | [
"@brief",
"The",
"function",
"handles",
"payload",
"length",
"overflow",
"of",
"BLE",
"and",
"IEEE802154",
"@param",
"None",
"@returns",
"None"
] | void handle_payload_length_for_standard(void)
{
if (current_phy_standard_value() == IEEE802154_250KBPS) {
if (range_test_settings.payload_length > IEEE802154_PAYLOAD_LEN_MAX) {
reset_payload_length_for_standard();
}
} else {
if (range_test_settings.payload_length > BLE_PAYLOAD_LEN_MAX) {
reset_payload_length_for_standard();
}
}
} | [
"void",
"handle_payload_length_for_standard",
"(",
"void",
")",
"{",
"if",
"(",
"current_phy_standard_value",
"(",
")",
"==",
"IEEE802154_250KBPS",
")",
"{",
"if",
"(",
"range_test_settings",
".",
"payload_length",
">",
"IEEE802154_PAYLOAD_LEN_MAX",
")",
"{",
"reset_payload_length_for_standard",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"range_test_settings",
".",
"payload_length",
">",
"BLE_PAYLOAD_LEN_MAX",
")",
"{",
"reset_payload_length_for_standard",
"(",
")",
";",
"}",
"}",
"}"
] | @brief The function handles payload length overflow of BLE and IEEE802154
@param None | [
"@brief",
"The",
"function",
"handles",
"payload",
"length",
"overflow",
"of",
"BLE",
"and",
"IEEE802154",
"@param",
"None"
] | [
"// BLE"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | print_standard_name | void | void print_standard_name(char *print_buffer)
{
if (current_phy_standard_value() == IEEE802154_250KBPS) {
#if RAIL_SUPPORTS_PROTOCOL_IEEE802154
sprintf(print_buffer, "IEEE 802.15.4");
range_test_settings.channel = IEEE802154_CHANNEL;
#endif
} else {
switch (current_phy_standard_value()) {
#if RAIL_BLE_SUPPORTS_CODED_PHY
case BLE_125KBPS:
sprintf(print_buffer, "BLE 125kbps");
break;
case BLE_500KBPS:
sprintf(print_buffer, "BLE 500kbps");
break;
#endif
#if RAIL_BLE_SUPPORTS_1MBPS
case BLE_1MBPS:
sprintf(print_buffer, "BLE 1Mbps");
break;
#endif
#if RAIL_BLE_SUPPORTS_2MBPS
case BLE_2MBPS:
sprintf(print_buffer, "BLE 2Mbps");
break;
#endif
}
range_test_settings.channel = BLE_PHYSICAL_CH;
}
} | /*******************************************************************************
* @brief Print function for menu, also updates the channel settings
*
* @param print_buffer: where the phy name should be written
*
* @returns None
******************************************************************************/ | @brief Print function for menu, also updates the channel settings
@param print_buffer: where the phy name should be written
@returns None | [
"@brief",
"Print",
"function",
"for",
"menu",
"also",
"updates",
"the",
"channel",
"settings",
"@param",
"print_buffer",
":",
"where",
"the",
"phy",
"name",
"should",
"be",
"written",
"@returns",
"None"
] | void print_standard_name(char *print_buffer)
{
if (current_phy_standard_value() == IEEE802154_250KBPS) {
#if RAIL_SUPPORTS_PROTOCOL_IEEE802154
sprintf(print_buffer, "IEEE 802.15.4");
range_test_settings.channel = IEEE802154_CHANNEL;
#endif
} else {
switch (current_phy_standard_value()) {
#if RAIL_BLE_SUPPORTS_CODED_PHY
case BLE_125KBPS:
sprintf(print_buffer, "BLE 125kbps");
break;
case BLE_500KBPS:
sprintf(print_buffer, "BLE 500kbps");
break;
#endif
#if RAIL_BLE_SUPPORTS_1MBPS
case BLE_1MBPS:
sprintf(print_buffer, "BLE 1Mbps");
break;
#endif
#if RAIL_BLE_SUPPORTS_2MBPS
case BLE_2MBPS:
sprintf(print_buffer, "BLE 2Mbps");
break;
#endif
}
range_test_settings.channel = BLE_PHYSICAL_CH;
}
} | [
"void",
"print_standard_name",
"(",
"char",
"*",
"print_buffer",
")",
"{",
"if",
"(",
"current_phy_standard_value",
"(",
")",
"==",
"IEEE802154_250KBPS",
")",
"{",
"#if",
"RAIL_SUPPORTS_PROTOCOL_IEEE802154",
"\n",
"sprintf",
"(",
"print_buffer",
",",
"\"",
"\"",
")",
";",
"range_test_settings",
".",
"channel",
"=",
"IEEE802154_CHANNEL",
";",
"#endif",
"}",
"else",
"{",
"switch",
"(",
"current_phy_standard_value",
"(",
")",
")",
"{",
"#if",
"RAIL_BLE_SUPPORTS_CODED_PHY",
"\n",
"case",
"BLE_125KBPS",
":",
"sprintf",
"(",
"print_buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"BLE_500KBPS",
":",
"sprintf",
"(",
"print_buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_1MBPS",
"\n",
"case",
"BLE_1MBPS",
":",
"sprintf",
"(",
"print_buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_2MBPS",
"\n",
"case",
"BLE_2MBPS",
":",
"sprintf",
"(",
"print_buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"#endif",
"}",
"range_test_settings",
".",
"channel",
"=",
"BLE_PHYSICAL_CH",
";",
"}",
"}"
] | @brief Print function for menu, also updates the channel settings
@param print_buffer: where the phy name should be written | [
"@brief",
"Print",
"function",
"for",
"menu",
"also",
"updates",
"the",
"channel",
"settings",
"@param",
"print_buffer",
":",
"where",
"the",
"phy",
"name",
"should",
"be",
"written"
] | [] | [
{
"param": "print_buffer",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "print_buffer",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | standard_phy_are_present | bool | bool standard_phy_are_present(void)
{
if ((get_number_of_phys() - NUM_OF_PREDEFINED_PHYS) > 0) {
if (range_test_settings.current_phy < get_number_of_custom_phys()) {
return false;
} else {
return true;
}
} else {
return true;
}
} | /*******************************************************************************
* @brief Helper function to check if BLE or IEEE is enabled for range test
*
* @param None
*
* @returns None
******************************************************************************/ | @brief Helper function to check if BLE or IEEE is enabled for range test
@param None
@returns None | [
"@brief",
"Helper",
"function",
"to",
"check",
"if",
"BLE",
"or",
"IEEE",
"is",
"enabled",
"for",
"range",
"test",
"@param",
"None",
"@returns",
"None"
] | bool standard_phy_are_present(void)
{
if ((get_number_of_phys() - NUM_OF_PREDEFINED_PHYS) > 0) {
if (range_test_settings.current_phy < get_number_of_custom_phys()) {
return false;
} else {
return true;
}
} else {
return true;
}
} | [
"bool",
"standard_phy_are_present",
"(",
"void",
")",
"{",
"if",
"(",
"(",
"get_number_of_phys",
"(",
")",
"-",
"NUM_OF_PREDEFINED_PHYS",
")",
">",
"0",
")",
"{",
"if",
"(",
"range_test_settings",
".",
"current_phy",
"<",
"get_number_of_custom_phys",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}"
] | @brief Helper function to check if BLE or IEEE is enabled for range test
@param None | [
"@brief",
"Helper",
"function",
"to",
"check",
"if",
"BLE",
"or",
"IEEE",
"is",
"enabled",
"for",
"range",
"test",
"@param",
"None"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | is_phy_standard | bool | bool is_phy_standard(uint8_t index)
{
if ((get_number_of_phys() - NUM_OF_PREDEFINED_PHYS) > 0) {
if (index < get_number_of_custom_phys()) {
return false;
} else {
return true;
}
} else {
return true;
}
} | /*******************************************************************************
* @brief Helper function to check if phy of index is standard
*
* @param index: index of the phy
*
* @returns None
******************************************************************************/ | @brief Helper function to check if phy of index is standard
@param index: index of the phy
@returns None | [
"@brief",
"Helper",
"function",
"to",
"check",
"if",
"phy",
"of",
"index",
"is",
"standard",
"@param",
"index",
":",
"index",
"of",
"the",
"phy",
"@returns",
"None"
] | bool is_phy_standard(uint8_t index)
{
if ((get_number_of_phys() - NUM_OF_PREDEFINED_PHYS) > 0) {
if (index < get_number_of_custom_phys()) {
return false;
} else {
return true;
}
} else {
return true;
}
} | [
"bool",
"is_phy_standard",
"(",
"uint8_t",
"index",
")",
"{",
"if",
"(",
"(",
"get_number_of_phys",
"(",
")",
"-",
"NUM_OF_PREDEFINED_PHYS",
")",
">",
"0",
")",
"{",
"if",
"(",
"index",
"<",
"get_number_of_custom_phys",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}"
] | @brief Helper function to check if phy of index is standard
@param index: index of the phy | [
"@brief",
"Helper",
"function",
"to",
"check",
"if",
"phy",
"of",
"index",
"is",
"standard",
"@param",
"index",
":",
"index",
"of",
"the",
"phy"
] | [] | [
{
"param": "index",
"type": "uint8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "index",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ce794b932fa2a8e38c75d91bda8ca923cbc2c5da | SiliconLabs/Gecko_SDK | app/flex/component/rail/sl_range_test_std_component/app_measurement_standard.c | [
"Zlib"
] | C | std_phy_list_generation | void | void std_phy_list_generation(uint8_t phy_index, uint8_t *buffer, uint8_t *length)
{
uint8_t std_phy_index = phy_index - get_number_of_custom_phys();
if (range_test_std_phys[std_phy_index].is_supported) {
switch (std_phy_index) {
#if RAIL_SUPPORTS_PROTOCOL_IEEE802154
case IEEE802154_250KBPS:
sprintf((char*)(&buffer[*length]), "%u:IEEE 802.15.4,", phy_index);
break;
#endif
#if RAIL_BLE_SUPPORTS_CODED_PHY
case BLE_125KBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 125kbps,", phy_index);
break;
case BLE_500KBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 500kbps,", phy_index);
break;
#endif
#if RAIL_BLE_SUPPORTS_1MBPS
case BLE_1MBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 1Mbps,", phy_index);
break;
#endif
#if RAIL_BLE_SUPPORTS_2MBPS
case BLE_2MBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 2Mbps,", phy_index);
break;
#endif
}
*length = strlen((char*)(buffer));
}
} | /*******************************************************************************
* @brief Genarete a string for the BLE mobile APP from standared phys
*
* @param phy_index: which phy name is needed
* @param buffer: where to write the caracters
* @param length: the length of the hole written string
*
* @returns None
******************************************************************************/ | @brief Genarete a string for the BLE mobile APP from standared phys
@param phy_index: which phy name is needed
@param buffer: where to write the caracters
@param length: the length of the hole written string
@returns None | [
"@brief",
"Genarete",
"a",
"string",
"for",
"the",
"BLE",
"mobile",
"APP",
"from",
"standared",
"phys",
"@param",
"phy_index",
":",
"which",
"phy",
"name",
"is",
"needed",
"@param",
"buffer",
":",
"where",
"to",
"write",
"the",
"caracters",
"@param",
"length",
":",
"the",
"length",
"of",
"the",
"hole",
"written",
"string",
"@returns",
"None"
] | void std_phy_list_generation(uint8_t phy_index, uint8_t *buffer, uint8_t *length)
{
uint8_t std_phy_index = phy_index - get_number_of_custom_phys();
if (range_test_std_phys[std_phy_index].is_supported) {
switch (std_phy_index) {
#if RAIL_SUPPORTS_PROTOCOL_IEEE802154
case IEEE802154_250KBPS:
sprintf((char*)(&buffer[*length]), "%u:IEEE 802.15.4,", phy_index);
break;
#endif
#if RAIL_BLE_SUPPORTS_CODED_PHY
case BLE_125KBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 125kbps,", phy_index);
break;
case BLE_500KBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 500kbps,", phy_index);
break;
#endif
#if RAIL_BLE_SUPPORTS_1MBPS
case BLE_1MBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 1Mbps,", phy_index);
break;
#endif
#if RAIL_BLE_SUPPORTS_2MBPS
case BLE_2MBPS:
sprintf((char*)(&buffer[*length]), "%u:BLE 2Mbps,", phy_index);
break;
#endif
}
*length = strlen((char*)(buffer));
}
} | [
"void",
"std_phy_list_generation",
"(",
"uint8_t",
"phy_index",
",",
"uint8_t",
"*",
"buffer",
",",
"uint8_t",
"*",
"length",
")",
"{",
"uint8_t",
"std_phy_index",
"=",
"phy_index",
"-",
"get_number_of_custom_phys",
"(",
")",
";",
"if",
"(",
"range_test_std_phys",
"[",
"std_phy_index",
"]",
".",
"is_supported",
")",
"{",
"switch",
"(",
"std_phy_index",
")",
"{",
"#if",
"RAIL_SUPPORTS_PROTOCOL_IEEE802154",
"\n",
"case",
"IEEE802154_250KBPS",
":",
"sprintf",
"(",
"(",
"char",
"*",
")",
"(",
"&",
"buffer",
"[",
"*",
"length",
"]",
")",
",",
"\"",
"\"",
",",
"phy_index",
")",
";",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_CODED_PHY",
"\n",
"case",
"BLE_125KBPS",
":",
"sprintf",
"(",
"(",
"char",
"*",
")",
"(",
"&",
"buffer",
"[",
"*",
"length",
"]",
")",
",",
"\"",
"\"",
",",
"phy_index",
")",
";",
"break",
";",
"case",
"BLE_500KBPS",
":",
"sprintf",
"(",
"(",
"char",
"*",
")",
"(",
"&",
"buffer",
"[",
"*",
"length",
"]",
")",
",",
"\"",
"\"",
",",
"phy_index",
")",
";",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_1MBPS",
"\n",
"case",
"BLE_1MBPS",
":",
"sprintf",
"(",
"(",
"char",
"*",
")",
"(",
"&",
"buffer",
"[",
"*",
"length",
"]",
")",
",",
"\"",
"\"",
",",
"phy_index",
")",
";",
"break",
";",
"#endif",
"#if",
"RAIL_BLE_SUPPORTS_2MBPS",
"\n",
"case",
"BLE_2MBPS",
":",
"sprintf",
"(",
"(",
"char",
"*",
")",
"(",
"&",
"buffer",
"[",
"*",
"length",
"]",
")",
",",
"\"",
"\"",
",",
"phy_index",
")",
";",
"break",
";",
"#endif",
"}",
"*",
"length",
"=",
"strlen",
"(",
"(",
"char",
"*",
")",
"(",
"buffer",
")",
")",
";",
"}",
"}"
] | @brief Genarete a string for the BLE mobile APP from standared phys
@param phy_index: which phy name is needed
@param buffer: where to write the caracters
@param length: the length of the hole written string | [
"@brief",
"Genarete",
"a",
"string",
"for",
"the",
"BLE",
"mobile",
"APP",
"from",
"standared",
"phys",
"@param",
"phy_index",
":",
"which",
"phy",
"name",
"is",
"needed",
"@param",
"buffer",
":",
"where",
"to",
"write",
"the",
"caracters",
"@param",
"length",
":",
"the",
"length",
"of",
"the",
"hole",
"written",
"string"
] | [] | [
{
"param": "phy_index",
"type": "uint8_t"
},
{
"param": "buffer",
"type": "uint8_t"
},
{
"param": "length",
"type": "uint8_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "phy_index",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a8cacf9d13330ba55167b2ed3676865879711c9 | SiliconLabs/Gecko_SDK | protocol/openthread/platform-abstraction/efr32/alarm.c | [
"Zlib"
] | C | otPlatRadioGetNow | uint64_t | uint64_t otPlatRadioGetNow(otInstance *aInstance)
{
static uint32_t timerWraps = 0U;
static uint32_t prev32TimeUs = 0U;
uint32_t now32TimeUs;
uint64_t now64TimeUs;
OT_UNUSED_VARIABLE(aInstance);
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
now32TimeUs = RAIL_GetTime();
if (now32TimeUs < prev32TimeUs) {
timerWraps += 1U;
}
prev32TimeUs = now32TimeUs;
now64TimeUs = ((uint64_t)timerWraps << 32) + now32TimeUs;
CORE_EXIT_CRITICAL();
return now64TimeUs;
} | // Note: This function should be called at least once per wrap
// period for the wrap-around logic to work below | This function should be called at least once per wrap
period for the wrap-around logic to work below | [
"This",
"function",
"should",
"be",
"called",
"at",
"least",
"once",
"per",
"wrap",
"period",
"for",
"the",
"wrap",
"-",
"around",
"logic",
"to",
"work",
"below"
] | uint64_t otPlatRadioGetNow(otInstance *aInstance)
{
static uint32_t timerWraps = 0U;
static uint32_t prev32TimeUs = 0U;
uint32_t now32TimeUs;
uint64_t now64TimeUs;
OT_UNUSED_VARIABLE(aInstance);
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_CRITICAL();
now32TimeUs = RAIL_GetTime();
if (now32TimeUs < prev32TimeUs) {
timerWraps += 1U;
}
prev32TimeUs = now32TimeUs;
now64TimeUs = ((uint64_t)timerWraps << 32) + now32TimeUs;
CORE_EXIT_CRITICAL();
return now64TimeUs;
} | [
"uint64_t",
"otPlatRadioGetNow",
"(",
"otInstance",
"*",
"aInstance",
")",
"{",
"static",
"uint32_t",
"timerWraps",
"=",
"0U",
";",
"static",
"uint32_t",
"prev32TimeUs",
"=",
"0U",
";",
"uint32_t",
"now32TimeUs",
";",
"uint64_t",
"now64TimeUs",
";",
"OT_UNUSED_VARIABLE",
"(",
"aInstance",
")",
";",
"CORE_DECLARE_IRQ_STATE",
";",
"CORE_ENTER_CRITICAL",
"(",
")",
";",
"now32TimeUs",
"=",
"RAIL_GetTime",
"(",
")",
";",
"if",
"(",
"now32TimeUs",
"<",
"prev32TimeUs",
")",
"{",
"timerWraps",
"+=",
"1U",
";",
"}",
"prev32TimeUs",
"=",
"now32TimeUs",
";",
"now64TimeUs",
"=",
"(",
"(",
"uint64_t",
")",
"timerWraps",
"<<",
"32",
")",
"+",
"now32TimeUs",
";",
"CORE_EXIT_CRITICAL",
"(",
")",
";",
"return",
"now64TimeUs",
";",
"}"
] | Note: This function should be called at least once per wrap
period for the wrap-around logic to work below | [
"Note",
":",
"This",
"function",
"should",
"be",
"called",
"at",
"least",
"once",
"per",
"wrap",
"period",
"for",
"the",
"wrap",
"-",
"around",
"logic",
"to",
"work",
"below"
] | [] | [
{
"param": "aInstance",
"type": "otInstance"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "aInstance",
"type": "otInstance",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
259384aae5a88b816964681c5d3f8a1963c4e727 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_sensor_server/app.c | [
"Zlib"
] | C | handle_boot_event | void | static void handle_boot_event(void)
{
sl_status_t sc;
bd_addr address;
uint8_t address_type;
char buf[BOOT_ERR_MSG_BUF_LEN];
// Check reset conditions and continue if not reset.
if (handle_reset_conditions()) {
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_status_f(sc, "Failed to get Bluetooth address\r\n");
set_device_name(&address);
// Initialize Mesh stack in Node operation mode, wait for initialized event
sc = sl_btmesh_node_init();
if (sc != SL_STATUS_OK) {
snprintf(buf, sizeof(buf), "init failed (0x%lx)", sc);
lcd_print(buf, BTMESH_WSTK_LCD_ROW_STATUS);
}
}
} | /***************************************************************************/
/**
* Handling of boot event.
* If needed it performs factory reset. In other case it sets device name
* and initialize mesh node.
******************************************************************************/ | Handling of boot event.
If needed it performs factory reset. In other case it sets device name
and initialize mesh node. | [
"Handling",
"of",
"boot",
"event",
".",
"If",
"needed",
"it",
"performs",
"factory",
"reset",
".",
"In",
"other",
"case",
"it",
"sets",
"device",
"name",
"and",
"initialize",
"mesh",
"node",
"."
] | static void handle_boot_event(void)
{
sl_status_t sc;
bd_addr address;
uint8_t address_type;
char buf[BOOT_ERR_MSG_BUF_LEN];
if (handle_reset_conditions()) {
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_status_f(sc, "Failed to get Bluetooth address\r\n");
set_device_name(&address);
sc = sl_btmesh_node_init();
if (sc != SL_STATUS_OK) {
snprintf(buf, sizeof(buf), "init failed (0x%lx)", sc);
lcd_print(buf, BTMESH_WSTK_LCD_ROW_STATUS);
}
}
} | [
"static",
"void",
"handle_boot_event",
"(",
"void",
")",
"{",
"sl_status_t",
"sc",
";",
"bd_addr",
"address",
";",
"uint8_t",
"address_type",
";",
"char",
"buf",
"[",
"BOOT_ERR_MSG_BUF_LEN",
"]",
";",
"if",
"(",
"handle_reset_conditions",
"(",
")",
")",
"{",
"sc",
"=",
"sl_bt_system_get_identity_address",
"(",
"&",
"address",
",",
"&",
"address_type",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"set_device_name",
"(",
"&",
"address",
")",
";",
"sc",
"=",
"sl_btmesh_node_init",
"(",
")",
";",
"if",
"(",
"sc",
"!=",
"SL_STATUS_OK",
")",
"{",
"snprintf",
"(",
"buf",
",",
"sizeof",
"(",
"buf",
")",
",",
"\"",
"\"",
",",
"sc",
")",
";",
"lcd_print",
"(",
"buf",
",",
"BTMESH_WSTK_LCD_ROW_STATUS",
")",
";",
"}",
"}",
"}"
] | Handling of boot event. | [
"Handling",
"of",
"boot",
"event",
"."
] | [
"// Check reset conditions and continue if not reset.",
"// Initialize Mesh stack in Node operation mode, wait for initialized event"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
259384aae5a88b816964681c5d3f8a1963c4e727 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_sensor_server/app.c | [
"Zlib"
] | C | handle_node_initialized_event | void | static void handle_node_initialized_event(sl_btmesh_evt_node_initialized_t *evt)
{
if (!evt->provisioned) {
// Enable ADV and GATT provisioning bearer
sl_status_t sc = sl_btmesh_node_start_unprov_beaconing(PB_ADV | PB_GATT);
app_assert_status_f(sc, "Failed to start unprovisioned beaconing\n");
}
} | /***************************************************************************/
/**
* Handling of mesh node initialized event.
* If device is provisioned it initializes the sensor server node.
* If device is unprovisioned it starts sending Unprovisioned Device Beacons.
*
* @param[in] evt Pointer to mesh node initialized event.
******************************************************************************/ | Handling of mesh node initialized event.
If device is provisioned it initializes the sensor server node.
If device is unprovisioned it starts sending Unprovisioned Device Beacons.
@param[in] evt Pointer to mesh node initialized event. | [
"Handling",
"of",
"mesh",
"node",
"initialized",
"event",
".",
"If",
"device",
"is",
"provisioned",
"it",
"initializes",
"the",
"sensor",
"server",
"node",
".",
"If",
"device",
"is",
"unprovisioned",
"it",
"starts",
"sending",
"Unprovisioned",
"Device",
"Beacons",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"mesh",
"node",
"initialized",
"event",
"."
] | static void handle_node_initialized_event(sl_btmesh_evt_node_initialized_t *evt)
{
if (!evt->provisioned) {
sl_status_t sc = sl_btmesh_node_start_unprov_beaconing(PB_ADV | PB_GATT);
app_assert_status_f(sc, "Failed to start unprovisioned beaconing\n");
}
} | [
"static",
"void",
"handle_node_initialized_event",
"(",
"sl_btmesh_evt_node_initialized_t",
"*",
"evt",
")",
"{",
"if",
"(",
"!",
"evt",
"->",
"provisioned",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_btmesh_node_start_unprov_beaconing",
"(",
"PB_ADV",
"|",
"PB_GATT",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"}"
] | Handling of mesh node initialized event. | [
"Handling",
"of",
"mesh",
"node",
"initialized",
"event",
"."
] | [
"// Enable ADV and GATT provisioning bearer"
] | [
{
"param": "evt",
"type": "sl_btmesh_evt_node_initialized_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_evt_node_initialized_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
259384aae5a88b816964681c5d3f8a1963c4e727 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_sensor_server/app.c | [
"Zlib"
] | C | sl_btmesh_on_event | void | void sl_btmesh_on_event(sl_btmesh_msg_t *evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
handle_node_initialized_event(&(evt->data.evt_node_initialized));
break;
default:
break;
}
} | /***************************************************************************/
/**
* Bluetooth Mesh stack event handler.
* This overrides the dummy weak implementation.
*
* @param[in] evt Pointer to incoming event from the Bluetooth Mesh stack.
******************************************************************************/ | Bluetooth Mesh stack event handler.
This overrides the dummy weak implementation.
@param[in] evt Pointer to incoming event from the Bluetooth Mesh stack. | [
"Bluetooth",
"Mesh",
"stack",
"event",
"handler",
".",
"This",
"overrides",
"the",
"dummy",
"weak",
"implementation",
".",
"@param",
"[",
"in",
"]",
"evt",
"Pointer",
"to",
"incoming",
"event",
"from",
"the",
"Bluetooth",
"Mesh",
"stack",
"."
] | void sl_btmesh_on_event(sl_btmesh_msg_t *evt)
{
switch (SL_BT_MSG_ID(evt->header)) {
case sl_btmesh_evt_node_initialized_id:
handle_node_initialized_event(&(evt->data.evt_node_initialized));
break;
default:
break;
}
} | [
"void",
"sl_btmesh_on_event",
"(",
"sl_btmesh_msg_t",
"*",
"evt",
")",
"{",
"switch",
"(",
"SL_BT_MSG_ID",
"(",
"evt",
"->",
"header",
")",
")",
"{",
"case",
"sl_btmesh_evt_node_initialized_id",
":",
"handle_node_initialized_event",
"(",
"&",
"(",
"evt",
"->",
"data",
".",
"evt_node_initialized",
")",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Bluetooth Mesh stack event handler. | [
"Bluetooth",
"Mesh",
"stack",
"event",
"handler",
"."
] | [] | [
{
"param": "evt",
"type": "sl_btmesh_msg_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "sl_btmesh_msg_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
259384aae5a88b816964681c5d3f8a1963c4e727 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_sensor_server/app.c | [
"Zlib"
] | C | app_led_blinking_timer_cb | void | static void app_led_blinking_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
if (!init_done) {
// Toggle LEDs
sl_simple_led_toggle(sl_led_led0.context);
#ifndef SINGLE_LED
sl_simple_led_toggle(sl_led_led1.context);
#endif // SINGLE_LED
}
} | /***************************************************************************/
/**
* periodic timer callback
* @param[in] handle Timer descriptor handle
* @param[in] data Callback input arguments
******************************************************************************/ | periodic timer callback
@param[in] handle Timer descriptor handle
@param[in] data Callback input arguments | [
"periodic",
"timer",
"callback",
"@param",
"[",
"in",
"]",
"handle",
"Timer",
"descriptor",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Callback",
"input",
"arguments"
] | static void app_led_blinking_timer_cb(sl_simple_timer_t *handle, void *data)
{
(void)data;
(void)handle;
if (!init_done) {
sl_simple_led_toggle(sl_led_led0.context);
#ifndef SINGLE_LED
sl_simple_led_toggle(sl_led_led1.context);
#endif
}
} | [
"static",
"void",
"app_led_blinking_timer_cb",
"(",
"sl_simple_timer_t",
"*",
"handle",
",",
"void",
"*",
"data",
")",
"{",
"(",
"void",
")",
"data",
";",
"(",
"void",
")",
"handle",
";",
"if",
"(",
"!",
"init_done",
")",
"{",
"sl_simple_led_toggle",
"(",
"sl_led_led0",
".",
"context",
")",
";",
"#ifndef",
"SINGLE_LED",
"sl_simple_led_toggle",
"(",
"sl_led_led1",
".",
"context",
")",
";",
"#endif",
"}",
"}"
] | periodic timer callback
@param[in] handle Timer descriptor handle
@param[in] data Callback input arguments | [
"periodic",
"timer",
"callback",
"@param",
"[",
"in",
"]",
"handle",
"Timer",
"descriptor",
"handle",
"@param",
"[",
"in",
"]",
"data",
"Callback",
"input",
"arguments"
] | [
"// Toggle LEDs",
"// SINGLE_LED"
] | [
{
"param": "handle",
"type": "sl_simple_timer_t"
},
{
"param": "data",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "handle",
"type": "sl_simple_timer_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
259384aae5a88b816964681c5d3f8a1963c4e727 | SiliconLabs/Gecko_SDK | app/bluetooth/example/soc_btmesh_sensor_server/app.c | [
"Zlib"
] | C | sl_btmesh_on_node_provisioned | void | void sl_btmesh_on_node_provisioned(uint16_t address, uint32_t iv_index)
{
sl_status_t sc = sl_simple_timer_stop(&app_led_blinking_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\r\n");
// Turn off LED
init_done = true;
sl_simple_led_turn_off(sl_led_led0.context);
#ifndef SINGLE_LED
sl_simple_led_turn_off(sl_led_led1.context);
#endif // SINGLE_LED
// Change LEDs to buttons in case of shared pin
change_leds_to_buttons();
app_show_btmesh_node_provisioned(address, iv_index);
} | /*******************************************************************************
* Called when the Provisioning finishes successfully
* @param[in] address Unicast address of the primary element of the node.
* Ignored if unprovisioned.
* @param[in] iv_index IV index for the first network of the node
* Ignored if unprovisioned.
******************************************************************************/ | Called when the Provisioning finishes successfully
@param[in] address Unicast address of the primary element of the node.
Ignored if unprovisioned.
@param[in] iv_index IV index for the first network of the node
Ignored if unprovisioned. | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully",
"@param",
"[",
"in",
"]",
"address",
"Unicast",
"address",
"of",
"the",
"primary",
"element",
"of",
"the",
"node",
".",
"Ignored",
"if",
"unprovisioned",
".",
"@param",
"[",
"in",
"]",
"iv_index",
"IV",
"index",
"for",
"the",
"first",
"network",
"of",
"the",
"node",
"Ignored",
"if",
"unprovisioned",
"."
] | void sl_btmesh_on_node_provisioned(uint16_t address, uint32_t iv_index)
{
sl_status_t sc = sl_simple_timer_stop(&app_led_blinking_timer);
app_assert_status_f(sc, "Failed to stop periodic timer\r\n");
init_done = true;
sl_simple_led_turn_off(sl_led_led0.context);
#ifndef SINGLE_LED
sl_simple_led_turn_off(sl_led_led1.context);
#endif
change_leds_to_buttons();
app_show_btmesh_node_provisioned(address, iv_index);
} | [
"void",
"sl_btmesh_on_node_provisioned",
"(",
"uint16_t",
"address",
",",
"uint32_t",
"iv_index",
")",
"{",
"sl_status_t",
"sc",
"=",
"sl_simple_timer_stop",
"(",
"&",
"app_led_blinking_timer",
")",
";",
"app_assert_status_f",
"(",
"sc",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"init_done",
"=",
"true",
";",
"sl_simple_led_turn_off",
"(",
"sl_led_led0",
".",
"context",
")",
";",
"#ifndef",
"SINGLE_LED",
"sl_simple_led_turn_off",
"(",
"sl_led_led1",
".",
"context",
")",
";",
"#endif",
"change_leds_to_buttons",
"(",
")",
";",
"app_show_btmesh_node_provisioned",
"(",
"address",
",",
"iv_index",
")",
";",
"}"
] | Called when the Provisioning finishes successfully
@param[in] address Unicast address of the primary element of the node. | [
"Called",
"when",
"the",
"Provisioning",
"finishes",
"successfully",
"@param",
"[",
"in",
"]",
"address",
"Unicast",
"address",
"of",
"the",
"primary",
"element",
"of",
"the",
"node",
"."
] | [
"// Turn off LED",
"// SINGLE_LED",
"// Change LEDs to buttons in case of shared pin"
] | [
{
"param": "address",
"type": "uint16_t"
},
{
"param": "iv_index",
"type": "uint32_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "address",
"type": "uint16_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv_index",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc11f78fb0144150ac0bad3063376f29f320c1b9 | SiliconLabs/Gecko_SDK | platform/micrium_os/kernel/source/os_core.c | [
"Zlib"
] | C | OSVersion | CPU_INT16U | CPU_INT16U OSVersion(RTOS_ERR *p_err)
{
OS_ASSERT_DBG_ERR_PTR_VALIDATE(p_err, 0u);
RTOS_ERR_SET(*p_err, RTOS_ERR_NONE);
return (OS_VERSION);
} | /****************************************************************************************************/
/**
* OSVersion()
*
* @brief Returns the version number of the Kernel. The returned value is the Kernel's version
* number multiplied by 10000. In other words, version 3.01.02 would be returned as 30102.
*
* @param p_err Pointer to the variable that will receive one of the following error code(s)
* from this function:
* - RTOS_ERR_NONE
*
* @return The version number of the Kernel multiplied by 10000.
*
* @note (1) This function is DEPRECATED and will be removed in a future version of this product.
* Instead, use RTOS_Version() or RTOS_VERSION.
* @deprecated
*******************************************************************************************************/ | OSVersion()
@brief Returns the version number of the Kernel. The returned value is the Kernel's version
number multiplied by 10000. In other words, version 3.01.02 would be returned as 30102.
@param p_err Pointer to the variable that will receive one of the following error code(s)
from this function:
- RTOS_ERR_NONE
@return The version number of the Kernel multiplied by 10000.
@note (1) This function is DEPRECATED and will be removed in a future version of this product. | [
"OSVersion",
"()",
"@brief",
"Returns",
"the",
"version",
"number",
"of",
"the",
"Kernel",
".",
"The",
"returned",
"value",
"is",
"the",
"Kernel",
"'",
"s",
"version",
"number",
"multiplied",
"by",
"10000",
".",
"In",
"other",
"words",
"version",
"3",
".",
"01",
".",
"02",
"would",
"be",
"returned",
"as",
"30102",
".",
"@param",
"p_err",
"Pointer",
"to",
"the",
"variable",
"that",
"will",
"receive",
"one",
"of",
"the",
"following",
"error",
"code",
"(",
"s",
")",
"from",
"this",
"function",
":",
"-",
"RTOS_ERR_NONE",
"@return",
"The",
"version",
"number",
"of",
"the",
"Kernel",
"multiplied",
"by",
"10000",
".",
"@note",
"(",
"1",
")",
"This",
"function",
"is",
"DEPRECATED",
"and",
"will",
"be",
"removed",
"in",
"a",
"future",
"version",
"of",
"this",
"product",
"."
] | CPU_INT16U OSVersion(RTOS_ERR *p_err)
{
OS_ASSERT_DBG_ERR_PTR_VALIDATE(p_err, 0u);
RTOS_ERR_SET(*p_err, RTOS_ERR_NONE);
return (OS_VERSION);
} | [
"CPU_INT16U",
"OSVersion",
"(",
"RTOS_ERR",
"*",
"p_err",
")",
"{",
"OS_ASSERT_DBG_ERR_PTR_VALIDATE",
"(",
"p_err",
",",
"0u",
")",
";",
"RTOS_ERR_SET",
"(",
"*",
"p_err",
",",
"RTOS_ERR_NONE",
")",
";",
"return",
"(",
"OS_VERSION",
")",
";",
"}"
] | OSVersion()
@brief Returns the version number of the Kernel. | [
"OSVersion",
"()",
"@brief",
"Returns",
"the",
"version",
"number",
"of",
"the",
"Kernel",
"."
] | [] | [
{
"param": "p_err",
"type": "RTOS_ERR"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_err",
"type": "RTOS_ERR",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc11f78fb0144150ac0bad3063376f29f320c1b9 | SiliconLabs/Gecko_SDK | platform/micrium_os/kernel/source/os_core.c | [
"Zlib"
] | C | OSIsIdle | CPU_BOOLEAN | CPU_BOOLEAN OSIsIdle(void)
{
if (OS_PrioGetHighest() != OS_CFG_PRIO_MAX ) {
return DEF_NO;
} else {
return DEF_YES;
}
} | /***************************************************************************/
/**
* This function return the state of the kernel.
*
* @return True, if the kernel is idle,
* False, otherwise.
******************************************************************************/ | This function return the state of the kernel.
@return True, if the kernel is idle,
False, otherwise. | [
"This",
"function",
"return",
"the",
"state",
"of",
"the",
"kernel",
".",
"@return",
"True",
"if",
"the",
"kernel",
"is",
"idle",
"False",
"otherwise",
"."
] | CPU_BOOLEAN OSIsIdle(void)
{
if (OS_PrioGetHighest() != OS_CFG_PRIO_MAX ) {
return DEF_NO;
} else {
return DEF_YES;
}
} | [
"CPU_BOOLEAN",
"OSIsIdle",
"(",
"void",
")",
"{",
"if",
"(",
"OS_PrioGetHighest",
"(",
")",
"!=",
"OS_CFG_PRIO_MAX",
")",
"{",
"return",
"DEF_NO",
";",
"}",
"else",
"{",
"return",
"DEF_YES",
";",
"}",
"}"
] | This function return the state of the kernel. | [
"This",
"function",
"return",
"the",
"state",
"of",
"the",
"kernel",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
dc11f78fb0144150ac0bad3063376f29f320c1b9 | SiliconLabs/Gecko_SDK | platform/micrium_os/kernel/source/os_core.c | [
"Zlib"
] | C | OS_Pend | void | void OS_Pend(OS_PEND_OBJ *p_obj,
OS_STATE pending_on,
OS_TICK timeout)
{
OS_PEND_LIST *p_pend_list;
OSTCBCurPtr->PendOn = pending_on; // Resource not available, wait until it is
OSTCBCurPtr->PendStatus = OS_STATUS_PEND_OK;
#if (OS_CFG_SCHED_ROUND_ROBIN_EN == DEF_ENABLED)
if (OSSchedRoundRobinEn) {
OSRoundRobinCurTCB->TimeQuantaCtr = 0u; // Time quanta counter will be reset later.
(void)sl_sleeptimer_stop_timer(&OSRoundRobinTimer);
}
#endif
OS_TaskBlock(OSTCBCurPtr, // Block the task and add it to the tick list if needed
timeout);
if (p_obj != DEF_NULL) { // Add the current task to the pend list ...
p_pend_list = &p_obj->PendList; // ... if there is an object to pend on
OSTCBCurPtr->PendObjPtr = p_obj; // Save the pointer to the object pending on
OS_PendListInsertPrio(p_pend_list, // Insert in the pend list in priority order
OSTCBCurPtr);
} else {
OSTCBCurPtr->PendObjPtr = DEF_NULL; // If no object being pended on, clear the pend object
}
#if (OS_CFG_DBG_EN == DEF_ENABLED)
OS_PendDbgNameAdd(p_obj,
OSTCBCurPtr);
#endif
} | /*****************************************************************************************************/
/**
* OS_Pend()
*
* @brief This function is called to place a task in the blocked state waiting for an event to occur.
* This function exists because it is common to a number of OSxxxPend() services.
*
* @param p_obj Pointer to the object to pend on. If there are no object used to pend
* on then the caller must pass a NULL pointer.
*
* @param pending_on Specifies what the task will be pending on:
* - OS_TASK_PEND_ON_FLAG
* - OS_TASK_PEND_ON_TASK_Q <- No object (pending for a message sent to
* the task)
* - OS_TASK_PEND_ON_MUTEX
* - OS_TASK_PEND_ON_Q
* - OS_TASK_PEND_ON_SEM
* - OS_TASK_PEND_ON_TASK_SEM <- No object (pending on a signal sent to
* the task)
*
* @param timeout Amount of time the task will wait for the event to occur.
*
* @note (1) This function is INTERNAL to the Kernel and your application MUST NOT call it.
*******************************************************************************************************/ | OS_Pend()
@brief This function is called to place a task in the blocked state waiting for an event to occur.
This function exists because it is common to a number of OSxxxPend() services.
@param p_obj Pointer to the object to pend on. If there are no object used to pend
on then the caller must pass a NULL pointer.
@param timeout Amount of time the task will wait for the event to occur.
@note (1) This function is INTERNAL to the Kernel and your application MUST NOT call it. | [
"OS_Pend",
"()",
"@brief",
"This",
"function",
"is",
"called",
"to",
"place",
"a",
"task",
"in",
"the",
"blocked",
"state",
"waiting",
"for",
"an",
"event",
"to",
"occur",
".",
"This",
"function",
"exists",
"because",
"it",
"is",
"common",
"to",
"a",
"number",
"of",
"OSxxxPend",
"()",
"services",
".",
"@param",
"p_obj",
"Pointer",
"to",
"the",
"object",
"to",
"pend",
"on",
".",
"If",
"there",
"are",
"no",
"object",
"used",
"to",
"pend",
"on",
"then",
"the",
"caller",
"must",
"pass",
"a",
"NULL",
"pointer",
".",
"@param",
"timeout",
"Amount",
"of",
"time",
"the",
"task",
"will",
"wait",
"for",
"the",
"event",
"to",
"occur",
".",
"@note",
"(",
"1",
")",
"This",
"function",
"is",
"INTERNAL",
"to",
"the",
"Kernel",
"and",
"your",
"application",
"MUST",
"NOT",
"call",
"it",
"."
] | void OS_Pend(OS_PEND_OBJ *p_obj,
OS_STATE pending_on,
OS_TICK timeout)
{
OS_PEND_LIST *p_pend_list;
OSTCBCurPtr->PendOn = pending_on;
OSTCBCurPtr->PendStatus = OS_STATUS_PEND_OK;
#if (OS_CFG_SCHED_ROUND_ROBIN_EN == DEF_ENABLED)
if (OSSchedRoundRobinEn) {
OSRoundRobinCurTCB->TimeQuantaCtr = 0u;
(void)sl_sleeptimer_stop_timer(&OSRoundRobinTimer);
}
#endif
OS_TaskBlock(OSTCBCurPtr,
timeout);
if (p_obj != DEF_NULL) {
p_pend_list = &p_obj->PendList;
OSTCBCurPtr->PendObjPtr = p_obj;
OS_PendListInsertPrio(p_pend_list,
OSTCBCurPtr);
} else {
OSTCBCurPtr->PendObjPtr = DEF_NULL;
}
#if (OS_CFG_DBG_EN == DEF_ENABLED)
OS_PendDbgNameAdd(p_obj,
OSTCBCurPtr);
#endif
} | [
"void",
"OS_Pend",
"(",
"OS_PEND_OBJ",
"*",
"p_obj",
",",
"OS_STATE",
"pending_on",
",",
"OS_TICK",
"timeout",
")",
"{",
"OS_PEND_LIST",
"*",
"p_pend_list",
";",
"OSTCBCurPtr",
"->",
"PendOn",
"=",
"pending_on",
";",
"OSTCBCurPtr",
"->",
"PendStatus",
"=",
"OS_STATUS_PEND_OK",
";",
"#if",
"(",
"OS_CFG_SCHED_ROUND_ROBIN_EN",
"==",
"DEF_ENABLED",
")",
"\n",
"if",
"(",
"OSSchedRoundRobinEn",
")",
"{",
"OSRoundRobinCurTCB",
"->",
"TimeQuantaCtr",
"=",
"0u",
";",
"(",
"void",
")",
"sl_sleeptimer_stop_timer",
"(",
"&",
"OSRoundRobinTimer",
")",
";",
"}",
"#endif",
"OS_TaskBlock",
"(",
"OSTCBCurPtr",
",",
"timeout",
")",
";",
"if",
"(",
"p_obj",
"!=",
"DEF_NULL",
")",
"{",
"p_pend_list",
"=",
"&",
"p_obj",
"->",
"PendList",
";",
"OSTCBCurPtr",
"->",
"PendObjPtr",
"=",
"p_obj",
";",
"OS_PendListInsertPrio",
"(",
"p_pend_list",
",",
"OSTCBCurPtr",
")",
";",
"}",
"else",
"{",
"OSTCBCurPtr",
"->",
"PendObjPtr",
"=",
"DEF_NULL",
";",
"}",
"#if",
"(",
"OS_CFG_DBG_EN",
"==",
"DEF_ENABLED",
")",
"\n",
"OS_PendDbgNameAdd",
"(",
"p_obj",
",",
"OSTCBCurPtr",
")",
";",
"#endif",
"}"
] | OS_Pend()
@brief This function is called to place a task in the blocked state waiting for an event to occur. | [
"OS_Pend",
"()",
"@brief",
"This",
"function",
"is",
"called",
"to",
"place",
"a",
"task",
"in",
"the",
"blocked",
"state",
"waiting",
"for",
"an",
"event",
"to",
"occur",
"."
] | [
"// Resource not available, wait until it is",
"// Time quanta counter will be reset later.",
"// Block the task and add it to the tick list if needed",
"// Add the current task to the pend list ...",
"// ... if there is an object to pend on",
"// Save the pointer to the object pending on",
"// Insert in the pend list in priority order",
"// If no object being pended on, clear the pend object"
] | [
{
"param": "p_obj",
"type": "OS_PEND_OBJ"
},
{
"param": "pending_on",
"type": "OS_STATE"
},
{
"param": "timeout",
"type": "OS_TICK"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_obj",
"type": "OS_PEND_OBJ",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pending_on",
"type": "OS_STATE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timeout",
"type": "OS_TICK",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc11f78fb0144150ac0bad3063376f29f320c1b9 | SiliconLabs/Gecko_SDK | platform/micrium_os/kernel/source/os_core.c | [
"Zlib"
] | C | OS_PendDbgNameRemove | void | void OS_PendDbgNameRemove(OS_PEND_OBJ *p_obj,
OS_TCB *p_tcb)
{
OS_PEND_LIST *p_pend_list;
OS_TCB *p_tcb1;
p_tcb->DbgNamePtr = (CPU_CHAR *)((void *)" "); // Remove name of object pended on for readied task
if (p_obj != DEF_NULL) {
p_pend_list = &p_obj->PendList;
p_tcb1 = p_pend_list->HeadPtr;
if (p_tcb1 != DEF_NULL) { // Find name of HP task pending on this object ...
p_obj->DbgNamePtr = p_tcb1->NamePtr; // ... Save in object
} else {
p_obj->DbgNamePtr = (CPU_CHAR *)((void *)" "); // Or no other task is pending on object
}
}
} | /****************************************************************************************************/
/**
* OS_PendDbgNameRemove()
*
* @brief Remove pointers to ASCII 'names' of objects so they can easily be displayed using a Kernel
* aware tool.
*
* @param p_obj Pointer to the object being pended on.
*
* @param p_tcb Pointer to the OS_TCB of the task pending on the object.
*
* @note (1) This function is INTERNAL to the Kernel and your application MUST NOT call it.
*******************************************************************************************************/ | OS_PendDbgNameRemove()
@brief Remove pointers to ASCII 'names' of objects so they can easily be displayed using a Kernel
aware tool.
@param p_obj Pointer to the object being pended on.
@param p_tcb Pointer to the OS_TCB of the task pending on the object.
@note (1) This function is INTERNAL to the Kernel and your application MUST NOT call it. | [
"OS_PendDbgNameRemove",
"()",
"@brief",
"Remove",
"pointers",
"to",
"ASCII",
"'",
"names",
"'",
"of",
"objects",
"so",
"they",
"can",
"easily",
"be",
"displayed",
"using",
"a",
"Kernel",
"aware",
"tool",
".",
"@param",
"p_obj",
"Pointer",
"to",
"the",
"object",
"being",
"pended",
"on",
".",
"@param",
"p_tcb",
"Pointer",
"to",
"the",
"OS_TCB",
"of",
"the",
"task",
"pending",
"on",
"the",
"object",
".",
"@note",
"(",
"1",
")",
"This",
"function",
"is",
"INTERNAL",
"to",
"the",
"Kernel",
"and",
"your",
"application",
"MUST",
"NOT",
"call",
"it",
"."
] | void OS_PendDbgNameRemove(OS_PEND_OBJ *p_obj,
OS_TCB *p_tcb)
{
OS_PEND_LIST *p_pend_list;
OS_TCB *p_tcb1;
p_tcb->DbgNamePtr = (CPU_CHAR *)((void *)" ");
if (p_obj != DEF_NULL) {
p_pend_list = &p_obj->PendList;
p_tcb1 = p_pend_list->HeadPtr;
if (p_tcb1 != DEF_NULL) {
p_obj->DbgNamePtr = p_tcb1->NamePtr;
} else {
p_obj->DbgNamePtr = (CPU_CHAR *)((void *)" ");
}
}
} | [
"void",
"OS_PendDbgNameRemove",
"(",
"OS_PEND_OBJ",
"*",
"p_obj",
",",
"OS_TCB",
"*",
"p_tcb",
")",
"{",
"OS_PEND_LIST",
"*",
"p_pend_list",
";",
"OS_TCB",
"*",
"p_tcb1",
";",
"p_tcb",
"->",
"DbgNamePtr",
"=",
"(",
"CPU_CHAR",
"*",
")",
"(",
"(",
"void",
"*",
")",
"\"",
"\"",
")",
";",
"if",
"(",
"p_obj",
"!=",
"DEF_NULL",
")",
"{",
"p_pend_list",
"=",
"&",
"p_obj",
"->",
"PendList",
";",
"p_tcb1",
"=",
"p_pend_list",
"->",
"HeadPtr",
";",
"if",
"(",
"p_tcb1",
"!=",
"DEF_NULL",
")",
"{",
"p_obj",
"->",
"DbgNamePtr",
"=",
"p_tcb1",
"->",
"NamePtr",
";",
"}",
"else",
"{",
"p_obj",
"->",
"DbgNamePtr",
"=",
"(",
"CPU_CHAR",
"*",
")",
"(",
"(",
"void",
"*",
")",
"\"",
"\"",
")",
";",
"}",
"}",
"}"
] | OS_PendDbgNameRemove()
@brief Remove pointers to ASCII 'names' of objects so they can easily be displayed using a Kernel
aware tool. | [
"OS_PendDbgNameRemove",
"()",
"@brief",
"Remove",
"pointers",
"to",
"ASCII",
"'",
"names",
"'",
"of",
"objects",
"so",
"they",
"can",
"easily",
"be",
"displayed",
"using",
"a",
"Kernel",
"aware",
"tool",
"."
] | [
"// Remove name of object pended on for readied task",
"// Find name of HP task pending on this object ...",
"// ... Save in object",
"// Or no other task is pending on object"
] | [
{
"param": "p_obj",
"type": "OS_PEND_OBJ"
},
{
"param": "p_tcb",
"type": "OS_TCB"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p_obj",
"type": "OS_PEND_OBJ",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p_tcb",
"type": "OS_TCB",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.