Skip to content

Class Rs485Communication

ClassList > Rs485Communication

Public Functions

Type Name
void configure (uint8_t * transmission_bufer, 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_bufer, 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.

Public Functions Documentation

function configure

configuration for RS485 communication using a 10Mbit/s speed

void Rs485Communication::configure (
    uint8_t * transmission_bufer,
    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 recevied 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

Date:

2024

Author:

Ayoub Farah Hassan [email protected]


function configureCustom

Custom configuration for RS485 communication to choose the communication speed.

void Rs485Communication::configureCustom (
    uint8_t * transmission_bufer,
    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 recevied 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 () 

Remark:

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