si7021: started simplifyied version of driver.

This commit is contained in:
Martin Preuss
2025-04-26 11:05:07 +02:00
parent b21c111aa3
commit 265a1e6043
3 changed files with 441 additions and 41 deletions

View File

@@ -452,47 +452,6 @@ si7021Muls16x16_32_done:
; ---------------------------------------------------------------------------
; @routine SI7021_GetValue @global
;
; @param R16 value to get (SI7021_VALUE_TEMP, SI7021_VALUE_HUMIDITY)
; @return CFLAG set if value available, cleared otherwise
; @return R19:R18 value
; @return R21:R20 denom (e.g. 100, meaning value must be divided by 100)
; @clobbers R16
SI7021_GetValue:
cpi r16, SI7021_VALUE_TEMP
breq SI7021_GetValue_temp
cpi r16, SI7021_VALUE_HUMIDITY
breq SI7021_GetValue_hum
SI7021_GetValue_clcRet:
clc
ret
SI7021_GetValue_temp:
lds r16, si7021Flags
andi r16, SI7021_FLAGS_TEMP_VALID
breq SI7021_GetValue_clcRet
lds r18, si7021LastTemp ; value
lds r19, si7021LastTemp+1
ldi r20, 100 ; denominator
rjmp SI7021_GetValue_finishValue
SI7021_GetValue_hum:
lds r16, si7021Flags
andi r16, SI7021_FLAGS_HUM_VALID
breq SI7021_GetValue_clcRet
lds r18, si7021LastHumidity ; value
lds r19, si7021LastHumidity+1
ldi r20, 1 ; denominator
SI7021_GetValue_finishValue:
clr r21
sec
ret
; @end
SI7021_SendTemp:
lds r16, si7021Flags
andi r16, SI7021_FLAGS_TEMP_VALID