Pradeep Kotipalli
/
frdm_gpio234
test
Fork of frdm_gpio by
Revision 1:d360ad53f8fd, committed 2014-12-22
- Comitter:
- pradeepvk2208
- Date:
- Mon Dec 22 07:04:43 2014 +0000
- Parent:
- 0:d5e352a3ea98
- Commit message:
- hi;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d5e352a3ea98 -r d360ad53f8fd main.cpp --- a/main.cpp Mon Dec 22 06:10:52 2014 +0000 +++ b/main.cpp Mon Dec 22 07:04:43 2014 +0000 @@ -2,6 +2,8 @@ SPI spi(PTD6, PTD7, PTD5); // mosi, miso, sclk DigitalOut cs(PTD2); +void spiwrite(int); + int main() { @@ -14,14 +16,16 @@ spi.frequency(1000000); // Send the commands to write to test the seconds register - cs = 0; + /*cs = 0; spi.write(0x80); // set write register to seconds - spi.write(0x00); // send value of one + spi.write(0x00); // send value of one*/ + spiwrite(0x80); cs=1; cs=0; spi.write(0x81); //write reg to minutes spi.write(0x00); + spiwrite(0x81); cs=1; cs=0; @@ -110,4 +114,12 @@ + } + + void spiwrite(int a) + { + cs=1; + cs=0; + spi.write(a); + spi.write(0x01); } \ No newline at end of file