Project

General

Profile

Revision 277

more cleanup

View differences:

buzzer.c
53 53
 **/
54 54
void buzzer_init( void )
55 55
{
56
	//NOTE: This is mostly handled by buzzer_Set_val for now
57
	// Set pin B7 to output - B7 is buzzer pin
58
	//DDRB |= _BV(DDB7);
59
	//Fast PWM Mode, Clear OCR0 on compare match and set at bottom, clock/64
60
	//TCCR2 = _BV(COM20) | _BV(WGM21)  | _BV(CS22);
56
  //NOTE: This is mostly handled by buzzer_Set_val for now
57
  // Set pin B7 to output - B7 is buzzer pin
58
  //DDRB |= _BV(DDB7);
59
  //Fast PWM Mode, Clear OCR0 on compare match and set at bottom, clock/64
60
  //TCCR2 = _BV(COM20) | _BV(WGM21)  | _BV(CS22);
61 61
}
62 62

  
63 63
/**
......
71 71
 **/
72 72
void buzzer_set_val(unsigned int buzz_value)
73 73
{
74
	TCCR2 = _BV(COM20) | _BV(WGM21)  | _BV(CS22);
75
	DDRB |= _BV(DDB7);
76
	OCR2 = buzz_value;
74
  TCCR2 = _BV(COM20) | _BV(WGM21)  | _BV(CS22);
75
  DDRB |= _BV(DDB7);
76
  OCR2 = buzz_value;
77 77
}
78 78

  
79 79
/**
......
92 92

  
93 93
  buzz_value = 62500/buzz_freq - 1;
94 94

  
95
  if(buzz_value > 255){
95
  if (buzz_value > 255) {
96 96
    buzz_value = 255;
97
  }else if(buzz_value < 0){
97
  } else if (buzz_value < 0) {
98 98
    buzz_value = 0;
99 99
  }
100 100

  
......
134 134
}
135 135

  
136 136
/** @} **/ // end buzzer group
137

  

Also available in: Unified diff