forked from reef-pi/reef-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request reef-pi#2290 from reef-pi/pi5
(chore)update gopsutil and pi detection logic to support pi5
- Loading branch information
Showing
8 changed files
with
83 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package drivers | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/reef-pi/hal" | ||
|
||
"github.com/reef-pi/reef-pi/controller/storage" | ||
) | ||
|
||
const ( | ||
DriverBucket = storage.DriverBucket | ||
_rpi = "rpi" | ||
) | ||
|
||
// swagger:model driver | ||
type Driver struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Type string `json:"type"` | ||
Config json.RawMessage `json:"config"` | ||
PinMap map[string][]int `json:"pinmap"` | ||
Parameters map[string]interface{} `json:"parameters"` | ||
} | ||
|
||
func (dr *Driver) loadPinMap(d hal.Driver) { | ||
pinmap := make(map[string][]int) | ||
for _, cap := range d.Metadata().Capabilities { | ||
pins, err := d.Pins(cap) | ||
if err != nil { | ||
continue | ||
} | ||
var ps []int | ||
for _, pin := range pins { | ||
ps = append(ps, pin.Number()) | ||
} | ||
pinmap[cap.String()] = ps | ||
} | ||
dr.PinMap = pinmap | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters