mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Update CAN examples.
This commit is contained in:
parent
2c80728bc8
commit
fecb586bae
@ -9,15 +9,9 @@ from pyb import CAN
|
|||||||
# NOTE: Set to False on receiving node.
|
# NOTE: Set to False on receiving node.
|
||||||
TRANSMITTER = True
|
TRANSMITTER = True
|
||||||
|
|
||||||
can = CAN(2, CAN.NORMAL)
|
can = CAN(2, CAN.NORMAL, baudrate=125_000, sampling_point=75)
|
||||||
# Set a different baudrate (default is 125Kbps)
|
# NOTE: uncomment to set bit timing manually, for example:
|
||||||
# NOTE: The following parameters are for the H7 only.
|
#can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3)
|
||||||
#
|
|
||||||
# can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3) # 125Kbps
|
|
||||||
# can.init(CAN.NORMAL, prescaler=16, sjw=1, bs1=8, bs2=3) # 250Kbps
|
|
||||||
# can.init(CAN.NORMAL, prescaler=8, sjw=1, bs1=8, bs2=3) # 500Kbps
|
|
||||||
# can.init(CAN.NORMAL, prescaler=4, sjw=1, bs1=8, bs2=3) # 1000Kbps
|
|
||||||
|
|
||||||
can.restart()
|
can.restart()
|
||||||
|
|
||||||
if (TRANSMITTER):
|
if (TRANSMITTER):
|
||||||
|
|||||||
@ -9,15 +9,9 @@ from pyb import CAN
|
|||||||
# NOTE: Set to False on receiving node.
|
# NOTE: Set to False on receiving node.
|
||||||
TRANSMITTER = True
|
TRANSMITTER = True
|
||||||
|
|
||||||
can = CAN(2, CAN.NORMAL)
|
can = CAN(2, CAN.NORMAL, baudrate=125_000, sampling_point=75)
|
||||||
# Set a different baudrate (default is 125Kbps)
|
# NOTE: uncomment to set bit timing manually, for example:
|
||||||
# NOTE: The following parameters are for the H7 only.
|
#can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3)
|
||||||
#
|
|
||||||
# can.init(CAN.NORMAL, prescaler=32, sjw=1, bs1=8, bs2=3) # 125Kbps
|
|
||||||
# can.init(CAN.NORMAL, prescaler=16, sjw=1, bs1=8, bs2=3) # 250Kbps
|
|
||||||
# can.init(CAN.NORMAL, prescaler=8, sjw=1, bs1=8, bs2=3) # 500Kbps
|
|
||||||
# can.init(CAN.NORMAL, prescaler=4, sjw=1, bs1=8, bs2=3) # 1000Kbps
|
|
||||||
|
|
||||||
can.restart()
|
can.restart()
|
||||||
|
|
||||||
if (TRANSMITTER):
|
if (TRANSMITTER):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user