daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define BUFLEN 1024
  2. static char buffer[BUFLEN];
  3. static char *rbp = buffer;
  4. static volatile int need_data = 1024;
  5. static char *wbp = buffer;
  6.  
  7. IRQ-send-to-PWM {
  8.  send-to-PWM(*rbp++);
  9.  need_data++;
  10.  if ( rbp == buffer + BUFLEN )
  11.    rbp = buffer;
  12. }
  13.  
  14. main()
  15. {
  16.  while()
  17.  {
  18.   volatile int fnf;
  19.   cli(); /* disable interrupts *.
  20.   fnf = need_data;
  21.   sei(); /* resume interrupts */
  22.   if ( fnf > 512 ) {
  23.     .. write 512 bytes, move wbp forward 512 bytes, roll it over
  24.   }
  25.   cli(); /* disable interrupts *.
  26.   need_data -= 512;
  27.   sei(); /* resume interrupts */
  28.  }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top