first try getting both chips to work

master
Paul Goeser 15 years ago
parent e2cb525cce
commit 2726d543b5

@ -0,0 +1,2 @@
read-temp
*.o

@ -89,7 +89,7 @@ int cnt, vid, pid;
} else {
int opcode, addr, value;
int i=0;
sscanf(argv, "%i %i %i", &opcode, &addr, &value);
sscanf(argv[1], "%i %i %i", &opcode, &addr, &value);
cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, opcode, addr, value, buffer, sizeof(buffer), 5000);
if(cnt < 0){
fprintf(stderr, "\nUSB error in iteration %d: %s\n", i, usb_strerror());
@ -97,7 +97,7 @@ int cnt, vid, pid;
rxValue = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8);
rxIndex = ((int)buffer[3] & 0xff) | (((int)buffer[2] & 0xff) << 8);
fprintf(stderr, "request = 0x%04x", opcode);
fprintf(stderr, "request = 0x%04x\n", opcode);
fprintf(stderr, "rxValue = 0x%04x value = 0x%04x\n", rxValue, addr);
fprintf(stderr, "rxIndex = 0x%04x index = 0x%04x\n", rxIndex, value);

@ -44,6 +44,8 @@ void hardinit() {
lcd_init(1);
lcd_clrscr(1);
spi_init();
sei();
}

@ -135,7 +135,7 @@ void __attribute__((always_inline)) spi_sla_handle_packet(){
}
}
ISR(SPI_vect){
ISR(SPI_STC_vect){
SPCR &= ~(_BV(SPIE)); //disable spi interrupts
spi_sla_handle_packet();
SPCR |= _BV(SPIE);

@ -13,8 +13,12 @@ void hardinit() {
/* initializes the hardware */
// enable softtimer isr
TCCR1A = _BV(WGM10);
TCCR1B = _BV(WGM12) | _BV(CS11); // clk/8 prescaler, 4kHz PWM-freq.
TIMSK1 |= _BV(TOIE1);
spi_init();
sei();
}

Loading…
Cancel
Save