Method: Tinkerforge::BrickletCAN#write_frame
- Defined in:
- lib/tinkerforge/bricklet_can.rb
#write_frame(frame_type, identifier, data, length) ⇒ Object
Writes a data or remote frame to the write buffer to be transmitted over the CAN transceiver.
The Bricklet supports the standard 11-bit (CAN 2.0A) and the additional extended 18-bit (CAN 2.0B) identifiers. For standard frames the Bricklet uses bit 0 to 10 from the identifier parameter as standard 11-bit identifier. For extended frames the Bricklet additionally uses bit 11 to 28 from the identifier parameter as extended 18-bit identifier.
For remote frames the data parameter is ignored.
Returns true if the frame was successfully added to the write buffer. Returns false if the frame could not be added because write buffer is already full.
The write buffer can overflow if frames are written to it at a higher rate than the Bricklet can transmitted them over the CAN transceiver. This may happen if the CAN transceiver is configured as read-only or is using a low baud rate (see BrickletCAN#set_configuration). It can also happen if the CAN bus is congested and the frame cannot be transmitted because it constantly loses arbitration or because the CAN transceiver is currently disabled due to a high write error level (see BrickletCAN#get_error_log).
131 132 133 134 135 |
# File 'lib/tinkerforge/bricklet_can.rb', line 131 def write_frame(frame_type, identifier, data, length) check_validity send_request FUNCTION_WRITE_FRAME, [frame_type, identifier, data, length], 'C L C8 C', 9, '?' end |