Fix compilation errors
Fixed an invalid bit read and added a missing semicolon.
This commit is contained in:
parent
12f1ce3e78
commit
660dd4e8de
1 changed files with 62 additions and 61 deletions
5
main.c
5
main.c
|
@ -90,12 +90,13 @@ uint8_t SendReceiveSPIData(uint8_t value)
|
||||||
// prob change the 8 below to len of value?
|
// prob change the 8 below to len of value?
|
||||||
for(i=0;i<8;i++)
|
for(i=0;i<8;i++)
|
||||||
{
|
{
|
||||||
USIDR=value[i]; // write data bytes in Data register, will cause them to get sent on clock
|
///USIDR = value[i]; // wrong way to do it apparently, still saving for future reference
|
||||||
|
USIDR = (value >> i) & 0x01; // write data bytes in Data register, will cause them to get sent on clock
|
||||||
while(USIOIF==0) // check USI data counter overflow flag to detect the end of transmission every byte
|
while(USIOIF==0) // check USI data counter overflow flag to detect the end of transmission every byte
|
||||||
{
|
{
|
||||||
USICR|=(1<<USICLK)|(1<<USITC); // enable clock for transmission and generate clock for slave deivce
|
USICR|=(1<<USICLK)|(1<<USITC); // enable clock for transmission and generate clock for slave deivce
|
||||||
}
|
}
|
||||||
USISR|=(1<<USIOIF) // clear USI data counter overflow flag
|
USISR|=(1<<USIOIF); // clear USI data counter overflow flag
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read in a 16 bit frame
|
// Read in a 16 bit frame
|
||||||
|
|
Loading…
Reference in a new issue