Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

  1. /*
  2. * Copyright (C) 2016 Stefan Brüns <stefan.bruens@rwth-aachen.de>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __PWM_H__
  19. #define __PWM_H__
  20. /*SUPPORT UP TO 8 PWM CHANNEL*/
  21. #ifndef PWM_CHANNEL_NUM_MAX
  22. #define PWM_CHANNEL_NUM_MAX 8
  23. #endif
  24. struct pwm_param {
  25. uint32 period;
  26. uint32 freq;
  27. uint32 duty[PWM_CHANNEL_NUM_MAX]; //PWM_CHANNEL<=8
  28. };
  29. /* pwm_init should be called only once, for now */
  30. void pwm_init(uint32 period, uint32 *duty,uint32 pwm_channel_num,uint32 (*pin_info_list)[3]);
  31. void pwm_start(void);
  32. void pwm_set_duty(uint32 duty, uint8 channel);
  33. uint32 pwm_get_duty(uint8 channel);
  34. void pwm_set_period(uint32 period);
  35. uint32 pwm_get_period(void);
  36. uint32 get_pwm_version(void);
  37. void set_pwm_debug_en(uint8 print_en);
  38. #endif