mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
SCRIPT Move subprojects
This commit is contained in:
committed by
Peter Johnson
parent
8cfc158790
commit
a5492d30da
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibNewCommands/generate_hids.py. DO NOT MODIFY
|
||||
{% macro capitalize_first(string) -%}
|
||||
{{ string[0]|capitalize + string[1:] }}
|
||||
{%- endmacro %}
|
||||
#include "frc2/command/button/Command{{ ConsoleName }}Controller.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
Command{{ ConsoleName }}Controller::Command{{ ConsoleName }}Controller(int port)
|
||||
: CommandGenericHID(port), m_hid{frc::{{ ConsoleName }}Controller(port)} {}
|
||||
|
||||
frc::{{ ConsoleName }}Controller& Command{{ ConsoleName }}Controller::GetHID() {
|
||||
return m_hid;
|
||||
}
|
||||
{% for button in buttons %}
|
||||
Trigger Command{{ ConsoleName }}Controller::{{ capitalize_first(button.name) }}(frc::EventLoop* loop) const {
|
||||
return Button(frc::{{ ConsoleName }}Controller::Button::k{{ capitalize_first(button.name) }}, loop);
|
||||
}
|
||||
{% endfor -%}
|
||||
{% for trigger in triggers -%}
|
||||
{% if trigger.UseThresholdMethods %}
|
||||
Trigger Command{{ ConsoleName }}Controller::{{ capitalize_first(trigger.name) }}(double threshold,
|
||||
frc::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, threshold] {
|
||||
return m_hid.Get{{ capitalize_first(trigger.name) }}Axis() > threshold;
|
||||
});
|
||||
}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% for stick in sticks %}
|
||||
double Command{{ ConsoleName }}Controller::Get{{ stick.NameParts|map("capitalize")|join }}() const {
|
||||
return m_hid.Get{{ stick.NameParts|map("capitalize")|join }}();
|
||||
}
|
||||
{% endfor -%}
|
||||
{% for trigger in triggers %}
|
||||
double Command{{ ConsoleName }}Controller::Get{{ capitalize_first(trigger.name) }}Axis() const {
|
||||
return m_hid.Get{{ capitalize_first(trigger.name) }}Axis();
|
||||
}
|
||||
{% endfor -%}
|
||||
Reference in New Issue
Block a user