Advertisement
Guest User

source code

a guest
Jun 7th, 2021
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. //-------------------------------------------------- Zephyr Defintions ------------------------------------------
  2. # include <zephyr.h>
  3. # include <device.h>
  4. # include <devicetree.h>
  5. # include <drivers/pwm.h>   // Include the PWM Driver
  6. # include <drivers/gpio.h>  // Incldue the GPIO Driver
  7. # include <inttypes.h>
  8. // -----------------------------------------------------------------------------------------------------------
  9.  
  10. const struct gpio_dt_spec signal = GPIO_DT_SPEC_GET(ZEPHYR_USER_NODE, signal_gpios);
  11.  
  12. // /* Configure the pin */
  13. gpio_pin_configure_dt(&signal, GPIO_OUTPUT_ACTIVE);
  14.  
  15. bool is_led_on = false;
  16.  
  17. void main(void)
  18. {  
  19.     while(1)
  20.     {  
  21.         gpio_pin_set(signal.port, signal.pin, (int)is_led_on);
  22.  
  23.         is_led_on = !is_led_on;
  24.         k_sleep(K_SECONDS(SLEEP_TIME_S));
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement