Esempio n. 1
0
void ipmb_init(void)
{
  rqSEQ = 1;
  memset((void*) &ReqMsgTbl, 0, sizeof(req_msg_tbl_entry_t));

  event_rcvr_ipmbl_addr = DEFAULT_EVT_RCVR_IPMBL_ADDR;

  register_timer_callback(xmt_retry_timer_callback, TEVENT_100MSEC);
}
Esempio n. 2
0
File: iat.c Progetto: metakevin/tds1
void iat_update_callback(timerentry_t *ctx)
{
    if (iat_ctx.peak_counter < IAT_PEAK_AGE)
    {
        ++iat_ctx.peak_counter;
    }

    register_timer_callback(&iat_timer, IAT_UPDATE_PERIOD,
            iat_update_callback, 0);
}
Esempio n. 3
0
int main( void )
{
  uint8_t buffer_index;
  packet_header_t* header;

  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;
  
  header = (packet_header_t*)tx_buffer;
  
  // Initialize Tx Buffer
  header->length = sizeof(packet_header_t) - 1;
  header->source = DEVICE_ADDRESS;
  header->type = 0x66; // Sync message
  header->flags = 0xAA;
  
  // Make sure processor is running at 12MHz
  setup_oscillator();
  
  // Initialize UART for communications at 115200baud
  setup_uart();
   
  // Initialize LEDs
  setup_leds();
  
  // Initialize timer
  set_ccr( 0, TIMER_LIMIT );
  setup_timer_a(MODE_UP);
  
  // Send sync message
  register_timer_callback( send_sync_message, 0 );

  // Initialize radio and enable receive callback function
  setup_radio( process_rx );
  
  // Enable interrupts, otherwise nothing will work
  eint();
   
  while (1)
  {
    // Enter sleep mode
    __bis_SR_register( LPM0_bits + GIE );
    __no_operation();
        
  }
  
  return 0;
}
Esempio n. 4
0
static void set_timer_speed(void)
{
    int new_timer_speed;

    /* Force 100% speed if using automatic refresh rate and there is no speed
       limit.  */
    if (warp_mode_enabled) {
        new_timer_speed = 0;
    } else if (relative_speed == 0 && refresh_rate == 0) {
	new_timer_speed = 100;
    } else {
	new_timer_speed = relative_speed;
    }

    if (new_timer_speed == timer_speed) {
        return;
    }

    timer_speed = new_timer_speed;
    register_timer_callback();
}
Esempio n. 5
0
//u8 dsflag;
void blink_callback(timerentry_t *t)
{
    u16 ms;
    if (t->key == 0)
    {
        debug_led(0);
        ms = 1000;

//        ow_2760_write_reg(8, dsflag?0xFF:0);
//        dsflag=!dsflag;
    }
    else
    {
        debug_led(1);
        ms = 1000;
    }

//    UDR1 = 0x5A;

    register_timer_callback(&blink_timer, MS_TO_TICK(ms), blink_callback,
            !t->key);
}
Esempio n. 6
0
void ui_display_callback(timerentry_t *ctx)
{
#if 0
    if (display_update_timer.key)
    {
        egt_read_thermocouple();
        goto timer_again;
    }
#endif

    ui_mode_t mode = current.mnum;
	
	if (current.stop_updates)
    {
        /* Stop timer */
		return;
    }

#ifdef RADIO_IN_SUPPORT
    if (current.mode_just_changed)
    {
        radio_change_counter = 0;
    }
#endif
    
    if (current.press_feedback)
    {
        send_feedback_msg();
    }    
    else if (ui_in_config_flag)
    {
		(display_modes[mode].displayfunc)(mode, CONFIG_REFRESH);
    }
#ifdef RADIO_IN_SUPPORT
    else if (radio_change_counter && radio_change_override)
    {
        --radio_change_counter;
        radioin_display_func(mode, DISPLAY_NORMAL_UPDATE);
    }
#endif
    else    /* normal display */
    {
        (display_modes[mode].displayfunc)(mode, 
            current.mode_just_changed?DISPLAY_MODE_JUST_CHANGED:
                                      DISPLAY_NORMAL_UPDATE);
    }

    current.mode_just_changed = 0;
    
    if (revert_counter < 80 && !ui_in_config_flag)   /* 10 sec */
    {
        ++revert_counter;
        if (revert_counter == 80)
        {
            /* This will switch to the last mode iff
             * we jumped to the current mode automatically
             * (i.e. due to atmospheric measurement) */
            switch_to_mode(current.mnum);
        }
    }    

#if 0
timer_again:
    register_timer_callback(&display_update_timer, MS_TO_TICK(125),
            ui_display_callback, !display_update_timer.key);    
#else
    register_timer_callback(&display_update_timer, MS_TO_TICK(60), // was 125
            ui_display_callback, 0);    
#endif

}