changeset 555:573a2bc796c8

Added HW_Info to Discovery <=> RTE data exchange: The information if an external ADC is supported and the type of the compass is forwarded to the Firmware software. This is especially needed to enable the menu structure to support calibration of external sensors
author Ideenmodellierer
date Thu, 12 Nov 2020 19:48:28 +0100
parents 3328189786e7
children eb2060caca7d
files Common/Inc/data_exchange.h Small_CPU/Src/compass.c
diffstat 2 files changed, 17 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/data_exchange.h	Thu Nov 12 19:46:03 2020 +0100
+++ b/Common/Inc/data_exchange.h	Thu Nov 12 19:48:28 2020 +0100
@@ -68,6 +68,13 @@
 uint8_t accident:1;
 } confirmbit8_t;
 
+typedef struct{
+uint8_t reserve:7;
+uint8_t extADC:1;
+uint8_t compass:8;
+} hw_Info_t;
+
+
 #define CRBUTTON 			(0x01)
 #define CRDATE 				(0x02)
 #define CRTIME 				(0x04)
@@ -137,8 +144,9 @@
 		float battery_charge;
 		//ambient light
 		uint16_t ambient_light_level;
-		// wireless data
-		SDataWireless wireless_data[4];
+		uint16_t SPARE_ALIGN32;
+		float	extADC_voltage[3];
+		uint8_t SPARE_OldWireless[50]; /* 64 - 12 for extADC */
 		// PIC data
 		uint8_t button_setting[4]; /* see dependency to SLiveData->buttonPICdata */
 		uint8_t SPARE1;
@@ -231,9 +239,8 @@
 	uint8_t RTE_VERSION_low;
 
 	uint8_t chargeStatus;
+	hw_Info_t hw_Info;
 	uint8_t spare1;
-	uint8_t spare2;
-	uint8_t spare3;
 
 	uint8_t boolDeviceData;
 	uint8_t boolVpmRepetitiveDataValid;
--- a/Small_CPU/Src/compass.c	Thu Nov 12 19:46:03 2020 +0100
+++ b/Small_CPU/Src/compass.c	Thu Nov 12 19:48:28 2020 +0100
@@ -35,31 +35,13 @@
 
 #include "i2c.h"
 #include "spi.h"
+#include "scheduler.h"
 #include "RTE_FlashAccess.h" // to store compass_calib_data
 
 #include "stm32f4xx_hal.h"
 
 extern uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow);
-
-/// split byte to bits
-typedef struct{ 
-uint8_t bit0:1; ///< split byte to bits
-uint8_t bit1:1; ///< split byte to bits
-uint8_t bit2:1; ///< split byte to bits
-uint8_t bit3:1; ///< split byte to bits
-uint8_t bit4:1; ///< split byte to bits
-uint8_t bit5:1; ///< split byte to bits
-uint8_t bit6:1; ///< split byte to bits
-uint8_t bit7:1; ///< split byte to bits
-} ubit8_t;
-
-
-/// split byte to bits
-typedef union{ 
-ubit8_t ub; ///< split byte to bits
-uint8_t uw; ///< split byte to bits
-} bit8_Type;
-	
+extern SGlobal global;
 
 /// split word to 2 bytes
 typedef struct{
@@ -309,6 +291,10 @@
 	if(hardwareCompass == compass_generation1)			//HMC5883L)
 		compass_init_HMC5883L(fast, gain);
 	
+	if(global.deviceDataSendToMaster.hw_Info.compass == 0)
+	{
+		global.deviceDataSendToMaster.hw_Info.compass = hardwareCompass;
+	}
 	tfull32 dataBlock[4];
 	if(BFA_readLastDataBlock((uint32_t *)dataBlock) == BFA_OK)
 		{