From 3e1c56c7445a533bda6905c9edd390640563d7ff Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 27 Apr 2011 00:11:52 +0200 Subject: [PATCH] fix shifts --- firmware/src/edubrm.c | 4 ++-- software/device.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/src/edubrm.c b/firmware/src/edubrm.c index dfd7ae1..1bcbbf5 100644 --- a/firmware/src/edubrm.c +++ b/firmware/src/edubrm.c @@ -17,8 +17,8 @@ void GetInReport (uint8_t src[], uint32_t length) } src[14] = 0; src[14] |= (LPC_GPIO2->MASKED_ACCESS[1<<0] & (1<<0)); - src[14] |= (LPC_GPIO2->MASKED_ACCESS[1<<6] & (1<<6)); - src[14] |= (LPC_GPIO2->MASKED_ACCESS[1<<7] & (1<<7)); + src[14] |= (LPC_GPIO2->MASKED_ACCESS[1<<6] & (1<<6)) >> 5; + src[14] |= (LPC_GPIO2->MASKED_ACCESS[1<<7] & (1<<7)) >> 5; } diff --git a/software/device.py b/software/device.py index 53bdfda..0f616a1 100644 --- a/software/device.py +++ b/software/device.py @@ -91,7 +91,7 @@ class Device: randint(0,1), randint(0,1), randint(0,1)) # IO1 .. IO3 else: i = self.epi.read(self.INSIZE) - return (i[0] + i[1]<<8, # AD0 - i[2] + i[3]<<8, i[4] + i[5]<<8, i[6] + i[7]<<8, # AD1 .. AD3 - i[9] + i[9]<<8, i[10] + i[11]<<8, i[12] + i[13]<<8, # AD4 .. AD6 - i[14] & 0x01, (i[14] & 0x02) >> 1, (i[14] & 0x04) >> 2) # IO1 .. IO3 + return (i[0] + (i[1]<<8), # AD0 + i[2] + (i[3]<<8), i[4] + (i[5]<<8), i[6] + (i[7]<<8), # AD1 .. AD3 + i[9] + (i[9]<<8), i[10] + (i[11]<<8), i[12] + (i[13]<<8), # AD4 .. AD6 + i[14] & 0x01, (i[14] & 0x02) >> 1, (i[14] & 0x04) >> 2) # IO1 .. IO3