Skip to content

Class Rs485Communication

ClassList > Rs485Communication

More...

  • #include <Rs485Communication.h>

Public Functions

Type Name
void configure (uint8_t * transmission_buffer, uint8_t * reception_buffer, uint16_t data_size, void(*)() user_function, rs485_speed_t data_speed=SPEED_10M)
Configuration for RS485 communication using a 10Mbit/s speed.
void configureCustom (uint8_t * transmission_buffer, uint8_t * reception_buffer, uint16_t data_size, void(*)(void) user_function, uint32_t baudrate, bool oversampling_8)
Custom configuration for RS485 communication to choose the communication speed.
void startTransmission ()
Start a transmission i.e. you send what is contained in the transmission buffer.
void turnOffCommunication ()
Turn off the RS485.
void turnOnCommunication ()
Turn on the RS485 communication.

Detailed Description

Static class definition

Public Functions Documentation

function configure

Configuration for RS485 communication using a 10Mbit/s speed.

void Rs485Communication::configure (
    uint8_t * transmission_buffer,
    uint8_t * reception_buffer,
    uint16_t data_size,
    void(*)() user_function,
    rs485_speed_t data_speed=SPEED_10M
) 

Parameters:

  • transmission_buffer Pointer to the transmitted buffer
  • reception_buffer Pointer to the received buffer
  • data_size Size of the sent and received data (in byte)
  • user_function Callback function called when we received data
  • data_speed Transmission speed (by default to 10Mbits/s) SPEED_2M,SPEED_5M,SPEED_10M,SPEED_20M

Warning:

The size of transmission_buffer and reception_buffer must be the same


function configureCustom

Custom configuration for RS485 communication to choose the communication speed.

void Rs485Communication::configureCustom (
    uint8_t * transmission_buffer,
    uint8_t * reception_buffer,
    uint16_t data_size,
    void(*)(void) user_function,
    uint32_t baudrate,
    bool oversampling_8
) 

Parameters:

  • transmission_buffer Pointer to the transmitted buffer
  • reception_buffer Pointer to the received buffer
  • data_size Size of the sent and received data (in byte)
  • user_function Callback function called when we received data
  • baudrate Communication speed in bit/s
  • oversampling_8 True for oversampling (and multiply communication speed by 2), False if you want to keep the normal speed communication

Warning:

The size of transmission_buffer and reception_buffer must be the same


function startTransmission

Start a transmission i.e. you send what is contained in the transmission buffer.

void Rs485Communication::startTransmission () 


function turnOffCommunication

Turn off the RS485.

void Rs485Communication::turnOffCommunication () 


function turnOnCommunication

Turn on the RS485 communication.

void Rs485Communication::turnOnCommunication () 

Warning:

The RS485 is automatically turned on when initializing with configureDefault or configure, no need to call this function



The documentation for this class was generated from the following file docs/core/zephyr/modules/owntech_communication/zephyr/src/Rs485Communication.h