#include "msw.h"
#include "am335x.h"

#define BuzzerBeep_OFF "echo 0 > /sys/class/pwm/ehrpwm.0:1/run"
#define BuzzerBeep_ON  "echo 1 > /sys/class/pwm/ehrpwm.0:1/run"


int main(int argc, char **argv)
{
	int  addr, wRetVal ;
	char value;
  
	if (argc != 2) {
		printf("Function: buzzer\n");
		printf("Description: Set buzzer beep ON or OFF for AM335x PAC \n");
		printf("Usage: buzzer  value\n");
		printf("Value: 1-->ON ; 0-->OFF \n");
		printf("Example: buzzer  1 \n");
		printf("Set RunLED ON\n");
		return FAILURE;
	}
	
  value=atoi(argv[1]);
  
  switch (value)
  {
    case 0:
    system(BuzzerBeep_OFF); //Set buzzer beep OFF
    break;
    
    case 1:
    system(BuzzerBeep_ON); //Set buzzer beep ON
    break;
  }
 
	return 0;
}
