mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-25 16:15:55 +02:00
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
This commit is contained in:
parent
10b4b51e4f
commit
190e8f0082
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
uint8_t cntr[4];
|
||||
enum hw_type hw_type = HW_TYPE_V1;
|
||||
enum hw_type hw_type;
|
||||
|
||||
|
||||
static void delay(unsigned ms)
|
||||
@ -37,17 +37,22 @@ static void delay(unsigned ms)
|
||||
|
||||
static void init_io(void)
|
||||
{
|
||||
if (VERSION_ID) {
|
||||
/* flash LED a second time */
|
||||
int i;
|
||||
|
||||
/* SDCC bug - needs parentheses here */
|
||||
hw_type = VERSION_ID1 ?
|
||||
(VERSION_ID2 ? HW_TYPE_V2 : HW_TYPE_V3) :
|
||||
HW_TYPE_V1;
|
||||
|
||||
for (i = HW_TYPE_V1; i != hw_type; i++) {
|
||||
/* flash LED a second or third time */
|
||||
LEDv2 = 0;
|
||||
delay(250);
|
||||
LEDv2 = 1;
|
||||
delay(250);
|
||||
|
||||
PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT;
|
||||
|
||||
hw_type = HW_TYPE_V2;
|
||||
}
|
||||
if (hw_type == HW_TYPE_V2)
|
||||
PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT;
|
||||
|
||||
/*
|
||||
* Signal Mode Value
|
||||
@ -70,7 +75,7 @@ static void init_io(void)
|
||||
P2 = 0;
|
||||
P3 = 0;
|
||||
|
||||
if (hw_type == HW_TYPE_V2)
|
||||
if (hw_type == HW_TYPE_V2 || hw_type == HW_TYPE_V3)
|
||||
PROBE_TERM = 1;
|
||||
|
||||
/*
|
||||
|
@ -25,6 +25,7 @@ extern uint8_t cntr[4];
|
||||
extern enum hw_type {
|
||||
HW_TYPE_V1 = 0,
|
||||
HW_TYPE_V2 = 1,
|
||||
HW_TYPE_V3 = 2,
|
||||
} hw_type;
|
||||
|
||||
#endif /* !CNTR_H */
|
||||
|
@ -30,6 +30,7 @@
|
||||
*
|
||||
* - v1: 100 kOhm termination (not very useful)
|
||||
* - v2: pull-up for input amplifier
|
||||
* - v3: 330 Ohm termination
|
||||
*/
|
||||
|
||||
#define PROBE_TERM P1_2
|
||||
@ -40,8 +41,20 @@
|
||||
* In version 1, P2_1 is used to provide ground to the input side. In version
|
||||
* 2, we use a ground place for this and P2_1 is unconnected. We can therefore
|
||||
* use it to identify the hardware version.
|
||||
*
|
||||
* In version 3, P2_0 is connected to ground. In all other versions, it is
|
||||
* unconnected.
|
||||
*
|
||||
* Board VERSION_ID1
|
||||
* | VERSION_ID2
|
||||
* | |
|
||||
* v1 0 Z
|
||||
* v2 Z Z
|
||||
* v3 Z 0
|
||||
*
|
||||
*/
|
||||
|
||||
#define VERSION_ID P2_1
|
||||
#define VERSION_ID1 P2_1
|
||||
#define VERSION_ID2 P2_0
|
||||
|
||||
#endif /* !IO_H */
|
||||
|
Loading…
Reference in New Issue
Block a user