![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Classes et code de la partie pompe du Robot 2021
Dependencies: mbed ident_crac
bloc_8_pompe.cpp@9:6869e3869638, 2021-07-17 (annotated)
- Committer:
- goldmas
- Date:
- Sat Jul 17 11:09:18 2021 +0000
- Revision:
- 9:6869e3869638
- Parent:
- 4:4bae30d48662
Dernier code de la coupe de fracne 2021
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
goldmas | 0:253443d82cba | 1 | #include "bloc_8_pompe.h" |
goldmas | 0:253443d82cba | 2 | |
goldmas | 0:253443d82cba | 3 | bloc_monopompe bloc1(PC_9, PA_8, PB_0) ; |
goldmas | 9:6869e3869638 | 4 | bloc_monopompe bloc2(PB_7, PA_10, PB_1) ; |
goldmas | 0:253443d82cba | 5 | bloc_monopompe bloc3(PA_11, PA_15, PC_1) ; |
goldmas | 9:6869e3869638 | 6 | bloc_monopompe bloc4(PA_9, PB_6, PC_0) ; |
goldmas | 0:253443d82cba | 7 | bloc_monopompe bloc5(PC_7, PC_8, PC_5) ; |
goldmas | 0:253443d82cba | 8 | bloc_monopompe bloc6(PB_10, PB_2, PC_4) ; |
goldmas | 0:253443d82cba | 9 | bloc_monopompe bloc7(PA_6, PA_5, PA_7) ; |
goldmas | 0:253443d82cba | 10 | bloc_monopompe bloc8(PA_0, PA_1, PA_4) ; |
goldmas | 0:253443d82cba | 11 | |
goldmas | 0:253443d82cba | 12 | |
goldmas | 0:253443d82cba | 13 | bloc_8_pompe::bloc_8_pompe (PinName pompe1, PinName electrovanne1, PinName capteur1, |
goldmas | 0:253443d82cba | 14 | PinName pompe2, PinName electrovanne2, PinName capteur2, |
goldmas | 0:253443d82cba | 15 | PinName pompe3, PinName electrovanne3, PinName capteur3, |
goldmas | 0:253443d82cba | 16 | PinName pompe4, PinName electrovanne4, PinName capteur4, |
goldmas | 0:253443d82cba | 17 | PinName pompe5, PinName electrovanne5, PinName capteur5, |
goldmas | 0:253443d82cba | 18 | PinName pompe6, PinName electrovanne6, PinName capteur6, |
goldmas | 0:253443d82cba | 19 | PinName pompe7, PinName electrovanne7, PinName capteur7, |
goldmas | 0:253443d82cba | 20 | PinName pompe8, PinName electrovanne8, PinName capteur8) |
goldmas | 0:253443d82cba | 21 | : _pompe1 (pompe1), _electrovanne1 (electrovanne1), _capteur1 (capteur1), |
goldmas | 0:253443d82cba | 22 | _pompe2 (pompe2), _electrovanne2 (electrovanne2), _capteur2 (capteur2), |
goldmas | 0:253443d82cba | 23 | _pompe3 (pompe3), _electrovanne3 (electrovanne3), _capteur3 (capteur3), |
goldmas | 0:253443d82cba | 24 | _pompe4 (pompe4), _electrovanne4 (electrovanne4), _capteur4 (capteur4), |
goldmas | 0:253443d82cba | 25 | _pompe5 (pompe5), _electrovanne5 (electrovanne5), _capteur5 (capteur5), |
goldmas | 0:253443d82cba | 26 | _pompe6 (pompe6), _electrovanne6 (electrovanne6), _capteur6 (capteur6), |
goldmas | 0:253443d82cba | 27 | _pompe7 (pompe7), _electrovanne7 (electrovanne7), _capteur7 (capteur7), |
goldmas | 0:253443d82cba | 28 | _pompe8 (pompe8), _electrovanne8 (electrovanne8), _capteur8 (capteur8) |
goldmas | 0:253443d82cba | 29 | { |
goldmas | 0:253443d82cba | 30 | _pompe1.period_us(20) ; |
goldmas | 0:253443d82cba | 31 | _pompe2.period_us(20) ; |
goldmas | 0:253443d82cba | 32 | _pompe3.period_us(20) ; |
goldmas | 0:253443d82cba | 33 | _pompe4.period_us(20) ; |
goldmas | 0:253443d82cba | 34 | _pompe5.period_us(20) ; |
goldmas | 0:253443d82cba | 35 | _pompe6.period_us(20) ; |
goldmas | 0:253443d82cba | 36 | _pompe7.period_us(20) ; |
goldmas | 0:253443d82cba | 37 | _pompe8.period_us(20) ; |
goldmas | 0:253443d82cba | 38 | } |
goldmas | 0:253443d82cba | 39 | |
goldmas | 4:4bae30d48662 | 40 | void bloc_8_pompe::aspirer (int groupe = 1) |
goldmas | 0:253443d82cba | 41 | { |
goldmas | 0:253443d82cba | 42 | switch (groupe) |
goldmas | 0:253443d82cba | 43 | { |
goldmas | 0:253443d82cba | 44 | case 1 : |
goldmas | 4:4bae30d48662 | 45 | bloc1.aspirer() ; |
goldmas | 0:253443d82cba | 46 | break; |
goldmas | 0:253443d82cba | 47 | |
goldmas | 0:253443d82cba | 48 | case 2 : |
goldmas | 4:4bae30d48662 | 49 | bloc2.aspirer() ; |
goldmas | 0:253443d82cba | 50 | break; |
goldmas | 0:253443d82cba | 51 | |
goldmas | 0:253443d82cba | 52 | case 3 : |
goldmas | 4:4bae30d48662 | 53 | bloc3.aspirer() ; |
goldmas | 0:253443d82cba | 54 | break; |
goldmas | 0:253443d82cba | 55 | |
goldmas | 0:253443d82cba | 56 | case 4 : |
goldmas | 4:4bae30d48662 | 57 | bloc4.aspirer() ; |
goldmas | 0:253443d82cba | 58 | break; |
goldmas | 0:253443d82cba | 59 | |
goldmas | 0:253443d82cba | 60 | case 5 : |
goldmas | 4:4bae30d48662 | 61 | bloc5.aspirer() ; |
goldmas | 0:253443d82cba | 62 | break; |
goldmas | 0:253443d82cba | 63 | |
goldmas | 0:253443d82cba | 64 | case 6 : |
goldmas | 4:4bae30d48662 | 65 | bloc6.aspirer() ; |
goldmas | 0:253443d82cba | 66 | break; |
goldmas | 0:253443d82cba | 67 | |
goldmas | 0:253443d82cba | 68 | case 7 : |
goldmas | 4:4bae30d48662 | 69 | bloc7.aspirer() ; |
goldmas | 0:253443d82cba | 70 | break; |
goldmas | 0:253443d82cba | 71 | |
goldmas | 0:253443d82cba | 72 | case 8 : |
goldmas | 4:4bae30d48662 | 73 | bloc8.aspirer() ; |
goldmas | 0:253443d82cba | 74 | break; |
goldmas | 0:253443d82cba | 75 | } |
goldmas | 0:253443d82cba | 76 | } |
goldmas | 0:253443d82cba | 77 | |
goldmas | 4:4bae30d48662 | 78 | void bloc_8_pompe::relacher (int groupe = 1) |
goldmas | 0:253443d82cba | 79 | { |
goldmas | 0:253443d82cba | 80 | switch (groupe) |
goldmas | 0:253443d82cba | 81 | { |
goldmas | 0:253443d82cba | 82 | case 1 : |
goldmas | 4:4bae30d48662 | 83 | bloc1.relacher() ; |
goldmas | 0:253443d82cba | 84 | break; |
goldmas | 0:253443d82cba | 85 | |
goldmas | 0:253443d82cba | 86 | case 2 : |
goldmas | 4:4bae30d48662 | 87 | bloc2.relacher() ; |
goldmas | 0:253443d82cba | 88 | break; |
goldmas | 0:253443d82cba | 89 | |
goldmas | 0:253443d82cba | 90 | case 3 : |
goldmas | 4:4bae30d48662 | 91 | bloc3.relacher() ; |
goldmas | 0:253443d82cba | 92 | break; |
goldmas | 0:253443d82cba | 93 | |
goldmas | 0:253443d82cba | 94 | case 4 : |
goldmas | 4:4bae30d48662 | 95 | bloc4.relacher() ; |
goldmas | 0:253443d82cba | 96 | break; |
goldmas | 0:253443d82cba | 97 | |
goldmas | 0:253443d82cba | 98 | case 5 : |
goldmas | 4:4bae30d48662 | 99 | bloc5.relacher() ; |
goldmas | 0:253443d82cba | 100 | break; |
goldmas | 0:253443d82cba | 101 | |
goldmas | 0:253443d82cba | 102 | case 6 : |
goldmas | 4:4bae30d48662 | 103 | bloc6.relacher() ; |
goldmas | 0:253443d82cba | 104 | break; |
goldmas | 0:253443d82cba | 105 | |
goldmas | 0:253443d82cba | 106 | case 7 : |
goldmas | 4:4bae30d48662 | 107 | bloc7.relacher() ; |
goldmas | 0:253443d82cba | 108 | break; |
goldmas | 0:253443d82cba | 109 | |
goldmas | 0:253443d82cba | 110 | case 8 : |
goldmas | 4:4bae30d48662 | 111 | bloc8.relacher() ; |
goldmas | 0:253443d82cba | 112 | break; |
goldmas | 0:253443d82cba | 113 | } |
goldmas | 4:4bae30d48662 | 114 | } |
goldmas | 9:6869e3869638 | 115 | char bloc_8_pompe::etat_actuel (int groupe) |
goldmas | 4:4bae30d48662 | 116 | { |
goldmas | 9:6869e3869638 | 117 | static char etat_groupe[8] ; |
goldmas | 4:4bae30d48662 | 118 | |
goldmas | 4:4bae30d48662 | 119 | switch (groupe) |
goldmas | 4:4bae30d48662 | 120 | { |
goldmas | 4:4bae30d48662 | 121 | case 1 : |
goldmas | 4:4bae30d48662 | 122 | etat_groupe[groupe-1] = bloc1.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 123 | break; |
goldmas | 4:4bae30d48662 | 124 | |
goldmas | 4:4bae30d48662 | 125 | case 2 : |
goldmas | 4:4bae30d48662 | 126 | etat_groupe[groupe-1] = bloc2.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 127 | break; |
goldmas | 4:4bae30d48662 | 128 | |
goldmas | 4:4bae30d48662 | 129 | case 3 : |
goldmas | 4:4bae30d48662 | 130 | etat_groupe[groupe-1] = bloc3.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 131 | break; |
goldmas | 4:4bae30d48662 | 132 | |
goldmas | 4:4bae30d48662 | 133 | case 4 : |
goldmas | 4:4bae30d48662 | 134 | etat_groupe[groupe-1] = bloc4.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 135 | break; |
goldmas | 4:4bae30d48662 | 136 | |
goldmas | 4:4bae30d48662 | 137 | case 5 : |
goldmas | 4:4bae30d48662 | 138 | etat_groupe[groupe-1] = bloc5.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 139 | break; |
goldmas | 4:4bae30d48662 | 140 | |
goldmas | 4:4bae30d48662 | 141 | case 6 : |
goldmas | 4:4bae30d48662 | 142 | etat_groupe[groupe-1] = bloc6.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 143 | break; |
goldmas | 4:4bae30d48662 | 144 | |
goldmas | 4:4bae30d48662 | 145 | case 7 : |
goldmas | 4:4bae30d48662 | 146 | etat_groupe[groupe-1] = bloc7.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 147 | break; |
goldmas | 4:4bae30d48662 | 148 | |
goldmas | 4:4bae30d48662 | 149 | case 8 : |
goldmas | 4:4bae30d48662 | 150 | etat_groupe[groupe-1] = bloc8.etat_actuel() ; |
goldmas | 4:4bae30d48662 | 151 | break; |
goldmas | 4:4bae30d48662 | 152 | } |
goldmas | 9:6869e3869638 | 153 | return etat_groupe[groupe-1]; |
goldmas | 9:6869e3869638 | 154 | // wait_us(150); |
goldmas | 0:253443d82cba | 155 | } |
goldmas | 0:253443d82cba | 156 | |
goldmas | 4:4bae30d48662 | 157 | void bloc_8_pompe::stop_pompe (int groupe = 1) |
goldmas | 0:253443d82cba | 158 | { |
goldmas | 0:253443d82cba | 159 | switch (groupe) |
goldmas | 0:253443d82cba | 160 | { |
goldmas | 0:253443d82cba | 161 | case 1 : |
goldmas | 4:4bae30d48662 | 162 | bloc1.stop_pompe() ; |
goldmas | 0:253443d82cba | 163 | break; |
goldmas | 0:253443d82cba | 164 | |
goldmas | 0:253443d82cba | 165 | case 2 : |
goldmas | 4:4bae30d48662 | 166 | bloc2.stop_pompe() ; |
goldmas | 0:253443d82cba | 167 | break; |
goldmas | 0:253443d82cba | 168 | |
goldmas | 0:253443d82cba | 169 | case 3 : |
goldmas | 4:4bae30d48662 | 170 | bloc3.stop_pompe() ; |
goldmas | 0:253443d82cba | 171 | break; |
goldmas | 0:253443d82cba | 172 | |
goldmas | 0:253443d82cba | 173 | case 4 : |
goldmas | 4:4bae30d48662 | 174 | bloc4.stop_pompe() ; |
goldmas | 0:253443d82cba | 175 | break; |
goldmas | 0:253443d82cba | 176 | |
goldmas | 0:253443d82cba | 177 | case 5 : |
goldmas | 4:4bae30d48662 | 178 | bloc5.stop_pompe() ; |
goldmas | 0:253443d82cba | 179 | break; |
goldmas | 0:253443d82cba | 180 | |
goldmas | 0:253443d82cba | 181 | case 6 : |
goldmas | 4:4bae30d48662 | 182 | bloc6.stop_pompe() ; |
goldmas | 0:253443d82cba | 183 | break; |
goldmas | 0:253443d82cba | 184 | |
goldmas | 0:253443d82cba | 185 | case 7 : |
goldmas | 4:4bae30d48662 | 186 | bloc7.stop_pompe() ; |
goldmas | 0:253443d82cba | 187 | break; |
goldmas | 0:253443d82cba | 188 | |
goldmas | 0:253443d82cba | 189 | case 8 : |
goldmas | 4:4bae30d48662 | 190 | bloc8.stop_pompe() ; |
goldmas | 0:253443d82cba | 191 | break; |
goldmas | 0:253443d82cba | 192 | } |
goldmas | 9:6869e3869638 | 193 | } |