PWM general purpose interface code for file system.  
More...
#include <stdio.h>
#include "bbbandroidHAL.h"
 
PWM general purpose interface code for file system. 
- Author
 - Ankur Yadav (ankur.nosp@m.ayad.nosp@m.av@gm.nosp@m.ail..nosp@m.com) 
 
 
      
        
          | #define SYSFS_PWM_DIR   "/sys/class/pwm" | 
        
      
 
File system path to access PWM 
 
 
      
        
          | int pwmGetDutyCycle  | 
          ( | 
          const uint8_t  | 
          channel | ) | 
           | 
        
      
 
It takes channel number as input and returns the value of duty cycle of specified channel in nano seconds. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
  
   
- Returns
 - value of duty cycle on success and -1 if it fails. 
 
 
 
      
        
          | int pwmGetPeriod  | 
          ( | 
          const uint8_t  | 
          channel | ) | 
           | 
        
      
 
It takes channel number as input and returns the value of period of specified channel in nano seconds. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
  
   
- Returns
 - value of period on success and -1 if it fails. 
 
 
 
      
        
          | int pwmGetPolarity  | 
          ( | 
          const uint8_t  | 
          channel | ) | 
           | 
        
      
 
It takes channel number as input and returns the value of polarity of specified channel. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
  
   
- Returns
 - value of polarity on success and -1 if it fails. 
 
 
 
      
        
          | int pwmRun  | 
          ( | 
          const uint8_t  | 
          channel | ) | 
           | 
        
      
 
It takes channel number as input and sets run for that channel so that pwm starts running for that channel. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
  
   
- Returns
 - 0 on success and -1 if it fails. 
 
 
 
      
        
          | int pwmRunCheck  | 
          ( | 
          const uint8_t  | 
          channel | ) | 
           | 
        
      
 
It takes channel number as input and returns the value of run for that channel. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
  
   
- Returns
 - value of run on success and -1 if it fails. 
 
 
 
      
        
          | int pwmSetDutyCycle  | 
          ( | 
          const uint8_t  | 
          channel,  | 
        
        
           | 
           | 
          const uint32_t  | 
          duration_ns  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
It takes channel and duty cycle to be assigned in nano seconds and sets duty cycle of that channel to specified value using file system. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
    | duration_ns | a constant uint32_t argument.  | 
  
   
- Returns
 - 0 on success and -1 if it fails. 
 
 
 
      
        
          | int pwmSetPeriod  | 
          ( | 
          const uint8_t  | 
          channel,  | 
        
        
           | 
           | 
          const uint32_t  | 
          period_ns  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
It takes channel and period to be assigned in nano seconds and sets period of that channel to specified value using file system. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
    | period_ns | a constant uint32_t argument.  | 
  
   
- Returns
 - 0 on success and -1 if it fails. 
 
 
 
      
        
          | int pwmSetPolarity  | 
          ( | 
          const uint8_t  | 
          channel,  | 
        
        
           | 
           | 
          const uint8_t  | 
          polarity  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
It takes channel and polarity to be assigned and sets polarity of that channel to the specified value using file system. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
    | polarity | a constant uint8_t argument.  | 
  
   
- Returns
 - 0 on success and -1 if it fails. 
 
 
 
      
        
          | int pwmStop  | 
          ( | 
          const uint8_t  | 
          channel | ) | 
           | 
        
      
 
It takes channel number as input and sets run to 0 for that channel so that pwm stops for that channel. 
- Parameters
 - 
  
    | channel | a constant uint8_t argument.  | 
  
   
- Returns
 - 0 on success and -1 if it fails. 
 
 
 
Buffer to store generated file system path using snprintf