Module ctr.ir

The ir module.

Usage:

    local ir = require("ctr.ir")

Functions

init ([bitrate=6]) Initialize the IR module.
shutdown () Disable the IR module.
send (data[, wait=false]) Send some data over the IR module.
receive (size[, wait=false]) Receive some data from the IR module.
setBitRate (bitrate) Set the bitrate of the communication.
getBitRate () Return the actual bitrate of the communication.

Tables

bitrates Bitrate codes list (this is not a part of the module, just a reference)


Functions

init ([bitrate=6])
Initialize the IR module.

Parameters:

  • bitrate number bitrate of the IR module (more informations below) (default 6)

Returns:

    boolean true if everything went fine

Or

  1. boolean false in case of error
  2. integer error code
shutdown ()
Disable the IR module.

Returns:

    boolean true if everything went fine

Or

  1. boolean false in case of error
  2. integer error code
send (data[, wait=false])
Send some data over the IR module.

Parameters:

  • data string just some data
  • wait boolean set to true to wait until the data is sent. (default false)

Returns:

    boolean true if everything went fine

Or

  1. boolean false in case of error
  2. integer error code
receive (size[, wait=false])
Receive some data from the IR module.

Parameters:

  • size number bytes to receive
  • wait boolean wait until the data is received (default false)

Returns:

    string data

Or

  1. nil in case of error
  2. integer error code
setBitRate (bitrate)
Set the bitrate of the communication.

Parameters:

  • bitrate number new bitrate for the communication

Returns:

    boolean true if everything went fine

Or

  1. boolean false in case of error
  2. integer error code
getBitRate ()
Return the actual bitrate of the communication.

Returns:

    number actual bitrate

Or

  1. nil in case of error
  2. integer error code

Tables

bitrates
Bitrate codes list (this is not a part of the module, just a reference)

Fields:

  • 3 115200
  • 4 96000
  • 5 72000
  • 6 48000 (default)
  • 7 36000
  • 8 24000
  • 9 18000
  • 10 12000
  • 11 9600
  • 12 6000
  • 13 3000
  • 14 57600
  • 15 38400
  • 16 19200
  • 17 7200
  • 18 4800
generated by LDoc 1.4.3 Last updated 2017-06-05 14:35:27