[HAL] Prevent reinit in PiHal
This commit is contained in:
parent
fada24c1c4
commit
64253f6e36
1 changed files with 5 additions and 0 deletions
|
@ -32,6 +32,10 @@ class PiHal : public RadioLibHal {
|
|||
}
|
||||
|
||||
void init() override {
|
||||
if(_gpioHandle != -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// first initialise lgpio library
|
||||
if((_gpioHandle = lgGpiochipOpen(_gpioDevice)) < 0) {
|
||||
fprintf(stderr, "Could not open GPIO chip: %s\n", lguErrorText(_gpioHandle));
|
||||
|
@ -48,6 +52,7 @@ class PiHal : public RadioLibHal {
|
|||
|
||||
// finally, stop the lgpio library
|
||||
lgGpiochipClose(_gpioHandle);
|
||||
_gpioHandle = -1;
|
||||
}
|
||||
|
||||
// GPIO-related methods (pinMode, digitalWrite etc.) should check
|
||||
|
|
Loading…
Add table
Reference in a new issue