<commit_before>package com.lynbrookrobotics.potassium.frc

import com.lynbrookrobotics.potassium.Signal
import com.lynbrookrobotics.potassium.events.{ContinuousEvent, EventPolling}
import edu.wpi.first.wpilibj.{AnalogInput, Joystick}
import squants.{Dimensionless, Each}
import squants.electro.Volts

object Implicits {
  // Interface -> signals
  implicit class AnalogInSignals(val analog: AnalogInput) extends AnyVal {
    def voltage = Signal(Volts(analog.getVoltage))
    def averageVoltage = Signal(Volts(analog.getAverageVoltage))

    def value = Signal(analog.getValue)
    def averageValue = Signal(analog.getAverageValue)
  }

  implicit class JoystickSignals(val joystick: Joystick) extends AnyVal {
    def x: Signal[Dimensionless] = Signal(Each(joystick.getX()))
    def y: Signal[Dimensionless] = Signal(Each(joystick.getY()))
    def z: Signal[Dimensionless] = Signal(Each(joystick.getZ()))

    def buttonPressed(button: Int)(implicit polling: EventPolling): ContinuousEvent = {
      Signal(joystick.getRawButton(button)).filter(down => down)
    }
  }

  implicit val clock = WPIClock
}
<commit_msg>Add signals for period and freuency of counters<commit_after>package com.lynbrookrobotics.potassium.frc

import com.lynbrookrobotics.potassium.Signal
import com.lynbrookrobotics.potassium.events.{ContinuousEvent, EventPolling}
import edu.wpi.first.wpilibj.{AnalogInput, Counter, Joystick}
import squants.{Dimensionless, Each, Time}
import squants.electro.Volts
import squants.time.{Frequency, Seconds}

object Implicits {
  // Interface -> signals
  implicit class AnalogInSignals(val analog: AnalogInput) extends AnyVal {
    def voltage = Signal(Volts(analog.getVoltage))
    def averageVoltage = Signal(Volts(analog.getAverageVoltage))

    def value = Signal(analog.getValue)
    def averageValue = Signal(analog.getAverageValue)
  }

  implicit class JoystickSignals(val joystick: Joystick) extends AnyVal {
    def x: Signal[Dimensionless] = Signal(Each(joystick.getX()))
    def y: Signal[Dimensionless] = Signal(Each(joystick.getY()))
    def z: Signal[Dimensionless] = Signal(Each(joystick.getZ()))

    def buttonPressed(button: Int)(implicit polling: EventPolling): ContinuousEvent = {
      Signal(joystick.getRawButton(button)).filter(down => down)
    }
  }

  implicit class CounterSignals(val counter: Counter) extends AnyVal {
    def period: Signal[Time] = Signal(Seconds(counter.getPeriod))
    def frequency: Signal[Frequency] = period.map(t => Each(1) / t)
  }

  implicit val clock = WPIClock
}

{'fraction_non_alphanumeric': 0.1069455406471981, 'fraction_numerical': 0.0003946329913180742, 'mean_word_length': 5.182926829268292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '5452595', 'n_tokens_mistral': 873, 'n_tokens_neox': 811, 'n_words': 167}