This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
robots:hako:firmware:welcome [2012/09/26 17:37] karina [Mainboard - Software - Notation - Types and prefixes] |
robots:hako:firmware:welcome [2012/09/26 18:45] karina [Mainboard - Software - Notation - Types and prefixes] |
||
---|---|---|---|
Line 73: | Line 73: | ||
==== Mainboard - Software - Notation - Types and prefixes ==== | ==== Mainboard - Software - Notation - Types and prefixes ==== | ||
+ | * Unordered List ItemTypes/ | ||
+ | * Typedef prefixes | ||
+ | * Definition prefixes | ||
+ | * Modifier refixes | ||
+ | * Validity prefixes | ||
+ | * [[robots: | ||
+ | |||
+ | |||
Header file: " | Header file: " | ||
Line 82: | Line 90: | ||
- | ^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< | |float80|f80_|80 bit|[ ≈ ±2< | ||
- | < | + | |
- | < | + | < |
- | </ | + | < |
+ | </ | ||
- | ^STW type ^Prefix^ Size^ Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^ | + | |
- | |charn|cn_ |8 bit |0x80 .. 0x7F| -128 .. +127|char| | + | |
- | |uintn|un_ |32 bit| 0x00000000 .. 0xFFFFFFFF|0 .. 4294967295|unsigned int| | + | ^STW type^Prefix^Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^ |
- | |sintn|sn_ |32 bit| 0x80000000 .. 0x7FFFFFFF|-2147483648 .. +2147483647| signed int| | + | |charn|cn_|8 bit |0x80 .. 0x7F|-128 .. +127|char| |
+ | |uintn|un_|32 bit| 0x00000000 .. 0xFFFFFFFF|0 .. 4294967295|unsigned int| | ||
+ | |sintn|sn_|32 bit| 0x80000000 .. 0x7FFFFFFF|-2147483648 .. +2147483647| signed int| | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | ^STW type^Prefix^Size^Range (hexadecimal - HEX)^Range (decimal - DEC)^C equivalent^ | ||
+ | |boolean|q_|C: | ||
+ | |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; | ||
+ | |U_|typedef union { ... } U_Union; | ||
+ | |E_|typedef enum { ... } E_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; | ||
+ | |pv_|void *pv_VoidPointer; | ||
+ | |s_|charn s_Text[3]=" | ||
+ | |||
+ | |||
+ | |||
+ | **Modifier prefixes** | ||
+ | ^Prefix^Example^Description^ | ||
+ | |p<type prefix> | ||
+ | |a<type prefix> | ||
+ | |||
+ | **Area of validity prefixes** | ||
+ | ^Prefix^Example^Description^ | ||
+ | |g<type prefix>| uint8 gu8_Global; |global| | ||
+ | |m<type prefix>| static uint8 mu8_ModuleGlobal; | ||
+ | |h<type prefix>| static uint8 hu8_Example; | ||
+ | |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 ' | ||
+ | typedef void (*PR_DIN_CallBack)(const uint8 ou8_Parameter); | ||
+ | |||
+ | /* global function pointer in module ' | ||
+ | PR_DIN_CallBack gpr_DIN_CallBack; | ||
+ | </ | ||
+ | |||
- | |