1 /* 2 * Copyright (c) 2024 Joakim Andersson 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 #include <zephyr/drivers/pinctrl.h> 9 main(void)10int main(void) 11 { 12 13 /* This sample demonstrates MCO usage via Device Tree. 14 * MCO configuration is performed in the Device Tree overlay files. 15 * Each MCO will be enabled automatically by the driver during device 16 * initialization. This sample checks that all MCOs are ready - if so, 17 * the selected clock should be visible on the chosen GPIO pin. 18 */ 19 20 #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mco1)) 21 const struct device *dev1; 22 23 dev1 = DEVICE_DT_GET(DT_NODELABEL(mco1)); 24 if (device_is_ready(dev1)) { 25 printk("MCO1 device successfully configured\n"); 26 } else { 27 printk("MCO1 device not ready\n"); 28 return -1; 29 } 30 #endif /* mco1 */ 31 32 #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mco2)) 33 const struct device *dev2; 34 35 dev2 = DEVICE_DT_GET(DT_NODELABEL(mco2)); 36 if (device_is_ready(dev2)) { 37 printk("MCO2 device successfully configured\n"); 38 } else { 39 printk("MCO2 device not ready\n"); 40 return -1; 41 } 42 #endif /* mco2 */ 43 44 printk("\nDisplayed the status of all MCO devices - end of example.\n"); 45 return 0; 46 } 47