diff options
author | Christian Pointner <equinox@mur.at> | 2012-05-31 21:32:20 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2012-05-31 21:32:20 +0000 |
commit | f7a1d2e9cdbb4f4d4f0c7712803d5abd34f55763 (patch) | |
tree | cb24f74e0424d1d9400de686b66cfdc3e5f5d785 /software/idm-test/idm-test.c | |
parent | cleanup (diff) |
some timing test for idm communication (not working yet - hardware probs?)
git-svn-id: https://svn.spreadspace.org/mur.sat@501 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm-test/idm-test.c')
-rw-r--r-- | software/idm-test/idm-test.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/software/idm-test/idm-test.c b/software/idm-test/idm-test.c index 0de977f..c72ab91 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[128];
+static uint8_t SPItoUSB_Buffer_Data[8];
/** 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
@@ -104,7 +104,7 @@ void SetupHardware(void) TCCR0B = (1 << CS02);
- SPI_Init(SPI_SPEED_FCPU_DIV_4 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
+ SPI_Init(SPI_SPEED_FCPU_DIV_16 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING);
SPI_CS_DDR |= (1<<CS);
SPI_CS_PORT |= (1<<CS);
@@ -129,17 +129,21 @@ void IDM_ReadData(void) {
led_on();
SPI_CS_PORT &= ~(1<<CS);
+ _delay_us(100);
SPI_SendByte('r');
+ _delay_us(50);
uint8_t int_state = (INT_PIN & (1<<INT));
while(!int_state) {
uint8_t ReceivedByte = SPI_ReceiveByte();
RingBuffer_Insert(&SPItoUSB_Buffer, ReceivedByte);
if(RingBuffer_IsFull(&SPItoUSB_Buffer))
break;
+ _delay_us(30);
int_state = (INT_PIN & (1<<INT));
}
+ _delay_us(100);
SPI_CS_PORT |= (1<<CS);
led_off();
}
|