Skip to content

Commit 613d0b7

Browse files
committed
Fixed wire speed setup
1 parent 75e3d90 commit 613d0b7

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

Wii-Nunchuk/Nunchuk.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@
4040
#define I2C_START(x) Wire.beginTransmission(x)
4141
#define I2C_STOP() Wire.endTransmission()
4242

43-
#ifndef CPU_FREQ
44-
#define CPU_FREQ 16000000L
45-
#endif
46-
47-
#ifndef TWI_FREQ
48-
#define TWI_FREQ 400000L
49-
#endif
50-
5143
uint8_t nunchuk_data[6];
5244
uint8_t nunchuk_cali[16];
5345

@@ -72,7 +64,7 @@ static void nunchuk_init() {
7264

7365
// Change TWI speed for nuchuk, which uses Fast-TWI (400kHz)
7466
// Normally this will be set in twi_init(), but this hack works without modifying the original source
75-
TWBR = ((CPU_FREQ / TWI_FREQ) - 16) / 2;
67+
Wire.setClock(400000);
7668

7769
#ifdef NUNCHUK_DISABLE_ENCRYPTION
7870
I2C_START(NUNCHUK_ADDRESS);

0 commit comments

Comments
 (0)