1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Improved Resource command output.

This commit is contained in:
blckmn 2016-07-09 17:03:16 +10:00
parent c4e75e456c
commit 67d448d8ea
41 changed files with 154 additions and 164 deletions

View file

@ -53,6 +53,19 @@ const struct ioPortDef_s ioPortDefs[] = {
};
# endif
const char * const ownerNames[OWNER_TOTAL_COUNT] = {
"FREE", "PWM", "PPM", "MOTOR", "SERVO", "SOFTSERIAL", "ADC", "SERIAL", "DEBUG", "TIMER",
"SONAR", "SYSTEM", "SPI", "I2C", "SDCARD", "FLASH", "USB", "BEEPER", "OSD",
"BARO", "MPU", "INVERTER", "LED STRIP", "LED", "RECEIVER",
};
const char * const resourceNames[RESOURCE_TOTAL_COUNT] = {
"", // NONE
"IN", "OUT", "IN / OUT", "TIMER","UART TX","UART RX","UART TX/RX","EXTI","SCL",
"SDA", "SCK","MOSI","MISO","CS","BATTERY","RSSI","EXT","CURRENT"
};
ioRec_t* IO_Rec(IO_t io)
{
return io;
@ -190,12 +203,12 @@ void IOToggle(IO_t io)
}
// claim IO pin, set owner and resources
void IOInit(IO_t io, resourceOwner_t owner, resourceType_t resources)
void IOInit(IO_t io, resourceOwner_t owner, resourceType_t resource, uint8_t index)
{
ioRec_t *ioRec = IO_Rec(io);
if (owner != OWNER_FREE) // pass OWNER_FREE to keep old owner
ioRec->owner = owner;
ioRec->resourcesUsed |= resources;
ioRec->owner = owner;
ioRec->resource = resource;
ioRec->index = index;
}
void IORelease(IO_t io)
@ -210,10 +223,10 @@ resourceOwner_t IOGetOwner(IO_t io)
return ioRec->owner;
}
resourceType_t IOGetResources(IO_t io)
resourceType_t IOGetResource(IO_t io)
{
ioRec_t *ioRec = IO_Rec(io);
return ioRec->resourcesUsed;
return ioRec->resource;
}
#if defined(STM32F1)