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.c13
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();
}