LEDComm  1.0
ledcomm.h File Reference

LEDComm Driver macros and structures. More...

#include "ledcommconf.h"

Go to the source code of this file.

Data Structures

struct  LEDCommConfig_t
 LEDComm Driver configuration structure. More...
 
struct  LEDCommDriverVMT
 LEDCommDriver virtual methods table. More...
 
struct  LEDCommDriver
 Full duplex LEDComm driver class. More...
 

Macros

#define LEDCOMM_DEFAULT_SYNCS   18
 Number of MARKs before considering the link is "up". More...
 
#define LEDCOMM_DEFAULT_THRESHOLD   3000
 Maximum number of hal ticks for a "shine". More...
 
#define LEDCOMM_DATA_BITS8   0
 8 data bits per character. More...
 
#define LEDCOMM_DATA_BITS7   1
 7 data bits per character (default). More...
 
#define LEDCOMM_PARITY_NONE   0
 Disable parity generation/detection (default). More...
 
#define LEDCOMM_PARITY   1
 Enable parity generation/detection. More...
 
#define LEDCOMM_PARITY_EVEN   0
 Use even parity (default). More...
 
#define LEDCOMM_PARITY_ODD   1
 Use off parity. More...
 
#define LEDCOMM_PARITY_SPACE   2
 Use space parity. More...
 
#define LEDCOMM_PARITY_MARK   3
 Use mark parity. More...
 
#define _ledcomm_driver_data
 LEDCommDriver specific data. More...
 
#define _ledcomm_driver_methods   _base_asynchronous_channel_methods
 LEDCommDriver specific methods. More...
 
LEDComm status flags
#define LD_PARITY_ERROR   32
 Parity error happened. More...
 
#define LD_FRAMING_ERROR   64
 Framing error happened. More...
 
#define LD_OVERRUN_ERROR   128
 Overflow happened. More...
 
#define LD_LINK_UP   256
 Link detected. More...
 
#define LD_LINK_DOWN   512
 No link detected. More...
 
Configuration options
#define LEDCOMM_USE_LCOM1   TRUE
 
#define LEDCOMM_USE_LCOM2   FALSE
 
#define LEDCOMM_BUFFERS_SIZE   16
 
Macro Functions
#define ldPut(ldp, b)   chOQPut(&(ldp)->oqueue, b)
 Direct write to a LEDCommDriver. More...
 
#define ldPutTimeout(ldp, b, t)   chOQPutTimeout(&(ldp)->oqueue, b, t)
 Direct write to a LEDCommDriver with timeout specification. More...
 
#define ldGet(ldp)   chIQGet(&(ldp)->iqueue)
 Direct read from a LEDCommDriver. More...
 
#define ldGetTimeout(ldp, t)   chIQGetTimeout(&(ldp)->iqueue, t)
 Direct read from a LEDCommDriver with timeout specification. More...
 
#define ldWrite(ldp, b, n)   chOQWriteTimeout(&(ldp)->oqueue, b, n, TIME_INFINITE)
 Direct blocking write to a LEDCommDriver. More...
 
#define ldWriteTimeout(ldp, b, n, t)   chOQWriteTimeout(&(ldp)->oqueue, b, n, t)
 Direct blocking write to a LEDCommDriver with timeout specification. More...
 
#define ldAsynchronousWrite(ldp, b, n)   chOQWriteTimeout(&(ldp)->oqueue, b, n, TIME_IMMEDIATE)
 Direct non-blocking write to a LEDCommDriver. More...
 
#define ldRead(ldp, b, n)   chIQReadTimeout(&(ldp)->iqueue, b, n, TIME_INFINITE)
 Direct blocking read from a LEDCommDriver. More...
 
#define ldReadTimeout(ldp, b, n, t)   chIQReadTimeout(&(ldp)->iqueue, b, n, t)
 Direct blocking read from a LEDCommDriver with timeout specification. More...
 
#define ldAsynchronousRead(ldp, b, n)   chIQReadTimeout(&(ldp)->iqueue, b, n, TIME_IMMEDIATE)
 Direct non-blocking read from a LEDCommDriver. More...
 

Typedefs

typedef struct LEDCommDriver LEDCommDriver_t
 Structure representing a LEDComm driver. More...
 

Enumerations

enum  ldstate_t { LD_UNINIT = 0, LD_STOP = 1, LD_READY = 2 }
 Driver state machine possible states. More...
 

Functions

void ldInit (void)
 LEDComm Driver initialization. More...
 
void ldObjectInit (LEDCommDriver_t *ldp, qnotify_t inotify, qnotify_t onotify)
 Initializes a generic full duplex driver object. More...
 
void ldStart (LEDCommDriver_t *ldp, const LEDCommConfig_t *config)
 Configures and starts the driver. More...
 
void ldStop (LEDCommDriver_t *ldp)
 Stops the driver. More...
 
void ldIncomingDataI (LEDCommDriver_t *ldp, uint8_t b)
 Handles incoming data. More...
 
msg_t ldRequestDataI (LEDCommDriver_t *ldp)
 Handles outgoing data. More...
 

Detailed Description

LEDComm Driver macros and structures.

Definition in file ledcomm.h.

Macro Definition Documentation

#define LEDCOMM_DEFAULT_SYNCS   18

Number of MARKs before considering the link is "up".

Definition at line 87 of file ledcomm.h.

Referenced by ldStart().

#define LEDCOMM_DEFAULT_THRESHOLD   3000

