Exemplo n.º 1
0
static ssize_t buzzer_write_play(struct kobj_t * kobj, void * buf, size_t size)
{
	struct buzzer_t * buzzer = (struct buzzer_t *)kobj->priv;

	if (strcmp(buf, "default") == 0)
		buzzer_play(buzzer, "AuldLangSyne:d=4,o=5,b=100:g,c.6,8c6,c6,e6,d.6,8c6,d6,8e6,"
			"8d6,c.6,8c6,e6,g6,2a.6,a6,g.6,8e6,e6,c6,d.6,8c6,d6,8e6,8d6,c.6,8a,a,g,2c.6");
	else
		buzzer_play(buzzer, buf);
	return size;
}
Exemplo n.º 2
0
static void as_event(enum sys_message msg)
{


	if ( (msg & SYS_MSG_RTC_MINUTE) == SYS_MSG_RTC_MINUTE)
	{
		if(sAccel.mode == ACCEL_MODE_ON) sAccel.timeout--;
		//if timeout is over disable the accelerometer
		if(sAccel.timeout<1)
		{
			//disable accelerometer to save power			
			as_stop();
			//update the mode to remember
			sAccel.mode = ACCEL_MODE_OFF;
		}

	}
	if ( (msg & SYS_MSG_AS_INT) == SYS_MSG_AS_INT)
	{
		//Check the vti register for status information
		as_status.all_flags=as_get_status();
		//TODO For debugging only
		_printf(0, LCD_SEG_L1_1_0, "%1u", as_status.all_flags);	
		buzzer_play(smb);
		//if we were in free fall or motion detection mode check for the event
		if(as_status.int_status.falldet || as_status.int_status.motiondet){

			//if such an event is detected enable the symbol
			//display_symbol(0, LCD_ICON_ALARM , SEG_SET | BLINK_ON);
			
			//read the data
			as_get_data(sAccel.xyz);
			//display_data(0);
			/* update menu screen */
			lcd_screen_activate(0);

		}//if we were in measurment mode do a measurement and put it in the virtual screen
		else
		{

			//display_symbol(0, LCD_ICON_ALARM , SEG_SET | BLINK_OFF);
			display_data(1);
			/* refresh to accelerometer screen only if in that modality */
			if (submenu_state== VIEW_AXIS )lcd_screen_activate(1);

		}
	}
	/* The 1 Hz timer is used to refresh the menu screen */
	if ( (msg & SYS_MSG_RTC_SECOND) == SYS_MSG_RTC_SECOND)
	{
	/*check the status register for debugging purposes */
	_printf(0, LCD_SEG_L1_1_0, "%1u", as_read_register(ADDR_INT_STATUS));	
	/* update menu screen */
	lcd_screen_activate(0);
	}

}
Exemplo n.º 3
0
Arquivo: music.c Projeto: epl692/Watch
static void num_press()
{
//	buzzer_play(smb);

    	/* Play "welcome" chord: A major */
	note welcome[4] = {0x1901, 0x1904, 0x1908, 0x000F};
	buzzer_play(welcome);

    
}
Exemplo n.º 4
0
inline void buzzer_init(void)
{
	/* Reset TA1R, TA1 runs from 32768Hz ACLK */
	TA1CTL = TACLR | TASSEL__SMCLK | MC__STOP;

	/* Enable IRQ, set output mode "toggle" */
	TA1CCTL0 = OUTMOD_4;

	/* Play "welcome" chord: A major */
	note welcome[4] = {0x1901, 0x1904, 0x1908, 0x000F};
	buzzer_play(welcome);
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: mbuesch/morse
/** \brief	Cleartaster-Ereignisse abarbeiten. */
static void handle_clear_button(void)
{
	enum edge_detect_result edge;

	irq_disable();
	if (machine.clear_button_pause) {
		irq_enable();
		/* Entprellpause ist aktiv.
		 * Keine Erkennung durchfuehren. */
		return;
	}
	irq_enable();

	/* Flankenerkennung des Cleartasters aufrufen. */
	edge = get_clear_button_edge();

	if (edge == EDGE_POS) {
		/* Positive Flanke: Cleartaster wurde gedrueckt.
		 * Morsestring im LCD loeschen. */
		if (memcmp(&out.text[OUT_TEXT_LEN - 5], " BNT ", 5) == 0) {
			irq_disable();
			buzzer_play(buzzer_elise);
			irq_enable();
		}
		clear_output_text();
		reset_capture_context();
		update_lcd();
	}
	if (edge != EDGE_NONE) {
		/* Es gab eine positive oder negative Flanke.
		 * Entprellzeit einstellen. */
		irq_disable();
		machine.clear_button_pause = DEBOUNCE_TICKS;
		irq_enable();
	}
}
Exemplo n.º 6
0
static void num_press()
{
	buzzer_play(smb);
}
Exemplo n.º 7
0
int app_main (void)
{
  long timer1 = 0;
  eParseResult parse_result;

  buzzer_init();
  buzzer_play(1500, 100); /* low beep */
	buzzer_wait();
  buzzer_play(2500, 200); /* high beep */

  init();

  read_config();

  // grbl init
  plan_init();      
  st_init();    
  
  // main loop
  for (;;)
  {

    // process characters from the serial port
    while (!serial_line_buf.seen_lf && (serial_rxchars() != 0) )
    {
      unsigned char c = serial_popchar();
      
      if (serial_line_buf.len < MAX_LINE)
        serial_line_buf.data [serial_line_buf.len++] = c;

      if ((c==10) || (c==13))
      {
        if (serial_line_buf.len > 1)
          serial_line_buf.seen_lf = 1;
        else
          serial_line_buf.len = 0;
      }      
    }

    // process SD file if no serial command pending
    if (!sd_line_buf.seen_lf && sd_printing)
    {
      if (sd_read_file (&sd_line_buf))
      {
          sd_line_buf.seen_lf = 1;
      } 
      else
      {
        sd_printing = false;
        serial_writestr ("Done printing file\r\n");
      }
    }

    // if queue is full, we wait
    if (!plan_queue_full())
    {
  
      /* At end of each line, put the "GCode" on movebuffer.
       * If there are movement to do, Timer will start and execute code which
       * will take data from movebuffer and generate the required step pulses
       * for stepper motors.
       */
  
      // give priority to user commands
      if (serial_line_buf.seen_lf)
      {
        parse_result = gcode_parse_line (&serial_line_buf);
        serial_line_buf.len = 0;
        serial_line_buf.seen_lf = 0;
      }
      else if (sd_line_buf.seen_lf)
      {
        parse_result = gcode_parse_line (&sd_line_buf);
        sd_line_buf.len = 0;
        sd_line_buf.seen_lf = 0;
      }

    }

    /* Do every 100ms */
    #define DELAY1 100
    if (timer1 < millis())
    {
      timer1 = millis() + DELAY1;

      /* If there are no activity during 30 seconds, power off the machine */
      if (steptimeout > (30 * 1000/DELAY1))
      {
        power_off();
      }
      else
      {
        steptimeout++;
      }
    }

#ifdef USE_BOOT_BUTTON
    // OPTION: enter bootloader on "Boot" button
    check_boot_request();
#endif

  }
}
Exemplo n.º 8
0
static void down_press()
{
	note welcome[4] = {0x1901, 0x1904, 0x1908, 0x000F};
	buzzer_play(welcome);
}