lujji / stm8-bare-min

Tiny peripheral library for STM8 microcontrolles
MIT License
120 stars 38 forks source link

bad timer 2 address #11

Closed GauchoMatrero closed 5 years ago

GauchoMatrero commented 5 years ago

Hi !

in file stm8s.h ( for stm8s ) says:

/ TIM2 (mutually exclusive with TIM5) /

define TIM2_BASE_ADDRESS 5300

it should be:

/ TIM2 (mutually exclusive with TIM5) /

define TIM2_BASE_ADDRESS ox5300

It took me a couple of hours debugging a non functioning timer, until I started looking at the assembly code.

lujji commented 5 years ago

Hi.

Thanks for pointing that out. This bug was introduced after this merge which included some refactoring. I'll make sure that all the registers are correct.

Sorry to hear about your debugging troubles. Another thing to keep in mind is 16-bit registers. If you write into TIMx_ARR register it won't work because the order would be incorrect. I was thinking about removing _SFR16_ definitions completely to avoid any confusion.