UDPversion

Dependencies:   XBee mbed NetServicesMin

Committer:
recotana
Date:
Sun Apr 15 10:49:08 2012 +0000
Revision:
1:3a46d2725374
Parent:
0:84a3b029656e

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
recotana 0:84a3b029656e 1 /*----------------------------------------------------------------------------*/
recotana 0:84a3b029656e 2 /* File Information */
recotana 0:84a3b029656e 3 /*----------------------------------------------------------------------------*/
recotana 0:84a3b029656e 4 /* Name : types.h */
recotana 0:84a3b029656e 5 /* Type : C Programming Language Header */
recotana 0:84a3b029656e 6 /*----------------------------------------------------------------------------*/
recotana 0:84a3b029656e 7 /*----------------------------------------------------------------------------*/
recotana 0:84a3b029656e 8
recotana 0:84a3b029656e 9 #ifndef __TYPES_H__
recotana 0:84a3b029656e 10 #define __TYPES_H__
recotana 0:84a3b029656e 11
recotana 0:84a3b029656e 12 #include "stdint.h"
recotana 0:84a3b029656e 13 /*
recotana 0:84a3b029656e 14 typedef char int8_t;
recotana 0:84a3b029656e 15 typedef unsigned char uint8_t;
recotana 0:84a3b029656e 16 typedef signed short int16_t;
recotana 0:84a3b029656e 17 typedef unsigned short uint16_t;
recotana 0:84a3b029656e 18 typedef signed int int32_t;
recotana 0:84a3b029656e 19 typedef unsigned int uint32_t;
recotana 0:84a3b029656e 20 typedef signed long long int64_t;
recotana 0:84a3b029656e 21 typedef unsigned long long uint64_t;
recotana 0:84a3b029656e 22 */
recotana 0:84a3b029656e 23 //typedef bool bool_t;
recotana 0:84a3b029656e 24 typedef enum{TRUE, FALSE} bool_t;
recotana 0:84a3b029656e 25
recotana 0:84a3b029656e 26 //=========================================================================
recotana 0:84a3b029656e 27 // byte bit access
recotana 0:84a3b029656e 28 //=========================================================================
recotana 0:84a3b029656e 29 typedef union{ // BYTE/NIBBLE/BIT access
recotana 0:84a3b029656e 30 uint8_t byte; // Byte access
recotana 0:84a3b029656e 31 struct{ // Nibble access
recotana 0:84a3b029656e 32 uint8_t lo : 4; // lower(Bit0 - 3)
recotana 0:84a3b029656e 33 uint8_t hi : 4; // upper(Bit4 - 7)
recotana 0:84a3b029656e 34 }nibble;
recotana 0:84a3b029656e 35 struct{ // Bit access
recotana 0:84a3b029656e 36 uint8_t b0 : 1; // Bit0
recotana 0:84a3b029656e 37 uint8_t b1 : 1; // Bit1
recotana 0:84a3b029656e 38 uint8_t b2 : 1; // Bit2
recotana 0:84a3b029656e 39 uint8_t b3 : 1; // Bit3
recotana 0:84a3b029656e 40 uint8_t b4 : 1; // Bit4
recotana 0:84a3b029656e 41 uint8_t b5 : 1; // Bit5
recotana 0:84a3b029656e 42 uint8_t b6 : 1; // Bit6
recotana 0:84a3b029656e 43 uint8_t b7 : 1; // Bit7
recotana 0:84a3b029656e 44 }bits;
recotana 0:84a3b029656e 45 }byte_t;
recotana 0:84a3b029656e 46
recotana 0:84a3b029656e 47 //=========================================================================
recotana 0:84a3b029656e 48 // word bit access
recotana 0:84a3b029656e 49 //=========================================================================
recotana 0:84a3b029656e 50 typedef union{ // WORD/BYTE/NIBBLE/BIT access
recotana 0:84a3b029656e 51 uint16_t word; // Word access
recotana 0:84a3b029656e 52 struct{ // Byte access
recotana 0:84a3b029656e 53 uint8_t b0; // upper byte
recotana 0:84a3b029656e 54 uint8_t b1; // lower byte
recotana 0:84a3b029656e 55 }byte;
recotana 0:84a3b029656e 56 struct { // Nibble access
recotana 0:84a3b029656e 57 uint8_t n0 : 4; // lower byte low(Bit 0 - 3)
recotana 0:84a3b029656e 58 uint8_t n1 : 4; // lower byte up (Bit 4 - 7)
recotana 0:84a3b029656e 59 uint8_t n2 : 4; // upper byte low(Bit 8 - 11)
recotana 0:84a3b029656e 60 uint8_t n3 : 4; // upper byte up (Bit12 - 15)
recotana 0:84a3b029656e 61 }nibble;
recotana 0:84a3b029656e 62 struct{ // Bit acces
recotana 0:84a3b029656e 63 uint8_t b0 : 1; // Bit0
recotana 0:84a3b029656e 64 uint8_t b1 : 1; // Bit1
recotana 0:84a3b029656e 65 uint8_t b2 : 1; // Bit2
recotana 0:84a3b029656e 66 uint8_t b3 : 1; // Bit3
recotana 0:84a3b029656e 67 uint8_t b4 : 1; // Bit4
recotana 0:84a3b029656e 68 uint8_t b5 : 1; // Bit5
recotana 0:84a3b029656e 69 uint8_t b6 : 1; // Bit6
recotana 0:84a3b029656e 70 uint8_t b7 : 1; // Bit7
recotana 0:84a3b029656e 71 uint8_t b8 : 1; // Bit8
recotana 0:84a3b029656e 72 uint8_t b9 : 1; // Bit9
recotana 0:84a3b029656e 73 uint8_t b10: 1; // Bit10
recotana 0:84a3b029656e 74 uint8_t b11: 1; // Bit11
recotana 0:84a3b029656e 75 uint8_t b12: 1; // Bit12
recotana 0:84a3b029656e 76 uint8_t b13: 1; // Bit13
recotana 0:84a3b029656e 77 uint8_t b14: 1; // Bit14
recotana 0:84a3b029656e 78 uint8_t b15: 1; // Bit15
recotana 0:84a3b029656e 79 }bits;
recotana 0:84a3b029656e 80 }word_t;
recotana 0:84a3b029656e 81
recotana 0:84a3b029656e 82
recotana 0:84a3b029656e 83 //=========================================================================
recotana 0:84a3b029656e 84 // ascii code
recotana 0:84a3b029656e 85 //=========================================================================
recotana 0:84a3b029656e 86 #define Z_NUL (0x00)
recotana 0:84a3b029656e 87 #define Z_SOH (0x01)
recotana 0:84a3b029656e 88 #define Z_STX (0x02)
recotana 0:84a3b029656e 89 #define Z_ETX (0x03)
recotana 0:84a3b029656e 90 #define Z_EOT (0x04)
recotana 0:84a3b029656e 91 #define Z_ENQ (0x05)
recotana 0:84a3b029656e 92 #define Z_ACK (0x06)
recotana 0:84a3b029656e 93 #define Z_BEL (0x07)
recotana 0:84a3b029656e 94
recotana 0:84a3b029656e 95 #define Z_BS (0x08)
recotana 0:84a3b029656e 96 #define Z_HT (0x09)
recotana 0:84a3b029656e 97 #define Z_LF (0x0A)
recotana 0:84a3b029656e 98 #define Z_HM (0x0B)
recotana 0:84a3b029656e 99 #define Z_FF (0x0C)
recotana 0:84a3b029656e 100 #define Z_CR (0x0D)
recotana 0:84a3b029656e 101 #define Z_SO (0x0E)
recotana 0:84a3b029656e 102 #define Z_SI (0x0F)
recotana 0:84a3b029656e 103
recotana 0:84a3b029656e 104 #define Z_DLE (0x10)
recotana 0:84a3b029656e 105 #define Z_DC1 (0x11)
recotana 0:84a3b029656e 106 #define Z_DC2 (0x12)
recotana 0:84a3b029656e 107 #define Z_DC3 (0x13)
recotana 0:84a3b029656e 108 #define Z_DC4 (0x14)
recotana 0:84a3b029656e 109 #define Z_NAK (0x15)
recotana 0:84a3b029656e 110 #define Z_SYN (0x16)
recotana 0:84a3b029656e 111 #define Z_ETB (0x17)
recotana 0:84a3b029656e 112
recotana 0:84a3b029656e 113
recotana 0:84a3b029656e 114 #endif /* __TYPES_H__*/