File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed
Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -83,19 +83,6 @@ func (sh *serialhub) Unregister(port *serport) {
8383 sh .mu .Unlock ()
8484}
8585
86- // Write data to the serial port.
87- func (sh * serialhub ) Write (port * serport , data string , sendMode string ) {
88- // if user sent in the commands as one text mode line
89- switch sendMode {
90- case "send" :
91- port .sendBuffered <- data
92- case "sendnobuf" :
93- port .sendNoBuf <- []byte (data )
94- case "sendraw" :
95- port .sendRaw <- data
96- }
97- }
98-
9986func (sh * serialhub ) FindPortByName (portname string ) (* serport , bool ) {
10087 sh .mu .Lock ()
10188 defer sh .mu .Unlock ()
@@ -328,5 +315,5 @@ func spWrite(arg string) {
328315 }
329316
330317 // send it to the write channel
331- sh .Write (port , data , bufferingMode )
318+ port .Write (data , bufferingMode )
332319}
Original file line number Diff line number Diff line change @@ -174,6 +174,19 @@ func (p *serport) reader(buftype string) {
174174 }
175175}
176176
177+ // Write data to the serial port.
178+ func (p * serport ) Write (data string , sendMode string ) {
179+ // if user sent in the commands as one text mode line
180+ switch sendMode {
181+ case "send" :
182+ p .sendBuffered <- data
183+ case "sendnobuf" :
184+ p .sendNoBuf <- []byte (data )
185+ case "sendraw" :
186+ p .sendRaw <- data
187+ }
188+ }
189+
177190// this method runs as its own thread because it's instantiated
178191// as a "go" method. so if it blocks inside, it is ok
179192func (p * serport ) writerBuffered () {
You can’t perform that action at this time.
0 commit comments