Files
super6502/sw/tests/test_main.c
Byron Lathi aca739338a Remove spi_word and replace with spi_deselect
Since the goal is to have the MAX3421E working, which uses multiple 8
bit transfers, we should support multiple 8 bit transfers instead of
trying to use 16 bit transfers.

When using spi_byte(), the device is automatically selected. After you
have made as many transfers as you want, you must deselect the device
with spi_deselect().
2022-03-10 14:43:49 -06:00

29 lines
597 B
C

#include <stdio.h>
#include <stdint.h>
#include <spi.h>
uint16_t retval;
int main(void)
{
printf("Setting SPI location to 0x02\n");
*(uint8_t*)0x7ff0 = 2;
if (!(*(uint8_t*)0x7ff0 == 2)) {
printf("Expected 0x02 at 0x7ff0\n");
return 1;
}
printf("Done!\n\n");
printf("Starting spi_byte test...\n");
retval = spi_byte(0xa5);
if (retval != 0) {
printf("Expected 0 return value from spi_byte\n");
return 1;
}
printf("Done! %x\n\n", retval);
printf("Starting spi_deselect test...\n");
spi_deselect();
return 0;
}