Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void spiSoftWrite( uint8_t byte )
- {
- uint8_t n = 0;
- for (n = 0 ; n < 8 ; n++)
- {
- PORT(SPI_SOFT_SCK_DDR) &= ~(1<<SPI_SOFT_SCK_BP); // SCK = 0
- if (byte & 0x80)
- {
- PORT(SPI_SOFT_SDA_DDR) |= (1<<SPI_SOFT_SDA_BP); // SD = 1
- }
- else
- {
- PORT(SPI_SOFT_SDA_DDR) &= ~(1<<SPI_SOFT_SDA_BP); // SD = 0
- }
- byte <<= 1;
- PORT(SPI_SOFT_SCK_DDR) |= (1<<SPI_SOFT_SCK_BP); // SCK = 1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement