Skip to content

Commit

Permalink
Consistent nunchuck vs nunchuk
Browse files Browse the repository at this point in the history
  • Loading branch information
datacute committed Jun 29, 2020
1 parent 961d3e1 commit 3db662c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TinyNunchuck
# TinyNunchuk

This is a library for an ATTiny85 to use a Wii Nunchuk, over I<sup>2</sup>C.

Expand Down
18 changes: 9 additions & 9 deletions src/TinyNunchuk_TinyWireM.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,39 @@ static uint8_t datacute_endTransmission_tinywirem(void) {

#endif

static bool nunchuck_beginTransmission_tinywirem(void) {
static bool nunchuk_beginTransmission_tinywirem(void) {
TinyWireM.beginTransmission(NUNCHUK_ADDRESS);
return true;
}

#ifndef TINYNUNCHUK_QUICK_BEGIN
static bool nunchuck_check_tinywirem(void) {
static bool nunchuk_check_tinywirem(void) {
const uint8_t noError = 0x00;
nunchuck_beginTransmission_tinywirem();
nunchuk_beginTransmission_tinywirem();
return (datacute_endTransmission_tinywirem()==noError);
}
#endif

static void nunchuck_begin_tinywirem(void) {
static void nunchuk_begin_tinywirem(void) {
TinyWireM.begin();
#ifndef TINYNUNCHUK_QUICK_BEGIN
while (!nunchuck_check_tinywirem()) {
while (!nunchuk_check_tinywirem()) {
delay(10);
}
#endif
}

static uint8_t nunchuck_request_tinywirem(uint8_t length) {
static uint8_t nunchuk_request_tinywirem(uint8_t length) {
const uint8_t noError = 0x00;
if (TinyWireM.requestFrom(NUNCHUK_ADDRESS, length)==noError) return length;
return 0;
}

NunchukDevice nunchuk(&nunchuck_begin_tinywirem,
&nunchuck_beginTransmission_tinywirem,
NunchukDevice nunchuk(&nunchuk_begin_tinywirem,
&nunchuk_beginTransmission_tinywirem,
&datacute_write_tinywirem,
&datacute_endTransmission_tinywirem,
&nunchuck_request_tinywirem,
&nunchuk_request_tinywirem,
&datacute_read_tinywirem,
&datacute_end_read_tinywirem);

Expand Down

0 comments on commit 3db662c

Please sign in to comment.