123

Dependencies:   mbed

Fork of LG by igor Apu

Revision:
149:abbf7663d27d
Parent:
137:14a0c452cf32
Child:
156:e68ee0bcdcda
diff -r 7ce8c1fd00f7 -r abbf7663d27d Device.h
--- a/Device.h	Fri Apr 29 13:53:50 2016 +0000
+++ b/Device.h	Tue May 03 05:12:26 2016 +0000
@@ -1,10 +1,23 @@
 #ifndef __DEVICE_H__
 #define __DEVICE_H__
 
+//#define DEV_BOARD
+#ifdef DEV_BOARD
+#warning "Program config: development board!!!"
+#endif
+
+#include "LPC17xx.h"
+#include "system_LPC17xx.h"
+#include "DeviceFlash.h"
 #include "DeviceSettings.h"
 #include "DeviceProtocol.h"
 #include "DeviceTimers.h"
-#include "DeviceUART.h"
+#include "DeviceServicePort.h"
+#include "DeviceHostPort.h"
+#include "DeviceSSP.h"
+#include "DeviceLightUp.h"
+#include "DeviceDither.h"
+#include "DevicePLCS.h"
 
 typedef enum _DeviceLatchMode {
   DeviceLatch10kHz,   //internal latch  by pulses 10 kHz (power on default mode)
@@ -40,24 +53,10 @@
     
 } DevicePhotoDetectorState;
 
-typedef struct _DeviceLightUpState {
-    
-} DeviceLightUpState;
-
 typedef struct _DeviceHFOState {
   uint8_t loop; //Output signal amplitude loop switch: 1 - on/0 - off
 } DeviceHFOState;
 
-typedef struct _DevicePLCSState {
-  uint8_t loop;      //Path length control system loop switch: 1 - on/0 - off
-  uint8_t modulator; //Path length control system modulator switch: 1 - on/0 - off
-} DevicePLCSState;
-
-typedef struct _DeviceDitherState {
-  uint8_t outputFrequencyLoop; //Output signal amplitude loop switch: 1 - on/0 - off
-  uint8_t oscillationFrequencyLoop; //Output signal amplitude loop switch: 1 - on/0 - off
-} DeviceDitherState;
-
 typedef struct _Host {
   DeviceUARTState port;
   DeviceProtocolDecoder decoder;
@@ -71,31 +70,46 @@
 } Service;
 
 typedef struct _Device {
+  //Flash memory
+  DeviceFlash flash;
   //Settings
   DeviceSettings settings;
-  //Communication
-  Host host; //Host - data consumer
-  Service service;
+  //Peripherals
+  Host host;       //Host communication asynchronous serial port
+  Service service; //Service communication asynchronous serial port
+  DeviceSSP SSP;   //Synchronous serial port controller (in SPI mode)
   //Counting
   DeviceLatchState latch;
   DeviceCountersState counters;
   //Units
   DevicePhotoDetectorState detector;
-  DeviceLightUpState lightUp;
+  DeviceLightUp lightUp;
+  DeviceDither dither;
+  DevicePathLengthControlSystem plcs;
   //Regulators
   DeviceHFOState hfo;
-  DevicePLCSState plcs;
-  DeviceDitherState dither;
 } Device;
 
-void InitDevice(void);
-
 typedef struct _HashParam {
   uint32_t hash;
   void * ref;
   uint32_t size;
 } HashParam;
 
-#define HASH_PARAM_COUNT 2
+#define HASH_PARAM_COUNT 29
+
+typedef struct _HashFunc {
+  uint32_t hash;
+  void * ref;
+  uint32_t resultSize;
+  uint32_t paramCount;
+} HashFunc;
+
+#define HASH_FUNC_COUNT 3
+
+void InitDevice(void);
+void StartDevice(void);
+
+void InitAllWithDefaults(void);
 
 #endif  /* __DEVICE_H__ */
\ No newline at end of file