SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
current_sense/hardware_api.h
Go to the documentation of this file.
1#ifndef HARDWARE_UTILS_CURRENT_H
2#define HARDWARE_UTILS_CURRENT_H
3
4#include "../common/foc_utils.h"
5#include "../common/time_utils.h"
6
7// flag returned if current sense init fails
8#define SIMPLEFOC_CURRENT_SENSE_INIT_FAILED ((void*)-1)
9
10// generic implementation of the hardware specific structure
11// containing all the necessary current sense parameters
12// will be returned as a void pointer from the _configureADCx functions
13// will be provided to the _readADCVoltageX() as a void pointer
18
19
20/**
21 * function reading an ADC value and returning the read voltage
22 *
23 * @param pinA - the arduino pin to be read (it has to be ADC pin)
24 * @param cs_params -current sense parameter structure - hardware specific
25 */
26float _readADCVoltageInline(const int pinA, const void* cs_params);
27
28/**
29 * function reading an ADC value and returning the read voltage
30 *
31 * @param driver_params - driver parameter structure - hardware specific
32 * @param pinA - adc pin A
33 * @param pinB - adc pin B
34 * @param pinC - adc pin C
35 */
36void* _configureADCInline(const void *driver_params, const int pinA,const int pinB,const int pinC = NOT_SET);
37
38/**
39 * function reading an ADC value and returning the read voltage
40 *
41 * @param driver_params - driver parameter structure - hardware specific
42 * @param pinA - adc pin A
43 * @param pinB - adc pin B
44 * @param pinC - adc pin C
45 */
46void* _configureADCLowSide(const void *driver_params, const int pinA,const int pinB,const int pinC = NOT_SET);
47
49
50/**
51 * function reading an ADC value and returning the read voltage
52 *
53 * @param pinA - the arduino pin to be read (it has to be ADC pin)
54 * @param cs_params -current sense parameter structure - hardware specific
55 */
56float _readADCVoltageLowSide(const int pinA, const void* cs_params);
57
58/**
59 * function syncing the Driver with the ADC for the LowSide Sensing
60 * @param driver_params - driver parameter structure - hardware specific
61 * @param cs_params - current sense parameter structure - hardware specific
62 *
63 * @return void* - returns the pointer to the current sense parameter structure (unchanged)
64 * - returns SIMPLEFOC_CURRENT_SENSE_INIT_FAILED if the init fails
65 */
66void* _driverSyncLowSide(void* driver_params, void* cs_params);
67
68#endif
void * _configureADCInline(const void *driver_params, const int pinA, const int pinB, const int pinC=NOT_SET)
float _readADCVoltageInline(const int pinA, const void *cs_params)
void * _driverSyncLowSide(void *driver_params, void *cs_params)
void * _configureADCLowSide(const void *driver_params, const int pinA, const int pinB, const int pinC=NOT_SET)
void _startADC3PinConversionLowSide()
float _readADCVoltageLowSide(const int pinA, const void *cs_params)
const int const int const int pinC
#define NOT_SET
Definition foc_utils.h:34