This is an involuntary fork, created because the repository would not update mmSPI. SPI library used to communicate with an altera development board attached to four zigbee-header pins.
Dependents: Embedded_RTOS_Project
Fork of mmSPI by
Diff: mmSPI.cpp
- Revision:
- 20:2d5cd38047ca
- Parent:
- 19:c2b753533b93
- Child:
- 21:e90dd0f8aaa1
diff -r c2b753533b93 -r 2d5cd38047ca mmSPI.cpp --- a/mmSPI.cpp Mon Aug 19 23:05:29 2013 +0000 +++ b/mmSPI.cpp Mon Aug 19 23:14:36 2013 +0000 @@ -306,20 +306,18 @@ // R2 <- high-data. // R1 <- low-data. write_register(0x03,cAddress, pcReceive, pcSend); - read_register(0x03,pcReceive,pcSend); - - // write_register(0x04,cHData, pcReceive, pcSend); - // write_register(0x05,cLdata, pcReceive, pcSend); + write_register(0x02,cHData, pcReceive, pcSend); + write_register(0x01,cLdata, pcReceive, pcSend); -// pcSend[7] = 0x02; // write-enable high. -// pcSend[1] = 0x02; - // pcSend[0] = 0x00; - // transceive_vector2(pcReceive, pcSend, 8); + pcSend[7] = 0x00; // write-enable high. + pcSend[1] = 0x02; + pcSend[0] = 0x00; + transceive_vector2(pcReceive, pcSend, 8); -// pcSend[7] = 0x02; // write-enable low. -// pcSend[1] = 0x00; - // pcSend[0] = 0x00; - // transceive_vector2(pcReceive, pcSend, 8); + pcSend[7] = 0x00; // write-enable low. + pcSend[1] = 0x00; + pcSend[0] = 0x00; + transceive_vector2(pcReceive, pcSend, 8); // clear transmit vector. for (dLoop = 0; dLoop < 8; dLoop++) pcSend[dLoop] = 0x00; @@ -354,18 +352,18 @@ write_register(0x03,cAddress, pcReceive, pcSend); pcSend[7] = 0x02; // mbed sends command. - pcSend[1] = 0xD0; // R2 <- MM[R3] + pcSend[1] = 0xC8; // R2 <- MM[R3] pcSend[0] = 0x00; transceive_vector2(pcReceive, pcSend, 8); // send command. pcSend[7] = 0x02; // mbed sends command. - pcSend[1] = 0xD1; // R1 <- MM[R3] + pcSend[1] = 0xC4; // R1 <- MM[R3] pcSend[0] = 0x00; transceive_vector2(pcReceive, pcSend, 8); // send command. // obtain MM content. - cHData = read_register(0x04, pcReceive, pcSend); - cLData = read_register(0x05, pcReceive, pcSend); + cHData = read_register(0x02, pcReceive, pcSend); + cLData = read_register(0x01, pcReceive, pcSend); udMemoryContent = (cHData << 8) + cLData; // build the memory word.