Skip to content

Commit c6fb4b5

Browse files
committed
Migrate from master/slave phrasing
1 parent 07514d2 commit c6fb4b5

File tree

5 files changed

+83
-83
lines changed

5 files changed

+83
-83
lines changed

Examples/Doc-GettingStarted-Yocto-RS485/helloworld.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
if serialPort is None:
3737
sys.exit('No module connected (check cable)')
3838

39-
print("Please enter the MODBUS slave address (1...255)")
40-
slave = 0
41-
while (slave < 1) or (slave > 255):
42-
slave = int(input("slave: ")) # use raw_input in python 2.x
39+
print("Please enter the MODBUS subordinate address (1...255)")
40+
subordinate = 0
41+
while (subordinate < 1) or (subordinate > 255):
42+
subordinate = int(input("subordinate: ")) # use raw_input in python 2.x
4343

4444
reg = 0
4545
while (reg < 1) or (reg >= 50000) or (reg % 10000) == 0:
@@ -49,13 +49,13 @@
4949

5050
while serialPort.isOnline():
5151
if reg >= 40001:
52-
val = serialPort.modbusReadRegisters(slave, reg - 40001, 1)[0]
52+
val = serialPort.modbusReadRegisters(subordinate, reg - 40001, 1)[0]
5353
elif reg >= 30001:
54-
val = serialPort.modbusReadInputRegisters(slave, reg - 30001, 1)[0]
54+
val = serialPort.modbusReadInputRegisters(subordinate, reg - 30001, 1)[0]
5555
elif reg >= 10001:
56-
val = serialPort.modbusReadInputBits(slave, reg - 10001, 1)[0]
56+
val = serialPort.modbusReadInputBits(subordinate, reg - 10001, 1)[0]
5757
else:
58-
val = serialPort.modbusReadBits(slave, reg - 1, 1)[0]
58+
val = serialPort.modbusReadBits(subordinate, reg - 1, 1)[0]
5959

6060
print("Current value: " + str(val))
6161
print("Press ENTER to read again, Q to quit")
@@ -69,7 +69,7 @@
6969
if cmd != "" and ((reg % 30000) < 10000):
7070
val = int(cmd)
7171
if reg >= 30001:
72-
serialPort.modbusWriteRegister(slave, reg - 30001, val)
72+
serialPort.modbusWriteRegister(subordinate, reg - 30001, val)
7373
else:
74-
serialPort.modbusWriteBit(slave, reg - 1, val)
74+
serialPort.modbusWriteBit(subordinate, reg - 1, val)
7575
YAPI.FreeAPI()

Examples/Prog-Modbus/modbus.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
if serialPort is None:
2323
sys.exit('No module connected (check cable)')
2424

25-
print("Please enter the MODBUS slave address (1...255)")
26-
slave = 0
27-
while (slave < 1) or (slave > 255):
28-
slave = int(input("slave: ")) # use raw_input in python 2.x
25+
print("Please enter the MODBUS subordinate address (1...255)")
26+
subordinate = 0
27+
while (subordinate < 1) or (subordinate > 255):
28+
subordinate = int(input("subordinate: ")) # use raw_input in python 2.x
2929

3030
reg = 0
3131
while (reg < 1) or (reg >= 50000) or (reg % 10000) == 0:
@@ -35,13 +35,13 @@
3535

3636
while True:
3737
if reg >= 40001:
38-
val = serialPort.modbusReadInputRegisters(slave, reg - 40001, 1)[0]
38+
val = serialPort.modbusReadInputRegisters(subordinate, reg - 40001, 1)[0]
3939
elif reg >= 30001:
40-
val = serialPort.modbusReadRegisters(slave, reg - 30001, 1)[0]
40+
val = serialPort.modbusReadRegisters(subordinate, reg - 30001, 1)[0]
4141
elif reg >= 10001:
42-
val = serialPort.modbusReadInputBits(slave, reg - 10001, 1)[0]
42+
val = serialPort.modbusReadInputBits(subordinate, reg - 10001, 1)[0]
4343
else:
44-
val = serialPort.modbusReadBits(slave, reg - 1, 1)[0]
44+
val = serialPort.modbusReadBits(subordinate, reg - 1, 1)[0]
4545

4646
print("Current value: " + str(val))
4747
print("Press ENTER to read again, Q to quit")
@@ -54,6 +54,6 @@
5454
if cmd != "" and ((reg % 30000) < 10000):
5555
val = int(cmd)
5656
if reg >= 30001:
57-
serialPort.modbusWriteRegister(slave, reg - 30001, val)
57+
serialPort.modbusWriteRegister(subordinate, reg - 30001, val)
5858
else:
59-
serialPort.modbusWriteBit(slave, reg - 1, val)
59+
serialPort.modbusWriteBit(subordinate, reg - 1, val)

