Skip to content

Commit 47c7ba1

Browse files
committed
Update robotpy-hal
- WPI_String migration
1 parent c55d4a5 commit 47c7ba1

File tree

6 files changed

+81
-7
lines changed

6 files changed

+81
-7
lines changed

subprojects/robotpy-hal/gen/DriverStation.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ functions:
1818
HAL_GetJoystickIsXbox:
1919
HAL_GetJoystickType:
2020
HAL_GetJoystickName:
21+
param_override:
22+
name:
23+
ignore: true
2124
cpp_code: |
2225
[](int32_t joystickNum) {
23-
auto name = HAL_GetJoystickName(joystickNum);
24-
std::string sname(name);
25-
HAL_FreeJoystickName(name);
26+
WPI_String name;
27+
HAL_GetJoystickName(&name, joystickNum);
28+
std::string sname(wpi::to_string_view(&name));
29+
WPI_FreeString(&name);
2630
return sname;
2731
}
28-
HAL_FreeJoystickName:
29-
ignore: true
3032
HAL_GetJoystickAxisType:
3133
HAL_SetJoystickOutputs:
3234
HAL_GetMatchTime:

subprojects/robotpy-hal/gen/HALBase.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,29 @@ functions:
1010
HAL_GetFPGAVersion:
1111
HAL_GetFPGARevision:
1212
HAL_GetSerialNumber:
13+
param_override:
14+
serialNumber:
15+
ignore: true
16+
cpp_code: |
17+
[]() {
18+
WPI_String s;
19+
HAL_GetSerialNumber(&s);
20+
std::string ss(wpi::to_string_view(&s));
21+
WPI_FreeString(&s);
22+
return ss;
23+
}
1324
HAL_GetComments:
25+
param_override:
26+
comments:
27+
ignore: true
28+
cpp_code: |
29+
[]() {
30+
WPI_String s;
31+
HAL_GetComments(&s);
32+
std::string ss(wpi::to_string_view(&s));
33+
WPI_FreeString(&s);
34+
return ss;
35+
}
1436
HAL_GetTeamNumber:
1537
HAL_GetRuntimeType:
1638
HAL_GetFPGAButton:

subprojects/robotpy-hal/gen/REVPH.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ functions:
3030
HAL_GetREVPHFaults:
3131
HAL_GetREVPHStickyFaults:
3232
HAL_ClearREVPHStickyFaults:
33+
HAL_GetREVPHSolenoidDisabledList:
3334
classes:
3435
HAL_REVPHVersion:
3536
shared_ptr: true
@@ -82,3 +83,5 @@ classes:
8283
canWarning:
8384
canBusOff:
8485
hasReset:
86+
hardwareFault:
87+
firmwareFault:

subprojects/robotpy-hal/gen/simulation/DriverStationData.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,24 @@ functions:
8787
HALSIM_SetJoystickIsXbox:
8888
HALSIM_SetJoystickType:
8989
HALSIM_SetJoystickName:
90+
cpp_code: |
91+
[](int32_t stick, std::string_view sv) {
92+
auto s = wpi::make_string(sv);
93+
HALSIM_SetJoystickName(stick, &s);
94+
}
9095
HALSIM_SetJoystickAxisType:
9196
HALSIM_SetGameSpecificMessage:
97+
cpp_code: |
98+
[](std::string_view sv) {
99+
auto s = wpi::make_string(sv);
100+
HALSIM_SetGameSpecificMessage(&s);
101+
}
92102
HALSIM_SetEventName:
103+
cpp_code: |
104+
[](std::string_view sv) {
105+
auto s = wpi::make_string(sv);
106+
HALSIM_SetEventName(&s);
107+
}
93108
HALSIM_SetMatchType:
94109
HALSIM_SetMatchNumber:
95110
HALSIM_SetReplayNumber:

subprojects/robotpy-hal/gen/simulation/RoboRioData.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,44 @@ functions:
9494
ignore: true
9595
HALSIM_CancelRoboRioSerialNumberCallback:
9696
HALSIM_GetRoboRioSerialNumber:
97+
param_override:
98+
serialNumber:
99+
ignore: true
100+
cpp_code: |
101+
[]() {
102+
WPI_String s;
103+
HALSIM_GetRoboRioSerialNumber(&s);
104+
std::string ss(wpi::to_string_view(&s));
105+
WPI_FreeString(&s);
106+
return ss;
107+
}
97108
HALSIM_SetRoboRioSerialNumber:
109+
cpp_code: |
110+
[](std::string_view sv) {
111+
auto s = wpi::make_string(sv);
112+
HALSIM_SetRoboRioSerialNumber(&s);
113+
}
98114
HALSIM_RegisterRoboRioCommentsCallback:
99115
ignore: true
100116
HALSIM_CancelRoboRioCommentsCallback:
101117
HALSIM_GetRoboRioComments:
118+
param_override:
119+
comments:
120+
ignore: true
121+
cpp_code: |
122+
[]() {
123+
WPI_String s;
124+
HALSIM_GetRoboRioComments(&s);
125+
std::string ss(wpi::to_string_view(&s));
126+
WPI_FreeString(&s);
127+
return ss;
128+
}
102129
HALSIM_SetRoboRioComments:
130+
cpp_code: |
131+
[](std::string_view sv) {
132+
auto s = wpi::make_string(sv);
133+
HALSIM_SetRoboRioComments(&s);
134+
}
103135
HALSIM_RegisterRoboRioAllCallbacks:
104136
ignore: true
105137
HALSIM_RegisterRoboRioCPUTempCallback:

subprojects/robotpy-hal/gen/simulation/SPIAccelerometerData.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ functions:
3030
HALSIM_CancelSPIAccelerometerZCallback:
3131
HALSIM_GetSPIAccelerometerZ:
3232
HALSIM_SetSPIAccelerometerZ:
33-
HALSIM_RegisterSPIAccelerometerAllCallbcaks:
34-
ignore: true
33+
HALSIM_RegisterSPIAccelerometerAllCallbacks:
34+
ignore: true

0 commit comments

Comments
 (0)