Skip to content

Commit e3625de

Browse files
author
Matthieu Antoine
committed
Release v1.3.0
1 parent e0f8ebf commit e3625de

File tree

119 files changed

+3393
-2297
lines changed

Some content is hidden

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

119 files changed

+3393
-2297
lines changed

embedded/Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ system/src/system_uart.c \
7575
system/src/system_time.c \
7676
system/src/system_lptim.c \
7777
system/src/system.c \
78+
lr1110_driver/src/lr1110_driver_version.c \
7879
lr1110_driver/src/lr1110_bootloader.c \
7980
lr1110_driver/src/lr1110_gnss.c \
8081
lr1110_driver/src/lr1110_radio.c \
@@ -93,22 +94,33 @@ C_SOURCES += ${CSRCS}
9394
# CPP sources
9495
CPP_SOURCES = \
9596
application/src/main.cpp \
96-
application/src/gnss_helper.cpp \
9797
application/src/timer_interface_implementation.cpp \
98+
communication/src/communication_manager.cpp \
99+
communication/src/communication_utils.cpp \
100+
communication/src/communication_interface.cpp \
101+
communication/src/communication_print_only.cpp \
102+
communication/src/communication_demo.cpp \
103+
communication/src/communication_field_test.cpp \
98104
demo/src/environment_interface.cpp \
99105
demo/src/demo_base.cpp \
106+
demo/src/demo_transceiver_base.cpp \
100107
demo/src/demo_wifi_interface.cpp \
101108
demo/src/demo_wifi_scan.cpp \
102109
demo/src/demo_wifi_country_code.cpp \
110+
demo/src/demo_wifi_types.cpp \
103111
demo/src/demo_gnss_autonomous.cpp \
104112
demo/src/demo_gnss_base.cpp \
105-
demo/src/demo_gnss_assisted.cpp\
106-
demo/src/demo_ping_pong.cpp\
113+
demo/src/demo_gnss_assisted.cpp \
114+
demo/src/demo_radio_interface.cpp \
115+
demo/src/demo_ping_pong.cpp \
107116
demo/src/demo_tx_cw.cpp \
108117
demo/src/demo_radio_per.cpp \
109118
demo/src/demo.cpp\
119+
demo/src/device_base.cpp \
120+
demo/src/device_transceiver.cpp \
110121
gui/src/gui.cpp \
111122
gui/src/guiCommon.cpp \
123+
gui/src/guiMenuCommon.cpp \
112124
gui/src/guiMenu.cpp \
113125
gui/src/guiMenuRadioTestModes.cpp \
114126
gui/src/guiConfigRadioTestModes.cpp \
@@ -124,11 +136,9 @@ gui/src/guiTestGnss.cpp \
124136
gui/src/guiTestWifi.cpp \
125137
gui/src/guiConfigWifi.cpp \
126138
gui/src/guiConfigGnss.cpp \
127-
log/src/log.cpp \
128139
supervisor/src/supervisor.cpp \
129140
hci/hci.cpp \
130141
hci/Command/Src/command_base.cpp \
131-
hci/Command/Src/command_configure.cpp \
132142
hci/Command/Src/command_factory.cpp \
133143
hci/Command/Src/command_fetch_result.cpp \
134144
hci/Command/Src/command_get_version.cpp \
@@ -204,6 +214,7 @@ AS_INCLUDES =
204214
# C includes
205215
C_INCLUDES = \
206216
-Iapplication/inc \
217+
-Icommunication/inc \
207218
-ICMSIS/Device/ST/STM32L4xx/Include \
208219
-ICMSIS/Core/Include \
209220
-Idemo/inc \
@@ -218,7 +229,6 @@ C_INCLUDES = \
218229
-Ilvgl/src/lv_objx \
219230
-Ilvgl/src/lv_themes \
220231
-Ilvgl/src \
221-
-Ilog/inc \
222232
-ISTM32L4xx_HAL_Driver/Inc \
223233
-Isupervisor/inc \
224234
-Isystem/inc \

embedded/application/inc/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#ifndef DEMO_VERSION
3838
#warning "No demo version provided"
39-
#define DEMO_VERSION "v1.2.0"
39+
#define DEMO_VERSION "v1.3.0"
4040
#endif
4141

4242
typedef struct

embedded/application/src/main.cpp

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
*/
3131

3232
#include "configuration.h"
33+
#include "device_transceiver.h"
3334
#include "lr1110_system.h"
3435
#include "lr1110_wifi.h"
3536
#include "system.h"
3637

3738
#include "supervisor.h"
3839
#include "environment_interface.h"
39-
#include "log.h"
4040
#include "antenna_selector_interface.h"
4141
#include "signaling_interface.h"
4242
#include "timer_interface_implementation.h"
@@ -46,6 +46,17 @@
4646
#include "string.h"
4747
#include "demo.h"
4848

49+
#include "hci.h"
50+
#include "command_factory.h"
51+
#include "command_get_version.h"
52+
#include "command_get_almanac_dates.h"
53+
#include "command_start_demo.h"
54+
#include "command_fetch_result.h"
55+
#include "command_set_date_loc.h"
56+
#include "command_reset.h"
57+
#include "command_update_almanac.h"
58+
#include "command_check_almanac_update.h"
59+
4960
#include "stm32_assert_template.h"
5061

