#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
#include "interface.h"
#include "sds.h"
#include "mem.h"
-extern uint8_t *mem_top;
-extern uint8_t *mem_bottom;
-extern uint8_t *mem_task;
-extern uint8_t *mem_sds;
+extern uint8_t *mem_top, *mem_bottom, *mem_task, *mem_sds;
struct sds *sds_head(void)
{
//Read identifier
struct sds *s = sds_get(id);
if(s != NULL){
- s->value = read16();
+ switch(read_byte()){
+ //Long
+ case 'l':
+ //Int
+ case 'i':
+ s->value = read16();
+ break;
+ case 'b': //Bool
+ case 'c': //Character
+ case 'B': //Button
+ case 'L': //UserLED
+ s->value = read_byte();
+ break;
+ }
debug("Received sds update %d: %d", s->id, s->value);
write_byte('u');
write16(s->id);
}
write_byte('\n');
return;
-
} else {
debug("SDS identifier unknown: %d", id);
die("");