@@ -189,15 +189,42 @@ namespace LOAD {
189189 static_assert (NUM_COMBINATIONS == (1u << NUM_PINS ),
190190 " NUM_COMBINATIONS must be 2^NUM_PINS" );
191191
192- etl::array<uint_fast8_t , 46 > RES_INDEX_TABLE = {
193- 0 , 1 , 2 , 4 , 3 , 8 , 5 , 6 , 9 , 12 , 16 , 11 , 7 , 14 , 13 , 15 ,
194- 19 , 24 , 21 , 22 , 25 , 23 , 28 , 29 , 32 , 31 , 33 , 35 , 36 , 40 , 37 , 41 ,
195- 39 , 44 , 48 , 45 , 46 , 50 , 47 , 51 , 56 , 53 , 54 , 57 , 55 , 60 };
192+ constexpr uint_fast8_t VOLT_LIMIT_SIZE = 12 ; // CONFIG
193+ etl::array<uint_fast16_t , VOLT_LIMIT_SIZE > VOLT_LIMITS_TABLE_mV = {
194+ 2000 , //
195+ 1900 , 1800 , 1700 , 1600 , 1400 , //
196+ 1500 , 1400 , 1300 , 1200 , 1100 , //
197+ 1000 };
198+
199+ constexpr uint_fast8_t RES_INDEX_SIZE = 46 ; // CONFIG
200+ etl::array<uint_fast8_t , RES_INDEX_SIZE > RES_INDEX_TABLE = {
201+ 0 , 1 , 2 , 4 , 3 , //
202+ 8 , 5 , 6 , 9 , 12 , //
203+ 16 , 11 , 7 , 14 , 13 , //
204+ 15 , 19 , 24 , 21 , 22 , //
205+ 25 , 23 , 28 , 29 , 32 , //
206+ 31 , 33 , 35 , 36 , 40 , //
207+ 37 , 41 , 39 , 44 , 48 , //
208+ 45 , 46 , 50 , 47 , 51 , //
209+ 56 , 53 , 54 , 57 , 55 , //
210+ 60 };
211+ // constexpr uint_fast8_t RES_INDEX_SIZE = 46; // CONFIG
212+ // etl::array<uint_fast8_t, RES_INDEX_SIZE> RES_INDEX_TABLE = {
213+ // 0, 1, 2, 4, 3, 8, 5, 6, 9, 12, 16, 11, 7, 14, 13, 15,
214+ // 19, 24, 21, 22, 25, 23, 28, 29, 32, 31, 33, 35, 36, 40, 37, 41,
215+ // 39, 44, 48, 45, 46, 50, 47, 51, 56, 53, 54, 57, 55, 60};
216+
217+ static_assert (
218+ VOLT_LIMIT_SIZE <= RES_INDEX_SIZE ,
219+ " VOLT_LIMIT_SIZE must be less than or equal to RES_INDEX_SIZE" );
220+ static_assert (
221+ RES_INDEX_SIZE <= NUM_COMBINATIONS ,
222+ " RES_INDEX_SIZE must be less than or equal to NUM_COMBINATIONS" );
196223
197224 /* *
198- * @brief Resistor values, in milli‑ohms, corresponding to each pin. Note
199- * that the resistors will be connected in series, so the total resistance
200- * is the sum of the selected resistors.
225+ * @brief Resistor values, in milli‑ohms, corresponding to each pin.
226+ * Note that the resistors will be connected in series, so the total
227+ * resistance is the sum of the selected resistors.
201228 */
202229 constexpr etl::array<uint_fast16_t , NUM_PINS > PIN_VALUES_mOhms = {
203230 500 , 1000 , 2000 , 2200 , 5000 , 10000 }; // in mOhms, in series // TODO
0 commit comments