diff options
author | Christian Pointner <equinox@mur.at> | 2012-06-22 20:12:13 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2012-06-22 20:12:13 +0000 |
commit | c7d481809a9827abbd2d73509b167c42cb841dc4 (patch) | |
tree | 2c8925f7299d1efaf8e628526166c78c730b6236 /software/idm-test/idm-test.c | |
parent | rx detect works, still receiving mostly noise (diff) |
small refactoring
some time tests .. not working yet :(
git-svn-id: https://svn.spreadspace.org/mur.sat@551 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm-test/idm-test.c')
-rw-r--r-- | software/idm-test/idm-test.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/software/idm-test/idm-test.c b/software/idm-test/idm-test.c index f50a57f..49fe3fc 100644 --- a/software/idm-test/idm-test.c +++ b/software/idm-test/idm-test.c @@ -43,7 +43,7 @@ /* Global I/O Buffers: */
static RingBuffer_t SPItoUSB_Buffer;
-static uint8_t SPItoUSB_Buffer_Data[64];
+static uint8_t SPItoUSB_Buffer_Data[16];
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
@@ -93,6 +93,8 @@ void EVENT_USB_Device_ControlRequest(void) #define INT_PIN PIND
#define INT 0
+volatile unsigned char cnt = 0;
+
void SetupHardware(void)
{
MCUSR &= ~(1 << WDRF);
@@ -104,7 +106,7 @@ void SetupHardware(void) TCCR0B = (1 << CS02);
- SPI_Init(SPI_SPEED_FCPU_DIV_8 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
+ SPI_Init(SPI_SPEED_FCPU_DIV_64 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING);
SPI_CS_DDR |= (1<<CS);
SPI_CS_PORT |= (1<<CS);
@@ -135,16 +137,17 @@ void IDM_ReadData(void) _delay_us(30);
uint8_t int_state = (INT_PIN & (1<<INT));
while(!int_state) {
- uint8_t ReceivedByte = SPI_ReceiveByte();
+ uint8_t ReceivedByte = SPI_TransferByte(0);
RingBuffer_Insert(&SPItoUSB_Buffer, ReceivedByte);
if(RingBuffer_IsFull(&SPItoUSB_Buffer))
break;
- _delay_us(25);
+ _delay_us(50);
int_state = (INT_PIN & (1<<INT));
}
- _delay_us(10);
+ _delay_us(30);
SPI_CS_PORT |= (1<<CS);
+ _delay_us(50);
led_off();
}
|