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