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'
|
||||
XDR_INCLUDE='GwXdrTypeMappings.h'
|
||||
TASK_INCLUDE='GwUserTasks.h'
|
||||
TASK_INCLUDE_IF='GwUserTasksIf.h'
|
||||
EMBEDDED_INCLUDE="GwEmbeddedFiles.h"
|
||||
|
||||
def getEmbeddedFiles(env):
|
||||
|
@ -267,14 +266,12 @@ def checkAndAdd(file,names,ilist):
|
|||
if not match:
|
||||
return
|
||||
ilist.append(file)
|
||||
def genereateUserTasks(outfile,forIf=False):
|
||||
def genereateUserTasks(outfile):
|
||||
includes=[]
|
||||
for task in userTaskDirs:
|
||||
#print("##taskdir=%s"%task)
|
||||
base=os.path.basename(task)
|
||||
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):
|
||||
checkAndAdd(f,includeNames,includes)
|
||||
includeData=""
|
||||
|
@ -403,7 +400,6 @@ def prebuild(env):
|
|||
print("#WARNING: infile %s for %s not found"%(inFile,ef))
|
||||
generateEmbedded(filedefs,os.path.join(outPath(),EMBEDDED_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)
|
||||
version="dev"+datetime.now().strftime("%Y%m%d")
|
||||
env.Append(CPPDEFINES=[('GWDEVVERSION',version)])
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "GwButtonTask.h"
|
||||
#include "GwIButtonTask.h"
|
||||
#include "GwHardware.h"
|
||||
#include "GwApi.h"
|
||||
#include "GwLedTask.h"
|
||||
|
|
|
@ -4,4 +4,19 @@
|
|||
//task function
|
||||
void initButtons(GwApi *param);
|
||||
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
|
|
@ -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
|
||||
#ifdef BOARD_TEST
|
||||
#include "GwExampleTask.h"
|
||||
#include "GwIExampleTask.h"
|
||||
#include "GwApi.h"
|
||||
#include "GWConfig.h"
|
||||
#include <vector>
|
||||
|
|
|
@ -12,8 +12,20 @@ void exampleInit(GwApi *param);
|
|||
|
||||
//let the core call an init function before the
|
||||
//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
|
||||
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
|
|
@ -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 "GwApi.h"
|
||||
#include "FastLED.h"
|
||||
#include "GwIButtonTask.h"
|
||||
typedef enum {
|
||||
LED_OFF,
|
||||
LED_GREEN,
|
||||
|
|
|
@ -93,7 +93,6 @@ class GwUserCapability{
|
|||
}
|
||||
};
|
||||
#include "GwUserTasks.h"
|
||||
#include "GwUserTasksIf.h"
|
||||
|
||||
class TaskDataEntry{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue