nexpaq / SerialInterface

Fork of SerialInterface by Greg Steiert

Embed: (wiki syntax)

« Back to documentation index

SerialInterface Class Reference

SerialInterface Class Reference

Serial Interface Library, Provides utilities for remotely accessing peripherals. More...

#include <SerialInterface.h>

Public Types

enum  PINTi2cArgs { IA_CNT = 0, IA_ADD, IA_DATA, IA_RDDA }
 

Name the I2C arguments.

More...

Public Member Functions

 SerialInterface (I2C *i2c, SPI *spi, DigitalInOut *gpio, AnalogIn *ain)
 Create a SerialInterface interface.
void call (char *input, char *output)
 Process URI encoded commands.

Detailed Description

Serial Interface Library, Provides utilities for remotely accessing peripherals.

Example:

 // Configure board to pass UART signals to peripheral connector.

 #include "SerialInterface.h"

 I2C i2c(P3_4, P3_5);
 SPI spi(P5_1, P5_2, P5_0);
 DigitalInOut gpio[] = {P5_3, P5_4, P5_5, P5_6, P3_0, P3_1, P3_2, P3_3};
 AnalogIn ain[] = {AIN_0, AIN_1, AIN_2, AIN_3, AIN_4, AIN_5, AIN_6, AIN_7};
 
 SerialInterface serInt(i2c, spi, gpio, ain);

 int main() {
    char ibuf[256];
    char obuf[256];
    while(1) {
        scanf("%s", ibuf);
        serInt.call(ibuf, obuf);
        printf("%s=", ibuf);
        printf("%s\n", obuf);
 }

Definition at line 39 of file SerialInterface.h.


Member Enumeration Documentation

Name the I2C arguments.

Enumerator:
IA_CNT 

Argument Count.

IA_ADD 

Device Address.

IA_DATA 

Data, Read = # bytes to read, Write = first data byte.

IA_RDDA 

Read Data, data to write prior to read.

Definition at line 52 of file SerialInterface.h.


Constructor & Destructor Documentation

SerialInterface ( I2C *  i2c,
SPI *  spi,
DigitalInOut *  gpio,
AnalogIn *  ain 
)

Create a SerialInterface interface.

Definition at line 8 of file SerialInterface.cpp.


Member Function Documentation

void call ( char *  input,
char *  output 
)

Process URI encoded commands.

Parameters:
inputa pointer to the string containing the command
outputa pointer to the string to write the result

Definition at line 209 of file SerialInterface.cpp.