DolphinV4 API  1.6.1.0
REMAN Controller Application

REMAN Controller application example files

REMAN Controller Application file - main.c

/************************************************************************-
EVA Board:
EVA300-3
Input PIN:
None
Output PIN:
SCSEDIO_0 indicates that an Air telegram was received
Description:
This example demonstrates how to implement a Remote Management Controller.
This example implements only the QueryID and Action RMC commands. The application
sends a QueryID broadcast and the first device which responds to the broadcast
sends an Action RMC command.
Notes:
The EEP profiles are not used for the Controller.
-************************************************************************/
#include "EO3100I_API.h"
#include "EO3100I_CFG.h"
#include <string.h>
code uint8 VERSION_APP[] = {0xE0,'V','E','R','S','I','O','N',1,0,4,1,'A','R','E','M','A','N','C','O','N','T','R','O','L','L','E','R',0x00,0xE0};
void main()
{
uint16 u16FnNumber;
uint16 u16DataSize;
// Initialize chip
mainInit();
// Send QueryID
u8gRmDataBuffer[0] = 0;
u8gRmDataBuffer[1] = 0;
u8gRmDataBuffer[2] = 0;
reman_sendMessageController(u8gRmDataBuffer, 3, RM_FN_QUERY_ID, MANUFACTURER_ID, BROADCAST_ID, FALSE);
// Send all queued telegrams
// Wait for one QueryID answer that is address to us
do
{
// Receive radio telegram
if (radio_getTelegram(&rTel, &pTel) != OK)
continue;
// Process remote management message
if (reman_receiveTelegramController(&rTel, &pTel, &u16FnNumber, &u16DataSize)!=OK)
continue;
}
while (!(u16FnNumber==RM_FN_QUERY_ID_ANS && misc_isLocalId(&pTel.p_rx.u32DestinationId)));
// Send action command to first device that replied to QueryID
reman_sendMessageController(u8gRmDataBuffer, 0, RM_FN_ACTION_COMMAND, MANUFACTURER_ID, rTel.sys_ex.u32SenderId, FALSE);
// Send all queued telegrams
// Send Ping
reman_sendMessageController(u8gRmDataBuffer, 0, RM_FN_PING_COMMAND, MANUFACTURER_ID, rTel.sys_ex.u32SenderId, FALSE);
// Send all queued telegrams
// Wait for one ping answer that is address to us
do
{
// Receive radio telegram
if (radio_getTelegram(&rTel, &pTel) != OK)
continue;
// Process remote management message
if (reman_receiveTelegramController(&rTel, &pTel, &u16FnNumber, &u16DataSize)!=OK)
continue;
}
while (!(u16FnNumber==RM_FN_PING_COMMAND_ANS && misc_isLocalId(&pTel.p_rx.u32DestinationId)));
// Ping answer received,
io_setDigital(SCSEDIO_0, 1);
while(1);
}



Config file - EO3100I_CFG.h

// Generated on 2013-06-07 13:47:36 by DolphinAPIConfigurator 1.1.0.20
#ifndef _EO3100I_CFG_H_INCLUDED
#define _EO3100I_CFG_H_INCLUDED
void startupInit();
void mainInit();
//*********************REMAN PARAM***************************
#define EEP_ORG 0xFF
#define EEP_FUNC 0x3F
#define EEP_TYPE 0x7F
#define MANUFACTURER_ID 0x7FF
#define RM_BUFF_SIZE 0x14
#define RM_CODE_ADDR 0x7E00
extern uint8 xdata u8gRmDataBuffer[RM_BUFF_SIZE];
extern uint16 code reman_param[];
//*********************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:47:45 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);
reman_init(reman_param, SET_ALL_PARAM);
}
//*********************REMAN PARAM***************************
uint8 xdata u8gRmDataBuffer[RM_BUFF_SIZE];
uint16 code reman_param[] = {
(EEP_ORG<<8) | (EEP_FUNC<<2) | (EEP_TYPE>>5), // IDX_EEP_BYTE0_BYTE1
(EEP_TYPE<<11), // IDX_EEP_BYTE2
MANUFACTURER_ID, // IDX_MANUFACTURERID
RM_BUFF_SIZE, // IDX_BUFF_SIZE
RM_CODE_ADDR, // IDX_CODE_ADDR
50 // IDX_TEL_DELAY
};
//*********************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
0x0E, //IDX_GPIO0_PULL_CONF
0x01, //IDX_GPIO0_DIR
0x00, //IDX_GPIO1_AN
0x00, //IDX_GPIO1_CONF0
0x00, //IDX_GPIO1_CONF1
0x03, //IDX_GPIO1_DIG_CONF
0x00, //IDX_GPIO1_DIR
0xFF, //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 Out None 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 In Up 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