Pages: [1]   Go Down
Author Topic: Serial receiving and sending  (Read 327 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
{
protected:
  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);



public:
  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


};
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26487
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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:
LIN_SERIAL& serial;// same with this line, what is the function of it?
It's a reference.

Logged

"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.

Pages: [1]   Go Up
Jump to: