|
| 1 | +ATOM CAN Base |
| 2 | +============== |
| 3 | + |
| 4 | +.. include:: ../refs/base.can.ref |
| 5 | + |
| 6 | +The following products are supported: |
| 7 | + |
| 8 | + ================== ================== |
| 9 | + |Atom CAN| |Atomic CAN Base| |
| 10 | + ================== ================== |
| 11 | + |
| 12 | + |
| 13 | +Micropython TX Example: |
| 14 | + |
| 15 | + .. literalinclude:: ../../../examples/unit/can/stickc_plus2_can_tx_example.py |
| 16 | + :language: python |
| 17 | + :linenos: |
| 18 | + |
| 19 | + |
| 20 | +Micropython RX Example: |
| 21 | + |
| 22 | + .. literalinclude:: ../../../examples/unit/can/dial_can_rx_example.py |
| 23 | + :language: python |
| 24 | + :linenos: |
| 25 | + |
| 26 | + |
| 27 | +UIFLOW2 TX Example: |
| 28 | + |
| 29 | + |tx_example.png| |
| 30 | + |
| 31 | + |
| 32 | +UIFLOW2 RX Example: |
| 33 | + |
| 34 | + |rx_example.png| |
| 35 | + |
| 36 | + |
| 37 | +.. only:: builder_html |
| 38 | + |
| 39 | + |stickc_plus2_can_tx_example.m5f2| |
| 40 | + |
| 41 | + |dial_can_rx_example.m5f2| |
| 42 | + |
| 43 | +class ATOMCANBase |
| 44 | +----------------- |
| 45 | + |
| 46 | +Constructors |
| 47 | +------------ |
| 48 | + |
| 49 | +.. class:: ATOMCANBase(id, tx, rx, mode, baudrate) |
| 50 | + |
| 51 | + Create an ATOMCANBase object. |
| 52 | + |
| 53 | + parameter is: |
| 54 | + |
| 55 | + - ``id`` is the ID of the CAN bus |
| 56 | + - ``tx`` is the pin to use for transmitting data |
| 57 | + - ``rx`` is the pin to use for receiving data |
| 58 | + - ``mode`` is one of: NORMAL, NO_ACKNOWLEDGE, LISTEN_ONLY |
| 59 | + - ``baudrate`` is the baudrate of ATOMCANBase |
| 60 | + |
| 61 | + UIFLOW2: |
| 62 | + |
| 63 | + |init.png| |
| 64 | + |
| 65 | +.. class:: ATOMCANBase(id, tx, rx, mode, prescaler, sjw, bs1, bs2, triple_sampling=False) |
| 66 | + :no-index: |
| 67 | + |
| 68 | + Initialise the CAN bus with the given parameters: |
| 69 | + |
| 70 | + - ``id`` is the ID of the CAN bus |
| 71 | + - ``tx`` is the pin to use for transmitting data |
| 72 | + - ``rx`` is the pin to use for receiving data |
| 73 | + - ``mode`` is one of: NORMAL, NO_ACKNOWLEDGE, LISTEN_ONLY |
| 74 | + - ``prescaler`` is the value by which the CAN input clock is divided to generate the |
| 75 | + nominal bit time quanta. The prescaler can be a value between 1 and 1024 inclusive |
| 76 | + for classic CAN. |
| 77 | + - ``sjw`` is the resynchronisation jump width in units of time quanta for nominal bits; |
| 78 | + it can be a value between 1 and 4 inclusive for classic CAN. |
| 79 | + - ``bs1`` defines the location of the sample point in units of the time quanta for nominal bits; |
| 80 | + it can be a value between 1 and 16 inclusive for classic CAN. |
| 81 | + - ``bs2`` defines the location of the transmit point in units of the time quanta for nominal bits; |
| 82 | + it can be a value between 1 and 8 inclusive for classic CAN. |
| 83 | + - ``triple_sampling`` is Enables triple sampling when the TWAI controller samples a bit |
| 84 | + |
| 85 | + UIFLOW2: |
| 86 | + |
| 87 | + |init_advanced.png| |
| 88 | + |
| 89 | +ATOMCANBase class inherits CAN class, See :ref:`hardware.CAN <hardware.CAN>` for more details. |
0 commit comments