aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-01-30 14:54:33 +0100
committerLars-Dominik Braun <lars@6xq.net>2014-01-30 14:54:33 +0100
commit2d69663265969a90ef8d3d9f3a4952860ffd631b (patch)
treee0253367ae263af1c7f323d4676b79c9d0a3263c
parent5155bc314b8372fc188aff804a7e206bebd067a6 (diff)
downloadhourglass-2d69663265969a90ef8d3d9f3a4952860ffd631b.tar.gz
hourglass-2d69663265969a90ef8d3d9f3a4952860ffd631b.tar.bz2
hourglass-2d69663265969a90ef8d3d9f3a4952860ffd631b.zip
Remove unused stuff
-rw-r--r--main.c115
1 files changed, 0 insertions, 115 deletions
diff --git a/main.c b/main.c
index 19ec4f8..f83d090 100644
--- a/main.c
+++ b/main.c
@@ -99,121 +99,6 @@ void cpuInit () {
CLKPR = 0b00000011;
}
-#if 0
-void test1 () {
- while (1) {
- unsigned char res = uartReceive ();
- for (unsigned char i = 0; i < 3; i++) {
- PORTB ^= (1 << PB6);
- _delay_ms (1000);
- }
- /* no frame or parity error? */
- if (!(UCSR0A & (1 << FE0)) && !(UCSR0A & (1 << UPE0))) {
- ledShow (res);
- }
- uartSend (res);
- /* check tx complete */
- while ( !(UCSR0A & (1<<TXC0)) );
- /* clear tx complete */
- UCSR0A |= (1<<TXC0);
- }
-}
-#endif
-
-#if 0
-void enumreg () {
- printf ("enumerating registers\n");
- unsigned char reg[] = {0xf, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37};
- //unsigned char reg[] = {0xf, 0x20, 0x21, 0x22, 0x23, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2d, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f};
- for (unsigned char i = 0; i < sizeof (reg)/sizeof(*reg); i++) {
- printf ("start\n");
- twStart ();
- twWait ();
- unsigned char status = 0x0;
-
- /* check status code */
- if ((status = TW_STATUS) == 0x8) {
- printf ("start ok\nwriting dev address\n");
-
- /* write device address and write bit */
- TWDR = L3GD20 | TW_WRITE;
- if (TWCR & (1 << TWWC)) {
- printf("write collision\n");
- }
- twFlush ();
- twWait ();
- if ((status = TW_STATUS) == 0x18) {
- printf ("ok\n");
- } else {
- printf ("fail with code %x\n", status);
- }
-
- printf ("writing subaddress %x\n", reg[i]);
-
- /* write subaddress (actually i2c data) */
- TWDR = reg[i];
- if (TWCR & (1 << TWWC)) {
- printf("write collision\n");
- }
- twFlush ();
- twWait ();
- if ((status = TW_STATUS) == 0x28) {
- printf ("ok\n");
- } else {
- printf ("fail with code %x\n", status);
- }
-
- printf ("starting again\n");
-
- /* repeated start */
- twStart ();
- twWait ();
- if ((status = TW_STATUS) == 0x10) {
- printf ("ok\n");
- } else {
- printf ("fail with code %x\n", status);
- }
-
- printf ("writing read request\n");
-
- /* write device address and read bit */
- TWDR = L3GD20 | TW_READ;
- if (TWCR & (1 << TWWC)) {
- printf("write collision\n");
- }
- twFlush ();
- twWait ();
- if ((status = TW_STATUS) == 0x40) {
- printf ("ok\n");
- } else {
- printf ("fail with code %x\n", status);
- }
-
- /* clear twint and wait for response */
- twFlush ();
- twWait ();
- if ((status = TW_STATUS) == 0x58) {
- printf ("ok\n");
- } else {
- printf ("fail with code %x\n", status);
- }
- unsigned char ret = TWDR;
-
- printf ("register %x is %x\n", reg[i], ret);
-
- twStop ();
-
- printf ("done\n");
-
- /* there is no way to tell whether stop has been sent or not, just wait */
- _delay_ms (10);
- } else {
- printf ("fail\n");
- }
- }
-}
-#endif
-
int main(void) {
cpuInit ();
ledInit ();