コード例 #1
0
int T_TX_InterfaceSerial::getDeviceSpeed ()/*{{{*/
{
  int speed = baudRateToSpeed (baudRate);
  if (speed < 0)
    speed = baudRateToSpeed (getDefaultBaudRate ());
  return speed;
}
コード例 #2
0
ファイル: RN2483.cpp プロジェクト: coredump-ch/watertemp
/**
* @brief Sends a serial line break to wake up the RN2483
*/
void RN2483::wakeUp()
{
   // "emulate" break condition
    _RN2483.send_break();
    // set baudrate
    _RN2483.baud(getDefaultBaudRate());
    _RN2483.putc((uint8_t)0x55);
}
コード例 #3
0
ファイル: RN2483.cpp プロジェクト: coredump-ch/watertemp
/**
* @brief Create a new instance of the RN2483.
* @param Serial TX pin name.
* @param Serial RX pin name.
*/
RN2483::RN2483(PinName tx, PinName rx) :
    _RN2483(tx, rx, getDefaultBaudRate()),
    inputBufferSize(DEFAULT_INPUT_BUFFER_SIZE),
    receivedPayloadBufferSize(DEFAULT_RECEIVED_PAYLOAD_BUFFER_SIZE),
    packetReceived(false),
    isRN2903(false)
{
#ifdef USE_DYNAMIC_BUFFER
    this->isBufferInitialized = false;
#endif
}
コード例 #4
0
void T_TX_InterfaceSerial::setDeviceSpeed (int speed)/*{{{*/
{
  if ((speed >= 0) && (speed < nNumBaudrates))
  {
    baudRate = anBaudRates[speed];
  }
  else
  {
    baudRate = getDefaultBaudRate();
  }
}
コード例 #5
0
void Sodaq_RN2483::wakeUp()
{
    debugPrintLn("[wakeUp]");

    // "emulate" break condition
    this->loraStream->flush();
    this->loraStream->end();
    this->loraStream->begin(300);
    this->loraStream->write((uint8_t)0x00);
    this->loraStream->flush();
    this->loraStream->end();

    // set baudrate
    this->loraStream->begin(getDefaultBaudRate());
    this->loraStream->write((uint8_t)0x55);
    this->loraStream->flush();
}
コード例 #6
0
int T_TX_InterfaceSerial::init (SimpleXMLTransfer *config)/*{{{*/
{
  DEBUG ("int T_TX_InterfaceSerial::init (SimpleXMLTransfer *config)\n");

  // Initialize the port settings
  SimpleXMLTransfer *port=config->getChild (getXmlChildName ()+".port", true);
  portName = port->getString ("name", DEFAULT_PORT_NAME);
  baudRate = port->getInt ("baudrate", getDefaultBaudRate ());
  // Initialize the subsystems
  if (mixer->init (config, getXmlChildName ())!=0)
  {
    setErrMsg("Mixer initialization failed.");
    return 1;
  }
  calib->init (config, getXmlChildName ());
  map->init (config, getXmlChildName ());

  try
  {
    // Try-Methode?
    ostringstream options;
    options << portName << "," << baudRate;
    string optionString=options.str ();
    cout << "Opening the serial port with option string " << optionString << endl;
    charDevice=new SerialCharDevice (optionString.c_str (), false);
  }
  catch (CharDevice::ConfigureDeviceException e)
  {
    setErrMsg ("The device could not be configured.");
    cerr << "Serial interface initialization: " << getErrMsg () << endl;
    return 1;
  }

  cout << "Serial interface initialization: OK" << endl;
  return 0;
}