Yes Marko, pwm_set_frequency_func_t() is to set the frequency of device. The comment you mentioned makes no sense to me either, it was inherited from hal_pwm I just forgot to delete it. I see no reason for this operation to affect channels provided by other devices.
Thanks for your feedback :) On Tue, Jul 11, 2017 at 5:56 PM, marko kiiskila <[email protected]> wrote: > Hi, > >> On Jul 10, 2017, at 8:31 PM, Miguel Azevedo <[email protected]> wrote: >> >> I am currently developing a PWM driver for mynewt, more specifically a >> driver for nRF52 based hardware. >> Therefore I came up with this PWM high level API, which will be >> described ahead on this e-mail. >> Its source code: >> https://github.com/mlaz/mynewt-core/blob/pwm_dev/hw/drivers/pwm/include/pwm/pwm.h >> >> This API is based in both the current ADC high level API >> https://github.com/apache/mynewt-core/blob/master/hw/drivers/adc/include/adc/adc.h >> and the abandoned hal_pwm API >> https://github.com/apache/mynewt-core/blob/090_dev/hw/hal/include/hal/hal_pwm.h >> . >> The API itself is roughly the same as hal_pwm exposes, which aligns >> with the following concepts: >> -It is assumed that within a system there is a number of discrete PWM >> devices which provide a number of channels per device. >> -These devices are configurable, its configuration typically >> contemplates all the parameters which affect all the provided channels >> (global to the device). >> -A channel is also configurable and its configuration may or may not >> affect other channels provided by the same device, depending on the >> device's configuration. >> >> I would be glad to have some feedback from the community, in order to >> validate this approach. >> > > In general this seems reasonable, I like it. And thanks for picking up the > effort. > > For clarification; setting frequency for a pwm_dev > would set it for all channels belonging to that pwm_dev? Comment on the > function prototype for pwm_set_frequency_func_t() says that ‘it might’ affect > other > channels, and this confuses me :) What do you mean by that comment? > > — > M -- -- Miguel Azevedo