Sources/yocto_hubport.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#noinspection PyProtectedMember
4848
class YHubPort(YFunction):
4949
"""
50-
The YHubPort class provides control over the power supply for slave ports
50+
The YHubPort class provides control over the power supply for subordinate ports
5151
on a YoctoHub. It provide information about the device connected to it.
5252
The logical name of a YHubPort is always automatically set to the
5353
unique serial number of the Yoctopuce device connected to it.
@@ -160,7 +160,7 @@ def get_baudRate(self):
160160
@staticmethod
161161
def FindHubPort(func):
162162
"""
163-
Retrieves a YoctoHub slave port for a given identifier.
163+
Retrieves a YoctoHub subordinate port for a given identifier.
164164
The identifier can be specified using several formats:
165165
<ul>
166166
<li>FunctionLogicalName</li>
@@ -170,22 +170,22 @@ def FindHubPort(func):
170170
<li>ModuleLogicalName.FunctionLogicalName</li>
171171
</ul>
172172
173-
This function does not require that the YoctoHub slave port is online at the time
173+
This function does not require that the YoctoHub subordinate port is online at the time
174174
it is invoked. The returned object is nevertheless valid.
175-
Use the method YHubPort.isOnline() to test if the YoctoHub slave port is
175+
Use the method YHubPort.isOnline() to test if the YoctoHub subordinate port is
176176
indeed online at a given time. In case of ambiguity when looking for
177-
a YoctoHub slave port by logical name, no error is notified: the first instance
177+
a YoctoHub subordinate port by logical name, no error is notified: the first instance
178178
found is returned. The search is performed first by hardware name,
179179
then by logical name.
180180
181181
If a call to this object's is_online() method returns FALSE although
182182
you are certain that the matching device is plugged, make sure that you did
183183
call registerHub() at application initialization time.
184184
185-
@param func : a string that uniquely characterizes the YoctoHub slave port, for instance
185+
@param func : a string that uniquely characterizes the YoctoHub subordinate port, for instance
186186
YHUBETH1.hubPort1.
187187
188-
@return a YHubPort object allowing you to drive the YoctoHub slave port.
188+
@return a YHubPort object allowing you to drive the YoctoHub subordinate port.
189189
"""
190190
# obj
191191
obj = YFunction._FindFromCache("HubPort", func)
@@ -196,14 +196,14 @@ def FindHubPort(func):
196196

197197
def nextHubPort(self):
198198
"""
199-
Continues the enumeration of YoctoHub slave ports started using yFirstHubPort().
200-
Caution: You can't make any assumption about the returned YoctoHub slave ports order.
201-
If you want to find a specific a YoctoHub slave port, use HubPort.findHubPort()
199+
Continues the enumeration of YoctoHub subordinate ports started using yFirstHubPort().
200+
Caution: You can't make any assumption about the returned YoctoHub subordinate ports order.
201+
If you want to find a specific a YoctoHub subordinate port, use HubPort.findHubPort()
202202
and a hardwareID or a logical name.
203203
204204
@return a pointer to a YHubPort object, corresponding to
205-
a YoctoHub slave port currently online, or a None pointer
206-
if there are no more YoctoHub slave ports to enumerate.
205+
a YoctoHub subordinate port currently online, or a None pointer
206+
if there are no more YoctoHub subordinate ports to enumerate.
207207
"""
208208
hwidRef = YRefParam()
209209
if YAPI.YISERR(self._nextFunction(hwidRef)):
@@ -219,12 +219,12 @@ def nextHubPort(self):
219219
@staticmethod
220220
def FirstHubPort():
221221
"""
222-
Starts the enumeration of YoctoHub slave ports currently accessible.
222+
Starts the enumeration of YoctoHub subordinate ports currently accessible.
223223
Use the method YHubPort.nextHubPort() to iterate on
224-
next YoctoHub slave ports.
224+
next YoctoHub subordinate ports.
225225
226226
@return a pointer to a YHubPort object, corresponding to
227-
the first YoctoHub slave port currently online, or a None pointer
227+
the first YoctoHub subordinate port currently online, or a None pointer
228228
if there are none.
229229
"""
230230
devRef = YRefParam()

Sources/yocto_i2cport.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,12 @@ def reset(self):
707707

708708
return self.sendCommand("Z")
709709

710-
def i2cSendBin(self, slaveAddr, buff):
710+
def i2cSendBin(self, subordinateAddr, buff):
711711
"""
712712
Sends a one-way message (provided as a a binary buffer) to a device on the I2C bus.
713713
This function checks and reports communication errors on the I2C bus.
714714
715-
@param slaveAddr : the 7-bit address of the slave device (without the direction bit)
715+
@param subordinateAddr : the 7-bit address of the subordinate device (without the direction bit)
716716
@param buff : the binary buffer to be sent
717717
718718
@return YAPI.SUCCESS if the call succeeds.
@@ -724,7 +724,7 @@ def i2cSendBin(self, slaveAddr, buff):
724724
# val
725725
# msg
726726
# reply
727-
msg = "@" + ("%02x" % slaveAddr) + ":"
727+
msg = "@" + ("%02x" % subordinateAddr) + ":"
728728
nBytes = len(buff)
729729
idx = 0
730730
while idx < nBytes:
@@ -746,12 +746,12 @@ def i2cSendBin(self, slaveAddr, buff):
746746
return YAPI.IO_ERROR
747747
return YAPI.SUCCESS
748748

