DolphinV4 API  1.6.1.0
Light control



Application file - main.c

#include "EO3100I_API.h"
#include "EO3100I_CFG.h"
/************************************************************************-
EVA Board:
EVA300-3
Input PIN:
Output PIN:
ADIO_7 Pin to control the light
Description:
These examples shows how to control an output pin when a RPS telegram
is received.
Notes:
You can use the RemoteControl example to send the RPS telegrams that
control this application.
-************************************************************************/
#include <stdio.h>
// ------------------------------------------------------------------
code uint8 VERSION_APP[] = {0xE0,'V','E','R','S','I','O','N',
1,0,0,0, // change APP Version here
'A',
'L','I','G','H','T','C','O','N','T','R','O','L', // change APP Description here (max. 15 chars)
0x00,0xE0};
// ------------------------------------------------------------------
void main()
{
uint8 *pID;
uint8 *pData;
uint8 u8SrcIdLength;
uint8 u8DstIdLength;
mainInit();
//enable radio
while(1)
{
// Receive telegram
if(radio_getTelegram2(&rTel2, &pTel2) != OK)
continue;
// Check the RORG
continue;
// Get the telegram ID pointer and lengths
pID = misc_getID2(&rTel2, &u8SrcIdLength, &u8DstIdLength);
if(pID == NULL)
continue;
// Calculate the pointer to data, for more information check the EnOcean Radio Protocol 2 (ERP2) Specification
pData = pID + u8SrcIdLength + u8DstIdLength;
// RPS telegram received
if(*pData == 0x70)
{
io_setDigital(ADIO_7, 1);
}
else if(*pData == 0x50)
{
io_setDigital(ADIO_7, 0);
}
}
}



Config file - EO3100I_CFG.h

// Generated on 2013-06-18 14:10:36 by DolphinAPIConfigurator 1.1.0.32
#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-18 14:10:19 by DolphinAPIConfigurator 1.1.0.32
#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