{"action":"created","issue":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/3405","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/3405/labels{/name}","comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/3405/comments","events_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/3405/events","html_url":"https://github.com/RIOT-OS/RIOT/pull/3405","id":95005740,"number":3405,"title":"cpu/stm32f3: PWM driver, some corrections.","user":{"login":"A-Paul","id":12623350,"avatar_url":"https://avatars.githubusercontent.com/u/12623350?v=3","gravatar_id":"","url":"https://api.github.com/users/A-Paul","html_url":"https://github.com/A-Paul","followers_url":"https://api.github.com/users/A-Paul/followers","following_url":"https://api.github.com/users/A-Paul/following{/other_user}","gists_url":"https://api.github.com/users/A-Paul/gists{/gist_id}","starred_url":"https://api.github.com/users/A-Paul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/A-Paul/subscriptions","organizations_url":"https://api.github.com/users/A-Paul/orgs","repos_url":"https://api.github.com/users/A-Paul/repos","events_url":"https://api.github.com/users/A-Paul/events{/privacy}","received_events_url":"https://api.github.com/users/A-Paul/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/arm","name":"arm","color":"dddddd"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/Device%20driver","name":"Device driver","color":"0052cc"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/enhancement","name":"enhancement","color":"f17070"}],"state":"open","locked":false,"assignee":{"login":"PeterKietzmann","id":7765855,"avatar_url":"https://avatars.githubusercontent.com/u/7765855?v=3","gravatar_id":"","url":"https://api.github.com/users/PeterKietzmann","html_url":"https://github.com/PeterKietzmann","followers_url":"https://api.github.com/users/PeterKietzmann/followers","following_url":"https://api.github.com/users/PeterKietzmann/following{/other_user}","gists_url":"https://api.github.com/users/PeterKietzmann/gists{/gist_id}","starred_url":"https://api.github.com/users/PeterKietzmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeterKietzmann/subscriptions","organizations_url":"https://api.github.com/users/PeterKietzmann/orgs","repos_url":"https://api.github.com/users/PeterKietzmann/repos","events_url":"https://api.github.com/users/PeterKietzmann/events{/privacy}","received_events_url":"https://api.github.com/users/PeterKietzmann/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-07-14T18:18:44Z","updated_at":"2015-07-20T08:52:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/3405","html_url":"https://github.com/RIOT-OS/RIOT/pull/3405","diff_url":"https://github.com/RIOT-OS/RIOT/pull/3405.diff","patch_url":"https://github.com/RIOT-OS/RIOT/pull/3405.patch"},"body":"While working on [PR#3405](https://github.com/RIOT-OS/RIOT/pull/3405) I noticed some incorrect or missing calculations. \r\n\r\n+ In `pwm_init()` the effective *resolution* was `resolution + 1`.\r\n+ In `pwm_init()` the return value of `frequency` is not recalculated, based on given *pwm clock* and *prescaler*.\r\n+ In `pwm_set()` the input for the duty cycle was not limited by resolution.\r\n\r\nInbetween I slapped myself for forgetting the astyle run, and then watched it spitting out newlines cheerfully. :-)\r\n"},"comment":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/comments/122815664","html_url":"https://github.com/RIOT-OS/RIOT/pull/3405#issuecomment-122815664","issue_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/3405","id":122815664,"user":{"login":"PeterKietzmann","id":7765855,"avatar_url":"https://avatars.githubusercontent.com/u/7765855?v=3","gravatar_id":"","url":"https://api.github.com/users/PeterKietzmann","html_url":"https://github.com/PeterKietzmann","followers_url":"https://api.github.com/users/PeterKietzmann/followers","following_url":"https://api.github.com/users/PeterKietzmann/following{/other_user}","gists_url":"https://api.github.com/users/PeterKietzmann/gists{/gist_id}","starred_url":"https://api.github.com/users/PeterKietzmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeterKietzmann/subscriptions","organizations_url":"https://api.github.com/users/PeterKietzmann/orgs","repos_url":"https://api.github.com/users/PeterKietzmann/repos","events_url":"https://api.github.com/users/PeterKietzmann/events{/privacy}","received_events_url":"https://api.github.com/users/PeterKietzmann/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T08:52:35Z","updated_at":"2015-07-20T08:52:35Z","body":"@A-Paul can you have a look at the [referance manual](http://www.st.com/web/en/resource/technical/document/reference_manual/DM00043574.pdf) sec. 20.3.10 point _PWM edge-aligned mode_ and the example in _fig. 174_ on page 537-538 please? Does it answer the question about the clipping of the duty cycle? If so, I'd suggest to stay with the `0xffff` solution and add a comment. "}}