mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
IO: handle NONE (NULL) io pin
This commit is contained in:
parent
1acf06c69c
commit
dcdaa6c7ad
1 changed files with 6 additions and 0 deletions
|
@ -238,6 +238,8 @@ void IOToggle(IO_t io)
|
|||
// claim IO pin, set owner and resources
|
||||
void IOInit(IO_t io, resourceOwner_e owner, uint8_t index)
|
||||
{
|
||||
if (!io)
|
||||
return;
|
||||
ioRec_t *ioRec = IO_Rec(io);
|
||||
ioRec->owner = owner;
|
||||
ioRec->index = index;
|
||||
|
@ -245,12 +247,16 @@ void IOInit(IO_t io, resourceOwner_e owner, uint8_t index)
|
|||
|
||||
void IORelease(IO_t io)
|
||||
{
|
||||
if (!io)
|
||||
return;
|
||||
ioRec_t *ioRec = IO_Rec(io);
|
||||
ioRec->owner = OWNER_FREE;
|
||||
}
|
||||
|
||||
resourceOwner_e IOGetOwner(IO_t io)
|
||||
{
|
||||
if (!io)
|
||||
return OWNER_FREE;
|
||||
ioRec_t *ioRec = IO_Rec(io);
|
||||
return ioRec->owner;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue