/** * Radiation counting */ #ifndef CPROJ_RADIATION_H #define CPROJ_RADIATION_H #include #include /// Init the radiation measuring subsystem void init_radiation(); /// Get progress 0-100, 100 = normal radiation reading resumed. /// We need some number of ticks after boot so the averaging results /// are somewhat accurate. uint8_t rad_get_progress(); enum rad_danger { // 0-2 uSv RAD_LEVEL_0_SAFE = 0, // 2-15 uSv RAD_LEVEL_1_ELEVATED, // 10-20 uSv RAD_LEVEL_2_DANGER, // 20-1000 uSv RAD_LEVEL_3_HIGH_DANGER, // 1000+ uSv ("evacuate immediately") RAD_LEVEL_4_SEVERE, RAD_LEVEL_MAX, }; struct rad_results { /// CPM (usvh before conversion), x10 (one decimal place) uint32_t cpm_x10; /// Current radiation dose rate uSv/h, adjusting scaling to fit in 5 digits uint32_t usvh_num; /// The position of the decimal point (places from the right) uint8_t usvh_decimals; /// Danger level enum enum rad_danger danger_level; }; void rad_get_reading(struct rad_results *out); #endif //CPROJ_RADIATION_H