diff --git a/obc-firmware/interfaceview.ui.xml b/obc-firmware/interfaceview.ui.xml
index 55d4d0f..d1b417b 100644
--- a/obc-firmware/interfaceview.ui.xml
+++ b/obc-firmware/interfaceview.ui.xml
@@ -1,4 +1,6 @@
-
+
+
+
@@ -6,7 +8,5 @@
-
-
\ No newline at end of file
diff --git a/obc-firmware/work/hal/implem/msp430/C/src/hal.c b/obc-firmware/work/hal/implem/msp430/C/src/hal.c
index 811fca2..0916a6a 100644
--- a/obc-firmware/work/hal/implem/msp430/C/src/hal.c
+++ b/obc-firmware/work/hal/implem/msp430/C/src/hal.c
@@ -14,10 +14,34 @@
#include
#include
+#include
+#include
+
#include "msp430_uart.h"
bool P4_6_LED_ON = false;
+typedef struct cmdQueueNode
+{
+ struct cmdQueueNode* next;
+ unsigned char cmd[2];
+ unsigned char* param;
+} cmdQueueNode;
+
+typedef struct cmdQueue
+{
+ cmdQueueNode* head;
+ cmdQueueNode* tail;
+ uint8_t size;
+} cmdQueue;
+
+void cmdQueueNodeFree( cmdQueueNode* node );
+void cmdQueueInit( cmdQueue* queue );
+void cmdQueueEnqueue( cmdQueue* queue, cmdQueueNode* node );
+cmdQueueNode* cmdQueueDequeue( cmdQueue* queue );
+void cmdQueueAddCmd( cmdQueue* queue, unsigned char cmd[], unsigned char param[], uint8_t paramSize );
+void cmdQueuePopCmd( cmdQueue* queue );
+
void hal_startup( void )
{
// Write your initialisation code, but DO NOT CALL REQUIRED INTERFACES
@@ -50,3 +74,76 @@ void hal_PI_set_led( const asn1SccT_Boolean *IN_val )
}
P4_6_LED_ON = *IN_val;
}
+
+void cmdQueueNodeFree( cmdQueueNode* node )
+{
+ free(node->param);
+ free(node);
+}
+
+void cmdQueueInit( cmdQueue* q )
+{
+ q->head = NULL;
+ q->tail = NULL;
+ q->size = 0;
+}
+
+void cmdQueueEnqueue( cmdQueue* queue, cmdQueueNode* node )
+{
+ node->next = NULL;
+ if (queue->tail == NULL)
+ {
+ queue->head = node;
+ }
+ else
+ {
+ queue->tail->next = node;
+ }
+ queue->tail = node;
+ queue->size++;
+}
+
+cmdQueueNode* cmdQueueDequeue( cmdQueue* queue )
+{
+ if (queue->head == NULL) // underflow
+ {
+ return NULL;
+ }
+ cmdQueueNode* node = queue->head;
+ queue->head = queue->head->next;
+ if (queue->head == NULL)
+ {
+ queue->tail = NULL;
+ }
+ queue->size--;
+
+ return node;
+}
+
+void cmdQueueAddCmd( cmdQueue* queue, unsigned char cmd[], unsigned char param[], uint8_t paramSize )
+{
+ cmdQueueNode* newNode = (cmdQueueNode*)malloc(sizeof(cmdQueueNode));
+ if (newNode != NULL)
+ {
+ unsigned char* paramField = (unsigned char*)malloc(sizeof(unsigned char*)*paramSize);
+ if (paramField == NULL) // not enought memory for newNode
+ {
+ free(newNode);
+ }
+ else
+ {
+ memcpy(newNode->cmd, cmd, 2);
+ memcpy(newNode->param, param, paramSize);
+ cmdQueueEnqueue(queue, newNode);
+ }
+ }
+}
+
+void cmdQueuePopCmd( cmdQueue* queue )
+{
+ cmdQueueNode* popedNode = cmdQueueDequeue(queue);
+ if (popedNode != NULL)
+ {
+ cmdQueueNodeFree(popedNode);
+ }
+}