-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
B414
authored and
B414
committed
Nov 15, 2017
1 parent
a7cd7a3
commit 14852b6
Showing
6 changed files
with
65 additions
and
23 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
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,6 @@ | ||
#include "serial.h" | ||
|
||
SERIAL::SERIAL() | ||
{ | ||
|
||
} |
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,12 @@ | ||
#ifndef SERIAL_H | ||
#define SERIAL_H | ||
#include<bcm2835.h> | ||
|
||
class SERIAL | ||
{ | ||
public: | ||
SERIAL(); | ||
virtual uint8_t transfer(uint8_t data)=0; | ||
}; | ||
|
||
#endif // SERIAL_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,14 @@ | ||
#include "spi.h" | ||
#include "bcm2835.h" | ||
SPI::SPI(int bitorder,int datamode, int clockdivider, int chipselect, int chipselectpolarity) | ||
{ | ||
bcm2835_spi_setBitOrder(bitorder); // The default | ||
bcm2835_spi_setDataMode(datamode); // The default | ||
bcm2835_spi_setClockDivider(clockdivider); // The default | ||
bcm2835_spi_chipSelect(chipselect); // The default | ||
bcm2835_spi_setChipSelectPolarity(chipselect,chipselectpolarity); | ||
} | ||
|
||
uint8_t SPI::transfer(uint8_t data){ | ||
return bcm2835_spi_transfer(data); | ||
} |
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,12 @@ | ||
#ifndef SPI_H | ||
#define SPI_H | ||
#include"serial.h" | ||
|
||
class SPI: public SERIAL | ||
{ | ||
public: | ||
SPI(int bitorder,int datamode, int clockdivider, int chipselect, int chipselectpolarity); | ||
uint8_t transfer(uint8_t data); | ||
}; | ||
|
||
#endif // SPI_H |