machine/stm32f103xx: correct convertion for fractional timing of RTC as used in ticks() function
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Этот коммит содержится в:
		
							родитель
							
								
									622d0ebde6
								
							
						
					
					
						коммит
						09e85b7859
					
				
					 1 изменённых файлов: 2 добавлений и 2 удалений
				
			
		|  | @ -124,8 +124,8 @@ func ticks() timeUnit { | |||
| 	// convert RTC counter from seconds to microseconds | ||||
| 	timerCounter := uint64(stm32.RTC.CNTH<<16|stm32.RTC.CNTL) * 1000 * 1000 | ||||
| 
 | ||||
| 	// add the fractional part of current time using DIV registers | ||||
| 	timerCounter += (uint64(stm32.RTC.DIVH<<16|stm32.RTC.DIVL) / 1024 * 32 * 32) * 1000 * 1000 | ||||
| 	// add the fractional part of current time using DIV register | ||||
| 	timerCounter += uint64(0x8000-stm32.RTC.DIVL) * 31 | ||||
| 
 | ||||
| 	// change since last measurement | ||||
| 	offset := (timerCounter - timerLastCounter) | ||||
|  |  | |||
		Загрузка…
	
	Создание таблицы
		
		Сослаться в новой задаче
	
	 Ron Evans
						Ron Evans