From b24866225a6301d3a663f874725e83c012dc25d3 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:36:00 +0100 Subject: digital/beacon: add bitcloud stack into common directory digital/zigbit --- .../HAL/avr/atmega1281/rcb230/src/halUid.c | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/rcb230/src/halUid.c (limited to 'digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/rcb230/src/halUid.c') diff --git a/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/rcb230/src/halUid.c b/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/rcb230/src/halUid.c new file mode 100644 index 00000000..21976ce9 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/rcb230/src/halUid.c @@ -0,0 +1,87 @@ +/**************************************************************************//** + \file halUid.c + + \brief Implementation of UID interface. + + \author + Atmel Corporation: http://www.atmel.com \n + Support email: avr@atmel.com + + Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. + Licensed under Atmel's Limited License Agreement (BitCloudTM). + + \internal + History: + 7/12/07 A. Khromykh - Created + ******************************************************************************/ +/****************************************************************************** + * WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK. * + * EXPERT USERS SHOULD PROCEED WITH CAUTION. * + ******************************************************************************/ + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Types section +******************************************************************************/ +/** \brief uid type. */ +typedef union +{ + uint64_t uid; + uint8_t array[sizeof(uint64_t)]; +} HalUid_t; + +/****************************************************************************** + Global variables section +******************************************************************************/ +static HalUid_t halUid = {.uid = 0ull}; + +/****************************************************************************** + Implementations section +******************************************************************************/ +/****************************************************************************** + Reads uid from external spi eeprom at25010a. +******************************************************************************/ +void halReadUid(void) +{ + uint8_t command = 0x03; + uint8_t address = 0; + uint8_t itr; + + GPIO_RF_RST_make_out(); + GPIO_RF_RST_clr(); + GPIO_SPI_CS_clr(); + + HAL_WriteByteRfSpi(command); + HAL_WriteByteRfSpi(address); + for (itr=0; itr