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.
Diff: main.h
- Revision:
- 3:dd4eb355f8d9
- Parent:
- 2:c9b24787d5e1
--- a/main.h Fri Aug 25 10:22:51 2017 +0000 +++ b/main.h Wed Aug 30 15:09:56 2017 +0000 @@ -100,10 +100,16 @@ AnalogIn yPot(PTB3); /** -@namespace joy_button -@brief interrupt executes an event triggered task when joy_button is pressed +@namespace joyButton +@brief interrupt executes an event triggered task when joyButton is pressed */ -InterruptIn joy_button(PTB11); +InterruptIn joyButton(PTB11); + +/** +@namespace swButton +@brief interrupt executes an event triggered task +*/ +InterruptIn swButton(PTB18); /** @namespace DirectionName @@ -159,6 +165,22 @@ void settings_menu(); /** +setup the position of the menu selector (circle) +*/ +void setup_selector(); + + +/** +init the LIA menu +*/ +void init_LIA_menu(); + +/** +joystick button pressed +*/ +void confirmationJoyButton(); + +/** set a timeout interrupt to implement power-efficient delays */ void timeout_isr(); @@ -169,6 +191,16 @@ void menu_isr(); /** +Event-triggered interrupt executes ISR when joystick button is pressed +*/ +void joyButton_isr(); + +/** +Event-triggered interrupt executes ISR when joystick button is pressed +*/ +void swButton_isr(); + +/** use MCU in High Power Mode and set Core, ADC, and BUS clocks at max */ @@ -232,17 +264,29 @@ /*!< flag used to update menu */ volatile int g_menu_flag = 0; +/*!< flag is set when joystick button is pressed */ +volatile int g_joyButton_flag = 0; + +/*!< flag is set when joystick button is pressed */ +volatile int g_swButton_flag = 0; + /*!< flag used to sample internal sine/cosine signals */ volatile int g_sample_flag = 0; +/*!< variable used to move the menu selector */ +volatile int menu_option = 0; + +/*!< variable used to move the continue selector */ +volatile int save_option = 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; +volatile double var_gain = 1.0; /*!< var is used to set the output speed */ -volatile float var_speed = 0; +volatile double var_speed = 1.0; /*!< array stores the square root of X^2 and Y^2 */ volatile double R[16];