Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
b5ee7dde
Unverified
Commit
b5ee7dde
authored
Jun 10, 2021
by
lbernstone
Committed by
GitHub
Jun 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert hall read to use hal/idf (#5268)
Fixes #4866
parent
10602939
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
19 deletions
+3
-19
cores/esp32/esp32-hal-adc.c
cores/esp32/esp32-hal-adc.c
+3
-19
No files found.
cores/esp32/esp32-hal-adc.c
View file @
b5ee7dde
...
...
@@ -245,28 +245,12 @@ void __analogSetVRefPin(uint8_t pin){
__analogVRefPin
=
pin
;
}
int
__hallRead
()
//hall sensor
without LNA
int
__hallRead
()
//hall sensor
using idf read
{
int
Sens_Vp0
;
int
Sens_Vn0
;
int
Sens_Vp1
;
int
Sens_Vn1
;
pinMode
(
36
,
ANALOG
);
pinMode
(
39
,
ANALOG
);
SET_PERI_REG_MASK
(
SENS_SAR_TOUCH_CTRL1_REG
,
SENS_XPD_HALL_FORCE_M
);
// hall sens force enable
SET_PERI_REG_MASK
(
RTC_IO_HALL_SENS_REG
,
RTC_IO_XPD_HALL
);
// xpd hall
SET_PERI_REG_MASK
(
SENS_SAR_TOUCH_CTRL1_REG
,
SENS_HALL_PHASE_FORCE_M
);
// phase force
CLEAR_PERI_REG_MASK
(
RTC_IO_HALL_SENS_REG
,
RTC_IO_HALL_PHASE
);
// hall phase
Sens_Vp0
=
__analogRead
(
36
);
Sens_Vn0
=
__analogRead
(
39
);
SET_PERI_REG_MASK
(
RTC_IO_HALL_SENS_REG
,
RTC_IO_HALL_PHASE
);
Sens_Vp1
=
__analogRead
(
36
);
Sens_Vn1
=
__analogRead
(
39
);
SET_PERI_REG_BITS
(
SENS_SAR_MEAS_WAIT2_REG
,
SENS_FORCE_XPD_SAR
,
0
,
SENS_FORCE_XPD_SAR_S
);
CLEAR_PERI_REG_MASK
(
SENS_SAR_TOUCH_CTRL1_REG
,
SENS_XPD_HALL_FORCE
);
CLEAR_PERI_REG_MASK
(
SENS_SAR_TOUCH_CTRL1_REG
,
SENS_HALL_PHASE_FORCE
);
return
(
Sens_Vp1
-
Sens_Vp0
)
-
(
Sens_Vn1
-
Sens_Vn0
);
__analogSetWidth
(
12
);
return
hall_sensor_read
();
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment