Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spi lib: working master transfer function
- Loading branch information
1 parent
38b5f31
commit a27fbbf
Showing
5 changed files
with
123 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* spi.h | ||
*/ | ||
|
||
#ifndef SPI_H_ | ||
#define SPI_H_ | ||
|
||
#define POLARITY_IDLE_LOW 0 | ||
#define POLARITY_IDLE_HIGH 1 | ||
|
||
#define PHASE_EDGE_LEADING 0 | ||
#define PHASE_EDGE_TRAILING 1 | ||
|
||
#define BIT_ORDER_MSB_FIRST 0 | ||
#define BIT_ORDER_LSB_FIRST 1 | ||
|
||
|
||
#endif /* SPI_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* spi0_master.h | ||
*/ | ||
|
||
#ifndef SPI0_MASTER_H_ | ||
#define SPI0_MASTER_H_ | ||
|
||
#include <spi.h> | ||
|
||
void spi0MasterInit(void); | ||
void spi0MasterSetFrequency(uint32 freq); | ||
void spi0MasterSetClockPolarity(BIT polarity); | ||
void spi0MasterSetClockPhase(BIT phase); | ||
void spi0MasterSetBitOrder(BIT bitOrder); | ||
uint16 spi0MasterBytesLeft(void); | ||
void spi0MasterTransfer(const uint8 XDATA * txBuffer, const uint8 XDATA * rxBuffer, uint16 size); | ||
|
||
ISR(URX0, 1); | ||
|
||
#endif /* SPI0_MASTER_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* spi1_master.h | ||
*/ | ||
|
||
#ifndef SPI1_MASTER_H_ | ||
#define SPI1_MASTER_H_ | ||
|
||
#include <spi.h> | ||
|
||
void spi1MasterInit(void); | ||
void spi1MasterSetFrequency(uint32 freq); | ||
void spi1MasterSetClockPolarity(BIT polarity); | ||
void spi1MasterSetClockPhase(BIT phase); | ||
void spi1MasterSetBitOrder(BIT bitOrder); | ||
uint16 spi1MasterBytesLeft(void); | ||
void spi1MasterTransfer(const uint8 XDATA * txBuffer, const uint8 XDATA * rxBuffer, uint16 size); | ||
|
||
ISR(URX0, 1); | ||
|
||
#endif /* SPI1_MASTER_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters