still debugging, pure chaos

master
Paul Goeser 15 years ago
parent 95ecf21807
commit ed66f05f4c

@ -84,10 +84,10 @@ int __attribute__((noreturn)) main(void) {
}
SOFTTIMER(1,250) {
//updateTemperature();
updateTemperature();
}
SOFTTIMER(3,100) {
/* SOFTTIMER(3,100) {
/* uint8_t foo[4];
foo[0]=0x55;
foo[1]=0x88;
@ -96,20 +96,20 @@ int __attribute__((noreturn)) main(void) {
spi_mst_start_packet();
spi_mst_write_read(2,foo+2);
spi_mst_end_packet();
*/
uint16_t foo=0x3456;
foo=spi_master_communicate(3,5,foo);
display_gotoyx(0,0);
/* display_puthex(foo[0]);
display_puthex(foo[0]);
display_puthex(foo[1]);
display_puthex(foo[2]);
display_puthex(foo[3]);*/
display_puthex(foo[3]);
display_puthex((foo>>8)&0xff);
display_puthex((foo)&0xff);
display_puts("\nfoo");
display_update();
}
}*/
}
}

@ -120,7 +120,6 @@ void __attribute__((always_inline)) spi_sla_handle_packet(){
// TODO: make slave not hangup in case of partial read
uint8_t opcode, addr, do_write;
uint16_t data;
SPI_WAIT;
SPDR = 0x53; // random ack
SPI_WAIT;
opcode = SPDR;
@ -146,13 +145,13 @@ void __attribute__((always_inline)) spi_sla_handle_packet(){
ISR(SPI_STC_vect){
uint8_t a;
/* uint8_t a;
a = SPDR;
SPDR = ~a;
/* SPCR &= ~(_BV(SPIE)); //disable spi interrupts
SPDR = ~a; //*/
SPCR &= ~(_BV(SPIE)); //disable spi interrupts
spi_sla_handle_packet();
SPCR |= _BV(SPIE);
*/
//*/
}
#endif //not SPI_MASTER

@ -18,7 +18,7 @@ void talk_to_slave(uint8_t opcode, uint8_t addr, uint8_t flags)
uint16_t spi_master_communicate(uint8_t opcode, uint8_t address, uint16_t value)
{
uint8_t flags = spi_proto_needs();
uint8_t flags = spi_proto_needs(opcode);
write_data[2] = value >> 8;
write_data[3] = value & 0xff;
talk_to_slave(opcode, address, flags);

@ -9,7 +9,7 @@
#define SPI_READ_DATA 0x10
#define SPI_NONE 0
uint16_t spi_master_communicate(uint8_t opcode, uint8_t address, uint16_t value)
uint16_t spi_master_communicate(uint8_t opcode, uint8_t address, uint16_t value);
uint8_t spi_proto_needs(uint8_t opcode);

@ -30,6 +30,8 @@ void softinit() {
int __attribute__((noreturn)) main(void) {
hardinit();
softinit();
foo= 0xfafa;
bar = 0x87;
for(;;){

@ -3,9 +3,23 @@
#include "main.h"
uint16_t *spi_proto_globals8[] = {
&foo,
&foo,
&foo,
&foo,
&foo,
&foo,
&foo
};
uint8_t *spi_proto_globals16[] = {
&bar,
&bar,
&bar,
&bar,
&bar,
&bar,
&bar,
&bar,
&bar
};
funptr_t spi_proto_funcs[] = {

Loading…
Cancel
Save