Permalink
Browse files

Removing hardcoded CPU speed from Wire library.

Replacing CPU_FREQ with F_CPU.
  • Loading branch information...
1 parent 24e62aa commit e1faf02deb990077856328a83fec3aa6edc5b5d0 @damellis damellis committed Feb 23, 2011
Showing with 1 addition and 5 deletions.
  1. +1 −1 libraries/Wire/utility/twi.c
  2. +0 −4 libraries/Wire/utility/twi.h
@@ -79,7 +79,7 @@ void twi_init(void)
// initialize twi prescaler and bit rate
cbi(TWSR, TWPS0);
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
SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR))
@@ -24,10 +24,6 @@
//#define ATMEGA8
- #ifndef CPU_FREQ
- #define CPU_FREQ 16000000L
- #endif
-
#ifndef TWI_FREQ
#define TWI_FREQ 100000L
#endif

0 comments on commit e1faf02

Please sign in to comment.