[riot-notifications] [RIOT-OS/RIOT] cpu/stm32: cleanup timer structure in vendor headers (#14144)

benpicco notifications at github.com
Tue May 26 23:31:51 CEST 2020


@benpicco commented on this pull request.



> @@ -53,7 +53,7 @@ uint32_t pwm_init(pwm_t pwm, pwm_mode_t mode, uint32_t freq, uint16_t res)
     dev(pwm)->CR1 = 0;
     dev(pwm)->CR2 = 0;
     for (unsigned i = 0; i < TIMER_CHAN; ++i) {
-        dev(pwm)->CCR[i] = 0;
+        *(uint32_t *)(&dev(pwm)->CCR1 + i) = 0;

Let's make this look a bit nicer

```suggestion
        TIM_CHAN(pwm, i) = 0;
```

```C
#define TIM_CHAN(t, c) *(uint32_t *)(&dev(t)->CCR1 + c) 
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14144#pullrequestreview-418694138
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200526/7186fd87/attachment.htm>


More information about the notifications mailing list