Commits

Trammell Hudson committed 0ecadc0 Draft

Enable buzzer on OC0A and switch paddles

Comments (0)

Files changed (1)

 led_on(void)
 {
 	PORTD |= LED_PIN;
+	DDRB |=  1 << 7; // OC0A enabled
 }
 
 static inline void
 led_off(void)
 {
 	PORTD &= ~LED_PIN;
+	DDRB &=  ~(1 << 7); // OC0A disabled
 }
 
 static inline void
 	const uint8_t value
 )
 {
-	return bit_is_clear(value, 5);
+	return bit_is_clear(value, 4);
 }
 
 
 	const uint8_t value
 )
 {
-	return bit_is_clear(value, 4);
+	return bit_is_clear(value, 5);
 }
 
 
 	const uint8_t cpm = 10;
 	const uint16_t dit_time = (1600 / cpm) * 16;
 
+	// TCNT0 is configured for a 500 Hz tone on OC0A
+	// At CLK/512, this is turns on and off each time
+	// a full counter is made
+	TCCR0A = (1 << COM0A0); // toggle OC0A on match
+	TCCR0B = 0x03; // CLK/64
+	OCR0A = 0xFF; // every roll over
+	led_off();
+
 	uint8_t value = 1;
 	uint8_t bits = 0;
 	uint8_t last_bit = 0;