DolphinV4 API  1.6.1.0
ADT Sensor





Application file - main.c

#include "EO3100I_API.h"
#include "EO3100I_CFG.h"
/************************************************************************-
EVA Board:
EVA300-3
Input PIN:
none
Outputs PIN:
ADIO_7
is toggled if addressed to this module(destinationID == chipID)
Description:
Demonstrates a sensor which waits for a telegram with its address (ADT).
If the received destination ID (address)is the same than the chip ID then
an 1BS telegram (without ADT) is replied.
Notes:
Adopt the sensor ID list (u32SensorId[]) to your hardware IDs!
Read the help file Examples/Adt Adress Destination Telegram for more informations
See FAQ on how to obtain chipIDs.
************************************************************************/
#define led_on(); io_setDigital(ADIO_7,1);
#define led_off(); io_setDigital(ADIO_7,0);
code uint8 VERSION_APP[] = {0xE0,'V','E','R','S','I','O','N',1,0,1,1,'A','A','D','T','S','E','N','S','O','R',0x00,0xE0};
void main()
{
TEL_RADIO_TYPE2 rTelRx, rTelTx;
TEL_PARAM_TYPE2 pTelRx, pTelTx;
uint32 u32MyId;
uint32 *pID;
uint8 u8SrcIdLength;
uint8 u8DstIdLength;
mainInit();
misc_getId(&u32MyId); // read chip ID
radio_enableRx(1); // Activate Rx radio
// Header: Only 32 bit Originator-ID, no extended Header, 1BS telegram
// SourceID: set to 0x0000000, will be replaced in radio_sendTelegram() by the Module ID
rTelTx.raw.bytes[1] = 0; // Id
rTelTx.raw.bytes[2] = 0; // Id
rTelTx.raw.bytes[3] = 0; // Id
rTelTx.raw.bytes[4] = 0; // Id
// Data
rTelTx.raw.bytes[5] = 0x09; // Any sensor DATA
// Length
rTelTx.raw.u8Length = 7;
pTelTx.p_tx.u8SubTelNum = 3; // send 3 sub tel
while (1)
{
// Received telegram?
if (radio_getTelegram2(&rTelRx,&pTelRx) != OK)
continue;
// Get the telegram ID
pID = (uint32*)misc_getID2(&rTelRx, &u8SrcIdLength, &u8DstIdLength);
// Destiantion ID corresponds to sensor ID?
if (u8DstIdLength == 4 && *(pID+1) == u32MyId)
{
led_on(); // Indicate this situation with the LED
while (radio_sendTelegram2(&rTelTx, &pTelTx)==BUFF_FULL); // Send telegram
time_wait(100); // keep LEDs on some time
led_off();
}
}
}



Config file - EO3100I_CFG.h

// Generated on 2013-05-28 16:26:27 by DolphinAPIConfigurator 1.1.0.6
#ifndef _EO3100I_CFG_H_INCLUDED
#define _EO3100I_CFG_H_INCLUDED
void startupInit();
void mainInit();
//*********************RADIO PARAM***************************
#define RADIO_BUFF_NUM 10
#define RADIO_MATURITY_TIME 100
extern volatile RADIO_BUFFER_TYPE xdata gRadioBuff[RADIO_BUFF_NUM];
//*********************FILTER PARAM***************************
#define FILTER_NUM 1
extern volatile uint32 xdata u32gFilterValue[FILTER_NUM];
extern volatile uint8 xdata u8gFilterCfg[FILTER_NUM];
//*********************IO PARAM******************************
extern uint8 code io_param[];
#endif //_EO3100I_CFG_H_INCLUDED



Config file - EO3100I_CFG.c

// Generated on 2013-06-07 13:12:13 by DolphinAPIConfigurator 1.1.0.20
#include "EO3100I_API.h"
#include "EO3100I_CFG.h"
//*********************API INIT***************************
//Note: Function is called from startup.a51. Global variables are not yet initialized!
void startupInit()
{
io_init(io_param);
}
void mainInit()
{
radio_init(RADIO_BUFF_NUM, RADIO_MATURITY_TIME);
}
//*********************RADIO PARAM***************************
volatile RADIO_BUFFER_TYPE xdata gRadioBuff[RADIO_BUFF_NUM];
//*********************FILTER PARAM***************************
volatile uint32 xdata u32gFilterValue[FILTER_NUM];
volatile uint8 xdata u8gFilterCfg[FILTER_NUM];
//*********************IO PARAM******************************
uint8 code io_param[] = {
0x07, //IDX_GPIO_CONF
0x00, //IDX_GPIO0_CONF
0x0F, //IDX_GPIO0_PULL_CONF
0x00, //IDX_GPIO0_DIR
0x00, //IDX_GPIO1_AN
0x00, //IDX_GPIO1_CONF0
0x00, //IDX_GPIO1_CONF1
0x03, //IDX_GPIO1_DIG_CONF
0x80, //IDX_GPIO1_DIR
0x7F, //IDX_GPIO1_PULL
0x0C, //IDX_GPIO2_CONF
0x00, //IDX_GPIO2_DIR
0x00, //IDX_GPIO0
0x00, //IDX_GPIO1
0x00, //IDX_GPIO2
};
// I/O Configuration overview
//
// Pin : Interface Direction Pull InitValue Interrupt
// SCSEDIO0 : Digital I/O In Up 0 No
// SCLKDIO1 : Digital I/O In Up 0 No
// WSDADIO2 : Digital I/O In Up 0 No
// RSDADIO3 : Digital I/O In Up 0 No
// ADIO0 : Digital I/O In Up 0 No
// ADIO1 : Digital I/O In Up 0 No
// ADIO2 : Digital I/O In Up 0 No
// ADIO3 : Digital I/O In Up 0 No
// ADIO4 : Digital I/O In Up 0 No
// ADIO5 : Digital I/O In Up 0 No
// ADIO6 : Digital I/O In Up 0 No
// ADIO7 : Digital I/O Out None 0 No
// WXIDIO : Digital I/O In Up 0 No
// WXODIO : Digital I/O In Up 0 No
// WAKE0 : Digital I/O In None 0 No
// WAKE1 : Digital I/O In None 0 No