本文整理汇总了C++中LEDS_ON函数的典型用法代码示例。如果您正苦于以下问题:C++ LEDS_ON函数的具体用法?C++ LEDS_ON怎么用?C++ LEDS_ON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LEDS_ON函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: blink_timeout_handler
/**@brief Timer callback used for controlling board LEDs to represent application state.
*
*/
static void blink_timeout_handler(iot_timer_time_in_ms_t wall_clock_value)
{
UNUSED_PARAMETER(wall_clock_value);
switch (m_display_state)
{
case LEDS_INACTIVE:
{
LEDS_OFF((LED_ONE | LED_TWO));
break;
}
case LEDS_BLE_ADVERTISING:
{
LEDS_INVERT(LED_ONE);
LEDS_OFF(LED_TWO);
break;
}
case LEDS_IPV6_IF_DOWN:
{
LEDS_ON(LED_ONE);
LEDS_INVERT(LED_TWO);
break;
}
case LEDS_IPV6_IF_UP:
{
LEDS_OFF(LED_ONE);
LEDS_ON(LED_TWO);
break;
}
default:
{
break;
}
}
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:38,代码来源:main.c
示例2: coap_response_handler
static void coap_response_handler(uint32_t status, void * arg, coap_message_t * p_response)
{
if (status == NRF_SUCCESS)
{
if (coap_message_opt_present(p_response, COAP_OPT_OBSERVE) == NRF_SUCCESS)
{
// It is an notification or result of a GET response
LEDS_ON(LED_FOUR);
}
else
{
LEDS_OFF(LED_FOUR);
}
APPL_LOG("[APPL]: Response Code : %d\r\n", p_response->header.code);
if (p_response->header.code == COAP_CODE_205_CONTENT)
{
switch (p_response->p_payload[0])
{
case STATUS_ON:
LEDS_ON(LED_THREE);
break;
case STATUS_OFF:
LEDS_OFF(LED_THREE);
break;
default:
break;
}
}
}
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:34,代码来源:main.c
示例3: gptimer1_handler
void gptimer1_handler(int id) {
uint32_t irq = reg32r(GPTIMER1_BASE, GPT_TISR);
{
static int blink = 0;
if (blink & (1<<2)) {
LEDS_OFF(LED0);
LEDS_ON(LED1);
} else {
LEDS_ON(LED0);
LEDS_OFF(LED1);
}
blink++;
}
// check for overflow int
if (irq & OVF_IT_FLAG) {
Remove(&thistask->Node);
AddTail(&tasks, &thistask->Node);
thistask = (struct task *)tasks.Head;
irq_new_task(tcb_to_sp(&thistask->tcb));
}
// clear ints
reg32w(GPTIMER1_BASE, GPT_TISR, ~0);
}
开发者ID:corywalker,项目名称:puppybits,代码行数:28,代码来源:irq-timer.c
示例4: blink_timeout_handler
/**@brief Timer callback used for controlling board LEDs to represent application state.
*
*/
static void blink_timeout_handler(iot_timer_time_in_ms_t wall_clock_value)
{
UNUSED_PARAMETER(wall_clock_value);
#ifdef COMMISSIONING_ENABLED
static bool id_mode_previously_enabled;
#endif // COMMISSIONING_ENABLED
switch (m_display_state)
{
case LEDS_INACTIVE:
{
LEDS_OFF((LED_ONE | LED_TWO));
break;
}
case LEDS_CONNECTABLE_MODE:
{
LEDS_INVERT(LED_ONE);
LEDS_OFF(LED_TWO);
break;
}
case LEDS_IPV6_IF_DOWN:
{
LEDS_ON(LED_ONE);
LEDS_INVERT(LED_TWO);
break;
}
case LEDS_IPV6_IF_UP:
{
LEDS_OFF(LED_ONE);
LEDS_ON(LED_TWO);
break;
}
default:
{
break;
}
}
#ifdef COMMISSIONING_ENABLED
if ((id_mode_previously_enabled == false) && (m_identity_mode_active == true))
{
LEDS_OFF(LED_THREE | LED_FOUR);
}
if ((id_mode_previously_enabled == true) && (m_identity_mode_active == true))
{
LEDS_INVERT(LED_THREE | LED_FOUR);
}
if ((id_mode_previously_enabled == true) && (m_identity_mode_active == false))
{
LEDS_OFF(LED_THREE | LED_FOUR);
}
id_mode_previously_enabled = m_identity_mode_active;
#endif // COMMISSIONING_ENABLED
}
开发者ID:sische,项目名称:MasterThesis,代码行数:61,代码来源:main.c
示例5: blink_timeout_handler
/**@brief Timer callback used for controlling board LEDs to represent application state.
*
* @param[in] p_context Pointer used for passing context. No context used in this application.
*/
static void blink_timeout_handler(void * p_context)
{
switch (m_display_state)
{
case LEDS_INACTIVE:
{
LEDS_OFF((LED_ONE | LED_TWO));
break;
}
case LEDS_BLE_ADVERTISING:
{
LEDS_INVERT(LED_ONE);
LEDS_OFF(LED_TWO);
break;
}
case LEDS_IPV6_IF_DOWN:
{
LEDS_ON(LED_ONE);
LEDS_INVERT(LED_TWO);
break;
}
case LEDS_TX_ECHO_RESPONSE:
{
LEDS_ON(LED_ONE);
LEDS_OFF(LED_TWO);
break;
}
case LEDS_TX_UDP_PACKET:
{
LEDS_ON(LED_TWO);
if (LED_IS_ON(LED_ONE) == 0)
{
if (m_udp_tx_occured)
{
// If UDP transmission stops, LED_ONE should stop blinking in off state.
LEDS_ON(LED_ONE);
m_udp_tx_occured = false;
}
}
else
{
LEDS_OFF(LED_ONE);
}
break;
}
default:
{
break;
}
}
}
开发者ID:451506709,项目名称:automated_machine,代码行数:56,代码来源:main.c
示例6: blink_timeout_handler
/**@brief Timer callback used for controlling board LEDs to represent application state.
*
*/
static void blink_timeout_handler(iot_timer_time_in_ms_t wall_clock_value)
{
UNUSED_PARAMETER(wall_clock_value);
switch (m_display_state)
{
case LEDS_INACTIVE:
{
LEDS_OFF(ALL_APP_LED);
break;
}
case LEDS_BLE_ADVERTISING:
{
LEDS_INVERT(LED_ONE);
LEDS_OFF((LED_TWO | LED_THREE | LED_FOUR));
break;
}
case LEDS_IPV6_IF_DOWN:
{
LEDS_INVERT(LED_TWO);
LEDS_OFF((LED_ONE | LED_THREE | LED_FOUR));
break;
}
case LEDS_IPV6_IF_UP:
{
LEDS_ON(LED_ONE);
LEDS_OFF((LED_TWO | LED_THREE | LED_FOUR));
break;
}
case LEDS_CONNECTED_TO_BROKER:
{
LEDS_ON(LED_TWO);
LEDS_OFF((LED_ONE | LED_THREE | LED_FOUR));
m_display_state = LEDS_PUBLISHING;
break;
}
case LEDS_PUBLISHING:
{
LEDS_OFF(LED_ONE);
LEDS_ON(LED_TWO);
break;
}
default:
{
break;
}
}
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:51,代码来源:main.c
示例7: app_mqtt_publish
/**@brief Publishes LED state to MQTT broker.
*
* @param[in] led_state LED state being published.
*/
static void app_mqtt_publish(bool led_state)
{
mqtt_topic_t topic;
mqtt_data_t data;
char topic_desc[] = "led/state";
topic.p_topic = (uint8_t *)topic_desc;
topic.topic_len = strlen(topic_desc);
data.data_len = 1;
data.p_data = (uint8_t *)&led_state;
uint32_t err_code = mqtt_publish(&m_app_mqtt_id,&topic, &data);
APPL_LOG("[APPL]: mqtt_publish result 0x%08lx\r\n", err_code);
if (err_code == MQTT_SUCCESS)
{
LEDS_INVERT(LED_FOUR);
m_led_state = !m_led_state;
}
else
{
// Flash LED_THREE if error occurs.
LEDS_ON(LED_THREE);
err_code = app_timer_start(m_led_blink_timer, LED_BLINK_INTERVAL, NULL);
APP_ERROR_CHECK(err_code);
}
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:32,代码来源:main.c
示例8: nfc_callback
static void nfc_callback(void * p_context, nfc_t2t_event_t event, const uint8_t * p_data, size_t data_length)
{
(void) p_context;
uint32_t err_code;
switch (event)
{
case NFC_T2T_EVENT_FIELD_ON:
{
NRF_LOG_INFO("NFC_EVENT_FIELD_ON\r\n");
LEDS_ON(BSP_LED_3_MASK);
/* Start advertising to become connectable. */
if (!m_advertising_flag)
{
m_advertising_flag = 1;
advertising_enable();
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
}
}
break;
case NFC_T2T_EVENT_FIELD_OFF:
NRF_LOG_INFO("NFC_EVENT_FIELD_OFF\r\n");
LEDS_OFF(BSP_LED_3_MASK);
break;
default:
break;
}
return;
}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:32,代码来源:main.c
示例9: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(wget_process, ev, data)
{
PROCESS_BEGIN();
PRINTF("wget: fetching %s\n", file);
#if STATS
fetch_counter = 0;
fetch_started = clock_time();
#endif /* STATS */
LEDS_ON(LEDS_YELLOW);
if(webclient_get(server, port, file) == 0) {
PRINTF("wget: failed to connect\n");
LEDS_OFF(LEDS_YELLOW);
fetch_running = 0;
call_done(WGET_CONNECT_FAILED);
} else {
while(fetch_running) {
PROCESS_WAIT_EVENT();
if(ev == tcpip_event) {
webclient_appcall(data);
}
}
}
PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:27,代码来源:wget.c
示例10: app_error_fault_handler
/**@brief Function for error handling, which demonstrates usage of the ANT debug
* module to output debug information over the debug channel on an assertion
*
* @param[in] error_code Error code supplied to the handler.
* @param[in] line_num Line number where the handler is called.
* @param[in] p_file_name Pointer to the file name.
*/
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
#if defined(INCLUDE_DEBUG_CHANNEL)
error_info_t * p_error_info = (error_info_t *)info;
char file_name[2];
uint32_t file_name_len = strlen((char *)p_error_info->p_file_name);
file_name[0] = '\0';
file_name[1] = '\0';
for (uint32_t i = 0; i < file_name_len; i++)
{
if ((p_error_info->p_file_name[i] != '.')
&& (p_error_info->p_file_name[i] != '/')
&& (p_error_info->p_file_name[i] != '\\'))
{
file_name[0] = p_error_info->p_file_name[i + 1];
file_name[1] = p_error_info->p_file_name[i];
break;
}
}
ad_force_error_page((uint8_t)p_error_info->err_code, (uint16_t)p_error_info->line_num, file_name);
#endif
LEDS_ON(LEDS_MASK);
for (;;)
{
// No implementation needed.
}
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:39,代码来源:main.c
示例11: vBlinkerRequest
void vBlinkerRequest(uint8_t cmd)
{
switch (cmd & CMD_MASK)
{
case CMD_LED_ON:
switch (cmd & LED_MASK)
{
case LED_RED:
LED_RED_ON();
break;
case LED_GREEN:
LED_GREEN_ON();
break;
case LED_BLUE:
LED_BLUE_ON();
break;
case LED_ALL:
LEDS_ON();
break;
}
break;
case CMD_LED_OFF:
switch (cmd & LED_MASK)
{
case LED_RED:
LED_RED_OFF();
break;
case LED_GREEN:
LED_GREEN_OFF();
break;
case LED_BLUE:
LED_BLUE_OFF();
break;
case LED_ALL:
LEDS_OFF();
break;
}
break;
case CMD_LED_TOGGLE:
switch (cmd & LED_MASK)
{
case LED_RED:
LED_RED_TOGGLE();
break;
case LED_GREEN:
LED_GREEN_TOGGLE();
break;
case LED_BLUE:
LED_BLUE_TOGGLE();
break;
case LED_ALL:
LED_RED_TOGGLE();
LED_GREEN_TOGGLE();
LED_BLUE_TOGGLE();
break;
}
break;
}
}
开发者ID:EDAyele,项目名称:wsn430,代码行数:60,代码来源:blinker.c
示例12: main
int main(void)
{
int i;
set_mcu_speed_xt2_mclk_8MHz_smclk_1MHz();
uart0_init(UART0_CONFIG_1MHZ_115200);
LEDS_INIT();
LEDS_ON();
delay(DELAY);
LEDS_OFF();
led_state = 0;
while (1)
{
for (i=0; i<99; i++)
{
printf("Salam Aleikoum\n");
uart0_getchar_polling();
led_change();
}
}
}
开发者ID:hunt978,项目名称:vatdma,代码行数:25,代码来源:main.c
示例13: cc2420_off
/*---------------------------------------------------------------------------*/
int
cc2420_off(void)
{
/* Don't do anything if we are already turned off. */
if(receive_on == 0) {
return 1;
}
/* If we are called when the driver is locked, we indicate that the
radio should be turned off when the lock is unlocked. */
if(locked) {
/* printf("Off when locked (%d)\n", locked);*/
LEDS_ON(LEDS_GREEN + LEDS_BLUE);
lock_off = 1;
return 1;
}
GET_LOCK();
/* If we are currently receiving a packet (indicated by SFD == 1),
we don't actually switch the radio off now, but signal that the
driver should switch off the radio once the packet has been
received and processed, by setting the 'lock_off' variable. */
if(status() & BV(CC2420_TX_ACTIVE)) {
lock_off = 1;
} else {
off();
}
RELEASE_LOCK();
return 1;
}
开发者ID:project-master-device,项目名称:project-master-device,代码行数:31,代码来源:cc2420.c
示例14: main
/**@brief Function for application main entry. Does not return.
*/
int main(void)
{
utils_setup();
softdevice_setup();
ant_channel_tx_broadcast_setup();
// Main loop.
for (;;)
{
#ifdef CPU_LOAD_TRACE
// Disabling interrupts in this way is highly not recommended. It has an impact on the work
// of the softdecive and it is used only in order to show CPU load.
__disable_irq();
LEDS_OFF(BSP_LED_0_MASK);
__WFI();
LEDS_ON(BSP_LED_0_MASK);
__enable_irq();
#else
// Put CPU in sleep if possible.
uint32_t err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
#endif // CPU_LOAD_TRACE
}
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:27,代码来源:main.c
示例15: on_evt_hvx
/**@brief Function for toggling LEDS based on received notifications.
*
* @param[in] p_ble_evt Event to handle.
*/
static void on_evt_hvx(ble_evt_t * p_ble_evt, client_t * p_client, uint32_t index)
{
if ((p_client != NULL) && (p_client->state == STATE_RUNNING))
{
if (
(
p_ble_evt->evt.gattc_evt.params.hvx.handle
==
p_client->srv_db.services[0].charateristics[p_client->char_index].characteristic.handle_value
)
&&
(p_ble_evt->evt.gattc_evt.params.hvx.len == 1)
)
{
if(index < LEDS_NUMBER)
{
uint8_t leds[] = LEDS_LIST;
if (p_ble_evt->evt.gattc_evt.params.hvx.data[0] == 0)
{
LEDS_OFF(1<<leds[index]);
}
else
{
LEDS_ON(1<<leds[index]);
}
}
}
}
}
开发者ID:BLEHexapod,项目名称:nrf_sdk,代码行数:34,代码来源:client_handling.c
示例16: app_error_handler
/**@brief Function for error handling, which is called when an error has occurred.
*
* @warning This handler is an example only and does not fit a final product. You need to analyze
* how your product is supposed to react in case of error.
*
* @param[in] error_code Error code supplied to the handler.
* @param[in] line_num Line number where the handler is called.
* @param[in] p_file_name Pointer to the file name.
*/
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
LEDS_ON((LED_ONE | LED_TWO | LED_THREE | LED_FOUR));
APPL_LOG("[** ASSERT **]: Error 0x%08lX, Line %ld, File %s\r\n", error_code, line_num, p_file_name);
// Variables used to retain function parameter values when debugging.
static volatile uint8_t s_file_name[MAX_LENGTH_FILENAME];
static volatile uint16_t s_line_num;
static volatile uint32_t s_error_code;
strncpy((char *)s_file_name, (const char *)p_file_name, MAX_LENGTH_FILENAME - 1);
s_file_name[MAX_LENGTH_FILENAME - 1] = '\0';
s_line_num = line_num;
s_error_code = error_code;
UNUSED_VARIABLE(s_file_name);
UNUSED_VARIABLE(s_line_num);
UNUSED_VARIABLE(s_error_code);
// This call can be used for debug purposes during application development.
// @note CAUTION: Activating this code will write the stack to flash on an error.
// This function should NOT be used in a final product.
// It is intended STRICTLY for development/debugging purposes.
// The flash write will happen EVEN if the radio is active, thus interrupting
// any communication.
// Use with care. Un-comment the line below to use.
// ble_debug_assert_handler(error_code, line_num, p_file_name);
// On assert, the system can only recover on reset.
//NVIC_SystemReset();
for(;;)
{
// Infinite loop.
}
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:44,代码来源:main.c
示例17: lock_control_handler
static void lock_control_handler(ble_doorlock_t * p_doorlock, uint8_t state)
{
uint32_t err_code;
if (state)
{
// Open door
LEDS_ON((BSP_LED_3_MASK));
// Start timer
if (m_lock_timer_id != 0xFFFFFFFF) {
err_code = app_timer_stop(m_lock_timer_id);
APP_ERROR_CHECK(err_code);
} else {
err_code = app_timer_create(&m_lock_timer_id,
APP_TIMER_MODE_SINGLE_SHOT,
lock_timeout_handler);
APP_ERROR_CHECK(err_code);
}
err_code = app_timer_start(m_lock_timer_id, APP_TIMER_TICKS(APP_CFG_CHAR_LOCK_TIMEOUT, APP_TIMER_PRESCALER), NULL);
APP_ERROR_CHECK(err_code);
}
else
{
// Lock door
LEDS_OFF((BSP_LED_3_MASK));
}
}
开发者ID:albert361,项目名称:nRF51_Beacon_Peripheral_DualRole,代码行数:26,代码来源:ble_srv_doorlock.c
示例18: main
int main(void)
{
ret_code_t err_code;
err_code = NRF_LOG_INIT();
APP_ERROR_CHECK(err_code);
NRF_LOG_PRINTF("[APP]: Multilink Example\r\n");
leds_init();
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);
buttons_init();
ble_stack_init();
db_discovery_init();
lbs_c_init();
// Start scanning for peripherals and initiate connection to devices which
// advertise.
scan_start();
// Turn on the LED to signal scanning.
LEDS_ON(CENTRAL_SCANNING_LED);
for (;;)
{
// Wait for BLE events.
power_manage();
}
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:28,代码来源:main.c
示例19: main
int main(void)
{
int i;
WDTCTL = WDTPW + WDTHOLD;
P1IE = 0x00; // Interrupt enable
P2IE = 0x00; // 0:disable 1:enable
LEDS_INIT();
LEDS_ON();
delay(DELAY);
LEDS_OFF();
led_state = 0;
while (1)
{
for (i=0; i<99; i++)
{
led_change();
delay(DELAY >> 2);
}
}
}
开发者ID:ESS-Group,项目名称:WSim,代码行数:25,代码来源:main.c
示例20: on_ble_peripheral_evt
/**@brief Function for handling the Application's BLE Stack events.
*
* @param[in] p_ble_evt Bluetooth stack event.
*/
static void on_ble_peripheral_evt(ble_evt_t * p_ble_evt)
{
uint32_t err_code;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
LEDS_OFF(PERIPHERAL_ADVERTISING_LED);
LEDS_ON(PERIPHERAL_CONNECTED_LED);
m_conn_handle_peripheral = p_ble_evt->evt.gap_evt.conn_handle;
break;
case BLE_GAP_EVT_DISCONNECTED:
LEDS_OFF(PERIPHERAL_CONNECTED_LED);
m_conn_handle_peripheral = BLE_CONN_HANDLE_INVALID;
break;
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
// Pairing not supported
err_code = sd_ble_gap_sec_params_reply(m_conn_handle_peripheral, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
APP_ERROR_CHECK(err_code);
break;
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
err_code = sd_ble_gatts_sys_attr_set(m_conn_handle_peripheral, NULL, 0, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
APP_ERROR_CHECK(err_code);
break;
default:
// No implementation needed.
break;
}
}
开发者ID:451506709,项目名称:automated_machine,代码行数:37,代码来源:main.c
注:本文中的LEDS_ON函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论