5162
#include "lvgl.h"
@@ -208,35 +219,47 @@ int main( void )
208219
lv_port_disp_init( );
209220
lv_port_indev_init( );
210221

211-
Logging::EnableLogging( );
222+
Environment environment;
223+
AntennaSelector antenna_selector;
224+
Signaling signaling( &environment );
225+
Gui gui;
226+
Timer timer;
227+
DeviceTransceiver device_transceiver( &radio );
228+
229+
CommandFactory command_factory;
230+
Hci hci( command_factory, environment );
231+
232+
CommunicationManager communication_manager( &environment, &hci );
233+
234+
Demo demo( &device_transceiver, &environment, &antenna_selector, &signaling, &timer, &communication_manager );
212235

213-
Environment environment;
214-
AntennaSelector antenna_selector;
215-
Signaling signaling( &environment );
216-
Gui gui;
217-
Timer timer;
218-
Demo demo( &radio, &environment, &antenna_selector, &signaling, &timer );
236+
CommandGetVersion com_get_version( hci );
237+
CommandGetAlmanacDates com_get_almanac_dates( &device_transceiver, hci );
238+
CommandStartDemo com_start( &device_transceiver, hci, demo );
239+
CommandFetchResult com_fetch_result( hci, environment, demo );
240+
CommandSetDateLoc com_set_date_loc( &device_transceiver, hci, environment );
241+
CommandReset com_reset( &device_transceiver, hci );
242+
CommandUpdateAlmanac com_update_almanac( &device_transceiver, hci );
243+
CommandCheckAlmanacUpdate com_check_almanac_update( &device_transceiver, hci );
219244

220-
Supervisor supervisor( &gui, &radio, &demo, &environment );
245+
command_factory.AddCommandToPool( com_get_version );
246+
command_factory.AddCommandToPool( com_get_almanac_dates );
247+
command_factory.AddCommandToPool( com_start );
248+
command_factory.AddCommandToPool( com_fetch_result );
249+
command_factory.AddCommandToPool( com_set_date_loc );
250+
command_factory.AddCommandToPool( com_reset );
251+
command_factory.AddCommandToPool( com_update_almanac );
252+
command_factory.AddCommandToPool( com_check_almanac_update );
253+
254+
Supervisor supervisor( &gui, &device_transceiver, &demo, &environment, &communication_manager );
221255
supervisor.Init( );
256+
com_get_version.SetVersion( supervisor.GetVersionHandler( ) );
222257

223258
system_uart_flush( );
224259

