<commit_before><commit_msg>added small class to encapsulate laser pointer on off control via SiLabs Servo board<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ch.unizh.ini.hardware.pantilt;

import ch.unizh.ini.caviar.hardwareinterface.usb.SiLabsC8051F320_USBIO_ServoController;
import java.util.logging.Logger;

/**
 * Encapsulates control of the a laser pointer on/off state controlled via a SiLabsC8051F320_USBIO_ServoController
 * controller board. Port 2 on the board is used in open drain mode to sink the laser supply current to turn
 * it on. The laser ground supply should be connected to multiple port 2 pins (at least 4) to reduce each pin's current
 * to less than 100mA. One green laser pointer tested sinks up to 230mA at 3V supply and seems to run
 * OK using the USB VBUS (5 volts).
 * @author tobi
 */
public class LaserOnOffControl {
    static Logger log=Logger.getLogger("LaserOnOffControl");
    SiLabsC8051F320_USBIO_ServoController controller;
    public LaserOnOffControl(SiLabsC8051F320_USBIO_ServoController controller){
        this.controller=controller;
    }
    
    public void setLaserEnabled(boolean yes){
        if(controller!=null){
           controller.setPort2(yes? 0:0xff);
        }
    }
}
{'fraction_non_alphanumeric': 0.06579954093343535, 'fraction_numerical': 0.032134659525631215, 'mean_word_length': 4.069767441860465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5997344', 'n_tokens_mistral': 418, 'n_tokens_neox': 383, 'n_words': 138}