User Tools

Site Tools


robots:hako:firmware:welcome

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
robots:hako:firmware:welcome [2012/09/26 17:48]
karina [Mainboard - Software - Notation - Types and prefixes]
robots:hako:firmware:welcome [2021/08/14 04:21] (current)
Line 73: Line 73:
 ==== Mainboard - Software - Notation - Types and prefixes ==== ==== Mainboard - Software - Notation - Types and prefixes ====
    
 +  * [[robots:hako:firmware:welcome#Recommended unambiguous type definitions and prefixes|Unordered List ItemTypes/prefixes]] 
 +  * [[robots:hako:firmware:welcome#Type definition (typedef) prefixes|Typedef prefixes]]
 +  * [[robots:hako:firmware:welcome#Definition prefixes|Definition prefixes]] 
 +  * [[robots:hako:firmware:welcome#Modifier prefixes|Modifier refixes]] 
 +  * [[robots:hako:firmware:welcome#Area of validity prefixes|Validity prefixes]] 
 +  * [[robots:hako:firmware:welcome#Examples|Examples]]
 +
 +
 Header file: "xll_stwtypes.h" Header file: "xll_stwtypes.h"
  
Line 79: Line 87:
 That is why STW introduced unambiguous types like 'uint16' to avoid confusions in future. That is why STW introduced unambiguous types like 'uint16' to avoid confusions in future.
  
-**Recommended unambiguous type definitions and prefixes**+== Recommended unambiguous type definitions and prefixes ==
  
  
-^STW type^Prefix^ Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^+^STW type^Prefix^Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^
 |uint8 |u8_ |8 bit |0x00 .. 0xFF|0 .. 255|unsigned char| |uint8 |u8_ |8 bit |0x00 .. 0xFF|0 .. 255|unsigned char|
 |sint8 |s8_ |8 bit |0x80 .. 0x7F|-128 .. +127|signed char| |sint8 |s8_ |8 bit |0x80 .. 0x7F|-128 .. +127|signed char|
Line 95: Line 103:
 |float80|f80_|80 bit|[ ≈ ±2<sup>-16382</sup> .. ±2<sup>16383</sup> ]|0, ≈ ±3.362E-4932 .. ±1.190E+4932 (decimal places 18..19)|long double (SW: IEEE-754) double extended precision| |float80|f80_|80 bit|[ ≈ ±2<sup>-16382</sup> .. ±2<sup>16383</sup> ]|0, ≈ ±3.362E-4932 .. ±1.190E+4932 (decimal places 18..19)|long double (SW: IEEE-754) double extended precision|
    
 +
 <html> <html>
 <b><span style="color:red;">Not recommended</span> mistakable NATIVE type definitions (PLATFORM DEPENDENT!)</b> <b><span style="color:red;">Not recommended</span> mistakable NATIVE type definitions (PLATFORM DEPENDENT!)</b>
Line 100: Line 109:
        
        
-^STW type^Prefix^ Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^ + 
-|charn|cn_ |8 bit|0x80 .. 0x7F|-128 .. +127|char| +^STW type^Prefix^Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^ 
-|uintn|un_ |32 bit| 0x00000000 .. 0xFFFFFFFF|0 .. 4294967295|unsigned int| +|charn|cn_|8 bit |0x80 .. 0x7F|-128 .. +127|char| 
-|sintn|sn_ |32 bit| 0x80000000 .. 0x7FFFFFFF|-2147483648 .. +2147483647| signed int|+|uintn|un_|32 bit| 0x00000000 .. 0xFFFFFFFF|0 .. 4294967295|unsigned int| 
 +|sintn|sn_|32 bit| 0x80000000 .. 0x7FFFFFFF|-2147483648 .. +2147483647| signed int|
  
 <html> <html>
 <b><span style="color:red;">Not recommended</span> mistakeable COMPATIBILTY type definitions</b> <b><span style="color:red;">Not recommended</span> mistakeable COMPATIBILTY type definitions</b>
 </html>  </html> 
 +
 +^STW type^Prefix^Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^
 +|boolean|q_|C: 1 bit, C++: 8 |0x00:FALSE / (!=0x00):TRUE|0:FALSE / (!=0):TRUE|C: _bit (TC1796), C++: bool|
 +|int8 |i8_ |8 bit |0x80 .. 0x7F | -128 .. +127|(signed) char|
 +|int16|i16_|16 bit|0x8000 .. 0x7FFF|-32768 .. +32767|(signed) short int|
 +|int32|i32_|32 bit|0x80000000 .. 0x7FFFFFFF|-2147483648 .. +2147483647|(signed) long int|
 +|int64|i64_|64 bit|0x8000000000000000 .. 0x7FFFFFFFFFFFFFFF|-9223372036854775808 .. +9223372036854775807|(signed) long long int|
 +
 +
 +== Type definition (typedef) prefixes ==
 +^Prefix^Example^Description^
 +|T_|typedef struct { ... } T_Struct;|type definition for structure (or bitfield) |
 +|U_|typedef union { ... } U_Union;|type definition for union|
 +|E_|typedef enum { ... } E_Enum;|type definition for enum |
 +|PR_|typedef void (*PR_Function)( const uint8 ou8_Parameter );| type definition for function pointer|
 +
 +== Definition prefixes ==
 +^Prefix^Example^Description^
 +|t_|T_Struct t_Struct;| structure (or bitfield)|
 +|u_|U_Union u_Union;| union |
 +|e_|E_Enum e_Enum;| enum |
 +|pr_|PR_Function pr_FunctionPointer;| function pointer|
 +|pv_|void *pv_VoidPointer;|void pointer|
 +|s_|charn s_Text[3]="12";|zero ('\0') terminated string|
 +
 +
 +
 +== Modifier prefixes ==
 +^Prefix^Example^Description^
 +|p<type prefix>|uint8 *pu8_Example; |pointer of type|
 +|a<type prefix>|uint8 au8_Example[4];| array of type|
 +
 +== Area of validity prefixes ==
 +^Prefix^Example^Description^
 +|g<type prefix>| uint8 gu8_Global; |global|
 +|m<type prefix>| static uint8 mu8_ModuleGlobal; |module global (static inside file)|
 +|h<type prefix>| static uint8 hu8_Example; |local static (static inside function - hold)|
 +|o<type prefix>| void Callback( const uint8 ou8_Parameter ); |function parameter (operand)|
 +
 +== Examples ==
 +
 +<sxh c>
 +//Prefix examples
 +/* local variable sint16 */ 
 +sint16 s16_VariableName;
 +
 +/* function internal array of pointers to uint8 with MAX_MESSAGES elements */ 
 +uint8 *apu8_Messages[MAX_MESSAGES];
 +
 +/* Module global variable of type uint32 */ 
 +static uint32 mu32_Index;
 +
 +/* typedef for structure */ 
 +typedef struct 
 +
 +{
 +uint8 u8_Element1;
 +uint32 *pu32_Element2; 
 +} T_StructType;
 +
 +/* modul globale pointer to structure defined by typdedef */ 
 +static T_StructType *mpt_PointerToMyStructType;
 +
 +/* function internal used structure */ 
 +T_StructType t_MyStructObject;
 +
 +/* module global structure variable */ 
 +static T_StructType mt_MyStruct;
 +
 +/* typedef for function pointer for a module 'DigIN' */ 
 +typedef void (*PR_DIN_CallBack)(const uint8 ou8_Parameter);
 +
 +/* global function pointer in module 'DigIN' */ 
 +PR_DIN_CallBack gpr_DIN_CallBack;
 +</sxh>
 +
 +
 +
robots/hako/firmware/welcome.1348674503.txt.gz · Last modified: 2021/08/14 04:20 (external edit)