Project

General

Profile

Revision 694

Added by Ben Poole almost 16 years ago

reads first byte of left encoder correctly, still can't get second byte

View differences:

branches/encoders/code/projects/libdragonfly/spi.c
69 69
	//char c=SPDR;
70 70
	//PORTB |= SS;
71 71
	if(spi_mode == FIRST_BYTE){
72
		i = (uint16_t)SPDR << 8;
72
		i = (uint16_t)SPDR;
73 73
		spi_recv_function(SPDR);
74 74
		spi_mode = SECOND_BYTE;
75 75
		SPDR = 'c';
76
	} else if (spi_mode == SECOND_BYTE){
76
		SPDR = 'c';
77
	} else {
78
		usb_puts("second byte\r\n");
77 79
		i = (uint16_t)SPDR << 8;
78 80
		spi_mode = 4;
79 81
		PORTB |= SS;
branches/encoders/code/projects/libdragonfly/spi.h
18 18
#define SCLK _BV(PB1)
19 19

  
20 20
#define size_t int
21
typedef void (*spi_fun_recv_t)(char);
22
typedef void (*spi_fun_send_t)(char);
21
typedef void (*spi_fun_recv_t)(unsigned char);
22
typedef void (*spi_fun_send_t)(unsigned char);
23 23
void spi_init(spi_fun_recv_t recv_func);
24 24
int spi_send(char *data, size_t bytes);
25 25
void spi_master_recv_on(void);

Also available in: Unified diff