<s> from calvin . actor . actor import Actor , ActionResult , manage , condition <EOL> class GPIOPWM ( Actor ) : <EOL> """<STR_LIT>""" <EOL> @ manage ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def init ( self , gpio_pin , frequency , dutycycle ) : <EOL> self . gpio_pin = gpio_pin <EOL> self . frequency = frequency <EOL> self . dutycycle = dutycycle <EOL> self . setup ( ) <EOL> def setup ( self ) : <EOL> self . use ( "<STR_LIT>" , shorthand = "<STR_LIT>" ) <EOL> self . gpio = self [ "<STR_LIT>" ] . open ( self . gpio_pin , "<STR_LIT:o>" ) <EOL> self . gpio . pwm_start ( self . frequency , self . dutycycle ) <EOL> def will_migrate ( self ) : <EOL> self . gpio . pwm_stop ( ) <EOL> self . gpio . close ( ) <EOL> def will_end ( self ) : <EOL> self . gpio . pwm_stop ( ) <EOL> self . gpio . close ( ) <EOL> def did_migrate ( self ) : <EOL> self . setup ( ) <EOL> @ condition ( action_input = ( "<STR_LIT>" , ) ) <EOL> def set_dutycycle ( self , dutycycle ) : <EOL> self . gpio . pwm_set_dutycycle ( dutycycle ) <EOL> return ActionResult ( ) <EOL> @ condition ( action_input = ( "<STR_LIT>" , ) ) <EOL> def set_frequency ( self , frequency ) : <EOL> self . gpio . pwm_set_frequency ( frequency ) <EOL> return ActionResult ( ) <EOL> action_priority = ( set_dutycycle , set_frequency ) <EOL> requires = [ "<STR_LIT>" ] </s>
