move get_Relay_PWM_Count to better file

This commit is contained in:
openshwprojects
2023-01-23 14:31:58 +01:00
parent e2efe3710d
commit b553b83c8b
3 changed files with 36 additions and 35 deletions

View File

@ -1540,41 +1540,6 @@ int http_fn_cfg_quick(http_request_t* request) {
return 0;
}
/// @brief Computes the Relay and PWM count.
/// @param relayCount Number of relay and LED channels.
/// @param pwmCount Number of PWM channels.
void get_Relay_PWM_Count(int* relayCount, int* pwmCount, int* dInputCount) {
int i;
(*relayCount) = 0;
(*pwmCount) = 0;
(*dInputCount) = 0;
for (i = 0; i < PLATFORM_GPIO_MAX; i++) {
int role = PIN_GetPinRoleForPinIndex(i);
switch (role) {
case IOR_Relay:
case IOR_Relay_n:
case IOR_LED:
case IOR_LED_n:
(*relayCount)++;
break;
case IOR_PWM:
case IOR_PWM_n:
(*pwmCount)++;
break;
case IOR_DigitalInput:
case IOR_DigitalInput_n:
case IOR_DigitalInput_NoPup:
case IOR_DigitalInput_NoPup_n:
(*dInputCount)++;
break;
default:
break;
}
}
}
void doHomeAssistantDiscovery(const char *topic, http_request_t *request) {
int i;
int relayCount;