LoraInterface dev
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
#include "E220Module.h"
|
#include "E220Module.h"
|
||||||
#include "BoardCfg.h"
|
#include "BoardCfg.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
#include "Uart.h"
|
||||||
|
#include "ProtocolDefs.h"
|
||||||
|
|
||||||
|
|
||||||
int InitLoraModule()
|
int InitLoraModule()
|
||||||
@@ -24,3 +26,96 @@ int SetLoraModuleConfigMode()
|
|||||||
LORA_MODULE_M1_PIN = 0;
|
LORA_MODULE_M1_PIN = 0;
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ReadLoraModuleConfig()
|
||||||
|
{
|
||||||
|
char Cmd[3]={0xC1,0x00,E220_CONFIG_SIZE};
|
||||||
|
SetLoraModuleConfigMode();
|
||||||
|
Sleep(100);
|
||||||
|
SendInternalUartDataBlocking(Cmd,3,LORA_MODULE_UART_PORT);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ReadLoraModuleRSSI()
|
||||||
|
{
|
||||||
|
char Cmd[6]={0xC0,0xC1,0xC2,0xC3,0x00,0x02};
|
||||||
|
Sleep(100);
|
||||||
|
SendInternalUartDataBlocking(Cmd,6,LORA_MODULE_UART_PORT);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AnalyzeLoraModuleConfigData(char *Data, int size)
|
||||||
|
{
|
||||||
|
char header = Data[0];
|
||||||
|
if(header != (char)0xC1)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
unsigned char StartAddress = Data[1];
|
||||||
|
unsigned char DataLength = Data[2];
|
||||||
|
|
||||||
|
if(DataLength != E220_CONFIG_SIZE)
|
||||||
|
{
|
||||||
|
//This function must be use to analyze all registers.
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
mModuleInternalAddress = Data[3];
|
||||||
|
mModuleInternalAddress <<= 8;
|
||||||
|
mModuleInternalAddress |= Data[4];
|
||||||
|
|
||||||
|
unsigned char Byte2 = Data[5];
|
||||||
|
mModuleAirRate = Byte2 & E220_AIR_RATE_MASK;
|
||||||
|
Byte2 >>= 3;
|
||||||
|
|
||||||
|
mModuleUARTParity = Byte2 & E220_UART_PARITY_MASK;
|
||||||
|
Byte2 >>= 2;
|
||||||
|
|
||||||
|
mModuleUARTRate = Byte2 & E220_UART_RATE_MASK;
|
||||||
|
|
||||||
|
|
||||||
|
unsigned char Byte3 = Data[6];
|
||||||
|
mModuleTxPower = Byte3 & E220_TX_POWER_MASK;
|
||||||
|
Byte3 >>= 5; //Bit 4,3,2 are reserved
|
||||||
|
|
||||||
|
mModuleRSSIEnabled = Byte3 & 0x01;
|
||||||
|
Byte3 >>= 1;
|
||||||
|
|
||||||
|
mModuleSubPacket = Byte3 & E220_PACKET_SIZE_MASK;
|
||||||
|
|
||||||
|
|
||||||
|
mModuleInternalChannel = Data[7];
|
||||||
|
|
||||||
|
unsigned char Byte5 = Data[8];
|
||||||
|
mModuleWORCycle = Byte5 & E220_WOR_CYCLE_MASK;
|
||||||
|
Byte5 >>= 4; //Bit 3 is reserved
|
||||||
|
|
||||||
|
mModuleLBTEnabled = Byte5 & 0x01;
|
||||||
|
Byte5 >>= 2; //Bit 5 is reserved
|
||||||
|
|
||||||
|
mModuleTxMethod = Byte5 & 0x01;
|
||||||
|
Byte5 >>= 1;
|
||||||
|
|
||||||
|
mModuleRSSIByteEnabled = Byte5 & 0x01;
|
||||||
|
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int AnalyzeLoraModuleRSSI(char *Data, int size)
|
||||||
|
{
|
||||||
|
char header = Data[0];
|
||||||
|
if(header != (char)0xC1)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
char StartAddress = Data[1];
|
||||||
|
char Size = Data[2];
|
||||||
|
|
||||||
|
mModuleAmbientRSSI = Data[3];
|
||||||
|
if(Size == (char)2)
|
||||||
|
{
|
||||||
|
mModuleLastRxRSSI = Data[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,11 +9,101 @@
|
|||||||
#define E220_MODULE_H
|
#define E220_MODULE_H
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
|
|
||||||
|
#define E220_CONFIG_SIZE 6 //Nb of bytes composing the configuration of the module
|
||||||
|
|
||||||
|
#define E220_UART_RATE_MASK 0x07
|
||||||
|
enum eE220UartRates
|
||||||
|
{
|
||||||
|
E220_UART_1200 = 0,
|
||||||
|
E220_UART_2400,
|
||||||
|
E220_UART_4800,
|
||||||
|
E220_UART_9600,
|
||||||
|
E220_UART_19200,
|
||||||
|
E220_UART_38400,
|
||||||
|
E220_UART_57600,
|
||||||
|
E220_UART_115200
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#define E220_UART_PARITY_MASK 0x03
|
||||||
|
enum eE220ParityBit
|
||||||
|
{
|
||||||
|
E220_UART_8N1=0,
|
||||||
|
E220_UART_8O1,
|
||||||
|
E220_UART_8E1,
|
||||||
|
E220_UART_8N1_bis
|
||||||
|
};
|
||||||
|
|
||||||
|
#define E220_AIR_RATE_MASK 0x07
|
||||||
|
enum e220AirDataRates
|
||||||
|
{
|
||||||
|
E220_AIR_RATE_24K = 0,
|
||||||
|
E220_AIR_RATE_24K_1,
|
||||||
|
E220_AIR_RATE_24K_2,
|
||||||
|
E220_AIR_RATE_48K,
|
||||||
|
E220_AIR_RATE_96K,
|
||||||
|
E220_AIR_RATE_192K,
|
||||||
|
E220_AIR_RATE_384K,
|
||||||
|
E220_AIR_RATE_625K
|
||||||
|
};
|
||||||
|
|
||||||
|
#define E220_PACKET_SIZE_MASK 0x03
|
||||||
|
enum e220PacketSizes
|
||||||
|
{
|
||||||
|
E220_PACKET_200,
|
||||||
|
E220_PACKET_128,
|
||||||
|
E220_PACKET_64,
|
||||||
|
E220_PACKET_32
|
||||||
|
};
|
||||||
|
|
||||||
|
#define E220_TX_POWER_MASK 0x03
|
||||||
|
enum e220TransmitPower
|
||||||
|
{
|
||||||
|
E220_TX_PWR_30,
|
||||||
|
E220_TX_PWR_27,
|
||||||
|
E220_TX_PWR_24,
|
||||||
|
E220_TX_PWR_21
|
||||||
|
};
|
||||||
|
|
||||||
|
#define E220_WOR_CYCLE_MASK 0x07
|
||||||
|
enum e220WORCycles
|
||||||
|
{
|
||||||
|
E220_WOR_500MS,
|
||||||
|
E220_WOR_1000MS,
|
||||||
|
E220_WOR_1500MS,
|
||||||
|
E220_WOR_2000MS,
|
||||||
|
E220_WOR_2500MS,
|
||||||
|
E220_WOR_3000MS,
|
||||||
|
E220_WOR_3500MS,
|
||||||
|
E220_WOR_4000MS
|
||||||
|
};
|
||||||
|
|
||||||
int InitLoraModule();
|
int InitLoraModule();
|
||||||
|
|
||||||
int SetLoraModuleTxMode();
|
int SetLoraModuleTxMode();
|
||||||
int SetLoraModuleConfigMode();
|
int SetLoraModuleConfigMode();
|
||||||
|
int ReadLoraModuleConfig();
|
||||||
|
int AnalyzeLoraModuleConfigData(char *Data, int size);
|
||||||
|
int ReadLoraModuleRSSI();
|
||||||
|
int AnalyzeLoraModuleRSSI(char *Data, int size);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
unsigned short mModuleInternalAddress;
|
||||||
|
unsigned char mModuleUARTParity;
|
||||||
|
unsigned char mModuleUARTRate;
|
||||||
|
unsigned char mModuleAirRate;
|
||||||
|
unsigned char mModuleSubPacket;
|
||||||
|
unsigned char mModuleRSSIEnabled;
|
||||||
|
unsigned char mModuleTxPower;
|
||||||
|
unsigned char mModuleInternalChannel;
|
||||||
|
unsigned char mModuleRSSIByteEnabled;
|
||||||
|
unsigned char mModuleTxMethod;
|
||||||
|
unsigned char mModuleLBTEnabled;
|
||||||
|
unsigned char mModuleWORCycle;
|
||||||
|
|
||||||
|
unsigned char mModuleAmbientRSSI;
|
||||||
|
unsigned char mModuleLastRxRSSI;
|
||||||
|
|
||||||
#endif /* E220_MODULE_H */
|
#endif /* E220_MODULE_H */
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,20 @@
|
|||||||
#include "Uart.h"
|
#include "Uart.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
short mModuleModel;
|
short mModuleModel;
|
||||||
|
|
||||||
|
|
||||||
int InitLoraInterface()
|
int InitLoraInterface()
|
||||||
{
|
{
|
||||||
mModuleModel = LORA_MODULE_MODEL;
|
mModuleModel = LORA_MODULE_MODEL;
|
||||||
|
InitLoraModule();
|
||||||
SetLoraModuleTxMode();
|
SetLoraModuleTxMode();
|
||||||
|
LoraResetRxStateMachine();
|
||||||
|
|
||||||
return RET_OK;
|
LoraInterfaceRequestModuleConfig();
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoraInterfaceRxData(char Data)
|
int LoraInterfaceRxData(char Data)
|
||||||
@@ -25,6 +30,7 @@ int LoraInterfaceRxData(char Data)
|
|||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Analyze data coming from lora module COM port
|
||||||
int LoraRxStateMachine(char Data, int Event)
|
int LoraRxStateMachine(char Data, int Event)
|
||||||
{
|
{
|
||||||
switch(mLoraRxSMState)
|
switch(mLoraRxSMState)
|
||||||
@@ -47,7 +53,7 @@ int LoraRxStateMachine(char Data, int Event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LORA_RX_SM_RECEIVING_STATE:
|
case LORA_RX_SM_RECEIVING_STATE: //Receiving wireless data from remote device
|
||||||
{
|
{
|
||||||
switch(Event)
|
switch(Event)
|
||||||
{
|
{
|
||||||
@@ -68,6 +74,46 @@ int LoraRxStateMachine(char Data, int Event)
|
|||||||
{
|
{
|
||||||
SendNetworkCommand(LORA_IF_NEW_FRAME_RESPONSE,mLoraModuleBuffer,mBufferIndex);
|
SendNetworkCommand(LORA_IF_NEW_FRAME_RESPONSE,mLoraModuleBuffer,mBufferIndex);
|
||||||
LoraResetRxStateMachine();
|
LoraResetRxStateMachine();
|
||||||
|
LoraInterfaceRequestModuleRSSI();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LORA_RX_SM_CONFIG_STATE: //we are waiting for answer from module command
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case LORA_RX_SM_NEW_DATA_EVENT:
|
||||||
|
{
|
||||||
|
mLoraModuleBuffer[mBufferIndex++] = Data;
|
||||||
|
TimerStart(LORA_MODULE_COMM_TIMER,LORA_RX_INTERBYTE_TIMEOUT);
|
||||||
|
if(mBufferIndex >= MAX_LORA_BUFFER_SIZE)
|
||||||
|
{
|
||||||
|
//TODO: Manage the exception with the MasterCtrl.
|
||||||
|
LoraResetRxStateMachine();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LORA_RX_SM_TICK_EVENT:
|
||||||
|
{
|
||||||
|
if(IsTimerExpired(LORA_MODULE_COMM_TIMER))
|
||||||
|
{
|
||||||
|
switch(mLastConfigCommand)
|
||||||
|
{
|
||||||
|
case LORA_CONFIG_READ_CONFIG_CMD:
|
||||||
|
{
|
||||||
|
SetLoraModuleTxMode();
|
||||||
|
AnalyzeLoraModuleConfigData(mLoraModuleBuffer,mBufferIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LORA_CONFIG_READ_RSSI_CMD:
|
||||||
|
{
|
||||||
|
AnalyzeLoraModuleRSSI(mLoraModuleBuffer,mBufferIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LoraResetRxStateMachine();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -90,10 +136,11 @@ int LoraInterfaceTransmitLoRaData(char *Payload, unsigned int PayloadSize)
|
|||||||
{
|
{
|
||||||
//TODO: Manage this...
|
//TODO: Manage this...
|
||||||
|
|
||||||
// return LORA_IF_RET_BUSY_CHANNEL;
|
return LORA_IF_RET_BUSY_CHANNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendInternalUartDataBlocking(Payload,PayloadSize,LORA_MODULE_UART_PORT);
|
SendInternalUartDataBlocking(Payload,PayloadSize,LORA_MODULE_UART_PORT);
|
||||||
|
TimerStart(LORA_MODULE_COMM_TIMER,LORA_RX_INTERBYTE_TIMEOUT);
|
||||||
|
|
||||||
return LORA_IF_RET_OK;
|
return LORA_IF_RET_OK;
|
||||||
}
|
}
|
||||||
@@ -102,3 +149,27 @@ void LoraInterfaceTick()
|
|||||||
{
|
{
|
||||||
LoraRxStateMachine(0,LORA_RX_SM_TICK_EVENT);
|
LoraRxStateMachine(0,LORA_RX_SM_TICK_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoraInterfaceRequestModuleConfig()
|
||||||
|
{
|
||||||
|
mLoraRxSMState = LORA_RX_SM_CONFIG_STATE;
|
||||||
|
ReadLoraModuleConfig();
|
||||||
|
mLastConfigCommand = LORA_CONFIG_READ_CONFIG_CMD;
|
||||||
|
TimerStart(LORA_MODULE_COMM_TIMER,LORA_RX_INTERBYTE_TIMEOUT);
|
||||||
|
}
|
||||||
|
void LoraInterfaceRequestModuleRSSI()
|
||||||
|
{
|
||||||
|
mLoraRxSMState = LORA_RX_SM_CONFIG_STATE;
|
||||||
|
ReadLoraModuleRSSI();
|
||||||
|
mLastConfigCommand = LORA_CONFIG_READ_RSSI_CMD;
|
||||||
|
TimerStart(LORA_MODULE_COMM_TIMER,LORA_RX_INTERBYTE_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
int LoraInterfaceIsBusy()
|
||||||
|
{
|
||||||
|
if(mLoraRxSMState != LORA_RX_SM_STANBY_STATE)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#ifndef LORA_INTERFACE_H
|
#ifndef LORA_INTERFACE_H
|
||||||
#define LORA_INTERFACE_H
|
#define LORA_INTERFACE_H
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
|
#include "E220Module.h"
|
||||||
|
|
||||||
#define MAX_LORA_BUFFER_SIZE 2048
|
#define MAX_LORA_BUFFER_SIZE 2048
|
||||||
#define LORA_RX_INTERBYTE_TIMEOUT 200 //ms
|
#define LORA_RX_INTERBYTE_TIMEOUT 200 //ms
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
int mLoraRxSMState;
|
int mLoraRxSMState;
|
||||||
char mLoraModuleBuffer[MAX_LORA_BUFFER_SIZE];
|
char mLoraModuleBuffer[MAX_LORA_BUFFER_SIZE];
|
||||||
int mBufferIndex;
|
int mBufferIndex;
|
||||||
|
int mLastConfigCommand;
|
||||||
|
|
||||||
enum eLoraModuleModel
|
enum eLoraModuleModel
|
||||||
{
|
{
|
||||||
@@ -26,10 +28,11 @@ enum eLoraModuleModel
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eLoraRxSMStates
|
enum eLoraNetworkRxSMStates
|
||||||
{
|
{
|
||||||
LORA_RX_SM_STANBY_STATE,
|
LORA_RX_SM_STANBY_STATE,
|
||||||
LORA_RX_SM_RECEIVING_STATE,
|
LORA_RX_SM_RECEIVING_STATE,
|
||||||
|
LORA_RX_SM_CONFIG_STATE,
|
||||||
|
|
||||||
LORA_RX_SM_MAX_STATE
|
LORA_RX_SM_MAX_STATE
|
||||||
};
|
};
|
||||||
@@ -52,6 +55,14 @@ enum eLoraInterfaceStatusCodes
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eLoraConfigCmds
|
||||||
|
{
|
||||||
|
LORA_CONFIG_READ_CONFIG_CMD,
|
||||||
|
LORA_CONFIG_READ_RSSI_CMD,
|
||||||
|
|
||||||
|
LORA_CONFIG_MAX_CMD
|
||||||
|
};
|
||||||
|
|
||||||
#define LORA_MODULE_MODEL LORA_MODULE_E220_MODEL
|
#define LORA_MODULE_MODEL LORA_MODULE_E220_MODEL
|
||||||
|
|
||||||
int InitLoraInterface();
|
int InitLoraInterface();
|
||||||
@@ -60,6 +71,9 @@ int LoraRxStateMachine(char Data, int Event);
|
|||||||
void LoraResetRxStateMachine();
|
void LoraResetRxStateMachine();
|
||||||
int LoraInterfaceTransmitLoRaData(char *Payload, unsigned int PayloadSize);
|
int LoraInterfaceTransmitLoRaData(char *Payload, unsigned int PayloadSize);
|
||||||
void LoraInterfaceTick();
|
void LoraInterfaceTick();
|
||||||
|
void LoraInterfaceRequestModuleConfig();
|
||||||
|
void LoraInterfaceRequestModuleRSSI();
|
||||||
|
int LoraInterfaceIsBusy();
|
||||||
|
|
||||||
|
|
||||||
#endif /* LORA_MODULE_H */
|
#endif /* LORA_MODULE_H */
|
||||||
|
|||||||
@@ -27,16 +27,38 @@ unsigned int mTotalMasterNbRequests = 0;
|
|||||||
|
|
||||||
void ExecuteMasterCommand(int Command, unsigned char *Data, int DataSize)
|
void ExecuteMasterCommand(int Command, unsigned char *Data, int DataSize)
|
||||||
{
|
{
|
||||||
//Whatever was the command, we are online...
|
if(LoraInterfaceIsBusy() == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
mTotalMasterNbRequests++;
|
mTotalMasterNbRequests++;
|
||||||
switch(Command)
|
switch(Command)
|
||||||
{
|
{
|
||||||
case LORA_IF_GET_STATUS_REQUEST:
|
case LORA_IF_GET_STATUS_REQUEST:
|
||||||
{
|
{
|
||||||
char ModuleModel = LORA_MODULE_MODEL;
|
char Payload[20];
|
||||||
|
|
||||||
SendNetworkCommand(LORA_IF_GET_STATUS_RESPONSE,&ModuleModel,1);
|
char temp;
|
||||||
|
|
||||||
|
Payload[0] = LORA_MODULE_MODEL;
|
||||||
|
temp = (char)(mModuleInternalAddress & 0xFF);
|
||||||
|
Payload[2] = temp;
|
||||||
|
temp = (char)((mModuleInternalAddress >> 8) & 0xFF);
|
||||||
|
Payload[1] = temp;
|
||||||
|
Payload[3] = mModuleUARTParity;
|
||||||
|
Payload[4] = mModuleUARTRate;
|
||||||
|
Payload[5] = mModuleAirRate;
|
||||||
|
Payload[6] = mModuleSubPacket;
|
||||||
|
Payload[7] = mModuleRSSIEnabled;
|
||||||
|
Payload[8] = mModuleTxPower;
|
||||||
|
Payload[9] = mModuleInternalChannel;
|
||||||
|
Payload[10] = mModuleRSSIByteEnabled;
|
||||||
|
Payload[11] = mModuleTxMethod;
|
||||||
|
Payload[12] = mModuleLBTEnabled;
|
||||||
|
Payload[13] = mModuleWORCycle;
|
||||||
|
Payload[14] = mModuleAmbientRSSI;
|
||||||
|
Payload[15] = mModuleLastRxRSSI;
|
||||||
|
|
||||||
|
SendNetworkCommand(LORA_IF_GET_STATUS_RESPONSE,Payload,16);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LORA_IF_SEND_FRAME_REQUEST:
|
case LORA_IF_SEND_FRAME_REQUEST:
|
||||||
@@ -84,7 +106,7 @@ void SendNetworkCommand(int Command, unsigned char *Data, unsigned int DataSize)
|
|||||||
{
|
{
|
||||||
unsigned char *Payload;
|
unsigned char *Payload;
|
||||||
unsigned int PayloadSize;
|
unsigned int PayloadSize;
|
||||||
Payload = ProtocolGetFrame(ID_MASTER,MASTER_ADDRESS,ID_LORA_INTERFACE,Command,Data,DataSize,0,&PayloadSize);
|
Payload = ProtocolGetFrame(ID_MASTER,MASTER_ADDRESS,ID_LORA_INTERFACE_DEVICE,Command,Data,DataSize,0,&PayloadSize);
|
||||||
|
|
||||||
UartTransmitData(NETWORK_UART_PORT,Payload,PayloadSize);
|
UartTransmitData(NETWORK_UART_PORT,Payload,PayloadSize);
|
||||||
|
|
||||||
@@ -95,7 +117,7 @@ void SendNetworkCommandBlocking(int Command, unsigned char *Data, unsigned int D
|
|||||||
unsigned char *Payload;
|
unsigned char *Payload;
|
||||||
unsigned int PayloadSize;
|
unsigned int PayloadSize;
|
||||||
//unsigned char DestDevice,unsigned char DestAddress, unsigned char SenderDevice, unsigned char Cmd, unsigned char *Data,unsigned int Size,unsigned char Flags, int *FrameSize)
|
//unsigned char DestDevice,unsigned char DestAddress, unsigned char SenderDevice, unsigned char Cmd, unsigned char *Data,unsigned int Size,unsigned char Flags, int *FrameSize)
|
||||||
Payload = ProtocolGetFrame(ID_MASTER,MASTER_ADDRESS,ID_LORA_INTERFACE,Command,Data,DataSize,0,&PayloadSize);
|
Payload = ProtocolGetFrame(ID_MASTER,MASTER_ADDRESS,ID_LORA_INTERFACE_DEVICE,Command,Data,DataSize,0,&PayloadSize);
|
||||||
|
|
||||||
SendInternalUartDataBlocking(Payload,PayloadSize,NETWORK_UART_PORT);
|
SendInternalUartDataBlocking(Payload,PayloadSize,NETWORK_UART_PORT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ unsigned char Flags = 0;
|
|||||||
unsigned char IsUpdating = 0;
|
unsigned char IsUpdating = 0;
|
||||||
unsigned char *BmpDataPtr = 0;
|
unsigned char *BmpDataPtr = 0;
|
||||||
|
|
||||||
static char MyDeviceID = ID_LORA_INTERFACE;
|
static char MyDeviceID = ID_LORA_INTERFACE_DEVICE;
|
||||||
|
|
||||||
void ProtocolInit(void)
|
void ProtocolInit(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ enum DEVICES_IDS
|
|||||||
ID_AVRECEIVER_INTERFACE,
|
ID_AVRECEIVER_INTERFACE,
|
||||||
ID_CHALET_INTERFACE,
|
ID_CHALET_INTERFACE,
|
||||||
ID_CHALET_DEVICE,
|
ID_CHALET_DEVICE,
|
||||||
ID_BOOTLOADER_VIRTUAL,
|
ID_ISPINDEL_INTERFACE,
|
||||||
ID_LORA_INTERFACE,
|
ID_LORA_INTERFACE_DEVICE,
|
||||||
|
ID_LORA_INTERFACE_INTERFACE,
|
||||||
ID_NB_DEVICE_ID
|
ID_NB_DEVICE_ID
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -375,4 +376,14 @@ enum LORA_INTERFACE_CMDS
|
|||||||
MAX_LORA_IF_CMD
|
MAX_LORA_IF_CMD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum LORA_MODULE_IF_INTERFACE_CMDS
|
||||||
|
{
|
||||||
|
LORA_MODULE_IF_INTERFACE_ACK = 1,
|
||||||
|
LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_REQUEST,
|
||||||
|
LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_RESPONSE,
|
||||||
|
|
||||||
|
|
||||||
|
MAX_LORA_MODULE_IF_INTERFACE_CMD
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Binary file not shown.
-4322
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+2107
-2002
File diff suppressed because it is too large
Load Diff
+719
-677
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
#Tue Mar 21 14:58:27 EDT 2023
|
#Tue Mar 21 16:04:54 EDT 2023
|
||||||
ChaletDuinoV2_795F512H_.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.33\\bin
|
ChaletDuinoV2_795F512H_.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.33\\bin
|
||||||
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.33\\bin
|
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.33\\bin
|
||||||
proj.dir=D\:\\Main\\PicDev\\Projets\\LoraInterface\\LoraInterface.X
|
proj.dir=D\:\\Main\\PicDev\\Projets\\LoraInterface\\LoraInterface.X
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user