Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------------------------------------- Zephyr Defintions ------------------------------------------
- # include <zephyr.h>
- # include <device.h>
- # include <devicetree.h>
- # include <drivers/pwm.h> // Include the PWM Driver
- # include <drivers/gpio.h> // Incldue the GPIO Driver
- #define ON_OFF_MOTOR1 DT_ALIAS(bimotor1)
- #if !DT_NODE_HAS_STATUS(ON_OFF_MOTOR1, okay)
- /* A build error here means your board isn't set up to blink an LED. */
- #error "Unsupported board: motor1 devicetree alias is not defined"
- #endif
- static const struct gpio_dt_spec on_off_motor1 = GPIO_DT_SPEC_GET_OR(ON_OFF_MOTOR1, gpios, {0});
- // Configure ON-OFF Motor Pin as Output
- if(on_off_motor1.port){
- return_variable = gpio_pin_configure_dt(&on_off_motor1, GPIO_OUPUT);
- if(return_variable != 0) {
- printk("Error %d: failed to configure LED device %s pin %d\n",
- return_variable, on_off_motor1.port->name, on_off_motor1.pin);
- led.port = NULL;}
- else {
- printk("Set up Motor PIN at %s pin %d\n", on_off_motor1.port->name, on_off_motor1.pin);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement