IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2010-11-06 21:03:33 (13 years 4 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 190e8f00827e6b1211caf10d69b565ee8f397f63 |
Message: | Firmware support for CNTR version 3. - common/io.h: describe the role of PROBE_TERM in version 3 - common/io.h (VERSION_ID): renamed to VERSION_ID1 - common/io.h (VERSION_ID2): added P2_0, and described version number encoding - cntr/cntr.h (enum hw_type): added HW_TYPE_V3 - cntr/cntr.c (init_io): decode version 3, flash LED three times, and configure PROBE_TERM according to version |
Files: |
cntr/fw/cntr/cntr.c (3 diffs) cntr/fw/cntr/cntr.h (1 diff) cntr/fw/common/io.h (2 diffs) |
Change Details
cntr/fw/cntr/cntr.c | ||
---|---|---|
22 | 22 | |
23 | 23 | |
24 | 24 | uint8_t cntr[4]; |
25 | enum hw_type hw_type = HW_TYPE_V1; | |
25 | enum hw_type hw_type; | |
26 | 26 | |
27 | 27 | |
28 | 28 | static void delay(unsigned ms) |
... | ... | |
37 | 37 | |
38 | 38 | static void init_io(void) |
39 | 39 | { |
40 | if (VERSION_ID) { | |
41 | /* flash LED a second time */ | |
40 | int i; | |
41 | ||
42 | /* SDCC bug - needs parentheses here */ | |
43 | hw_type = VERSION_ID1 ? | |
44 | (VERSION_ID2 ? HW_TYPE_V2 : HW_TYPE_V3) : | |
45 | HW_TYPE_V1; | |
46 | ||
47 | for (i = HW_TYPE_V1; i != hw_type; i++) { | |
48 | /* flash LED a second or third time */ | |
42 | 49 | LEDv2 = 0; |
43 | 50 | delay(250); |
44 | 51 | LEDv2 = 1; |
45 | 52 | delay(250); |
46 | ||
47 | PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT; | |
48 | ||
49 | hw_type = HW_TYPE_V2; | |
50 | 53 | } |
54 | if (hw_type == HW_TYPE_V2) | |
55 | PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT; | |
51 | 56 | |
52 | 57 | /* |
53 | 58 | * Signal Mode Value |
... | ... | |
70 | 75 | P2 = 0; |
71 | 76 | P3 = 0; |
72 | 77 | |
73 | if (hw_type == HW_TYPE_V2) | |
78 | if (hw_type == HW_TYPE_V2 || hw_type == HW_TYPE_V3) | |
74 | 79 | PROBE_TERM = 1; |
75 | 80 | |
76 | 81 | /* |
cntr/fw/cntr/cntr.h | ||
---|---|---|
25 | 25 | extern enum hw_type { |
26 | 26 | HW_TYPE_V1 = 0, |
27 | 27 | HW_TYPE_V2 = 1, |
28 | HW_TYPE_V3 = 2, | |
28 | 29 | } hw_type; |
29 | 30 | |
30 | 31 | #endif /* !CNTR_H */ |
cntr/fw/common/io.h | ||
---|---|---|
30 | 30 | * |
31 | 31 | * - v1: 100 kOhm termination (not very useful) |
32 | 32 | * - v2: pull-up for input amplifier |
33 | * - v3: 330 Ohm termination | |
33 | 34 | */ |
34 | 35 | |
35 | 36 | #define PROBE_TERM P1_2 |
... | ... | |
40 | 41 | * In version 1, P2_1 is used to provide ground to the input side. In version |
41 | 42 | * 2, we use a ground place for this and P2_1 is unconnected. We can therefore |
42 | 43 | * use it to identify the hardware version. |
44 | * | |
45 | * In version 3, P2_0 is connected to ground. In all other versions, it is | |
46 | * unconnected. | |
47 | * | |
48 | * Board VERSION_ID1 | |
49 | * | VERSION_ID2 | |
50 | * | | | |
51 | * v1 0 Z | |
52 | * v2 Z Z | |
53 | * v3 Z 0 | |
54 | * | |
43 | 55 | */ |
44 | 56 | |
45 | #define VERSION_ID P2_1 | |
57 | #define VERSION_ID1 P2_1 | |
58 | #define VERSION_ID2 P2_0 | |
46 | 59 | |
47 | 60 | #endif /* !IO_H */ |