aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-01-30 14:40:06 +0100
committerLars-Dominik Braun <lars@6xq.net>2014-01-30 14:40:06 +0100
commit77836164a300800886c72e76d5769f9a4da0e804 (patch)
tree7f69f29351c4be834655339bd5e2cb44847cdc4f
parent9177693c7a201e70743d7ab786c4053abe1fcb84 (diff)
downloadhourglass-77836164a300800886c72e76d5769f9a4da0e804.tar.gz
hourglass-77836164a300800886c72e76d5769f9a4da0e804.tar.bz2
hourglass-77836164a300800886c72e76d5769f9a4da0e804.zip
Use twi constants
-rw-r--r--main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/main.c b/main.c
index a747b31..ee9c0ba 100644
--- a/main.c
+++ b/main.c
@@ -230,7 +230,7 @@ int main(void) {
unsigned char status = 0x0;
/* check status code */
- if ((status = TW_STATUS) == 0x8) {
+ if ((status = TW_STATUS) == TW_START) {
/* write device address and write bit */
TWDR = L3GD20 | TW_WRITE;
if (TWCR & (1 << TWWC)) {
@@ -238,7 +238,7 @@ int main(void) {
}
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x18) {
+ if ((status = TW_STATUS) == TW_MT_SLA_ACK) {
} else {
printf ("fail with code %x\n", status);
}
@@ -250,7 +250,7 @@ int main(void) {
}
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x28) {
+ if ((status = TW_STATUS) == TW_MT_DATA_ACK) {
} else {
printf ("fail with code %x\n", status);
}
@@ -262,7 +262,7 @@ int main(void) {
}
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x28) {
+ if ((status = TW_STATUS) == TW_MT_DATA_ACK) {
} else {
printf ("fail with code %x\n", status);
}
@@ -283,7 +283,7 @@ int main(void) {
unsigned char status = 0x0;
/* check status code */
- if ((status = TW_STATUS) == 0x8) {
+ if ((status = TW_STATUS) == TW_START) {
/* write device address and write bit */
TWDR = L3GD20 | TW_WRITE;
@@ -292,7 +292,7 @@ int main(void) {
}
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x18) {
+ if ((status = TW_STATUS) == TW_MT_SLA_ACK) {
} else {
printf ("fail with code %x\n", status);
}
@@ -304,7 +304,7 @@ int main(void) {
}
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x28) {
+ if ((status = TW_STATUS) == TW_MT_DATA_ACK) {
} else {
printf ("fail with code %x\n", status);
}
@@ -312,7 +312,7 @@ int main(void) {
/* repeated start */
twStart ();
twWait ();
- if ((status = TW_STATUS) == 0x10) {
+ if ((status = TW_STATUS) == TW_REP_START) {
} else {
printf ("fail with code %x\n", status);
}
@@ -324,7 +324,7 @@ int main(void) {
}
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x40) {
+ if ((status = TW_STATUS) == TW_MR_SLA_ACK) {
} else {
printf ("fail with code %x\n", status);
}
@@ -332,7 +332,7 @@ int main(void) {
/* clear twint and wait for response */
twFlush ();
twWait ();
- if ((status = TW_STATUS) == 0x58) {
+ if ((status = TW_STATUS) == TW_MR_DATA_NACK) {
} else {
printf ("fail with code %x\n", status);
}