Gabriel Delgado / Mbed 2 deprecated MTi-1_uart

Dependencies:   mbed mbed-rtos Xbus

Revision:
22:3eab999c5076
Parent:
19:46e88d37ecef
Child:
23:8171449f0dc3
--- a/xbus/xbusparser.c	Tue May 19 16:59:11 2015 +0200
+++ b/xbus/xbusparser.c	Tue May 19 16:59:53 2015 +0200
@@ -83,6 +83,7 @@
 	switch (mid)
 	{
 		case XMID_DeviceId:
+		case XMID_OutputConfig:
 			return true;
 
 		default:
@@ -109,6 +110,30 @@
 			}
 			break;
 
+		case XMID_OutputConfig:
+			{
+				uint8_t fields = parser->currentMessage.length / 4;
+				struct OutputConfiguration* conf = parser->callbacks.allocateBuffer(fields * sizeof(struct OutputConfiguration));
+				uint8_t const* dptr = parser->rxBuffer;
+				if (conf)
+				{
+					parser->currentMessage.data = conf;
+					parser->currentMessage.length = fields;
+
+					for (int i = 0; i < fields; ++i)
+					{
+						dptr = XbusUtility_readU16((uint16_t*)&conf->dtype, dptr);
+						dptr = XbusUtility_readU16(&conf->freq, dptr);
+						++conf;
+					}
+				}
+				else
+				{
+					parser->currentMessage.data = NULL;
+				}
+			}
+			break;
+
 		default:
 			assert(!canParseMessagePayload(parser->currentMessage.mid));
 			break;