SPI library used to communicate with an altera development board attached to four zigbee-header pins.
mmSPI.cpp@2:bebcf53b72dc, 2013-08-14 (annotated)
- Committer:
- gatedClock
- Date:
- Wed Aug 14 10:30:30 2013 +0000
- Revision:
- 2:bebcf53b72dc
- Parent:
- 1:15706d15d123
- Child:
- 3:de99451ab3c0
toward defining DigitalOut objects within a class. it doesn't look to be working with straight instantiation, so use allocation instead.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gatedClock | 0:fb42c5acf810 | 1 | /*----------------------------------------------//------------------------------ |
gatedClock | 0:fb42c5acf810 | 2 | student : m-moore |
gatedClock | 0:fb42c5acf810 | 3 | class : external SPI interface |
gatedClock | 0:fb42c5acf810 | 4 | directory : mmSPI |
gatedClock | 0:fb42c5acf810 | 5 | file : mmSPI.cpp |
gatedClock | 0:fb42c5acf810 | 6 | ------------------------------------------------//----------------------------*/ |
gatedClock | 0:fb42c5acf810 | 7 | #include "mmSPI.h" |
gatedClock | 0:fb42c5acf810 | 8 | /*----------------------------------------------//------------------------------ |
gatedClock | 0:fb42c5acf810 | 9 | ------------------------------------------------//----------------------------*/ |
gatedClock | 0:fb42c5acf810 | 10 | //==============================================//============================== |
gatedClock | 0:fb42c5acf810 | 11 | mmSPI::mmSPI() // constructor. |
gatedClock | 0:fb42c5acf810 | 12 | { |
gatedClock | 2:bebcf53b72dc | 13 | pSCLK = new DigitalOut(p29); |
gatedClock | 0:fb42c5acf810 | 14 | } |
gatedClock | 0:fb42c5acf810 | 15 | //----------------------------------------------//------------------------------ |
gatedClock | 0:fb42c5acf810 | 16 | mmSPI::~mmSPI() // destructor. |
gatedClock | 0:fb42c5acf810 | 17 | { |
gatedClock | 0:fb42c5acf810 | 18 | |
gatedClock | 0:fb42c5acf810 | 19 | } |
gatedClock | 0:fb42c5acf810 | 20 | //----------------------------------------------//------------------------------ |
gatedClock | 1:15706d15d123 | 21 | char mmSPI::transceive_byte(char cSend) // send/receive a byte. |
gatedClock | 1:15706d15d123 | 22 | { |
gatedClock | 2:bebcf53b72dc | 23 | *pSCLK = 1; |
gatedClock | 1:15706d15d123 | 24 | |
gatedClock | 1:15706d15d123 | 25 | |
gatedClock | 1:15706d15d123 | 26 | |
gatedClock | 1:15706d15d123 | 27 | } |
gatedClock | 1:15706d15d123 | 28 | //----------------------------------------------//------------------------------ |