Commits

Trammell Hudson committed 4d81608

Use 8-bit PWM and a better diode

Comments (0)

Files changed (1)

 	// start bit
 	out(0xD7, 0);
 
-#define BIT_CLOCK 22000
+#define BIT_CLOCK 22
 //#define BIT_CLOCK 16666
 
-	_delay_us(BIT_CLOCK); // + BIT_CLOCK/2);
+	_delay_ms(BIT_CLOCK); // + BIT_CLOCK/2);
 
 	for (int i = 0 ; i < 5 ; i++)
 	{
 		else
 			out(0xD7, 0);
 
-		_delay_us(BIT_CLOCK);
+		_delay_ms(BIT_CLOCK);
 	}
 
 	out(0xD7, 1);
-	_delay_us(BIT_CLOCK + BIT_CLOCK/2); // 1.42 stop bits
+	_delay_ms(BIT_CLOCK + BIT_CLOCK/2); // 1.42 stop bits
 }
 
 
 boost_setup(void)
 {
 
-        // Configure OC1x in fast-PWM mode, 10-bit
+        // Configure OC1x in fast-PWM mode, 8-bit
         sbi(TCCR1B, WGM12);
-        sbi(TCCR1A, WGM11);
+        cbi(TCCR1A, WGM11);
         sbi(TCCR1A, WGM10);
 
         // OC1C is used to generate the boost converter pump
         cbi(TCCR1B, CS11);
         sbi(TCCR1B, CS10);
 
-	OCR1C = 0x2B0; // very little off time makes the mosfet unhappy
+	OCR1C = 0x10; // very little off time makes the mosfet unhappy
 	ddr(0xB7, 1);
 	out(0xB7, 1);
 }