本文整理汇总了C++中LEDS_ON函数的典型用法代码示例。如果您正苦于以下问题:C++ LEDS_ON函数的具体用法?C++ LEDS_ON怎么用?C++ LEDS_ON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LEDS_ON函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例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;
}
}
}
}
示例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);
}
示例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
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
}
示例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;
}
示例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();
}
示例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.
}
}
示例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;
}
}
示例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();
}
}
}
示例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;
}
示例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
}
}
示例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]);
}
}
}
}
}