Commits

Trammell Hudson committed 0ecadc0

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;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.