MCPcopy Create free account
hub / github.com/facebook/time / Init

Function Init

sa53/protocol/protocol.go:81–97  ·  view source on GitHub ↗

Init is to create Mac structure and open serial port

(device string)

Source from the content-addressed store, hash-verified

79
80// Init is to create Mac structure and open serial port
81func Init(device string) (*Mac, error) {
82 mode := &serial.Mode{
83 BaudRate: 57600,
84 }
85
86 port, err := serial.Open(device, mode)
87 if err != nil {
88 return nil, fmt.Errorf("cannot open serial port %s: %w", device, err)
89 }
90
91 m := &Mac{
92 device: device,
93 port: port,
94 closer: port,
95 }
96 return m, nil
97}
98
99// Close is to close serial port
100func (m *Mac) Close() {

Callers 3

runPollFunction · 0.92
runPollSingleCmdFunction · 0.92
ApplyFunction · 0.92

Calls 1

OpenMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…