From 37feeae1ac48ae9b70c99b768943648fd6c354ff Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 27 Nov 2023 08:47:37 -0700 Subject: fixed ADC on attiny85 and related builds (also enabled smooth steps on BLF GT, but had to remove stuff to make room) --- arch/attiny85.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'arch/attiny85.h') diff --git a/arch/attiny85.h b/arch/attiny85.h index 2753fd7..3f6ffcb 100644 --- a/arch/attiny85.h +++ b/arch/attiny85.h @@ -21,8 +21,6 @@ ////////// default hw_setup() ////////// -// FIXME: fsm/main should call hwdef_setup(), not hw_setup, -// and this function should be hwdef_setup #ifdef USE_GENERIC_HWDEF_SETUP static inline void hwdef_setup(); #endif @@ -48,8 +46,6 @@ inline void mcu_adc_sleep_mode(); inline void mcu_adc_start_measurement(); -inline void mcu_adc_on(); - inline void mcu_adc_off(); // NOP because interrupt flag clears itself @@ -57,6 +53,15 @@ inline void mcu_adc_off(); inline uint16_t mcu_adc_result(); +// return Volts * 40, range 0 to 6.375V +#define voltage_raw2cooked mcu_vdd_raw2cooked +inline uint8_t mcu_vdd_raw2cooked(uint16_t measurement); +inline uint8_t mcu_vdivider_raw2cooked(uint16_t measurement); + +// return (temp in Kelvin << 6) +#define temp_raw2cooked mcu_temp_raw2cooked +inline uint16_t mcu_temp_raw2cooked(uint16_t measurement); + inline uint8_t mcu_adc_lsb(); -- cgit v1.2.3