Imported changes from example branch

This commit is contained in:
BlackMark committed 2017-12-17 10:55:25 +01:00
1 parent 8e2e18128b
commit 22a74d0b77
2 files changed
+3 -5

No files matched your search

+1 -1
View File
@@ -79,7 +79,7 @@ void twi_init(void)
// initialize twi prescaler and bit rate // initialize twi prescaler and bit rate
cbi(TWSR, TWPS0); cbi(TWSR, TWPS0);
cbi(TWSR, TWPS1); cbi(TWSR, TWPS1);
TWBR = ((CPU_FREQ / TWI_FREQ) - 16) / 2; TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
/* twi bit rate formula from atmega128 manual pg 204 /* twi bit rate formula from atmega128 manual pg 204
SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR)) SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR))
+2 -4
View File
@@ -22,11 +22,9 @@
#include <inttypes.h> #include <inttypes.h>
//#define ATMEGA8 #include "../clock.h"
#ifndef CPU_FREQ //#define ATMEGA8
#define CPU_FREQ 16000000L
#endif
#ifndef TWI_FREQ #ifndef TWI_FREQ
#define TWI_FREQ 100000L #define TWI_FREQ 100000L