VivicoreSerial library
Macros | Enumerations
CommunicationProtocol.h File Reference

Communication protocol definitions for VIVIWARE Cell Branch and Custom. More...

#include <inttypes.h>

Go to the source code of this file.

Macros

#define BLE_PROTOCOL_MAJOR_VERSION   (uint8_t)(0x07)
 BLE communication protocol major version. More...
 
#define BLE_PROTOCOL_MINOR_VERSION   (uint8_t)(0x00)
 BLE communication protocol minor version. More...
 
#define NUM_MAX_BLE_PKT   (20)
 Maximum packet size for BLE communication protocol. More...
 
#define NUM_MAX_BLE_PKT_BODY   (NUM_MAX_BLE_PKT - 2)
 Maximum body size on a packet for BLE communication protocol. More...
 
#define UART_PROTOCOL_MAJOR_VERSION   (uint8_t)(0x07)
 UART communication protocol major version. More...
 
#define UART_PROTOCOL_MINOR_VERSION   (uint8_t)(0x00)
 UART communication protocol minor version. More...
 
#define UART_PROTOCOL_BAUDRATE   (50000)
 Baudrate for UART communication protocol. More...
 
#define NUM_MAX_UART_PKT_BODY_DATA   (NUM_MAX_BLE_PKT_BODY)
 Maximum data size on a packet for UART communication protocol. More...
 
#define NUM_MAX_UART_PKT_BODY   (NUM_MAX_UART_PKT_BODY_DATA + 2)
 Maximum body size on a packet for UART communication protocol. More...
 
#define NUM_MAX_UART_PKT   (NUM_MAX_UART_PKT_BODY + 3)
 Maximum packet size for UART communication protocol. More...
 
#define NUM_MAX_DC   (16)
 Maximum number of DC info in a Branch.
 

Enumerations

enum  BranchId_t {
  BRANCH_ID_BROADCAST = 0x00 , BRANCH_ID_ALL = BRANCH_ID_BROADCAST , BRANCH_ID_ROOT = 0x01 , BRANCH_ID_2 = 0x02 ,
  BRANCH_ID_3 = 0x03 , BRANCH_ID_4 = 0x04 , BRANCH_ID_5 = 0x05 , BRANCH_ID_MAX = BRANCH_ID_5 ,
  BRANCH_ID_IGNORED = 0xFF
}
 Branch ID. More...
 
enum  ChipType_t { CHIP_TYPE_ATMEGA_328P = 0x00 , CHIP_TYPE_ATMEGA_328PB = 0x01 }
 Microcontroller chip types on Branch. More...
 

Detailed Description

Communication protocol definitions for VIVIWARE Cell Branch and Custom.

Macro Definition Documentation

◆ BLE_PROTOCOL_MAJOR_VERSION

#define BLE_PROTOCOL_MAJOR_VERSION   (uint8_t)(0x07)

BLE communication protocol major version.

The major version should be incremented if any of the following changes is applied.

  • New BLE services/characteristics are added
  • Any of the BLE services/characteristics is removed and it influences the behavior
  • Any of the BLE characteristics permission is changed and it influences the behavior
  • Internal structure and/or member of packet for any command is added, removed, or changed, which influences the total system behavior

◆ BLE_PROTOCOL_MINOR_VERSION

#define BLE_PROTOCOL_MINOR_VERSION   (uint8_t)(0x00)

BLE communication protocol minor version.

The minor version should be incremented if any of the following changes is applied.

  • Internal structure and/or member of packet for any command is added, removed, or changed

◆ NUM_MAX_BLE_PKT

#define NUM_MAX_BLE_PKT   (20)

Maximum packet size for BLE communication protocol.

The packet for BLE communication protocol is constructed with HEADER and BODY. This size includes all of them.

◆ NUM_MAX_BLE_PKT_BODY

#define NUM_MAX_BLE_PKT_BODY   (NUM_MAX_BLE_PKT - 2)

Maximum body size on a packet for BLE communication protocol.

This size is equivalent to the size excluding HEADER of ACMD size (1) and Branch ID size (1) from NUM_MAX_BLE_PKT.

◆ NUM_MAX_UART_PKT

#define NUM_MAX_UART_PKT   (NUM_MAX_UART_PKT_BODY + 3)

Maximum packet size for UART communication protocol.

The packet for UART communication protocol is constructed with HEADER, BODY, and FOOTER. This size includes all of HEADER, BODY, and FOOTER. This is equivalent to the size appending HEADER of STX size (1) and data length size (1), and FOOTER of CRC (1) to NUM_MAX_UART_PKT_BODY.

◆ NUM_MAX_UART_PKT_BODY

#define NUM_MAX_UART_PKT_BODY   (NUM_MAX_UART_PKT_BODY_DATA + 2)

Maximum body size on a packet for UART communication protocol.

The packet for UART communication protocol is constructed with HEADER, BODY, and FOOTER. This size includes only BODY. This is equivalent to the size appending BCMD size (1) and Branch ID size (1) to NUM_MAX_UART_PKT_BODY_DATA.

◆ NUM_MAX_UART_PKT_BODY_DATA

#define NUM_MAX_UART_PKT_BODY_DATA   (NUM_MAX_BLE_PKT_BODY)

Maximum data size on a packet for UART communication protocol.

The packet for UART communication protocol is constructed with HEADER (STX + data length), BODY (BCMD + Branch ID + data), and FOOTER (CRC). This size includes BODY which excludes BCMD and Branch ID. This is equivalent to NUM_MAX_BLE_PKT_BODY.

◆ UART_PROTOCOL_BAUDRATE

#define UART_PROTOCOL_BAUDRATE   (50000)

Baudrate for UART communication protocol.

This is baudrate of UART to communicate between Core and Branch.

◆ UART_PROTOCOL_MAJOR_VERSION

#define UART_PROTOCOL_MAJOR_VERSION   (uint8_t)(0x07)

UART communication protocol major version.

The major version should be incremented if any of the following changes is applied.

  • Any of the UART configuration like baudrate is changed and it influences the behavior

◆ UART_PROTOCOL_MINOR_VERSION

#define UART_PROTOCOL_MINOR_VERSION   (uint8_t)(0x00)

UART communication protocol minor version.

The minor version should be incremented if any of the following changes is applied.

  • The internal structure and/or member of packet for any command is added, removed, or changedh

Enumeration Type Documentation

◆ BranchId_t

enum BranchId_t

Branch ID.

This ID is assigned to the connected branches. ID 1 is for the nearest one to Core. ID 5 is maximum number and farthest from Core.

Enumerator
BRANCH_ID_BROADCAST 

ID for broadcasting (e.g. used for discovery command)

BRANCH_ID_ALL 

Equivalent to BRANCH_ID_BROADCAST

BRANCH_ID_ROOT 

ID for the nearest one to Core

BRANCH_ID_2 

ID for second one

BRANCH_ID_3 

ID for third one

BRANCH_ID_4 

ID for fourth one

BRANCH_ID_5 

ID for farthest one

◆ ChipType_t

enum ChipType_t

Microcontroller chip types on Branch.

Enumerator
CHIP_TYPE_ATMEGA_328P 

ATmega328P (deprecated)

CHIP_TYPE_ATMEGA_328PB 

ATmega328PB