void init_leds(void) { // init the objects and set up the unified controller uint8_t i; for (i = 0; i < LEDS_NUM; i++) { leds_state[i] = 0; } leds_init(&ledbar1, 8, 0); leds_init(&ledbar2, 8, 8); leds_init(&ledbar3, 8, 16); leds_init(&ledcenter, 60, 24); IPC0 |= 0x0700; // OC1 interrupt highest priority timer_every(&timer4, 0.035, __leds_update); }
int main() { char data; leds_init(); //开始默认关闭LED灯 leds_OFF_all(); // 串口初始化, 在start.S中已经调用过 UART0_Port_Init(); UART0_Set_BaudRate(); UART0_Set_Format(); // '\n' 换行 // '\r' 回车 UART0_SendString("\n\rHello World!\n\r"); //UART0_SendString("Hello World!\n"); while(1) { data = UART0_GetChar(); UART0_PutChar(data); } return 0; }
void board_init() { // disable watchdog timer WDTCTL = WDTPW + WDTHOLD; // setup clock speed DCOCTL |= DCO0 | DCO1 | DCO2; // MCLK at ~8MHz BCSCTL1 |= RSEL0 | RSEL1 | RSEL2; // MCLK at ~8MHz // by default, ACLK from 32kHz XTAL which is running // initialize pins P4DIR |= 0x20; // [P4.5] radio VREG: output P4DIR |= 0x40; // [P4.6] radio reset: output // initialize bsp modules debugpins_init(); leds_init(); uart_init(); spi_init(); bsp_timer_init(); radio_init(); radiotimer_init(); // enable interrupts __bis_SR_register(GIE); }
void board_init(void) { /* initialize the CPU */ cpu_init(); /* initialize the boards LEDs */ leds_init(); }
*/ int main(void) { // Initialize. leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); }
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(); } }
void range_sensors_main() { iodefs_init(); leds_init(); range_sensors_init(); event_q_init(); sei(); range_sensors_start(); while(1){ event_t e = event_q_get_next_event(); switch(e){ case NEW_PROXIMITY_READINGS: handle_new_prox(); break; default: break; } } }
int main(void) { // At this stage the microcontroller clock setting is already configured, // this is done through SystemInit() function which is called from startup // file (startup_stm32f40_41xxx.s) before to branch to application main. // To reconfigure the default setting of SystemInit() function, refer to // system_stm32f4xx.c file. // Update the system clocks. SystemCoreClockUpdate(); // Event initialization. event_init(); // LED initialization. leds_init(); // UART initialization. uart_init(); // Initialize the LED blinker. blink_init(); // Initialize the interactive shell. shell_init(); // Process events. event_loop(); }
uint32_t ble_dfu_transport_init(void) { uint32_t err_code; m_flags &= ~DFU_BLE_FLAG_NONE; leds_init(); err_code = ble_stack_init(true); VERIFY_SUCCESS(err_code); err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); VERIFY_SUCCESS(err_code); err_code = gap_params_init(); VERIFY_SUCCESS(err_code); // Initialize the Device Firmware Update Service. err_code = ble_dfu_init(&m_dfu); VERIFY_SUCCESS(err_code); err_code = conn_params_init(); VERIFY_SUCCESS(err_code); err_code = advertising_start(); VERIFY_SUCCESS(err_code); return NRF_SUCCESS; }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(hello_world_process, ev, data) { PROCESS_BEGIN(); static struct etimer myTimer; printf("Hello, world\n"); leds_init(); //PORTR_OUT = 0x3; etimer_set(&myTimer, CLOCK_SECOND); while(1) { PROCESS_WAIT_EVENT(); // PORTR.OUTTGL = 0x3; leds_toggle(0x3); printf("Toggle LED0 from process: %10d: %X\n", i++, leds_get()); etimer_restart(&myTimer); } PROCESS_END(); }
/**@brief Function for application main entry. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); simple_uart_config(UART_RTS, UART_TX, UART_CTS, UART_RX, 0); ble_stack_init(); scheduler_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); // Start execution //app_button_enable(); advertising_start(); uart_tx_str("nRF51822 run"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
void main() { // Current Functionality: // Very functional gate/trigger sequencer: // - Mode toggles current encoder value, indicated by mode led // - 0 (No light): Clear gate // - 1 (Solid): Set gate // - 2 (All Flash): Set CV // - 3 (Double Flash): Set Preset // - Target selects active pattern (none, 1, 2, 3), indicated by target led // - When Target = none, Set stores encoder to global gate length // - Otherwise, Set triggers write of encoder value to current step in target pattern (depending on mode) // - Clock/RST 1 controlls pattern 1 // - Clock/RST 2 ticks patterns 2 and 3 // - DIR 1 controls direction on all patterns // - DIR 2 controlls gate length offset on patterns 2 and 3; pattern 1 is 'trigger' only // - CV edit from A/D LVL input // // Next Steps: // - Sequence Presets (selected by encoder and applied by set?) // setup(); seq_init(16); leds_init(); while (1) { clock_check(); buttons_check(); } }
PROCESS_THREAD(server_process, ev, data) { PROCESS_BEGIN(); set_global_address(); leds_init(); print_local_addresses(); printf("Starting TCP server on port=%d\n", PORT); tcp_listen(UIP_HTONS(PORT)); while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if(uip_aborted() ) printf("TCP aborted\n"); if(uip_timedout() ) printf("TCP timeoutn\n"); if(uip_closed() ) printf("TCP closed\n"); if(uip_connected()) { printf("TCP Connected\n\r"); PSOCK_INIT(&ps, buf, sizeof(buf)); while(!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); handle_connection(&ps); } } } PROCESS_END(); }
/**@brief Function for application main entry. */ int main(void) { gpio_config(); bool success = nrf6350_lcd_init(); APP_ERROR_CHECK_BOOL(success); success = nrf6350_lcd_write_string(" BLE ANCS ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0); APP_ERROR_CHECK_BOOL(success); // Initialize. leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); service_add(); advertising_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
void main(void) { //configuring P1OUT |= 0x04; // set P1.2 for debug P4DIR |= 0x20; // P4.5 as output (for debug) gina_init(); scheduler_init(); leds_init(); if (*(&eui64+3)==0x09) { // this is a GINA board (not a basestation) gyro_init(); large_range_accel_init(); magnetometer_init(); sensitive_accel_temperature_init(); } radio_init(); timer_init(); P1OUT &= ~0x04; // clear P1.2 for debug //check sensor configuration is right gyro_get_config(); large_range_accel_get_config(); magnetometer_get_config(); sensitive_accel_temperature_get_config(); //scheduler_push_task(ID_TASK_APPLICATION); scheduler_register_application_task(&task_application_imu_radio, 0, FALSE); scheduler_start(); }
int prueba_leds_fila_a_int() { Leds leds; int y, salida; char fila_prueba[NUM_FILAS_LED] = FILA_PRUEBA_LEDS_FILA_A_INT; leds_init(&leds); //Rellenamos los leds con la fila que queremos printf(" Valor de la entrada para leds_fila_a_int: "); for (y = 0; y < NUM_FILAS_LED; y++) { leds.pantalla[COLUMNA_PRUEBA_LEDS_FILA_A_INT][y] = fila_prueba[y] - 48; printf("%i", fila_prueba[y] - 48); } printf("\n"); salida = 0; leds_fila_a_int(&leds, COLUMNA_PRUEBA_LEDS_FILA_A_INT, &salida); printf(" Valor de la salida para leds_fila_a_int: %i\n", salida); if (salida != SALIDA_PRUEBA_LEDS_FILA_A_INT) return PRUEBA_FALLO; return PRUEBA_EXITO; }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize. app_trace_init(); leds_init(); timers_init(); gpiote_init(); err_code = ipv6_transport_init(); APP_ERROR_CHECK(err_code); // Initialize IP Stack. ip_stack_init(); APPL_LOG("\r\n"); APPL_LOG("[APPL]: Init complete.\r\n"); // Start execution. advertising_start(); // Enter main loop. for (;;) { /* Sleep waiting for an application event. */ err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
void board_init(void) { volatile int i; /* initialize the CPU */ cpu_init(); /* initialize the boards LEDs */ leds_init(); LED_GREEN_ON; /* Comments by JSI */ /* PC13 must be pulled for 100ms. PB1 in floating */ // gpio_init_out(GPIO_1, GPIO_PULLUP); // gpio_init_in(GPIO_2, GPIO_NOPULL); /*Enable interrups*/ // __enable_irq(); /* forced delay 100ms */ for(i=0; i < (100 * CLOCK_CORECLOCK) / 1000; i++); /* initialize the UART */ uart_init(STDIO, STDIO_BAUDRATE, NULL, NULL, NULL); //board_uart0_init(); /* forced delay 100ms, waiting for UART */ for(i=0; i < (100 * CLOCK_CORECLOCK) / 1000; i++); }
/**@brief Function for application main entry. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); scheduler_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); bond_manager_init(); ble_stack_init(); scheduler_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { // Initialize. app_trace_init(); leds_init(); buttons_init(); timers_init(); ble_stack_init(); device_manager_init(); gap_params_init(); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); // Start execution. application_timers_start(); advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
int main() { configure_mcu_clocks(); uart_init(115200); printf("Platform init complete, starting contiki init\n"); clock_init(); rtimer_init(); leds_init(); process_init(); #if WITH_SERIAL_LINE_INPUT uart_set_input(serial_line_input_byte); serial_line_init(); #endif process_start(&etimer_process, NULL); ctimer_init(); autostart_start(autostart_processes); while(1) { do { // meant to do some sleeping here, if we want to save power... // } while(process_run() > 0); } return 0; }
/**@brief Function for application main entry. */ int main(void) { // Initialize app_trace_init(); leds_init(); timers_init(); buttons_init(); ipv6_transport_init(); ip_stack_init(); uint32_t err_code = coap_init(17); APP_ERROR_CHECK(err_code); coap_endpoints_init(); iot_timer_init(); APPL_LOG("\r\n"); APPL_LOG("[APPL]: Init complete.\r\n"); // Start execution advertising_start(); // Enter main loop for (;;) { power_manage(); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); bond_manager_init(); ble_stack_init(); ble_error_log_init(); gap_params_init(); advertising_init(); alert_notification_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution advertising_start(); // Enter main loop for (;;) { power_manage(); } }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code; clock_init(); // Start APP_TIMER to generate timeouts. APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL); leds_init(); err_code = bsp_init(BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), bsp_evt_handler); APP_ERROR_CHECK(err_code); nfc_init(); m_active_led_mask = BSP_LED_0_MASK; err_code = led_softblink_start(m_active_led_mask); APP_ERROR_CHECK(err_code); while (true) { __WFE(); softblink_led_update(); } }
/**@brief Function for application main entry. */ int main(void) { // Initialize. leds_init(); buttons_init(); timers_init(); ble_stack_init(); device_manager_init(); gap_params_init(); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); //simple_uart_config(31,9,31,31,false); //simple_uart_putstring("Starting..."); // Start execution. //Turn off HRM update //application_timers_start(); advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
uint32_t dfu_transport_update_start() { uint32_t err_code; m_pkt_type = PKT_TYPE_INVALID; leds_init(); err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); if (err_code != NRF_SUCCESS) { return err_code; } dfu_register_callback(dfu_cb_handler); err_code = hci_mem_pool_open(); if (err_code != NRF_SUCCESS) { return err_code; } gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); advertising_start(); return NRF_SUCCESS; }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code; //Initialize. app_trace_init(); leds_init(); scheduler_init(); timers_init(); iot_timer_init(); button_init(); ble_stack_init(); advertising_init(); ip_stack_init (); //Start execution. advertising_start(); //Enter main loop. for (;;) { //Execute event schedule. app_sched_execute(); //Sleep waiting for an application event. err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); buttons_init(); ble_stack_init(); bond_manager_init(); timers_init(); gap_params_init(); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution application_timers_start(); advertising_start(); // Enter main loop for (;;) { power_manage(); } }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(shell_change_detect_process, ev, data) { static struct etimer etimer; PROCESS_BEGIN(); leds_init(); while(1) { sensor_init(); etimer_set(&etimer, CLOCK_SECOND / 4); PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); sample = sensor_read(); sensor_uinit(); printf("sample = %d\n",sample); if(abs_sub(sample, sample_mean) > (sample_std_dev * NUM_DEVS)) { // Change detected, turn on LED(s)? leds_on(LEDS_RED); } else { // Turn off LED(s). leds_off(LEDS_RED); } } PROCESS_END(); }