Пример #1
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();

//	sem1 = nrk_sem_create(1, 10);
	nrk_sem_list[0].value = 1;
	nrk_sem_list[0].count = 1;
	nrk_sem_list[0].resource_ceiling = 5;
	sem1 = nrk_sem_list;

	if (sem1 == NULL)
		printf("Creating sem error\n");
	nrk_start();

	return 0;
}
Пример #2
0
int main ()
{
  nrk_setup_ports();
  nrk_setup_uart(UART_BAUDRATE_115K2);
  nrk_init_hardware();
  nrk_init();

  nrk_led_clr(BLUE_LED);
  nrk_led_clr(GREEN_LED);
  nrk_led_clr(RED_LED);

  nrk_time_set(0,0);
  nrk_create_taskset ();

  for (uint16_t task_ID = 1; task_ID <= 3; task_ID++) {
	  nrk_kprintf("InitT");
	  nrk_printnum((uint32_t)task_ID);
	  nrk_kprintf(":NP:");
	  nrk_printnum((uint32_t)nrk_task_TCB[task_ID].next_period);
	  nrk_kprintf("\r\n");
  }

  nrk_start();

  return 0;
}
Пример #3
0
int
main ()
{
  uint8_t t;
  nrk_setup_ports();
  nrk_setup_uart(UART_BAUDRATE_115K2);
  oled_setup();
  nrk_init();

  nrk_gpio_direction(NRK_DEBUG_0, NRK_PIN_INPUT);
  nrk_gpio_direction(NRK_DEBUG_1, NRK_PIN_OUTPUT);
  oled_off();
  nrk_gpio_direction(NRK_DEBUG_2, NRK_PIN_INPUT);
  nrk_gpio_direction(NRK_DEBUG_3, NRK_PIN_INPUT);
  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);
  bmac_task_config ();
  nrk_create_taskset ();
  nrk_start();
  
  return 0;
}
Пример #4
0
int main ()
{
  uint16_t div;
  nrk_setup_ports ();
  nrk_setup_uart (UART_BAUDRATE_115K2);
  begin();//start I2C

  nrk_init ();

  nrk_led_clr (0);
  nrk_led_clr (1);
  nrk_led_clr (2);
  nrk_led_clr (3);

  nrk_time_set (0, 0);

  tdma_set_error_callback(&tdma_error);
  tdma_task_config();

  //nrk_register_drivers();
  nrk_create_taskset ();
  nrk_start ();

  return 0;
}
Пример #5
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();
  
