Implementation file for metal detecting functionality. More...
Functions | |
MD_DetectStatus_t | md_detect (MD_Handle_t *const handle, const MD_Data_t *const data, int16_t *const phase_difference) |
Detects the presence of a target based on signal magnitude and phase difference. | |
void | md_set_gndbalance (MD_Handle_t *const handle, const uint16_t new_balance) |
Sets the ground balance parameter for metal detection. | |
void | md_set_sensitivity (MD_Handle_t *const handle, const uint16_t new_sens) |
Sets the sensitivity parameter for metal detection. | |
Variables | |
MD_Handle_t | md_handle = {0 } |
Global handle for metal detecting operations. | |
Implementation file for metal detecting functionality.
This file contains the implementation of functions for metal detecting. It includes functions for detecting targets based on signal magnitude and phase difference, as well as setting ground balance and sensitivity parameters.
Created on: Jul 23, 2024 Author: Viktor
MD_DetectStatus_t md_detect | ( | MD_Handle_t *const | handle, |
const MD_Data_t *const | data, | ||
int16_t *const | phase_difference ) |
Detects the presence of a target based on signal magnitude and phase difference.
Detects the presence of a target based on signal data.
This function determines if a target is detected by comparing the current signal magnitude with a ground balance and sensitivity threshold. It also calculates the phase difference between the transmitted and received signals.
handle | Pointer to the MD_Handle_t structure containing detection parameters. |
data | Pointer to the MD_Data_t structure containing the received signal data. |
phase_difference | Pointer to an integer where the calculated phase difference will be stored. |
< Default return value indicating no target detected
< Variable to hold the calculated phase difference
< Set the return value to indicate that a target is detected
< Convert phase difference to degrees
< Take the absolute value of the phase difference
< Store the phase difference in the provided pointer
< Return the detection status
void md_set_gndbalance | ( | MD_Handle_t *const | handle, |
const uint16_t | new_balance ) |
Sets the ground balance parameter for metal detection.
This function updates the ground balance value used in target detection.
handle | Pointer to the MD_Handle_t structure containing detection parameters. |
new_balance | New ground balance value to be set. |
< Update the ground balance parameter
void md_set_sensitivity | ( | MD_Handle_t *const | handle, |
const uint16_t | new_sens ) |
Sets the sensitivity parameter for metal detection.
This function updates the sensitivity value used in target detection.
handle | Pointer to the MD_Handle_t structure containing detection parameters. |
new_sens | New sensitivity value to be set. |
< Update the sensitivity parameter