Skip to content

Commit 68c0714

Browse files
Optimized code structure, naming in Arduino style.
1 parent 2d4e2d8 commit 68c0714

File tree

94 files changed

+1585
-1603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1585
-1603
lines changed

cores/asr650x/board/src/asr_board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static const double TWO52[2]={
458458

459459

460460

461-
void BoardInitMcu( void )
461+
void boardInitMcu( void )
462462
{
463463
SpiInit();
464464
Asr_Timer_Init();

cores/asr650x/cores/AT_Command.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ enum eDeviceState_Lora
3030
};
3131

3232

33-
void Enable_AT(void);
33+
void enableAt(void);
3434
void getDevParam(void);
3535
void printDevParam(void);
36-
void SaveNetInfo(uint8_t *joinpayload, uint16_t size);
37-
void SaveUpCnt(void);
38-
void SaveDownCnt(void);
39-
void GetNetInfo(void);
40-
void SaveDr(void);
41-
bool CheckNetInfo(void);
42-
void NetInfoDisable(void);
43-
extern bool AT_user_check(char * cmd, char * content);
36+
void saveNetInfo(uint8_t *joinpayload, uint16_t size);
37+
void saveUpCnt(void);
38+
void saveDownCnt(void);
39+
void getNetInfo(void);
40+
void saveDr(void);
41+
bool checkNetInfo(void);
42+
void netInfoDisable(void);
43+
extern bool checkUserAt(char * cmd, char * content);
4444

4545

4646

cores/asr650x/kernel/protocols/lorawan/README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

cores/asr650x/kernel/protocols/lorawan/lorawan.mk

Lines changed: 0 additions & 54 deletions
This file was deleted.
File renamed without changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*!
2+
* \file Commissioning.h
3+
*
4+
* \brief End device commissioning parameters
5+
*
6+
* \copyright Revised BSD License, see section \ref LICENSE.
7+
*
8+
* \code
9+
* ______ _
10+
* / _____) _ | |
11+
* ( (____ _____ ____ _| |_ _____ ____| |__
12+
* \____ \| ___ | (_ _) ___ |/ ___) _ \
13+
* _____) ) ____| | | || |_| ____( (___| | | |
14+
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
15+
* (C)2013-2017 Semtech
16+
*
17+
* \endcode
18+
*
19+
* \author Miguel Luis ( Semtech )
20+
*
21+
* \author Gregory Cristian ( Semtech )
22+
*/
23+
#ifndef __LORA_COMMISSIONING_H__
24+
#define __LORA_COMMISSIONING_H__
25+
26+
#include "LoRaMac.h"
27+
28+
/*!
29+
* User application data buffer size
30+
*/
31+
#define LORAWAN_APP_DATA_MAX_SIZE 128 //if use AT mode, don't modify this value or may run dead
32+
33+
/*!
34+
* Indicates if the end-device is to be connected to a private or public network
35+
*/
36+
#define LORAWAN_PUBLIC_NETWORK true
37+
38+
/*!
39+
* Current network ID
40+
*/
41+
#define LORAWAN_NETWORK_ID ( uint32_t )0
42+
43+
44+
#endif // __LORA_COMMISSIONING_H__

cores/asr650x/kernel/protocols/lorawan/lora/mac/LoRaMac.c renamed to cores/asr650x/loramac/mac/LoRaMac.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ static void OpenContinuousRx2Window( void );
699699

700700
static void OnRadioTxDone( void )
701701
{
702+
DIO_PRINTF("Event : Tx Done\r\n");
702703
GetPhyParams_t getPhy;
703704
PhyParam_t phyParam;
704705
SetBandTxDoneParams_t txDone;
@@ -772,7 +773,7 @@ static void OnRadioTxDone( void )
772773
#endif
773774

774775
#if (LoraWan_RGB==1)
775-
RGB_OFF();
776+
turnOffRGB();
776777
#endif
777778

778779
}
@@ -795,6 +796,7 @@ static void PrepareRxDoneAbort( void )
795796

796797
void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
797798
{
799+
DIO_PRINTF("Event : Rx Done\r\n");
798800
uint8_t * temp = payload;
799801
LoRaMacHeader_t macHdr;
800802
LoRaMacFrameCtrl_t fCtrl;
@@ -932,7 +934,7 @@ void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
932934

933935
LoRaMacConfirmQueueSetStatus( LORAMAC_EVENT_INFO_STATUS_OK, MLME_JOIN );
934936
IsLoRaMacNetworkJoined = true;
935-
SaveNetInfo(temp, size);
937+
saveNetInfo(temp, size);
936938
//Joined save its DR using LoRaMacParams.ChannelsDatarate, if set it will be default
937939
// LoRaMacParams.ChannelsDatarate = LoRaMacParamsDefaults.ChannelsDatarate;
938940
} else {
@@ -1088,7 +1090,7 @@ void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
10881090
}
10891091
DownLinkCounter = downLinkCounter;
10901092
if(DownLinkCounter%15000==0){
1091-
SaveDownCnt();
1093+
saveDownCnt();
10921094
}
10931095
}
10941096

@@ -1213,8 +1215,9 @@ void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
12131215
static void OnRadioTxTimeout( void )
12141216
{
12151217
#if (LoraWan_RGB==1)
1216-
RGB_OFF();
1218+
turnOffRGB();
12171219
#endif
1220+
DIO_PRINTF("Event : Tx Timeout\r\n");
12181221

12191222
if( LoRaMacDeviceClass != CLASS_C )
12201223
{
@@ -1235,6 +1238,7 @@ static void OnRadioTxTimeout( void )
12351238

12361239
static void OnRadioRxError( void )
12371240
{
1241+
DIO_PRINTF("Event : Rx Error\r\n");
12381242
bool classBRx = false;
12391243

12401244
if( LoRaMacDeviceClass != CLASS_C )
@@ -1307,8 +1311,10 @@ static void OnRadioRxError( void )
13071311
static void OnRadioRxTimeout( void )
13081312
{
13091313
#if (LoraWan_RGB==1)
1310-
RGB_OFF();
1314+
turnOffRGB();
13111315
#endif
1316+
DIO_PRINTF("Event : Rx Timeout\r\n");
1317+
13121318
bool classBRx = false;
13131319

13141320
if( LoRaMacDeviceClass != CLASS_C )
@@ -1707,7 +1713,7 @@ static void OnRxWindow1TimerEvent( void )
17071713
//printf("w1 dr:%d\r\n",McpsIndication.RxDatarate);
17081714
RxWindowSetup( RxWindow1Config.RxContinuous, LoRaMacParams.MaxRxWindow );
17091715
#if(LoraWan_RGB==1)
1710-
RGB_ON(COLOR_RXWINDOW1,0);
1716+
turnOnRGB(COLOR_RXWINDOW1,0);
17111717
#endif
17121718
}
17131719

@@ -1733,7 +1739,7 @@ static void OnRxWindow2TimerEvent( void )
17331739
RxSlot = RX_SLOT_WIN_2;
17341740
}
17351741
#if(LoraWan_RGB==1)
1736-
RGB_ON(COLOR_RXWINDOW2,0);
1742+
turnOnRGB(COLOR_RXWINDOW2,0);
17371743
#endif
17381744

17391745
}
@@ -2843,7 +2849,7 @@ LoRaMacStatus_t SendFrameOnChannel( uint8_t channel )
28432849
}
28442850
// Send now
28452851
#if (LoraWan_RGB==1)
2846-
RGB_ON(COLOR_SEND,0);
2852+
turnOnRGB(COLOR_SEND,0);
28472853
#endif
28482854
Radio.Send( LoRaMacBuffer, LoRaMacBufferPktLen );
28492855

@@ -3672,8 +3678,7 @@ LoRaMacStatus_t LoRaMacMlmeRequest( MlmeReq_t *mlmeRequest )
36723678
case MLME_JOIN: {
36733679
if ( ( mlmeRequest->Req.Join.DevEui == NULL ) ||
36743680
( mlmeRequest->Req.Join.AppEui == NULL ) ||
3675-
( mlmeRequest->Req.Join.AppKey == NULL ) ||
3676-
( mlmeRequest->Req.Join.NbTrials == 0 ) ) {
3681+
( mlmeRequest->Req.Join.AppKey == NULL )) {
36773682
return LORAMAC_STATUS_PARAMETER_INVALID;
36783683
}
36793684

cores/asr650x/kernel/protocols/lorawan/lora/mac/LoRaMac.h renamed to cores/asr650x/loramac/mac/LoRaMac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,8 +2449,8 @@ LoRaMacStatus_t LoRaMacMlmeRequest( MlmeReq_t *mlmeRequest );
24492449
*/
24502450
LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t *mcpsRequest );
24512451

2452-
extern void RGB_ON(uint32_t color,uint32_t time);
2453-
extern void RGB_OFF(void);
2452+
extern void turnOnRGB(uint32_t color,uint32_t time);
2453+
extern void turnOffRGB(void);
24542454

24552455

24562456
#ifdef __cplusplus
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)