summaryrefslogtreecommitdiff
path: root/software/mpu
diff options
context:
space:
mode:
authorRoland Sahlsten <Roland.Sahlsten.ASE10@fh-joanneum.at>2011-10-24 21:10:53 +0000
committerRoland Sahlsten <Roland.Sahlsten.ASE10@fh-joanneum.at>2011-10-24 21:10:53 +0000
commit2252e04a485eee196c0cc2bff0e8f3b02e5eb313 (patch)
treecee7f91140e071773ecc0b838930cc77f152595b /software/mpu
parentgit-svn-id: https://svn.spreadspace.org/mur.sat@180 7de4ea59-55d0-425e-a1af-a... (diff)
git-svn-id: https://svn.spreadspace.org/mur.sat@181 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/mpu')
-rw-r--r--software/mpu/src/camera.c56
-rw-r--r--software/mpu/src/lightsens.c62
2 files changed, 118 insertions, 0 deletions
diff --git a/software/mpu/src/camera.c b/software/mpu/src/camera.c
new file mode 100644
index 0000000..4fad440
--- /dev/null
+++ b/software/mpu/src/camera.c
@@ -0,0 +1,56 @@
+/*
+ * camera.c
+ *
+ * Created on: 23.10.2011
+ * Author: Roland
+ */
+
+#include "Types.h"
+#include "FreeRTOS.h"
+#include "queue.h"
+
+#define TASK_PRIORITY_camera ( tskIDLE_PRIORITY + 2 )
+#define TASK_STACK_SIZE_camera ( ( unsigned short ) 64 )
+
+/* Globals */
+static Task_Param_t TaskParam_Camera;
+
+/*
+ * Wake up other tasks, send them messages telling what to do,
+ * wait for them to have processed the commands or not, maybe
+ * put them to sleep again, ...
+ * */
+static void camera_Process_Task(void *Param)
+{
+ Message_t Msg;
+
+ if(NULL == TaskParam_Camera.QueueHandles.hxq_Camera)
+ {
+ return;
+ }
+ while(1)
+ {
+ if( xQueueReceive( TaskParam_Camera.QueueHandles.hxq_Camera,
+ &Msg, portTICK_RATE_MS * 5 ))
+ {
+ /*
+ * switch Msg.Sender
+ *
+ */
+ ;
+ }
+ }
+}
+
+Status_t camera_Init_Camera(QH_t hxQueues)
+{
+ TaskParam_Camera.QueueHandles = hxQueues;
+
+ if(!xTaskCreate( camera_Process_Task, (signed char *) "Camera",
+ TASK_STACK_SIZE_camera, &TaskParam_Camera,
+ TASK_PRIORITY_camera, &(TaskParam_Camera.hxTask_Self)))
+ return STATUS_ERROR_INIT;
+
+ /*TODO: check for success and pass it over to caller. */
+ return STATUS_OK;
+}
diff --git a/software/mpu/src/lightsens.c b/software/mpu/src/lightsens.c
new file mode 100644
index 0000000..230a0c3
--- /dev/null
+++ b/software/mpu/src/lightsens.c
@@ -0,0 +1,62 @@
+/*
+ * lightsens.c
+ *
+ * Created on: 23.10.2011
+ * Author: Roland
+ */
+
+#include "Types.h"
+#include "FreeRTOS.h"
+#include "queue.h"
+
+#define TASK_PRIORITY_lightsens ( tskIDLE_PRIORITY + 2 )
+#define TASK_STACK_SIZE_lightsens ( ( unsigned short ) 64 )
+
+/* Globals */
+static Task_Param_t TaskParam_LightSens;
+
+/*
+ * Wake up other tasks, send them messages telling what to do,
+ * wait for them to have processed the commands or not, maybe
+ * put them to sleep again, ...
+ * */
+static void lightsens_Process_Task(void *Param)
+{
+ Message_t Msg;
+ portCHAR chBufLSe[10] = "Seas Knl!";
+
+ if(NULL == TaskParam_LightSens.QueueHandles.hxq_LightSens)
+ {
+ return;
+ }
+
+ Msg.Sender = Sender_LightSens;
+ Msg.pData = chBufLSe;
+ xQueueSend(TaskParam_LightSens.QueueHandles.hxq_Kernel, &Msg, MS(10));
+ while(1)
+ {
+ if( xQueueReceive( TaskParam_LightSens.QueueHandles.hxq_LightSens, &Msg, MS(5)))
+ {
+ /*
+ * switch Msg.Sender
+ *
+ */
+ Msg.Sender = Sender_LightSens;
+ Msg.pData = chBufLSe;
+ xQueueSend(TaskParam_LightSens.QueueHandles.hxq_Kernel, &Msg, MS(10));
+ }
+ }
+}
+
+Status_t lightsens_Init_LightSens(QH_t hxQueues)
+{
+ TaskParam_LightSens.QueueHandles = hxQueues;
+
+ if(!xTaskCreate( lightsens_Process_Task, (signed char *) "LightSensor",
+ TASK_STACK_SIZE_lightsens, &TaskParam_LightSens,
+ TASK_PRIORITY_lightsens, &(TaskParam_LightSens.hxTask_Self)))
+ return STATUS_ERROR_INIT;
+
+ /*TODO: check for success and pass it over to caller. */
+ return STATUS_OK;
+}