Go Down

Topic: Serial receiving and sending (Read 349 times) previous topic - next topic


Dear all,

I have few questions about  serial functions in arduino, they are highlighted in code:

#define LIN_SERIAL            HardwareSerial  // if LIN_SERIAL is defined as hardware serial  then I cannot  define UART anymore as hardware serial for teensy?
class Lin
 void serialBreak(void);
 // For Lin 1.X "start" should = 0, for Lin 2.X "start" should be the addr byte.
 static uint8_t dataChecksum(const uint8_t* message, char nBytes,uint16_t start=0);
 static uint8_t addrParity(uint8_t addr);

 Lin(LIN_SERIAL& ser=Serial,uint8_t txPin=1); //ser=serial what this means in Arduino, ?
 LIN_SERIAL& serial;// same with this line, what is the function of it?
 uint8_t txPin;               //  isnt that pin allready defined by board
 int     serialSpd;           //  in bits/sec. Also called baud rate
 uint8_t serialOn;            //  whether the serial port is "begin"ed or "end"ed.  Optimization so we don't begin twice.
 unsigned long int timeout;   //  How long to wait for a slave to fully transmit when doing a "read".  You can modify this after calling "begin"
 void begin(int speed);

 // Send a message right now, ignoring the schedule table.
 void send(uint8_t addr, const uint8_t* message,uint8_t nBytes,uint8_t =2); //how is the send function defined in arduino?

 // Receive a message right now, returns 0xff if good checksum, # bytes received (including checksum) if checksum is bad.
 uint8_t recv(uint8_t addr, uint8_t* message, uint8_t nBytes,uint8_t proto=2); // how is the recv function working in arduino, can I use Arduino alternatives for this line to recievce all bytes from bus



ser=serial what this means in Arduino, ?

The same as it means in C++.
"ser" is a reference to a "LIN_SERIAL" object, and its default value is the "Serial" object.

Code: [Select]
LIN_SERIAL& serial;// same with this line, what is the function of it?
It's a reference.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131