summaryrefslogtreecommitdiff
path: root/digital/zigbit/common/uid.c
diff options
context:
space:
mode:
Diffstat (limited to 'digital/zigbit/common/uid.c')
-rw-r--r--digital/zigbit/common/uid.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/digital/zigbit/common/uid.c b/digital/zigbit/common/uid.c
index 6ecc8ce9..9f8bff42 100644
--- a/digital/zigbit/common/uid.c
+++ b/digital/zigbit/common/uid.c
@@ -26,13 +26,27 @@
/* This function returns the UID of the device according to the mapping of F5 F6 F7 F8*/
#include "uid.h"
+#include <util/delay.h>
/* APBTeam static zigbit device list */
-static DeviceType_t apbeam_zigbit_table[APBTEAM_MAX_ZIGBIT_DEVICES] =
+static zigbit_definition_s apbeam_zigbit_table[APBTEAM_MAX_ZIGBIT_DEVICES] =
{
- DEVICE_TYPE_COORDINATOR,
- DEVICE_TYPE_END_DEVICE,
- DEVICE_TYPE_END_DEVICE
+ {0 ,DEVICE_TYPE_COORDINATOR ,ZIGBIT_BEACON},
+ {1 ,DEVICE_TYPE_ROUTER ,ZIGBIT_BEACON},
+ {2 ,DEVICE_TYPE_ROUTER ,ZIGBIT_BEACON},
+ {3 ,DEVICE_TYPE_ROUTER ,ZIGBIT_BEACON},
+ {4 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {5 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {6 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {7 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {8 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {9 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {10 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {11 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {12 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {13 ,DEVICE_TYPE_ROUTER ,ZIGBIT_NOT_DEFINED},
+ {14 ,DEVICE_TYPE_ROUTER ,ZIGBIT_DONGLE},
+ {15 ,DEVICE_TYPE_ROUTER ,ZIGBIT_DONGLE},
};
/* This function returns the UID of the device according to the mapping of F5 F6 F7 F8*/
@@ -46,6 +60,8 @@ uint16_t get_uid(void)
/* F4 -> F7 configured as input */
DDRF = 0x00;
+ _delay_ms(10);
+
if(PINF&0x20) //PINF5
value &= 0xF7;
@@ -59,14 +75,20 @@ uint16_t get_uid(void)
value &= 0xFE;
/* Nothing connected */
- if(PINF&0xFF)
- value &=0xF0;
-
+// if(PINF&0xFF)
+// value &=0xF0;
+
return value;
}
/* This function returns the device type */
DeviceType_t get_device_type(uint16_t uid)
{
- return apbeam_zigbit_table[uid];
+ return apbeam_zigbit_table[uid].type;
+}
+
+/* This function returns the device functionnaly */
+TFunctionnality get_device_functionnality(uint16_t uid)
+{
+ return apbeam_zigbit_table[uid].func;
}