elixys periphreal system firmware library
Dependencies: MAX31855 MCP23S18 MCP3202 MCP3208 MCP482x ShiftRegister1
Fork of elixys by
chipselectarray.cpp@1:b0f7c49b67f8, 2013-12-15 (annotated)
- Committer:
- henryeherman
- Date:
- Sun Dec 15 02:43:07 2013 +0000
- Revision:
- 1:b0f7c49b67f8
Working elixys interface library with unit tests
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
henryeherman | 1:b0f7c49b67f8 | 1 | #include "chipselectarray.h" |
henryeherman | 1:b0f7c49b67f8 | 2 | |
henryeherman | 1:b0f7c49b67f8 | 3 | DigitalOut cssck(P1_20); |
henryeherman | 1:b0f7c49b67f8 | 4 | DigitalOut csdat(P1_24); |
henryeherman | 1:b0f7c49b67f8 | 5 | DigitalOut cslatch(P1_21); |
henryeherman | 1:b0f7c49b67f8 | 6 | DigitalOut csclr(P1_22); |
henryeherman | 1:b0f7c49b67f8 | 7 | DigitalOut csoe(P1_25); |
henryeherman | 1:b0f7c49b67f8 | 8 | ShiftRegister shiftreg(cssck, csdat, cslatch, csclr, csoe); |
henryeherman | 1:b0f7c49b67f8 | 9 | |
henryeherman | 1:b0f7c49b67f8 | 10 | void unselect() { |
henryeherman | 1:b0f7c49b67f8 | 11 | shiftreg.write((unsigned int)NONECS, 32); |
henryeherman | 1:b0f7c49b67f8 | 12 | } |
henryeherman | 1:b0f7c49b67f8 | 13 | |
henryeherman | 1:b0f7c49b67f8 | 14 | void selectvalve0(void) { |
henryeherman | 1:b0f7c49b67f8 | 15 | shiftreg.write((unsigned int)VALVCS0, 32); |
henryeherman | 1:b0f7c49b67f8 | 16 | } |
henryeherman | 1:b0f7c49b67f8 | 17 | |
henryeherman | 1:b0f7c49b67f8 | 18 | void selectvalve1(void) { |
henryeherman | 1:b0f7c49b67f8 | 19 | shiftreg.write((unsigned int)VALVCS1, 32); |
henryeherman | 1:b0f7c49b67f8 | 20 | } |
henryeherman | 1:b0f7c49b67f8 | 21 | |
henryeherman | 1:b0f7c49b67f8 | 22 | void selectvalve2(void) { |
henryeherman | 1:b0f7c49b67f8 | 23 | shiftreg.write((unsigned int)VALVCS2, 32); |
henryeherman | 1:b0f7c49b67f8 | 24 | } |
henryeherman | 1:b0f7c49b67f8 | 25 | |
henryeherman | 1:b0f7c49b67f8 | 26 | void selecttc0() { |
henryeherman | 1:b0f7c49b67f8 | 27 | shiftreg.write((unsigned int)THERMCOUPLECS0, 32); |
henryeherman | 1:b0f7c49b67f8 | 28 | } |
henryeherman | 1:b0f7c49b67f8 | 29 | |
henryeherman | 1:b0f7c49b67f8 | 30 | void selecttc1() { |
henryeherman | 1:b0f7c49b67f8 | 31 | shiftreg.write((unsigned int)THERMCOUPLECS1, 32); |
henryeherman | 1:b0f7c49b67f8 | 32 | } |
henryeherman | 1:b0f7c49b67f8 | 33 | |
henryeherman | 1:b0f7c49b67f8 | 34 | void selecttc2() { |
henryeherman | 1:b0f7c49b67f8 | 35 | shiftreg.write((unsigned int)THERMCOUPLECS2, 32); |
henryeherman | 1:b0f7c49b67f8 | 36 | } |
henryeherman | 1:b0f7c49b67f8 | 37 | |
henryeherman | 1:b0f7c49b67f8 | 38 | void selecttc3(void) { |
henryeherman | 1:b0f7c49b67f8 | 39 | shiftreg.write((unsigned int)THERMCOUPLECS3, 32); |
henryeherman | 1:b0f7c49b67f8 | 40 | } |
henryeherman | 1:b0f7c49b67f8 | 41 | |
henryeherman | 1:b0f7c49b67f8 | 42 | void selecttc4() { |
henryeherman | 1:b0f7c49b67f8 | 43 | shiftreg.write((unsigned int)THERMCOUPLECS4, 32); |
henryeherman | 1:b0f7c49b67f8 | 44 | } |
henryeherman | 1:b0f7c49b67f8 | 45 | |
henryeherman | 1:b0f7c49b67f8 | 46 | void selecttc5() { |
henryeherman | 1:b0f7c49b67f8 | 47 | shiftreg.write((unsigned int)THERMCOUPLECS5, 32); |
henryeherman | 1:b0f7c49b67f8 | 48 | } |
henryeherman | 1:b0f7c49b67f8 | 49 | |
henryeherman | 1:b0f7c49b67f8 | 50 | void selecttc6() { |
henryeherman | 1:b0f7c49b67f8 | 51 | shiftreg.write((unsigned int)THERMCOUPLECS6, 32); |
henryeherman | 1:b0f7c49b67f8 | 52 | } |
henryeherman | 1:b0f7c49b67f8 | 53 | |
henryeherman | 1:b0f7c49b67f8 | 54 | void selecttc7() { |
henryeherman | 1:b0f7c49b67f8 | 55 | shiftreg.write((unsigned int)THERMCOUPLECS7, 32); |
henryeherman | 1:b0f7c49b67f8 | 56 | } |
henryeherman | 1:b0f7c49b67f8 | 57 | |
henryeherman | 1:b0f7c49b67f8 | 58 | void selecttc8() { |
henryeherman | 1:b0f7c49b67f8 | 59 | shiftreg.write((unsigned int)THERMCOUPLECS8, 32); |
henryeherman | 1:b0f7c49b67f8 | 60 | } |
henryeherman | 1:b0f7c49b67f8 | 61 | |
henryeherman | 1:b0f7c49b67f8 | 62 | void selectheater(void) { |
henryeherman | 1:b0f7c49b67f8 | 63 | shiftreg.write((unsigned int)HEATERCS, 32); |
henryeherman | 1:b0f7c49b67f8 | 64 | } |
henryeherman | 1:b0f7c49b67f8 | 65 | |
henryeherman | 1:b0f7c49b67f8 | 66 | void selectliq(void) { |
henryeherman | 1:b0f7c49b67f8 | 67 | shiftreg.write((unsigned int)LIQUIDSENSORCS, 32); |
henryeherman | 1:b0f7c49b67f8 | 68 | } |
henryeherman | 1:b0f7c49b67f8 | 69 | |
henryeherman | 1:b0f7c49b67f8 | 70 | void selectpos(void) { |
henryeherman | 1:b0f7c49b67f8 | 71 | shiftreg.write((unsigned int)POSITIONSENSORCS, 32); |
henryeherman | 1:b0f7c49b67f8 | 72 | } |
henryeherman | 1:b0f7c49b67f8 | 73 | |
henryeherman | 1:b0f7c49b67f8 | 74 | void selectsmcadc(void) { |
henryeherman | 1:b0f7c49b67f8 | 75 | shiftreg.write((unsigned int)SMCADCCS, 32); |
henryeherman | 1:b0f7c49b67f8 | 76 | } |
henryeherman | 1:b0f7c49b67f8 | 77 | |
henryeherman | 1:b0f7c49b67f8 | 78 | void selectsmcdac(void) { |
henryeherman | 1:b0f7c49b67f8 | 79 | shiftreg.write((unsigned int)SMCDACCS, 32); |
henryeherman | 1:b0f7c49b67f8 | 80 | } |
henryeherman | 1:b0f7c49b67f8 | 81 | |
henryeherman | 1:b0f7c49b67f8 | 82 | void selectrad0(void) { |
henryeherman | 1:b0f7c49b67f8 | 83 | shiftreg.write((unsigned int)RADCS0, 32); |
henryeherman | 1:b0f7c49b67f8 | 84 | } |
henryeherman | 1:b0f7c49b67f8 | 85 | |
henryeherman | 1:b0f7c49b67f8 | 86 | void selectrad1(void) { |
henryeherman | 1:b0f7c49b67f8 | 87 | shiftreg.write((unsigned int)RADCS1, 32); |
henryeherman | 1:b0f7c49b67f8 | 88 | } |
henryeherman | 1:b0f7c49b67f8 | 89 | |
henryeherman | 1:b0f7c49b67f8 | 90 | void selectrad2(void) { |
henryeherman | 1:b0f7c49b67f8 | 91 | shiftreg.write((unsigned int)RADCS2, 32); |
henryeherman | 1:b0f7c49b67f8 | 92 | } |
henryeherman | 1:b0f7c49b67f8 | 93 | |
henryeherman | 1:b0f7c49b67f8 | 94 | void selectrad3(void) { |
henryeherman | 1:b0f7c49b67f8 | 95 | shiftreg.write((unsigned int)RADCS3, 32); |
henryeherman | 1:b0f7c49b67f8 | 96 | } |
henryeherman | 1:b0f7c49b67f8 | 97 | |
henryeherman | 1:b0f7c49b67f8 | 98 | void selectrad4(void) { |
henryeherman | 1:b0f7c49b67f8 | 99 | shiftreg.write((unsigned int)RADCS4, 32); |
henryeherman | 1:b0f7c49b67f8 | 100 | } |
henryeherman | 1:b0f7c49b67f8 | 101 | |
henryeherman | 1:b0f7c49b67f8 | 102 | void selectrad5(void) { |
henryeherman | 1:b0f7c49b67f8 | 103 | shiftreg.write((unsigned int)RADCS5, 32); |
henryeherman | 1:b0f7c49b67f8 | 104 | } |
henryeherman | 1:b0f7c49b67f8 | 105 | |
henryeherman | 1:b0f7c49b67f8 | 106 | void selectrad6(void) { |
henryeherman | 1:b0f7c49b67f8 | 107 | shiftreg.write((unsigned int)RADCS6, 32); |
henryeherman | 1:b0f7c49b67f8 | 108 | } |
henryeherman | 1:b0f7c49b67f8 | 109 | |
henryeherman | 1:b0f7c49b67f8 | 110 | void selectaux0(void) { |
henryeherman | 1:b0f7c49b67f8 | 111 | shiftreg.write((unsigned int)AUXCS0, 32); |
henryeherman | 1:b0f7c49b67f8 | 112 | } |
henryeherman | 1:b0f7c49b67f8 | 113 | |
henryeherman | 1:b0f7c49b67f8 | 114 | void selectaux1(void) { |
henryeherman | 1:b0f7c49b67f8 | 115 | shiftreg.write((unsigned int)AUXCS1, 32); |
henryeherman | 1:b0f7c49b67f8 | 116 | } |
henryeherman | 1:b0f7c49b67f8 | 117 | |
henryeherman | 1:b0f7c49b67f8 | 118 | void selectaux2(void) { |
henryeherman | 1:b0f7c49b67f8 | 119 | shiftreg.write((unsigned int)AUXCS2, 32); |
henryeherman | 1:b0f7c49b67f8 | 120 | } |
henryeherman | 1:b0f7c49b67f8 | 121 | |
henryeherman | 1:b0f7c49b67f8 | 122 | void selectaux3(void) { |
henryeherman | 1:b0f7c49b67f8 | 123 | shiftreg.write((unsigned int)AUXCS3, 32); |
henryeherman | 1:b0f7c49b67f8 | 124 | } |
henryeherman | 1:b0f7c49b67f8 | 125 | |
henryeherman | 1:b0f7c49b67f8 | 126 | void selectaux4(void) { |
henryeherman | 1:b0f7c49b67f8 | 127 | shiftreg.write((unsigned int)AUXCS4, 32); |
henryeherman | 1:b0f7c49b67f8 | 128 | } |
henryeherman | 1:b0f7c49b67f8 | 129 | |
henryeherman | 1:b0f7c49b67f8 | 130 | void selectaux5(void) { |
henryeherman | 1:b0f7c49b67f8 | 131 | shiftreg.write((unsigned int)AUXCS5, 32); |
henryeherman | 1:b0f7c49b67f8 | 132 | } |
henryeherman | 1:b0f7c49b67f8 | 133 | |
henryeherman | 1:b0f7c49b67f8 | 134 | void selectaux6(void) { |
henryeherman | 1:b0f7c49b67f8 | 135 | shiftreg.write((unsigned int)AUXCS6, 32); |
henryeherman | 1:b0f7c49b67f8 | 136 | } |
henryeherman | 1:b0f7c49b67f8 | 137 | |
henryeherman | 1:b0f7c49b67f8 | 138 | void selectaux7(void){ |
henryeherman | 1:b0f7c49b67f8 | 139 | shiftreg.write((unsigned int)AUXCS7, 32); |
henryeherman | 1:b0f7c49b67f8 | 140 | } |