// Semaphore initialization
  semaphore1 = nrk_sem_create(1,3);  
  semaphore2 = nrk_sem_create(1,5);
  semaphore3 = nrk_sem_create(1,1);

  nrk_start();
  
  return 0;
}
Пример #6
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);

  
  rtl_task_config();
  
  nrk_create_taskset ();

  nrk_start();
  
  return 0;
}
Пример #7
0
int
main ()
{
  nrk_setup_ports();
	nrk_register_drivers();
  //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);

  
  rtl_task_config();
  
  nrk_create_taskset ();

  nrk_start();
  
  return 0;
}
Пример #8
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);

  // use tdma's tree scheduler
  tdma_schedule_method_set(TDMA_SCHED_TREE);

  tdma_task_config ();

  nrk_create_taskset ();

  nrk_start ();

  return 0;
}
Пример #9
0
int main ()
{
  nrk_init_hardware();
  //nrk_setup_ports();
  //nrk_setup_uart(UART_BAUDRATE_115K2);

  nrk_init();
  nrk_time_set(0,0);
  nrk_create_taskset();

  P2DIR |= 0x06;                        // Set P1.0 to output direction
  P2OUT |= 0x06;
  
  nrk_start();						// includes //nrk_target_start();	includes timer_start

  
  for (;;)
  {
    volatile unsigned int i;            // volatile to prevent optimization

//    P2OUT ^= 0x06;                      // Toggle P1.0 using exclusive-OR

    i = 10000;                          // SW Delay
    do i--;
    while (i != 0);
  }
}
Пример #10
0
int
main ()
{
  nrk_setup_ports();
  nrk_setup_uart(UART_BAUDRATE_115K2);

  TWI_Master_Initialise();
  sei();
  nrk_led_set(RED_LED);
  /* initialize the adxl345 */
  init_adxl345();
  init_itg3200();
  init_hmc5843();
  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;
}
Пример #11
0
int main()
{
	// initialise the UART	
	nrk_setup_ports();  
	nrk_setup_uart(UART_BAUDRATE_115K2);
	
	// initialise the OS
	nrk_init();

	// clear all LEDs	
	nrk_led_clr(ORANGE_LED);		
   nrk_led_clr(BLUE_LED);			// will toggle whenever a packet is sent
   nrk_led_clr(GREEN_LED);			// will toggle whenever a packet is received
   nrk_led_clr(RED_LED);			// will light up on error
	  
	// start the clock	
	nrk_time_set(0,0);

	// initialise the network stack  	
	nrk_init_nw_stack();
	if(DEBUG_APP == 1)
		nrk_kprintf(PSTR("Network stack initialised\r\n"));
	
	nrk_create_taskset();		// create the set of tasks
	nrk_start();					// start this node
	
	return 0;
}
Пример #12
0
int main ()
{

  // init phoenix
  phoenix_init();
  
  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;
}
Пример #13
0
int main ()
{
    nrk_setup_ports ();
    nrk_setup_uart (UART_BAUDRATE_115K2);

    nrk_init ();
    nrk_led_clr(ORANGE_LED);
    nrk_led_clr(GREEN_LED);
    nrk_led_clr(RED_LED);
    nrk_led_clr(BLUE_LED);

    nrk_time_set(0,0);

    bmac_task_config();
    nrk_create_taskset();

    lock = nrk_sem_create(1,2);
    if( lock==NULL ) {
        nrk_kprintf( PSTR("Error creating sem\r\n" ));
    }

    nrk_start();

    return 0;
}
Пример #14
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 ();

  my_semaphore = nrk_sem_create(1,4);
  if(my_semaphore==NULL) nrk_kprintf( PSTR("Error creating sem\r\n" ));
  nrk_start();
  
  return 0;
}
Пример #15
0
int
main ()
{
  nrk_setup_ports();
  nrk_setup_uart(UART_BAUDRATE_115K2);


DDRF=0xff;

while(1)
{
PORTF=0xff;
nrk_spin_wait_us(500);
PORTF=0x00;
nrk_spin_wait_us(500);

}

  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;
}
Пример #16
0
int main ()
{
    uint8_t ds;
    nrk_setup_ports ();
    nrk_setup_uart (UART_BAUDRATE_115K2);


    ds=nrk_eeprom_read_byte(EEPROM_SLEEP_STATE_ADDR);
    if(ds==1) deep_sleep_button();

    nrk_init ();

    nrk_led_clr (0);
    nrk_led_clr (1);
    nrk_led_clr (2);
    nrk_led_clr (3);

    nrk_time_set (0, 0);

    tdma_set_error_callback(&tdma_error);
    tdma_task_config();

    nrk_register_drivers();
    nrk_create_taskset ();
    nrk_start ();

    return 0;
}
Пример #17
0
int main ()
{
  nrk_setup_ports ();
  nrk_setup_uart (UART_BAUDRATE_115K2);
  //  nrk_setup_uart (UART_BAUDRATE_230K4);
  nrk_setup_uart_gps(UART_BAUDRATE_115K2);

  TWI_Master_Initialise();
  grideye_addr = 0x68;

  printf ("Starting up...\r\n");

  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;
}
Пример #18
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);

	INITIALIZE_TASK(1, CBS_TASK);
    	INITIALIZE_TASK(2, BASIC_TASK);
    	INITIALIZE_TASK(3, CBS_TASK);

    nrk_start();

    return 0;
}
Пример #19
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_SLAVE);

  // do the scheduling by yourself
  tdma_schedule_method_set(TDMA_SCHED_MANUAL);

  // rcv sync packet from master
  tdma_schedule_add(0, TDMA_RX, -1);

  // SCHEDULE A
  // add a TX slot for every tenth slot
  
  for (tdma_slot_t i = 10; i < TDMA_SLOTS_PER_CYCLE; i+=10)
  {
    tdma_schedule_add(i, TDMA_TX_PARENT, 0);
  }
  
  
  // SCHEDULE B
  // just do one slot
  //tdma_schedule_add(10, TDMA_TX_PARENT, 0);


  // SCHEDULE C
  // for node 2
  //  tdma_schedule_add(0, TDMA_RX, 0);
  //  tdma_schedule_add(10, TDMA_TX_PARENT, 0);
  //  tdma_schedule_add(100, TDMA_TX_CHILD, 0);

  // for node 3
    //tdma_schedule_add(20, TDMA_TX_PARENT, 0);
    //tdma_schedule_add(100, TDMA_RX, 0);




  tdma_task_config ();

  nrk_create_taskset ();

  nrk_start ();

  return 0;
}
Пример #20
0
int main ()
{
    uint16_t div;

    nrk_int_disable();
    // Configure relay port directions
    DDRE |= 0x10;
    socket_0_enable();
    // Configure led port directions
    DDRE |= 0x0c;
    DDRD |= 0x00;
    PORTD |= 0xff;
    DDRF = 0;

    socket_0_active=nrk_eeprom_read_byte(EEPROM_STATE_ADDR);
    // turn outlet on if active or throttled for testing
    if(socket_0_active==1 || socket_0_active==2)
    {
        socket_0_enable();
        plug_led_green_set();
    } else
    {
        socket_0_disable();
        plug_led_green_clr();
    }
    // If PUD value set, then we expect it wasn't a clean reboot (unexpected restart).
    // Try to force a proper watchdog reboot
    if((MCUCR&0x10)!=0 )
    {
        //nrk_watchdog_enable();
        nrk_int_disable();
        MCUSR &= ~(1<<WDRF);
        WDTCSR |= (1<<WDCE) | (1<<WDE);
        WDTCSR = (1<<WDE) | (1<<WDP2) | (1<<WDP0);

        // Disable interrupts to stop pending timers etc
        while(1);
    }

    nrk_setup_uart (UART_BAUDRATE_115K2);

    MCUCR |= BM(PUD);

    nrk_init ();
    nrk_time_set (0, 0);

    tdma_set_error_callback(&tdma_error);
    tdma_task_config();

    nrk_create_taskset ();
    nrk_start ();

    return 0;
}
Пример #21
0
Файл: main.c Проект: jnwu/nanork
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;
}
Пример #22
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;
}
Пример #23
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;
}
Пример #24
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;
}
Пример #25
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;
}
Пример #26
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;
}
Пример #27
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;
}
Пример #28
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;
}
Пример #29
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;
}
Пример #30
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;
}