Commit 71978752 authored by Peter Zumbruch's avatar Peter Zumbruch
Browse files

Merge branch 'SPI'

parents e22e7388 4137eec4
......@@ -3,67 +3,58 @@
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<buildSystem id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1529452256">
<storageModule id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1529452256" moduleId="org.eclipse.cdt.core.settings"/>
</buildSystem>
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1529452256">
<cconfiguration id="0.156350869">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.156350869" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="API-Slave (merged 3.1 - 3.0 and some clean-up)" buildProperties="" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1529452256" name="Preference Configuration" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1529452256." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.587721207" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.587721207.1262813214" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.1074387911" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.459986821" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.262262354" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.2093176722" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<configuration buildProperties="" description="" id="0.156350869" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.156350869." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.640603916" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.640603916.910172101" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.1408240114" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1491519979" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.259046369" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1286898020" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/cross/avr/avr/include"/>
<listOptionValue builtIn="false" value="/opt/cross/avr/include"/>
<listOptionValue builtIn="false" value="/opt/cross/avr/lib/gcc/avr/4.3.3/include"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1731298658" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.974436993" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1677033840" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.226584050" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<tool id="org.eclipse.cdt.build.core.settings.holder.1538976891" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.847140887" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/cross/avr/avr/include"/>
<listOptionValue builtIn="false" value="/opt/cross/avr/include"/>
<listOptionValue builtIn="false" value="/opt/cross/avr/lib/gcc/avr/4.3.3/include"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1214494111" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.480429370" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1491492003" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.643433533" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<tool id="org.eclipse.cdt.build.core.settings.holder.124781639" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1767058096" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/cross/avr/avr/include"/>
<listOptionValue builtIn="false" value="/opt/cross/avr/include"/>
<listOptionValue builtIn="false" value="/opt/cross/avr/lib/gcc/avr/4.3.3/include"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.883719941" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.159649634" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1529452256" moduleId="org.eclipse.cdt.core.settings" name="Preference Configuration">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="API-Slave.null.552902338" name="API-Slave"/>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Preference Configuration">
<resource resourceType="PROJECT" workspacePath="/API-Slave (merged 3.1 - 3.0 and some clean-up)"/>
</configuration>
<project id="API-Slave.git.null.912774011" name="API-Slave.git"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
......@@ -90,41 +81,10 @@
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="0.156350869">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="program" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>program</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="both" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>both</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="refreshScope"/>
</cproject>
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
......@@ -36,6 +37,7 @@
#include "one_wire_api_settings.h"
#include "one_wire_octalSwitch.h"
#include "relay.h"
#include "spiApi.h"
#include "api_debug.h"
#include "api_show.h"
......@@ -735,7 +737,8 @@ void Process_Uart_Event(void)
int8_t number_of_elements = -1;
number_of_elements = uartSplitUartString();
printDebug_p(debugLevelEventDebugVerbose, debugSystemCommandKey, __LINE__, PSTR(__FILE__), PSTR("number of string elements found: %i"), number_of_elements);
printDebug_p(debugLevelEventDebugVerbose, debugSystemCommandKey, __LINE__, PSTR(__FILE__),
PSTR("number of string elements found: %i"), number_of_elements);
if ( 0 < number_of_elements )
{
......@@ -826,7 +829,10 @@ void Process_Uart_Event(void)
}
}
}
else
{
CommunicationError_p(ERRA, dynamicMessage_ErrorIndex, FALSE, PSTR("API Parsing failed") );
}
/*clear the variables*/
Reset_SetParameter();
Reset_UartStruct(ptr_uartStruct);
......@@ -837,11 +843,15 @@ void Process_Uart_Event(void)
/*
* this function splits the string to receive various parameters
* only copy the first MAX_PARAMETER elements
* if there are more, still count the elements
* and copy the rest into decrypt_uartString_remainder
*
* no direct input : use of global variable decrypt_uartString
* no direct output: use of global variable setParameter
* return value:
* number of found elements,
* FALSE else
* 0 else
*/
int8_t uartSplitUartString( void )
......@@ -852,7 +862,7 @@ int8_t uartSplitUartString( void )
if ( MAX_LENGTH_COMMAND < strlen(decrypt_uartString) )
{
uartErrorCode = CommunicationError_p(ERRA, SERIAL_ERROR_command_is_too_long, FALSE, NULL);
CommunicationError_p(ERRA, SERIAL_ERROR_command_is_too_long, FALSE, NULL);
/* reset */
clearString(decrypt_uartString, BUFFER_SIZE);
......@@ -867,11 +877,11 @@ int8_t uartSplitUartString( void )
* into elements of array setParameter
*/
char *test = NULL;
char *save_ptr = NULL;
char *result = NULL; /* pointer init */
/* initial iteration */
result = strtok_rP(decrypt_uartString, PSTR(UART_DELIMITER), &test); /*search spaces in string */
result = strtok_rP(decrypt_uartString, PSTR(UART_DELIMITER), &save_ptr); /*search spaces in string */
parameterIndex = 0; /* pointer of setParameter*/
while ( result != NULL )
......@@ -879,29 +889,40 @@ int8_t uartSplitUartString( void )
if (MAX_LENGTH_PARAMETER < strlen(result))
{
/* TODO: create correct error code*/
uartErrorCode = CommunicationError_p(ERRA, SERIAL_ERROR_command_is_too_long, FALSE, NULL);
CommunicationError_p(ERRA, SERIAL_ERROR_command_is_too_long, FALSE, NULL);
clearString(decrypt_uartString, BUFFER_SIZE);
/* "reset": decrypt_uartString[0] = '\0'; */
return 0;
}
strncpy(setParameter[parameterIndex], result, MAX_LENGTH_PARAMETER);
result = strtok_rP(NULL, PSTR(UART_DELIMITER), &test);
parameterIndex++;
if ( MAX_PARAMETER < parameterIndex )
/* only copy the first MAX_PARAMETER elements
* if there are more, still count the elements
* and copy the rest into decrypt_uartString_remainder*/
if ( MAX_PARAMETER > parameterIndex )
{
uartErrorCode = CommunicationError_p(ERRA, SERIAL_ERROR_too_many_arguments, FALSE, NULL);
clearString(decrypt_uartString, BUFFER_SIZE);
/* "reset": decrypt_uartString[0] = '\0'; */
return 0;
strncpy(setParameter[parameterIndex], result, MAX_LENGTH_PARAMETER);
}
if (MAX_PARAMETER == parameterIndex)
{
clearString(decrypt_uartString_remainder, BUFFER_SIZE);
strncpy(decrypt_uartString_remainder, save_ptr, BUFFER_SIZE);
}
result = strtok_rP(NULL, PSTR(UART_DELIMITER), &save_ptr);
parameterIndex++;
// if ( MAX_PARAMETER < parameterIndex )
// {
// CommunicationError_p(ERRA, SERIAL_ERROR_too_many_arguments, FALSE, NULL);
// clearString(decrypt_uartString, BUFFER_SIZE);
// /* "reset": decrypt_uartString[0] = '\0'; */
// return 0;
// }
}
printDebug_p(debugLevelEventDebug, debugSystemDecrypt, __LINE__, PSTR(__FILE__), PSTR("found %i arguments "), parameterIndex-1);
clearString(decrypt_uartString, BUFFER_SIZE);
/* "reset": decrypt_uartString[0] = '\0'; */
......
......@@ -10,6 +10,7 @@
/* Canapi.h*/
extern char decrypt_uartString[BUFFER_SIZE];
extern char decrypt_uartString_remainder[BUFFER_SIZE];
extern char ring_buffer[MAX_INPUT][MAX_LENGTH_CAN_DATA];/*variable for storage all received CAN data*/
extern char setParameter[MAX_PARAMETER][MAX_LENGTH_PARAMETER]; /*storage of cut string */
extern char *ptr_setParameter[MAX_PARAMETER];
......
......@@ -4,6 +4,7 @@
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
#include <math.h>
#include <stdlib.h>
#include <util/delay.h>
......@@ -126,6 +127,7 @@ char keepAliveString[15] = "PING";/*only for keep_alive function*/
char uartString[BUFFER_SIZE]; /* variable for storage received a complete string via UART */
char decrypt_uartString[BUFFER_SIZE];
char decrypt_uartString_remainder[BUFFER_SIZE];
/* unused
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment