Hi,
Thanks for the response!!
Hi,
Thanks for the response!!
Hi,
Are you looking to use an existing zephyr driver, or create a new one? Either way, the structure will be populated by the DEVICE_DEFINE()/DEVICE_DT_DEFINE() macro in the driver implementation, and the pointer to this structure is then retrieved by the main application through DEVICE_GET()/DEVICE_DT_GET() or device_get_binding(<device name>).
As an example, you may take a look at the Zephyr fade_led sample (/zephyr/samples/fade_led) to see how it invokes the nrf52's PWM driver:
Getting the device object from the main application

"PWM_0" label in <build dir>/zephyr/zephyr.dts

Device object definition in /zephyr/drivers/pwm/pwm_nrfx.c

Hi,
Thanks for the quick response!!
Hi,
The following code can be used to retreive the device struct for clock:
const struct device *clock;
clock = device_get_binding("CLOCK");
if (clock == NULL) {
printk("Clock device not found\n\r");
}
But like mentioned earlier, the clock control driver is already being invoked by the system on startup, and I'm honestly not sure if it it supports multiple users - that is something I need to look into. Could you let me know what you are trying achieve with this?