Data_Type - HomeMadeRobots/Embedded_Software_Cpp_Framework GitHub Wiki

Implementation of Data_Types

Basic_Integer_Types

The Basic_Integer_Types are implemented using the types defined in <stdint.h>.

Basic_Type C++ type
uint8 uint8_t
sint8 int8_t
uint16 uint16_t
sint16 int16_t
uint32 uint32_t
sint32 int32_t
uint64 unt64_t
sint64 int64_t

Basic_Boolean_Type

The Basic_Boolean_Type boolean is implemented using the C++ type bool

Basic_Floating_Point_Type

The Basic_Floating_Point_Types are implemented using the native C++ floating point data types.

Basic_Type C++ type
fp32 float
fp64 double

Enumerated_Data_Type

An Enumerated_Data_Type is implemented using the typedef specifier with the enum keyword.

Example

The following Enumerated_Data_Type :

Enumerated_Data_Type model example

is implemented as follow :

#ifndef E_IO_LEVEL_H
#define E_IO_LEVEL_H

/* Enumerated_Data_Type */
/* Allows to model a data representing the hardware level of a pin. */
typedef enum E_IO_LEVEL {
    IO_LEVEL_HIGH,
    IO_LEVEL_LOW
} E_IO_LEVEL;

#endif

Array_Data_Type

Physical_Data_Type

A Physical_Data_Type is implemented using the typedef specifier. It defines the Physical_Data_Type name as its Based_Data_Type_Ref (a Basic_Integer_Type).

The following Physical_Data_Type:

Physical_Data_Type model example

is implemented as follow :

#ifndef T_VOLTAGE_H
#define T_VOLTAGE_H

#include "stdint.h"

/* Physical_Data_Type */
/*
Allows to model a data representing a voltage with a resolution of 0.004887 V. 
(Typically used to represent a data from 0 to 5 V.)
*/
/*
Unit : V
Resolution : 0.004887
Offset : 0
*/
typedef uint16_t T_VOLTAGE;

#endif

Structured_Data_Type

⚠️ **GitHub.com Fallback** ⚠️