From d6c89d35e7982789d256c9a66c39685af537ebcc Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 5 Jun 2012 18:47:32 +0000 Subject: first working version of spi communication git-svn-id: https://svn.spreadspace.org/mur.sat@503 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/idm-test/idm-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'software/idm-test') diff --git a/software/idm-test/idm-test.c b/software/idm-test/idm-test.c index c72ab91..89363e6 100644 --- a/software/idm-test/idm-test.c +++ b/software/idm-test/idm-test.c @@ -104,7 +104,7 @@ void SetupHardware(void) TCCR0B = (1 << CS02); - SPI_Init(SPI_SPEED_FCPU_DIV_16 | 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< 0) { int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); - if (!(ReceivedByte < 0)) { + if (ReceivedByte >= 0) { switch(ReceivedByte) { case 'p': PWRDWN_PORT &= ~(1< (uint8_t)(sizeof(SPItoUSB_Buffer_Data) * .75))) { TIFR0 |= (1 << TOV0); while (BufferCount--) { - if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, - RingBuffer_Peek(&SPItoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) + if(CDC_Device_SendByte(&VirtualSerial_CDC_Interface, + RingBuffer_Peek(&SPItoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) break; RingBuffer_Remove(&SPItoUSB_Buffer); -- cgit v1.2.3