Maximum number of hal ticks for a "shine".

Definition at line 88 of file ledcomm.h.

#define LEDCOMM_DATA_BITS8   0

8 data bits per character.

Definition at line 90 of file ledcomm.h.

#define LEDCOMM_DATA_BITS7   1

7 data bits per character (default).

Definition at line 91 of file ledcomm.h.

Referenced by ldStart().

#define LEDCOMM_PARITY_NONE   0

Disable parity generation/detection (default).

Definition at line 96 of file ledcomm.h.

#define LEDCOMM_PARITY   1

Enable parity generation/detection.

Definition at line 97 of file ledcomm.h.

#define LEDCOMM_PARITY_EVEN   0

Use even parity (default).

Definition at line 102 of file ledcomm.h.

#define LEDCOMM_PARITY_ODD   1

Use off parity.

Definition at line 103 of file ledcomm.h.

#define LEDCOMM_PARITY_SPACE   2

Use space parity.

Definition at line 104 of file ledcomm.h.

#define LEDCOMM_PARITY_MARK   3

Use mark parity.

Definition at line 105 of file ledcomm.h.

#define _ledcomm_driver_data

LEDCommDriver specific data.

Definition at line 122 of file ledcomm.h.

#define _ledcomm_driver_methods   _base_asynchronous_channel_methods

LEDCommDriver specific methods.

Definition at line 200 of file ledcomm.h.

#define ldPut (   ldp,
 
)    chOQPut(&(ldp)->oqueue, b)

Direct write to a LEDCommDriver.

Note
This function bypasses the indirect access to the channel and writes directly on the output queue. This is faster but cannot be used to write to different channels implementations.
See also
chnPutTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 243 of file ledcomm.h.

#define ldPutTimeout (   ldp,
  b,
 
)    chOQPutTimeout(&(ldp)->oqueue, b, t)

Direct write to a LEDCommDriver with timeout specification.

Note
This function bypasses the indirect access to the channel and writes directly on the output queue. This is faster but cannot be used to write to different channels implementations.
See also
chnPutTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 255 of file ledcomm.h.

#define ldGet (   ldp)    chIQGet(&(ldp)->iqueue)

Direct read from a LEDCommDriver.

Note
This function bypasses the indirect access to the channel and reads directly from the input queue. This is faster but cannot be used to read from different channels implementations.
See also
chnGetTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 267 of file ledcomm.h.

#define ldGetTimeout (   ldp,
 
)    chIQGetTimeout(&(ldp)->iqueue, t)

Direct read from a LEDCommDriver with timeout specification.

Note
This function bypasses the indirect access to the channel and reads directly from the input queue. This is faster but cannot be used to read from different channels implementations.
See also
chnGetTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 279 of file ledcomm.h.

#define ldWrite (   ldp,
  b,
 
)    chOQWriteTimeout(&(ldp)->oqueue, b, n, TIME_INFINITE)

Direct blocking write to a LEDCommDriver.

Note
This function bypasses the indirect access to the channel and writes directly to the output queue. This is faster but cannot be used to write from different channels implementations.
See also
chnWrite()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 291 of file ledcomm.h.

#define ldWriteTimeout (   ldp,
  b,
  n,
 
)    chOQWriteTimeout(&(ldp)->oqueue, b, n, t)

Direct blocking write to a LEDCommDriver with timeout specification.

Note
This function bypasses the indirect access to the channel and writes directly to the output queue. This is faster but cannot be used to write to different channels implementations.
See also
chnWriteTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 305 of file ledcomm.h.

#define ldAsynchronousWrite (   ldp,
  b,
 
)    chOQWriteTimeout(&(ldp)->oqueue, b, n, TIME_IMMEDIATE)

Direct non-blocking write to a LEDCommDriver.

Note
This function bypasses the indirect access to the channel and writes directly to the output queue. This is faster but cannot be used to write to different channels implementations.
See also
chnWriteTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 318 of file ledcomm.h.

#define ldRead (   ldp,
  b,
 
)    chIQReadTimeout(&(ldp)->iqueue, b, n, TIME_INFINITE)

Direct blocking read from a LEDCommDriver.

Note
This function bypasses the indirect access to the channel and reads directly from the input queue. This is faster but cannot be used to read from different channels implementations.
See also
chnRead()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 331 of file ledcomm.h.

#define ldReadTimeout (   ldp,
  b,
  n,
 
)    chIQReadTimeout(&(ldp)->iqueue, b, n, t)

Direct blocking read from a LEDCommDriver with timeout specification.

Note
This function bypasses the indirect access to the channel and reads directly from the input queue. This is faster but cannot be used to read from different channels implementations.
See also
chnReadTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 345 of file ledcomm.h.

#define ldAsynchronousRead (   ldp,
  b,
 
)    chIQReadTimeout(&(ldp)->iqueue, b, n, TIME_IMMEDIATE)

Direct non-blocking read from a LEDCommDriver.

Note
This function bypasses the indirect access to the channel and reads directly from the input queue. This is faster but cannot be used to read from different channels implementations.
See also
chnReadTimeout()
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 358 of file ledcomm.h.

Typedef Documentation

Structure representing a LEDComm driver.

Definition at line 195 of file ledcomm.h.

Enumeration Type Documentation

enum ldstate_t

Driver state machine possible states.

Enumerator
LD_UNINIT 

Not initialized.

LD_STOP 

Stopped.

LD_READY 

Ready.

Definition at line 186 of file ledcomm.h.