11 uint16_t
get_aqi(uint16_t pm2_5_value, uint16_t pm10_0_value)
override {
15 return (pm2_5_index < pm10_0_index) ? pm10_0_index : pm2_5_index;
29 if (grid_index == -1) {
33 int aqi_lo = index_grid_[grid_index][0];
34 int aqi_hi = index_grid_[grid_index][1];
35 int conc_lo = array[grid_index][0];
36 int conc_hi = array[grid_index][1];
38 return (value - conc_lo) * (aqi_hi - aqi_lo) / (conc_hi - conc_lo) + aqi_lo;
43 if (value >= array[i][0] && value <= array[i][1]) {
int get_grid_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2])
static const int AMOUNT_OF_LEVELS
int pm2_5_calculation_grid_[AMOUNT_OF_LEVELS][2]
int pm10_0_calculation_grid_[AMOUNT_OF_LEVELS][2]
int calculate_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2])
uint16_t get_aqi(uint16_t pm2_5_value, uint16_t pm10_0_value) override
int index_grid_[AMOUNT_OF_LEVELS][2]
Implementation of SPI Controller mode.