labSPI
Dependencies: mbed
Fork of MCP4922_Sinewave by
main.cpp
- Committer:
- soulx
- Date:
- 2015-08-24
- Revision:
- 2:2244c8986987
- Parent:
- 1:09b69f38fc73
- Child:
- 3:863a9b7d417a
File content as of revision 2:2244c8986987:
#include "mbed.h" #include "MCP4922.h" MCP4922 MCP(SPI_MOSI, SPI_SCK,SPI_CS); // MOSI, SCLK, CS /**** Main Function ***/ int main(void) { MCP.frequency(20000000); uint16_t i=0; uint8_t state=0; while(1) { if(i < 0x0FFF) { i++; } else { i=0; state = ~state; } if(state ==0) { MCP.writeA(i); } else{ MCP.writeA( ((~i)+1)&0x0FFF); } wait_us(20); } }