int main(void) { nrk_setup_ports(); nrk_init(); bmac_task_config(); nrk_create_taskset(); nrk_start(); return 0; }
//------------------------------------------------------------------------------ // void main (void) // // DESCRIPTION: // Startup routine and main loop //------------------------------------------------------------------------------ int main (void) { uint8_t i,length; uint32_t cnt; nrk_setup_ports(); nrk_setup_uart (UART_BAUDRATE_115K2); printf( "Basic TX...\r\n" ); nrk_led_set(0); nrk_led_set(1); nrk_led_clr(2); nrk_led_clr(3); /* while(1) { for(i=0; i<40; i++ ) halWait(10000); nrk_led_toggle(1); } */ rfRxInfo.pPayload = rx_buf; rfRxInfo.max_length = RF_MAX_PAYLOAD_SIZE; nrk_int_enable(); rf_init (&rfRxInfo, 26, 0x2420, 0x1214); cnt=0; while(1){ DPDS1 |= 0x3; DDRG |= 0x1; PORTG |= 0x1; DDRE|=0xE0; PORTE|=0xE0; rfTxInfo.pPayload=tx_buf; sprintf( tx_buf, "%lu", cnt); rfTxInfo.length= strlen(tx_buf) + 1; rfTxInfo.destAddr = 0x1215; rfTxInfo.cca = 0; rfTxInfo.ackRequest = 0; printf( "Sending\r\n" ); // nrk_gpio_set(NRK_DEBUG_0); if(rf_tx_packet(&rfTxInfo) != 1) printf("--- RF_TX ERROR ---\r\n"); // nrk_gpio_clr(NRK_DEBUG_0); cnt++; for(i=0; i<10; i++ ) halWait(10000); nrk_led_toggle(RED_LED); } }
//------------------------------------------------------------------------------ // void main (void) // // DESCRIPTION: // Startup routine and main loop //------------------------------------------------------------------------------ int main (void) { uint8_t cnt,i,length; nrk_setup_ports(); nrk_setup_uart (UART_BAUDRATE_115K2); printf( "Basic TX...\r\n" ); nrk_led_set(0); nrk_led_set(1); nrk_led_clr(2); nrk_led_clr(3); /* while(1) { for(i=0; i<40; i++ ) halWait(10000); nrk_led_toggle(1); } */ rfRxInfo.pPayload = rx_buf; rfRxInfo.max_length = RF_MAX_PAYLOAD_SIZE; nrk_int_enable(); rf_init (&rfRxInfo, 13, 0x2420, 0x1214); cnt=0; while(1){ nrk_led_set(GREEN_LED); rfTxInfo.pPayload=tx_buf; sprintf( tx_buf, "This is my string counter %d", cnt); rfTxInfo.length= strlen(tx_buf) + 1; rfTxInfo.destAddr = 0x1215; rfTxInfo.cca = 0; rfTxInfo.ackRequest = 0; printf( "Sending\r\n" ); nrk_gpio_set(NRK_DEBUG_0); if(rf_tx_packet(&rfTxInfo) != 1) printf("--- RF_TX ERROR ---\r\n"); nrk_gpio_clr(NRK_DEBUG_0); cnt++; for(i=0; i<80; i++ ) halWait(10000); nrk_led_clr(GREEN_LED); for(i=0; i<20; i++ ) halWait(10000); } }
int main(void) { nrk_setup_ports(); nrk_register_drivers(); nrk_init(); nrk_create_taskset(); nrk_start(); return 0; }
int main(void) { nrk_setup_ports(); nrk_init(); nrk_register_drivers(); bmac_task_config(); nrk_create_taskset(); bmac_init (MY_CHANNEL); bmac_auto_ack_disable(); nrk_start(); return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_init(); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }
int main(void) { table_function.nrk_led_toggle = &nrk_led_toggle; nrk_setup_ports(); nrk_init(); bmac_task_config(); nrk_create_taskset(); bmac_init (MY_CHANNEL); bmac_auto_ack_disable(); nrk_start(); return 0; }
int main () { nrk_setup_ports (); nrk_setup_uart (UART_BAUDRATE_115K2); nrk_init (); nrk_led_clr (0); nrk_led_clr (1); nrk_led_clr (2); nrk_led_clr (3); nrk_time_set (0, 0); tdma_mode_set(TDMA_MASTER); // do the scheduling by yourself tdma_schedule_method_set(TDMA_SCHED_MANUAL); // send sync to child tdma_schedule_add(0, TDMA_TX_CHILD, 0); // SCHEDULE A // add a RX from child every tenth slot for (tdma_slot_t i = 10; i < TDMA_SLOTS_PER_CYCLE; i+=10) { tdma_schedule_add(i, TDMA_RX, 0); } // SCHEDULE B // rcv data from child. priority is ignored //tdma_schedule_add(10, TDMA_RX, -1); // SCHEDULE C: Sync Test // Add 2 RX slots from children from level 1 and 2 //tdma_schedule_add(0, TDMA_TX_CHILD, 0); //tdma_schedule_add(10, TDMA_RX, 0); //tdma_schedule_add(20, TDMA_RX, 0); tdma_task_config (); nrk_create_taskset (); nrk_start (); return 0; }
int main () { uint8_t t; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_230K4); nrk_init(); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); log_g = 1; if(log_g)printf("log:Starting up...\r\n" ); nrk_init(); uint8_t i; request_flag_g=0; retransmit_count_g=0; //added this 1 for(i=0;i<5;i++) { version_g[i] = 0; } //added version_g[MAC_ADDR] = -1; data_index_g = -1; nrk_led_clr(ORANGE_LED); nrk_led_clr(BLUE_LED); nrk_led_set(GREEN_LED); nrk_led_clr(RED_LED); tx_sem = nrk_sem_create(1,4); if(tx_sem==NULL) nrk_kprintf( PSTR("log:Error creating sem\r\n" )); conn_sem = nrk_sem_create(1,4); if(conn_sem==NULL) nrk_kprintf( PSTR("log:Error creating sem\n" )); uart_sem = nrk_sem_create(1,4); if(conn_sem==NULL) nrk_kprintf( PSTR("log:Error creating sem\n" )); ack_sem = nrk_sem_create(1,4); if(conn_sem==NULL) nrk_kprintf( PSTR("log:Error creating sem\n" )); nrk_time_set(0,0); nrk_register_drivers(); bmac_task_config (); nrk_create_taskset (); nrk_start(); return 0; }
int main() { uint8_t led = 0; nrk_setup_ports(); nrk_led_clr(ORANGE_LED); nrk_led_clr(BLUE_LED); nrk_led_clr(GREEN_LED); nrk_led_clr(RED_LED); while (1) { nrk_led_toggle(ORANGE_LED); nrk_spin_wait_us(PERIOD); } return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_init(); nrk_time_set(0,0); //Initialize tasks INITIALIZE_TASK(1); INITIALIZE_TASK(2); nrk_start(); return 0; }
int main () { uint8_t t; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_kprintf( PSTR("Starting up...\r\n") ); nrk_init(); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }
int main () { uint8_t t; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); printf( "Starting up...\r\n" ); nrk_init(); nrk_time_set(0,0); nrk_register_drivers(); nrk_create_taskset (); nrk_start(); return 0; }
int main () { nrk_setup_ports (); nrk_setup_uart (UART_BAUDRATE_115K2); nrk_init (); nrk_led_clr (ORANGE_LED); nrk_led_clr (BLUE_LED); nrk_led_clr (GREEN_LED); nrk_led_clr (RED_LED); nrk_time_set (0, 0); nrk_create_taskset (); nrk_start (); return 0; }
int main() { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_kprintf(PSTR("\r\n Nano-RK Version \r\n ")); printf("%d\r\n", NRK_VERSION ); nrk_init(); nrk_led_clr(ORANGE_LED); nrk_led_clr(BLUE_LED); nrk_led_clr(GREEN_LED); nrk_led_clr(RED_LED); nrk_time_set(0, 0); nrk_create_taskset(); printf("NRK_START ::\r\n"); nrk_start(); return 0; }
//------------------------------------------------------------------------------ // void main (void) // // DESCRIPTION: // Startup routine //------------------------------------------------------------------------------ int main (void) { nrk_setup_ports(); nrk_setup_uart (UART_BAUDRATE_115K2); nrk_init(); printf( "WiDom Test Starting up... (MSG_PRIO=%d)\r\n", MSG_PRIO ); nrk_led_set(ORANGE_LED); nrk_led_clr(BLUE_LED); nrk_led_clr(GREEN_LED); nrk_led_clr(RED_LED); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }
//------------------------------------------------------------------------------ // void main (void) // // DESCRIPTION: // Startup routine and main loop //------------------------------------------------------------------------------ int main (void) { uint8_t cnt,i,length; nrk_setup_ports(); nrk_setup_uart (UART_BAUDRATE_115K2); printf( "Basic TX...\r\n" ); nrk_led_clr(0); nrk_led_clr(1); nrk_led_clr(2); nrk_led_clr(3); nrk_gpio_set(NRK_DEBUG_0); nrk_gpio_set(NRK_DEBUG_1); rfRxInfo.pPayload = rx_buf; rfRxInfo.max_length = RF_MAX_PAYLOAD_SIZE; rf_init (&rfRxInfo, 25, 0x2420, 0x1215); cnt=0; while(1) { nrk_led_set(1); rfTxInfo.pPayload=tx_buf; sprintf( tx_buf, "This is my string counter %d", cnt); rfTxInfo.length=strlen(&tx_buf); rfTxInfo.cca=0; nrk_gpio_set(NRK_DEBUG_0); printf( "Sending\r\n" ); rf_tx_packet (&rfTxInfo); nrk_gpio_clr(NRK_DEBUG_0); cnt++; for(i=0; i<10; i++ ) halWait(10000); nrk_led_clr(1); for(i=0; i<10; i++ ) halWait(10000); } }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_init(); nrk_led_clr(0); nrk_led_clr(1); nrk_led_clr(2); nrk_led_clr(3); nrk_time_set(0, 0); bmac_task_config(); nrk_create_taskset(); nrk_start(); return 0; }
int main(void) { nrk_setup_ports(); volatile boolean_T noErr; float modelBaseRate = 0.5; float systemClock = 0; SystemCoreClockUpdate(); UNUSED(modelBaseRate); UNUSED(systemClock); rtmSetErrorStatus(simulinkmodeltoblinkLed_M, 0); simulinkmodeltoblinkLed_initialize(); /* No scheduler to configure */ ; noErr = rtmGetErrorStatus(simulinkmodeltoblinkLed_M) == (NULL); /* No interrupts to enable */ ; ; while (noErr ) { rt_OneStep(); noErr = rtmGetErrorStatus(simulinkmodeltoblinkLed_M) == (NULL); } /* Disable rt_OneStep() here */ /* Terminate model */ simulinkmodeltoblinkLed_terminate(); ; nrk_led_set (RED_LED); return 0; }
int main () { uint8_t t; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); printf( PSTR("starting...\r\n") ); audio_data_size = 30; audio_data = malloc(audio_data_size * (sizeof audio_data[0])); nrk_init(); nrk_time_set(0,0); nrk_register_drivers(); nrk_create_taskset (); nrk_start(); return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_kprintf( PSTR("Starting up...\r\n") ); nrk_init(); nrk_led_clr(0); nrk_led_clr(1); nrk_led_clr(2); nrk_led_clr(3); nrk_time_set(0,0); nrk_register_drivers(); rtl_task_config(); nrk_create_taskset (); nrk_start(); return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_init(); nrk_time_set(0,0); nrk_time_get(seed); srand(seed->nano_secs); //Initialize tasks //Higher value higher priority` INITIALIZE_TASK(1, BASIC_TASK); INITIALIZE_TASK(2, CBS_TASK); INITIALIZE_TASK(3, BASIC_TASK); nrk_start(); return 0; }
int main () { uint8_t t; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); printf( "Starting up...\r\n" ); nrk_init(); nrk_led_clr(ORANGE_LED); nrk_led_clr(BLUE_LED); nrk_led_set(GREEN_LED); nrk_led_clr(RED_LED); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }
int main () { uint16_t div; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); printf( "Starting up...\r\n" ); nrk_init(); nrk_led_clr(0); nrk_led_clr(1); nrk_led_clr(2); nrk_led_clr(3); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }
int main () { uint16_t div; nrk_setup_ports (); nrk_setup_uart (UART_BAUDRATE_115K2); nrk_init (); nrk_led_clr (0); nrk_led_clr (1); nrk_led_clr (2); nrk_led_clr (3); nrk_time_set (0, 0); tdma_task_config(); nrk_register_drivers(); nrk_create_taskset (); nrk_start (); return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_init(); printf( "Starting up... (NODE_ADDR=%d)\r\n", NODE_ADDR); nrk_led_clr(ORANGE_LED); nrk_led_clr(BLUE_LED); nrk_led_set(GREEN_LED); nrk_led_clr(RED_LED); // widom init (must be in main unless wd_timer_cpu_clk.h uses timer/counter1) wd_init(WD_CHANNEL); #ifdef CONTINUOUS_SEND // Testing purposes only; The node will try to access the medium // continuously, acting like it is always backlogged. // defined in widom.h // put just two bytes of payload in the packet... tx_buf[0]=0xCB; tx_buf[1]=MSG_PRIO; // put MSG_PRIO in the payload also // This function transmits packets in a non-blocking manner wd_tx_packet_enqueue (tx_buf, 2, MSG_PRIO); while (1); #endif nrk_time_set(0,0); nrk_create_taskset(); nrk_start(); return 0; }
int main () { nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); printf( "Starting up...\r\n" ); nrk_init(); nrk_time_set(0,0); //Initialize tasks INITIALIZE_TASK(1); INITIALIZE_TASK(2); INITIALIZE_TASK(3); //instead of passing the ceiling priority, the task with the shortest period that accesses the semaphore is given //in this case, task1 which has a period 350*NANOS_PER_MS my_semaphore = nrk_sem_create(1,350*NANOS_PER_MS); if(my_semaphore==NULL) nrk_kprintf( PSTR("Error creating sem\r\n" )); nrk_start(); return 0; }
//------------------------------------------------------------------------------ // void main (void) // // DESCRIPTION: // Startup routine and main loop //------------------------------------------------------------------------------ int main (void) { uint8_t cnt,i,length,n; nrk_setup_ports(); nrk_setup_uart (UART_BAUDRATE_115K2); printf( "Receiver\r\n" ); nrk_led_clr(0); nrk_led_clr(1); nrk_led_clr(2); nrk_led_clr(3); rfRxInfo.pPayload = rx_buf; rfRxInfo.max_length = RF_MAX_PAYLOAD_SIZE; rfRxInfo.ackRequest= 0; nrk_int_enable(); rf_init (&rfRxInfo, 13, 0x2420, 0x1215); printf( "Waiting for packet...\r\n" ); nrk_led_set(ORANGE_LED); while(1) { nrk_led_set(BLUE_LED); rf_polling_rx_on(); while ((n = rf_rx_check_sfd()) == 0) continue; if (n != 0) { nrk_led_toggle(ORANGE_LED); n = 0; // Packet on its way cnt=0; while ((n = rf_polling_rx_packet ()) == 0) { nrk_led_toggle(GREEN_LED); if (cnt > 50) { //printf( "PKT Timeout\r\n" ); break; // huge timeout as failsafe } halWait(10000); cnt++; } } nrk_led_clr(BLUE_LED); if (n == 1) { nrk_led_clr(RED_LED); // nrk_led_toggle(BLUE_LED); // CRC and checksum passed // printf("packet received\r\n"); // printf("SEQNUM: %d SRCADDR: 0x%x SNR: %d\r\n[",rfRxInfo.seqNumber, rfRxInfo.srcAddr, rfRxInfo.rssi); // printf("\r\n%d, ",rfRxInfo.seqNumber); for(i=0; i<rfRxInfo.length; i++ ) // printf( "%c", rfRxInfo.pPayload[i]); putchar(rfRxInfo.pPayload[i]); // printf( "]\r\n\r\n" ); // printf("\r\nR%d = %d",rfRxInfo.seqNumber,rfRxInfo.length); } else if(n != 0) { printf( "CRC failed!\r\n" ); nrk_led_set(RED_LED); } } }
int main () { uint8_t v_TempCnt_u8r, v_Dummy_u8r, v_RdLcycmode_u8r; nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); nrk_kprintf( PSTR("Starting up...\r\n") ); ////////////////////////////////////////////////// F_ChkIntEntry_U8R = 0; nrk_led_clr(BLUE_LED); nrk_led_clr(GREEN_LED); nrk_led_clr(ORANGE_LED); nrk_led_clr(RED_LED); for(v_TempCnt_u8r=0;v_TempCnt_u8r<100;v_TempCnt_u8r++) V_TxBuff_U8R[v_TempCnt_u8r]=v_TempCnt_u8r+'a'; V_RdPtr_U32R = 0; slip_tx(&V_TxBuff_U8R[V_RdPtr_U32R],C_SlipPktSize,&V_TxBuff_U8R[C_CircBuffSize-1],C_CircBuffSize); signal_one=nrk_signal_create(); sei(); DDRD &= ~(_BV(PORTD3)); //Making INT3 pin as input EIMSK = 0x00; EICRA = 0x80; EIMSK = 0x08; printf("#"); //Set ADE in normal power mode PM0=1 (PE2), PM!=0 (PE3) DDRE |= _BV(PORTE2) | _BV(PORTE3); PORTE |= _BV(PORTE2); PORTE &= ~(_BV(PORTE3)); while(F_ChkIntEntry_U8R==0); while(EIMSK !=0); //Enable SPI Master, Set Clock rate fck/4 SPCR = 0x01; SPCR |= _BV(SPE) | _BV(MSTR) | _BV(CPOL) | _BV(CPHA); PORTB |= _BV(PORTB0);//default state of SS should be low v_RdLcycmode_u8r=0; //This segment below is added because it was observed that the 7878 //SPI or the ATMEL SPI takes some time to start. So waiting till //some register gives its default value printf("Wait.."); while(v_RdLcycmode_u8r!=0x78) v_RdLcycmode_u8r = ade_read8(LCYCMODE); printf("\r\n7878 Ready"); if(ade_init() < 0) printf("\nInit failed"); else printf("\nInit Success"); V_Status1RdWr_U32R = ade_read32(STATUS1); ade_write32(STATUS1, V_Status1RdWr_U32R); ///////////////////////////////////////////////// nrk_init(); nrk_time_set(0,0); nrk_create_taskset (); nrk_start(); return 0; }