yoshinari kou
/
TEST_WW_SPI_CS
White Wizard SPI Chip Select test program. I changed chip select signal timing.
wwChipSelect.cpp@1:048ae028f72d, 2011-07-25 (annotated)
- Committer:
- halfpitch
- Date:
- Mon Jul 25 10:01:36 2011 +0000
- Revision:
- 1:048ae028f72d
- Parent:
- 0:1d2148b42390
- Child:
- 2:5312f16c3ee8
Rev.A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halfpitch | 1:048ae028f72d | 1 | //Nest Egg Inc. |
halfpitch | 1:048ae028f72d | 2 | //http://wizard.nestegg.jp/ |
halfpitch | 1:048ae028f72d | 3 | //White Wizard Board SPI Chip Select Code |
halfpitch | 1:048ae028f72d | 4 | //Auther : Yoshinari kou |
halfpitch | 1:048ae028f72d | 5 | //2010/10/03 |
halfpitch | 1:048ae028f72d | 6 | |
halfpitch | 1:048ae028f72d | 7 | #include "wwChipSelect.h" |
halfpitch | 1:048ae028f72d | 8 | |
halfpitch | 1:048ae028f72d | 9 | wwChipSelect :: wwChipSelect(PinName cs): |
halfpitch | 1:048ae028f72d | 10 | ChipSelect(cs){ |
halfpitch | 1:048ae028f72d | 11 | } |
halfpitch | 1:048ae028f72d | 12 | |
halfpitch | 1:048ae028f72d | 13 | void wwChipSelect :: wwCSwrite(int ch){ |
halfpitch | 1:048ae028f72d | 14 | //start |
halfpitch | 1:048ae028f72d | 15 | ChipSelect.write(1); |
halfpitch | 1:048ae028f72d | 16 | wait_us(20); |
halfpitch | 1:048ae028f72d | 17 | |
halfpitch | 1:048ae028f72d | 18 | ChipSelect.write(0); |
halfpitch | 1:048ae028f72d | 19 | |
halfpitch | 1:048ae028f72d | 20 | wait_us(26);//26 |
halfpitch | 1:048ae028f72d | 21 | |
halfpitch | 1:048ae028f72d | 22 | //A1 |
halfpitch | 1:048ae028f72d | 23 | ChipSelect.write(0x01 & ch); |
halfpitch | 1:048ae028f72d | 24 | wait_us(20);//46 |
halfpitch | 1:048ae028f72d | 25 | |
halfpitch | 1:048ae028f72d | 26 | //A2 |
halfpitch | 1:048ae028f72d | 27 | ChipSelect.write((0x02 & ch)>>1); |
halfpitch | 1:048ae028f72d | 28 | wait_us(20);//66 |
halfpitch | 1:048ae028f72d | 29 | |
halfpitch | 1:048ae028f72d | 30 | //A3 |
halfpitch | 1:048ae028f72d | 31 | ChipSelect.write((0x04 & ch)>>2); |
halfpitch | 1:048ae028f72d | 32 | wait_us(20);//86 |
halfpitch | 1:048ae028f72d | 33 | |
halfpitch | 1:048ae028f72d | 34 | //A4 |
halfpitch | 1:048ae028f72d | 35 | ChipSelect.write((0x08 & ch)>>3); |
halfpitch | 1:048ae028f72d | 36 | wait_us(20);//106 |
halfpitch | 1:048ae028f72d | 37 | |
halfpitch | 1:048ae028f72d | 38 | ChipSelect.write(1); |
halfpitch | 1:048ae028f72d | 39 | |
halfpitch | 1:048ae028f72d | 40 | } |
halfpitch | 1:048ae028f72d | 41 | |
halfpitch | 1:048ae028f72d | 42 |