749-
def i2cSendArray(self, slaveAddr, values):
749+
def i2cSendArray(self, subordinateAddr, values):
750750
"""
751751
Sends a one-way message (provided as a list of integer) to a device on the I2C bus.
752752
This function checks and reports communication errors on the I2C bus.
753753
754-
@param slaveAddr : the 7-bit address of the slave device (without the direction bit)
754+
@param subordinateAddr : the 7-bit address of the subordinate device (without the direction bit)
755755
@param values : a list of data bytes to be sent
756756
757757
@return YAPI.SUCCESS if the call succeeds.
@@ -763,7 +763,7 @@ def i2cSendArray(self, slaveAddr, values):
763763
# val
764764
# msg
765765
# reply
766-
msg = "@" + ("%02x" % slaveAddr) + ":"
766+
msg = "@" + ("%02x" % subordinateAddr) + ":"
767767
nBytes = len(values)
768768
idx = 0
769769
while idx < nBytes:
@@ -785,17 +785,17 @@ def i2cSendArray(self, slaveAddr, values):
785785
return YAPI.IO_ERROR
786786
return YAPI.SUCCESS
787787

788-
def i2cSendAndReceiveBin(self, slaveAddr, buff, rcvCount):
788+
def i2cSendAndReceiveBin(self, subordinateAddr, buff, rcvCount):
789789
"""
790790
Sends a one-way message (provided as a a binary buffer) to a device on the I2C bus,
791791
then read back the specified number of bytes from device.
792792
This function checks and reports communication errors on the I2C bus.
793793
794-
@param slaveAddr : the 7-bit address of the slave device (without the direction bit)
794+
@param subordinateAddr : the 7-bit address of the subordinate device (without the direction bit)
795795
@param buff : the binary buffer to be sent
796796
@param rcvCount : the number of bytes to receive once the data bytes are sent
797797
798-
@return a list of bytes with the data received from slave device.
798+
@return a list of bytes with the data received from subordinate device.
799799
800800
On failure, throws an exception or returns an empty binary buffer.
801801
"""
@@ -805,7 +805,7 @@ def i2cSendAndReceiveBin(self, slaveAddr, buff, rcvCount):
805805
# msg
806806
# reply
807807
# rcvbytes
808-
msg = "@" + ("%02x" % slaveAddr) + ":"
808+
msg = "@" + ("%02x" % subordinateAddr) + ":"
809809
nBytes = len(buff)
810810
idx = 0
811811
while idx < nBytes:
@@ -834,17 +834,17 @@ def i2cSendAndReceiveBin(self, slaveAddr, buff, rcvCount):
834834
rcvbytes = YAPI._hexStrToBin(reply)
835835
return rcvbytes
836836

837-
def i2cSendAndReceiveArray(self, slaveAddr, values, rcvCount):
837+
def i2cSendAndReceiveArray(self, subordinateAddr, values, rcvCount):
838838
"""
839839
Sends a one-way message (provided as a list of integer) to a device on the I2C bus,
840840
then read back the specified number of bytes from device.
841841
This function checks and reports communication errors on the I2C bus.
842842
843-
@param slaveAddr : the 7-bit address of the slave device (without the direction bit)
843+
@param subordinateAddr : the 7-bit address of the subordinate device (without the direction bit)
844844
@param values : a list of data bytes to be sent
845845
@param rcvCount : the number of bytes to receive once the data bytes are sent
846846
847-
@return a list of bytes with the data received from slave device.
847+
@return a list of bytes with the data received from subordinate device.
848848
849849
On failure, throws an exception or returns an empty array.
850850
"""
@@ -855,7 +855,7 @@ def i2cSendAndReceiveArray(self, slaveAddr, values, rcvCount):
855855
# reply
856856
# rcvbytes
857857
res = []
858-
msg = "@" + ("%02x" % slaveAddr) + ":"
858+
msg = "@" + ("%02x" % subordinateAddr) + ":"
859859
nBytes = len(values)
860860
idx = 0
861861
while idx < nBytes:

0 commit comments

Comments
 (0)