225-
if( system_gpio_get_pin_state( { BUTTON_BLUE_PORT, BUTTON_BLUE_PIN } ) == SYSTEM_GPIO_PIN_STATE_LOW )
226-
{
227-
automatic_mode = true;
228-
}
229-
230260
while( 1 )
231261
{
232262
signaling.Runtime( );
233-
if( automatic_mode == true )
234-
{
235-
supervisor.RuntimeAuto( );
236-
}
237-
else
238-
{
239-
supervisor.Runtime( );
240-
}
263+
supervisor.Runtime( );
241264
};
242265
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* @file communication_demo.h
3+
*
4+
* @brief Definition of the communication demo.
5+
*
6+
* Revised BSD License
7+
* Copyright Semtech Corporation 2020. All rights reserved.
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
* * Neither the name of the Semtech corporation nor the
17+
* names of its contributors may be used to endorse or promote products
18+
* derived from this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY
24+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
#ifndef __COMMUNICATION_DEMO_H__
33+
#define __COMMUNICATION_DEMO_H__
34+
35+
#include "communication_interface.h"
36+
37+
typedef enum
38+
{
39+
COMMUNICATION_DEMO_STATUS_OK,
40+
COMMUNICATION_DEMO_STATUS_TIMEOUT,
41+
COMMUNICATION_DEMO_STATUS_OVERFLOW,
42+
COMMUNICATION_DEMO_STATUS_DISABLED,
43+
} CommunicationDemoStatus_t;
44+
45+
class CommunicationDemo : public CommunicationInterface
46+
{
47+
public:
48+
virtual void Runtime( ) override;
49+
virtual bool GetDateAndApproximateLocation( uint32_t& gps_second, float& latitude, float& longitude,
50+
float& altitude ) override;
51+
virtual bool GetResults( float& latitude, float& longitude, float& altitude, float& accuracy, char* geo_coding,
52+
const uint8_t geo_coding_max_length );
53+
virtual void Store( const demo_wifi_scan_all_results_t& wifi_results );
54+
virtual void Store( const demo_gnss_all_results_t& gnss_results, uint32_t delay_since_capture );
55+
virtual void Store( const version_handler_t& version );
56+
virtual void EraseDataStored( ) override;
57+
virtual void SendDataStoredToServer( ) override;
58+
virtual void vLog( const char* fmt, va_list argp ) override;
59+
virtual bool HasNewCommand( ) const override;
60+
virtual CommandInterface* FetchCommand( ) override;
61+
62+
protected:
63+
CommunicationDemoStatus_t AskAndParseResults( float& latitude, float& longitude, float& altitude, float& accuracy,
64+
char* geo_coding, const uint8_t geo_coding_max_length );
65+
CommunicationDemoStatus_t ReceiveData( const uint16_t buffer_length_max, char* buffer,
66+
uint16_t& buffer_length_received, const uint16_t timeout );
67+
CommunicationDemoStatus_t AskData( const char* token, const uint16_t buffer_length_max, char* buffer,
68+
uint16_t& buffer_length_received, const uint16_t timeout );
69+
void SendCommand( const char* command );
70+
void Store( const char* fmt, ... );
71+
};
72+
73+
#endif // __COMMUNICATION_DEMO_H__
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* @file communication_field_test.h
3+
*
4+
* @brief Definition of the communication field test.
5+
*
6+
* Revised BSD License
7+
* Copyright Semtech Corporation 2020. All rights reserved.
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
* * Neither the name of the Semtech corporation nor the
17+
* names of its contributors may be used to endorse or promote products
18+
* derived from this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY
24+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
#ifndef __COMMUNICATION_FIELD_TEST_H__
33+
#define __COMMUNICATION_FIELD_TEST_H__
34+
35+
#include "communication_interface.h"
36+
#include "environment_interface.h"
37+
#include "hci.h"
38+
39+
class CommunicationFieldTest : public CommunicationInterface
40+
{
41+
public:
42+
explicit CommunicationFieldTest( Hci* hci );
43+
virtual ~CommunicationFieldTest( );
44+
45+
virtual void Init( ) override;
46+
virtual void DeInit( ) override;
47+
virtual void Runtime( ) override;
48+
virtual void Store( const demo_wifi_scan_all_results_t& wifi_results ) override;
49+
virtual void Store( const demo_gnss_all_results_t& gnss_results, uint32_t delay_since_capture ) override;
50+
virtual void Store( const version_handler_t& version ) override;
51+
virtual void EraseDataStored( ) override;
52+
virtual void SendDataStoredToServer( ) override;
53+
virtual bool GetDateAndApproximateLocation( uint32_t& gps_second, float& latitude, float& longitude,
54+
float& altitude ) override;
55+
virtual bool GetResults( float& latitude, float& longitude, float& altitude, float& accuracy, char* geo_coding,
56+
const uint8_t geo_coding_max_length ) override;
57+
virtual void vLog( const char* fmt, va_list argp ) override;
58+
virtual void EventNotify( ) override;
59+
virtual bool HasNewCommand( ) const override;
60+
virtual CommandInterface* FetchCommand( ) override;
61+
62+
protected:
63+
Hci* hci;
64+
};
65+
66+
#endif // __COMMUNICATION_FIELD_TEST_H__
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* @file communication_interface.h
3+
*
4+
* @brief Definition of the communication interface.
5+
*
6+
* Revised BSD License
7+
* Copyright Semtech Corporation 2020. All rights reserved.
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
* * Neither the name of the Semtech corporation nor the
17+
* names of its contributors may be used to endorse or promote products
18+
* derived from this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY
24+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
#ifndef __COMMUNICATION_INTERFACE_H__
33+
#define __COMMUNICATION_INTERFACE_H__
34+
35+
#include <stdarg.h>
36+
#include "command_interface.h"
37+
#include "version.h"
38+
#include "demo_wifi_types.h"
39+
#include "demo_gnss_types.h"
40+
41+
class CommunicationInterface
42+
{
43+
public:
44+
virtual ~CommunicationInterface( );
45+
virtual void Init( ){};
46+
virtual void DeInit( ){};
47+
virtual void Runtime( ) = 0;
48+
virtual void Log( const char* fmt, ... );
49+
virtual void vLog( const char* fmt, va_list argp ) = 0;
50+
virtual void Store( const demo_wifi_scan_all_results_t& wifi_results ) = 0;
51+
virtual void Store( const demo_gnss_all_results_t& gnss_results, uint32_t delay_since_capture ) = 0;
52+
virtual void Store( const version_handler_t& version ) = 0;
53+
virtual void EraseDataStored( ) = 0;
54+
virtual void SendDataStoredToServer( ) = 0;
55+
virtual bool GetDateAndApproximateLocation( uint32_t& gps_second, float& latitude, float& longitude,
56+
float& altitude ) = 0;
57+
virtual bool GetResults( float& latitude, float& longitude, float& altitude, float& accuracy, char* geo_coding,
58+
const uint8_t geo_coding_max_length ) = 0;
59+
virtual void EventNotify( );
60+
virtual bool HasNewCommand( ) const = 0;
61+
virtual CommandInterface* FetchCommand( ) = 0;
62+
63+
protected:
64+
static const char* WifiTypeToStr( const demo_wifi_signal_type_t type );
65+
};
66+
67+
#endif // __COMMUNICATION_INTERFACE_H__

0 commit comments

Comments
 (0)