summaryrefslogtreecommitdiff
path: root/software/idm-test/idm-test.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-06-05 18:47:32 +0000
committerChristian Pointner <equinox@mur.at>2012-06-05 18:47:32 +0000
commitd6c89d35e7982789d256c9a66c39685af537ebcc (patch)
tree39a7e652970fd61f6fc69a55849f83df2af7ae62 /software/idm-test/idm-test.c
parentUSB Manufacturer and Product (diff)
first working version of spi communication
git-svn-id: https://svn.spreadspace.org/mur.sat@503 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm-test/idm-test.c')
-rw-r--r--software/idm-test/idm-test.c8
1 files changed, 4 insertions, 4 deletions
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<<CS);
SPI_CS_PORT |= (1<<CS);
@@ -158,7 +158,7 @@ int main(void)
int16_t BytesReceived = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface);
while(BytesReceived > 0) {
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
- if (!(ReceivedByte < 0)) {
+ if (ReceivedByte >= 0) {
switch(ReceivedByte) {
case 'p': PWRDWN_PORT &= ~(1<<PWRDWN); break;
case 'P': PWRDWN_PORT |= (1<<PWRDWN); break;
@@ -176,8 +176,8 @@ int main(void)
if ((TIFR0 & (1 << TOV0)) || (BufferCount > (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);