![](/media/cache/profiles/c8ecfaea0b7e3aa83b017a786d53b9e8.50x50_q85.jpg)
White Wizard micro SD Card module test program.You can use White Wizard SPI system easily! Details : http://wizard.nestegg.jp/sd.html
wwChipSelect.cpp@0:b8ab9a03a28d, 2011-07-06 (annotated)
- Committer:
- halfpitch
- Date:
- Wed Jul 06 16:22:44 2011 +0000
- Revision:
- 0:b8ab9a03a28d
- Child:
- 1:731d34c1b57d
Rev.A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halfpitch | 0:b8ab9a03a28d | 1 | //Nest Egg Inc. |
halfpitch | 0:b8ab9a03a28d | 2 | //http://nestegg.jp/ |
halfpitch | 0:b8ab9a03a28d | 3 | //White Wizard Board SPI Chip Select Code |
halfpitch | 0:b8ab9a03a28d | 4 | //Auther : Yoshinari kou |
halfpitch | 0:b8ab9a03a28d | 5 | //2010/10/03 |
halfpitch | 0:b8ab9a03a28d | 6 | |
halfpitch | 0:b8ab9a03a28d | 7 | #include "wwChipSelect.h" |
halfpitch | 0:b8ab9a03a28d | 8 | |
halfpitch | 0:b8ab9a03a28d | 9 | wwChipSelect :: wwChipSelect(PinName cs): |
halfpitch | 0:b8ab9a03a28d | 10 | ChipSelect(cs){ |
halfpitch | 0:b8ab9a03a28d | 11 | } |
halfpitch | 0:b8ab9a03a28d | 12 | |
halfpitch | 0:b8ab9a03a28d | 13 | void wwChipSelect :: wwCSwrite(int ch){ |
halfpitch | 0:b8ab9a03a28d | 14 | //start |
halfpitch | 0:b8ab9a03a28d | 15 | ChipSelect.write(1); |
halfpitch | 0:b8ab9a03a28d | 16 | wait_us(20); |
halfpitch | 0:b8ab9a03a28d | 17 | |
halfpitch | 0:b8ab9a03a28d | 18 | ChipSelect.write(0); |
halfpitch | 0:b8ab9a03a28d | 19 | |
halfpitch | 0:b8ab9a03a28d | 20 | wait_us(26);//26 |
halfpitch | 0:b8ab9a03a28d | 21 | |
halfpitch | 0:b8ab9a03a28d | 22 | //A1 |
halfpitch | 0:b8ab9a03a28d | 23 | ChipSelect.write(0x01 & ch); |
halfpitch | 0:b8ab9a03a28d | 24 | wait_us(20);//46 |
halfpitch | 0:b8ab9a03a28d | 25 | |
halfpitch | 0:b8ab9a03a28d | 26 | //A2 |
halfpitch | 0:b8ab9a03a28d | 27 | ChipSelect.write((0x02 & ch)>>1); |
halfpitch | 0:b8ab9a03a28d | 28 | wait_us(20);//66 |
halfpitch | 0:b8ab9a03a28d | 29 | |
halfpitch | 0:b8ab9a03a28d | 30 | //A3 |
halfpitch | 0:b8ab9a03a28d | 31 | ChipSelect.write((0x04 & ch)>>2); |
halfpitch | 0:b8ab9a03a28d | 32 | wait_us(20);//86 |
halfpitch | 0:b8ab9a03a28d | 33 | |
halfpitch | 0:b8ab9a03a28d | 34 | //A4 |
halfpitch | 0:b8ab9a03a28d | 35 | ChipSelect.write((0x08 & ch)>>3); |
halfpitch | 0:b8ab9a03a28d | 36 | wait_us(20);//106 |
halfpitch | 0:b8ab9a03a28d | 37 | |
halfpitch | 0:b8ab9a03a28d | 38 | ChipSelect.write(1); |
halfpitch | 0:b8ab9a03a28d | 39 | |
halfpitch | 0:b8ab9a03a28d | 40 | } |
halfpitch | 0:b8ab9a03a28d | 41 |