Пример #1
0
void setup() {
	// Only for test!
	Serial.begin(9600);

	// Setup all system components
	systemSetup();
	setupLeds();
	setupPowerButton();
	setupSystemPowerRelay();
	setupSystemFansRelay();
	setupRaspiStatus();
}
Пример #2
0
int main(void)
{
    laser_off(); 
	bootloaderSwitcher();

  init_serial_number();
	USB_Start();
  
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);

	setupJP5();
	setupJP6();
	setupLeds();
  init_watchdog();
  setup_interlock();

	//debug: flas the light on boot, to watch for watchdog resets
	setCoilLed(1);

	initialize_led_override();
	if (LED_OVERRIDES_EN){
		play_long_spin(); //Spin the led's while we load the rest of this stuff
	}

  initialize_pwm();
  initialize_dripper();

	setCornerLed(0);
	setInLed(0);
	setCoilLed(0);
	setUSBLed(0);

  SysTick_Config(SystemCoreClock / 2000); //48MHz/2000 gives us 2000 ticks per second (2KHz)

  int last_drip_count = g_dripcount;

  while(1) {
    serialio_feed();
    updateADC();
    if (move_count!=0){
      g_twig_coils=0;
      g_key_coil_gate=0;
    }
    if (g_dripcount != last_drip_count) {
      last_drip_count = g_dripcount;
      send_updated_drip_count();
    }
    if ((tick % 500) == 0) {
      send_printer_status();
    } 
  }
}
Пример #3
0
int main(void)
{
	cli();
	// Disable the watchdog
	wdt_disable();
	
	// Setup LEDS
	setupLeds();
	
	// Two second blink
	setLeds(0xFF);
	_delay_ms(2000);
	setLeds(0);
	
	setupTimer();
	
	setupInterrupt();

	// Enable interrupts
	sei();
	
	// Halt
	while(1);
}