avoid the need for additional includes for task interfaces
This commit is contained in:
parent
ff1bc50607
commit
a98693a9b1
|
@ -22,7 +22,6 @@ CFG_INCLUDE='GwConfigDefinitions.h'
|
||||||
CFG_INCLUDE_IMPL='GwConfigDefImpl.h'
|
CFG_INCLUDE_IMPL='GwConfigDefImpl.h'
|
||||||
XDR_INCLUDE='GwXdrTypeMappings.h'
|
XDR_INCLUDE='GwXdrTypeMappings.h'
|
||||||
TASK_INCLUDE='GwUserTasks.h'
|
TASK_INCLUDE='GwUserTasks.h'
|
||||||
TASK_INCLUDE_IF='GwUserTasksIf.h'
|
|
||||||
EMBEDDED_INCLUDE="GwEmbeddedFiles.h"
|
EMBEDDED_INCLUDE="GwEmbeddedFiles.h"
|
||||||
|
|
||||||
def getEmbeddedFiles(env):
|
def getEmbeddedFiles(env):
|
||||||
|
@ -267,14 +266,12 @@ def checkAndAdd(file,names,ilist):
|
||||||
if not match:
|
if not match:
|
||||||
return
|
return
|
||||||
ilist.append(file)
|
ilist.append(file)
|
||||||
def genereateUserTasks(outfile,forIf=False):
|
def genereateUserTasks(outfile):
|
||||||
includes=[]
|
includes=[]
|
||||||
for task in userTaskDirs:
|
for task in userTaskDirs:
|
||||||
#print("##taskdir=%s"%task)
|
#print("##taskdir=%s"%task)
|
||||||
base=os.path.basename(task)
|
base=os.path.basename(task)
|
||||||
includeNames=[base.lower()+".h",'gw'+base.lower()+'.h']
|
includeNames=[base.lower()+".h",'gw'+base.lower()+'.h']
|
||||||
if forIf:
|
|
||||||
includeNames=["i"+base.lower()+".h",'gwi'+base.lower()+'.h']
|
|
||||||
for f in os.listdir(task):
|
for f in os.listdir(task):
|
||||||
checkAndAdd(f,includeNames,includes)
|
checkAndAdd(f,includeNames,includes)
|
||||||
includeData=""
|
includeData=""
|
||||||
|
@ -403,7 +400,6 @@ def prebuild(env):
|
||||||
print("#WARNING: infile %s for %s not found"%(inFile,ef))
|
print("#WARNING: infile %s for %s not found"%(inFile,ef))
|
||||||
generateEmbedded(filedefs,os.path.join(outPath(),EMBEDDED_INCLUDE))
|
generateEmbedded(filedefs,os.path.join(outPath(),EMBEDDED_INCLUDE))
|
||||||
genereateUserTasks(os.path.join(outPath(), TASK_INCLUDE))
|
genereateUserTasks(os.path.join(outPath(), TASK_INCLUDE))
|
||||||
genereateUserTasks(os.path.join(outPath(), TASK_INCLUDE_IF),forIf=True)
|
|
||||||
generateFile(os.path.join(basePath(),XDR_FILE),os.path.join(outPath(),XDR_INCLUDE),generateXdrMappings)
|
generateFile(os.path.join(basePath(),XDR_FILE),os.path.join(outPath(),XDR_INCLUDE),generateXdrMappings)
|
||||||
version="dev"+datetime.now().strftime("%Y%m%d")
|
version="dev"+datetime.now().strftime("%Y%m%d")
|
||||||
env.Append(CPPDEFINES=[('GWDEVVERSION',version)])
|
env.Append(CPPDEFINES=[('GWDEVVERSION',version)])
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "GwButtonTask.h"
|
#include "GwButtonTask.h"
|
||||||
#include "GwIButtonTask.h"
|
|
||||||
#include "GwHardware.h"
|
#include "GwHardware.h"
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
#include "GwLedTask.h"
|
#include "GwLedTask.h"
|
||||||
|
|
|
@ -4,4 +4,19 @@
|
||||||
//task function
|
//task function
|
||||||
void initButtons(GwApi *param);
|
void initButtons(GwApi *param);
|
||||||
DECLARE_INITFUNCTION(initButtons);
|
DECLARE_INITFUNCTION(initButtons);
|
||||||
|
|
||||||
|
class IButtonTask : public GwApi::TaskInterfaces::Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
OFF,
|
||||||
|
PRESSED,
|
||||||
|
PRESSED_5, // 5...10s
|
||||||
|
PRESSED_10 //>10s
|
||||||
|
} ButtonState;
|
||||||
|
ButtonState state=OFF;
|
||||||
|
long pressCount=0;
|
||||||
|
};
|
||||||
|
DECLARE_TASKIF(IButtonTask);
|
||||||
#endif
|
#endif
|
|
@ -1,19 +0,0 @@
|
||||||
#ifndef _GWIBUTTONTASK_H
|
|
||||||
#define _GWIBUTTONTASK_H
|
|
||||||
#include "GwApi.h"
|
|
||||||
class IButtonTask : public GwApi::TaskInterfaces::Base
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
OFF,
|
|
||||||
PRESSED,
|
|
||||||
PRESSED_5, // 5...10s
|
|
||||||
PRESSED_10 //>10s
|
|
||||||
} ButtonState;
|
|
||||||
ButtonState state=OFF;
|
|
||||||
long pressCount=0;
|
|
||||||
};
|
|
||||||
DECLARE_TASKIF(IButtonTask);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -2,7 +2,6 @@
|
||||||
//we only compile for some boards
|
//we only compile for some boards
|
||||||
#ifdef BOARD_TEST
|
#ifdef BOARD_TEST
|
||||||
#include "GwExampleTask.h"
|
#include "GwExampleTask.h"
|
||||||
#include "GwIExampleTask.h"
|
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
#include "GWConfig.h"
|
#include "GWConfig.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -12,8 +12,20 @@ void exampleInit(GwApi *param);
|
||||||
|
|
||||||
//let the core call an init function before the
|
//let the core call an init function before the
|
||||||
//N2K Stuff and the communication is set up
|
//N2K Stuff and the communication is set up
|
||||||
//normally you should not need this at all
|
//especially this init function will register the real task at the core
|
||||||
|
//this gives you some flexibility to decide based on config or defines whether you
|
||||||
|
//really want to start the task or not
|
||||||
//this function must return when done - otherwise the core will not start up
|
//this function must return when done - otherwise the core will not start up
|
||||||
DECLARE_INITFUNCTION(exampleInit);
|
DECLARE_INITFUNCTION(exampleInit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* an interface for the example task
|
||||||
|
*/
|
||||||
|
class ExampleTaskIf : public GwApi::TaskInterfaces::Base{
|
||||||
|
public:
|
||||||
|
long count=0;
|
||||||
|
String someValue;
|
||||||
|
};
|
||||||
|
DECLARE_TASKIF(ExampleTaskIf);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef GWIEXAMPLETASK_H
|
|
||||||
#define GWIEXAMPLETASK_H
|
|
||||||
#include "GwApi.h"
|
|
||||||
/**
|
|
||||||
* an interface for the example task
|
|
||||||
*/
|
|
||||||
class ExampleTaskIf : public GwApi::TaskInterfaces::Base{
|
|
||||||
public:
|
|
||||||
long count=0;
|
|
||||||
String someValue;
|
|
||||||
};
|
|
||||||
DECLARE_TASKIF(ExampleTaskIf);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include "GwHardware.h"
|
#include "GwHardware.h"
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
#include "GwIButtonTask.h"
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LED_OFF,
|
LED_OFF,
|
||||||
LED_GREEN,
|
LED_GREEN,
|
||||||
|
|
|
@ -93,7 +93,6 @@ class GwUserCapability{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#include "GwUserTasks.h"
|
#include "GwUserTasks.h"
|
||||||
#include "GwUserTasksIf.h"
|
|
||||||
|
|
||||||
class TaskDataEntry{
|
class TaskDataEntry{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue