leaflabs / libmaple

[INACTIVE] C and C++ library for STM32 ARM Cortex-M3 development boards.
http://leaflabs.com/docs/libmaple.html
Other
304 stars 218 forks source link

Transistion from Serial to PWM #118

Closed Gregwar closed 8 years ago

Gregwar commented 8 years ago

Hello, It appear that end() doesn't allow a port to get back its PWM configuration, here is an example:

   // (pin 9 is Serial2 TX)
    Serial2.begin(115200);
    Serial2.write('x');
    Serial2.end();        
   // This doesn't output any PWM
    pinMode(9, PWM);
    pwmWrite(9, 1500);

Something is maybe not cleaned, any idea?

Gregwar commented 8 years ago

Actually, there is a comment in usart_disable that clearly tell that

Gregwar commented 8 years ago

It appear that disabling the device in APB1ENR fixes the problem

Gregwar commented 8 years ago

(Here, adding this: RCC_BASE->APB1ENR &= ~RCC_APB1ENR_USART2EN; after end())