Temperature scaling changes for HackRF r9 (MAX2839) (#1561)

* Add files via upload

* Add files via upload

* Add files via upload
This commit is contained in:
Mark Thompson 2023-11-06 13:56:09 -06:00 committed by GitHub
parent 6784fe72dd
commit 68f960e4e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 17 deletions

View file

@ -321,7 +321,7 @@ void MAX2837::set_rx_buff_vcm(const size_t v) {
flush();
}
reg_t MAX2837::temp_sense() {
int8_t MAX2837::temp_sense() {
if (!_map.r.rx_top.ts_en) {
_map.r.rx_top.ts_en = 1;
flush_one(Register::RX_TOP);
@ -334,12 +334,15 @@ reg_t MAX2837::temp_sense() {
halPolledDelay(ticks_for_temperature_sense_adc_conversion);
const auto value = read(Register::TEMP_SENSE);
/*
* Conversion to degrees C determined by testing - does not match data sheet.
*/
reg_t value = read(Register::TEMP_SENSE) & 0x1F;
_map.r.rx_top.ts_adc_trigger = 0;
flush_one(Register::RX_TOP);
return value;
return value * 4.31 - 6; // reg value is 0 to 31; possible return range is -6 C to 127 C
}
} // namespace max2837