The project is a fast lock in amplifier (LIA) which can update its output at rate of 1000 measurements/s. It performs digital dual mixing and filtering to obtain a DC value proportional to the AC input signal.

Dependencies:   N5110 mbed

Revision:
2:c9b24787d5e1
Parent:
1:bf693859586c
Child:
3:dd4eb355f8d9
diff -r bf693859586c -r c9b24787d5e1 main.h
--- a/main.h	Mon Aug 21 11:43:03 2017 +0000
+++ b/main.h	Fri Aug 25 10:22:51 2017 +0000
@@ -39,6 +39,12 @@
 InterruptIn dref(D6);
 
 /**
+@namespace menu_ticker
+@brief time-triggered interrupt to update the menu of the LIA
+*/
+Ticker menu_ticker;
+
+/**
 @namespace amp_ticker
 @brief time-triggered interrupt calculates the offset of the input signal
 */
@@ -82,6 +88,24 @@
 Serial pc(USBTX,USBRX);
 
 /**
+@namespace xPot
+@brief read x-axis position from the value of the joystick
+*/
+AnalogIn xPot(PTB2);
+
+/**
+@namespace yPot
+@brief read y-axis position from the value of the joystick
+*/
+AnalogIn yPot(PTB3);
+
+/**
+@namespace joy_button
+@brief interrupt executes an event triggered task when joy_button is pressed
+*/
+InterruptIn joy_button(PTB11);
+
+/**
 @namespace DirectionName
 @brief define joystick's direction based on its x,y values
 */
@@ -110,18 +134,44 @@
 Joystick joystick;
 
 /**
+update position of joystick
+*/
+void updateJoystick();
+
+/**
+set origin of joystick
+*/
+void calibrateJoystick();
+
+/**
 set-up serial port
 */
 void init_serial();
 
 /**
-initialise lcd and serial
+initialise lcd
+*/
+void lcd_intro();
+
+/**
+configure settings of the LIA, sensitivity (gain) and update output (speed) 
 */
-void program_init();
+void settings_menu();
+
+/**
+set a timeout interrupt to implement power-efficient delays
+*/
+void timeout_isr();
+
+/**
+set a timeout interrupt to update the menu on screen
+*/
+void menu_isr();
 
 /**
 use MCU in High Power Mode and set Core, ADC, and BUS clocks at max
 */
+
 void setupK64Fclocks();
 
 /**
@@ -179,9 +229,21 @@
 /*!< flag used to update output */
 volatile int g_output_flag = 0;
 
+/*!< flag used to update menu */
+volatile int g_menu_flag = 0;
+
 /*!< flag used to sample internal sine/cosine signals */
 volatile int g_sample_flag = 0;
 
+/*!< var is set to exit the menu */
+volatile int exit_menu = 0;
+
+/*!< var is used to set the output gain */
+volatile float var_gain = 0;
+
+/*!< var is used to set the output speed */
+volatile float var_speed = 0;
+
 /*!< array stores the square root of X^2 and Y^2 */
 volatile double R[16];