doc: CAN: Fix code in CAN API documentation

Fix code sections in the doc.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
This commit is contained in:
Alexander Wachter 2021-01-17 22:13:00 +01:00 committed by Anas Nashif
commit f0145f9f3e

View file

@ -155,13 +155,12 @@ a mailbox. When a transmitting mailbox is assigned, sending cannot be canceled.
.id_type = CAN_STANDARD_IDENTIFIER,
.rtr = CAN_DATAFRAME,
.id = 0x123,
.dlc = 8
.dlc = 8,
.data = {1,2,3,4,5,6,7,8}
};
const struct device *can_dev;
int ret;
frame.data = {1,2,3,4,5,6,7,8};
can_dev = device_get_binding("CAN_0");
ret = can_send(can_dev, &frame, K_MSEC(100), NULL, NULL);
@ -196,7 +195,9 @@ occurred. It does not block until the message is sent like the example above.
.dlc = 2
};
frame.data = {1,2};
frame.data[0] = 1;
frame.data[1] = 2;
return can_send(can_dev, &frame, K_FOREVER, tx_irq_callback, "Sender 1");
}