summaryrefslogtreecommitdiff
path: root/software/idm-test
diff options
context:
space:
mode:
Diffstat (limited to 'software/idm-test')
-rw-r--r--software/idm-test/idm-test.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/software/idm-test/idm-test.c b/software/idm-test/idm-test.c
index a4c4535..9e10771 100644
--- a/software/idm-test/idm-test.c
+++ b/software/idm-test/idm-test.c
@@ -106,7 +106,7 @@ void SetupHardware(void)
TCCR0B = (1 << CS02);
- SPI_Init(SPI_SPEED_FCPU_DIV_64 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
+ SPI_Init(SPI_SPEED_FCPU_DIV_8 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING);
SPI_CS_DDR |= (1<<CS);
SPI_CS_PORT |= (1<<CS);
@@ -157,12 +157,15 @@ void IDM_ReadData(void)
RingBuffer_Insert(&SPItoUSB_Buffer, ReceivedByte);
tmp_cnt++;
- if(RingBuffer_IsFull(&SPItoUSB_Buffer))
+ /* if(RingBuffer_IsFull(&SPItoUSB_Buffer)) */
+ if(RingBuffer_GetFreeCount(&SPItoUSB_Buffer) == 1)
break;
- _delay_us(50);
+ _delay_us(70);
int_state = (INT_PIN & (1<<INT));
}
-
+
+ RingBuffer_Insert(&SPItoUSB_Buffer, 128);
+
_delay_us(30);
SPI_CS_PORT |= (1<<CS);
_delay_us(50);