From 9bd376464a4b2cd4871bdc4b8d389fad6920b47c Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Mon, 9 Sep 2024 15:49:58 +0200 Subject: [PATCH] avr: optimized cny70 module (not tested, yet). --- avr/modules/cny70/main.asm | 122 +++++++++++++------------------------ 1 file changed, 42 insertions(+), 80 deletions(-) diff --git a/avr/modules/cny70/main.asm b/avr/modules/cny70/main.asm index 787e45a..56c3313 100644 --- a/avr/modules/cny70/main.asm +++ b/avr/modules/cny70/main.asm @@ -19,16 +19,11 @@ .equ CNY70_FLAGS_ADC_STARTED = 0x01 -.equ CNY70_FLAGS_ADC_FINISHED = 0x02 -.equ CNY70_FLAGS_ADC_VALID = 0x04 - -.equ CNY70_TIMER_100MS = 20 ; every 2s - +.equ CNY70_FLAGS_ADC_UPDATED = 0x02 cny70DataBegin: cny70Flags: .byte 1 cny70LastData: .byte 1 - cny70TimerCounter: .byte 1 cny70DataEnd: @@ -60,13 +55,16 @@ CNY70_Init: ; setup pins and interrupts sbi CNY70_DDR_LED, CNY70_PINNUM_LED ; set DATA port as output - cbi CNY70_PORT_LED, CNY70_PINNUM_LED ; LED off + sbi CNY70_PORT_LED, CNY70_PINNUM_LED ; LED off cbi CNY70_PORT_ADC, CNY70_PINNUM_ADC ; disable internal pullup for ADC cbi CNY70_DDR_ADC, CNY70_PINNUM_ADC ; set ADC port as input - ldi r16, (1<