Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3-rs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tux coder
flow3-rs
Commits
e93ce83a
Commit
e93ce83a
authored
1 year ago
by
TuxCoder
Browse files
Options
Downloads
Patches
Plain Diff
fix pad 2 captouch
parent
b3a86794
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ad7147/src/device.rs
+8
-8
8 additions, 8 deletions
ad7147/src/device.rs
ad7147/src/driver.rs
+2
-2
2 additions, 2 deletions
ad7147/src/driver.rs
src/flow3r/captouch.rs
+15
-4
15 additions, 4 deletions
src/flow3r/captouch.rs
with
25 additions
and
14 deletions
ad7147/src/device.rs
+
8
−
8
View file @
e93ce83a
...
...
@@ -221,10 +221,10 @@ impl<STATE, const S: usize> ConfigurationBuilder<STATE, S> {
stages
[
i
]
=
ext_stage
.0
;
}
let
mut
calibration
=
[
false
;
1
2
];
let
mut
low_int
=
[
false
;
1
2
];
let
mut
high_int
=
[
false
;
1
2
];
let
mut
conv_int
=
[
false
;
1
2
];
let
mut
calibration
=
[
false
;
1
3
];
let
mut
low_int
=
[
false
;
1
3
];
let
mut
high_int
=
[
false
;
1
3
];
let
mut
conv_int
=
[
false
;
1
3
];
for
(
i
,
stage
)
in
stages
.iter
()
.enumerate
()
{
calibration
[
i
]
=
stage
.global.calibration_enabled
;
...
...
@@ -330,7 +330,7 @@ pub enum CdcBias {
#[derive(Debug,
Default,
Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord)]
pub
(
crate
)
struct
CalibrationEnable
{
stages_enable
:
[
bool
;
1
2
],
stages_enable
:
[
bool
;
1
3
],
avg_fp_skip
:
FullPowerSkip
,
avg_lp_skip
:
LowPowerSkip
,
}
...
...
@@ -431,7 +431,7 @@ pub enum PowerDownTimeout {
#[derive(Debug,
Default,
Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord)]
pub
(
crate
)
struct
StageLowIntEnable
{
stages_enable
:
[
bool
;
1
2
],
stages_enable
:
[
bool
;
1
3
],
gpio_setup
:
GpioSetup
,
gpio_input_config
:
GpioInputConfig
,
}
...
...
@@ -474,7 +474,7 @@ pub enum GpioInputConfig {
#[derive(Debug,
Default,
Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord)]
pub
(
crate
)
struct
StageHighIntEnable
{
stages_enable
:
[
bool
;
1
2
],
stages_enable
:
[
bool
;
1
3
],
}
impl
StageHighIntEnable
{
...
...
@@ -495,7 +495,7 @@ impl StageHighIntEnable {
#[derive(Debug,
Default,
Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord)]
pub
(
crate
)
struct
StageCompleteIntEnable
{
stages_enable
:
[
bool
;
1
2
],
stages_enable
:
[
bool
;
1
3
],
}
impl
StageCompleteIntEnable
{
...
...
This diff is collapsed.
Click to expand it.
ad7147/src/driver.rs
+
2
−
2
View file @
e93ce83a
...
...
@@ -42,7 +42,7 @@ where
configuration
:
DeviceConfiguration
<
S
>
,
delay
:
&
mut
DELAY
,
)
->
Result
<
Ad7147
<
I2C
,
Initialized
,
S
>
,
E
>
{
let
mut
data
=
[
0u16
;
(
1
2
*
8
)
+
1
];
let
mut
data
=
[
0u16
;
(
1
3
*
8
)
+
1
];
data
[
0
]
=
0x080
;
for
(
i
,
stage
)
in
configuration
.0
.stages
.iter
()
.enumerate
()
{
let
data_idx
=
(
i
*
8
)
+
1
;
...
...
@@ -82,7 +82,7 @@ where
I2C
:
WriteRead
<
Error
=
E
>
+
Write
<
Error
=
E
>
,
{
pub
fn
read_all_stages
(
&
mut
self
)
->
Result
<
[
u16
;
S
],
E
>
{
let
mut
result
=
[
0u8
;
1
2
*
2
];
let
mut
result
=
[
0u8
;
1
3
*
2
];
self
.i2c
.write_read
(
self
.address
,
to_be_array
([
STAGE_CONVERSION_RESULT_REGISTER
])
.as_byte_slice
(),
...
...
This diff is collapsed.
Click to expand it.
src/flow3r/captouch.rs
+
15
−
4
View file @
e93ce83a
...
...
@@ -216,7 +216,7 @@ fn init_captouch(
i2c_top
:
I2cProxy
<
'static
,
XtensaMutex
<
I2C
<
'static
,
I2C0
>>>
,
)
->
Result
<
(
Ad7147
<
I2cProxy
<
'static
,
XtensaMutex
<
I2C
<
'static
,
I2C0
>>>
,
Initialized
,
1
2
>
,
Ad7147
<
I2cProxy
<
'static
,
XtensaMutex
<
I2C
<
'static
,
I2C0
>>>
,
Initialized
,
1
3
>
,
Ad7147
<
I2cProxy
<
'static
,
XtensaMutex
<
I2C
<
'static
,
I2C0
>>>
,
Initialized
,
12
>
,
),
hal
::
i2c
::
Error
,
...
...
@@ -346,6 +346,16 @@ fn init_captouch(
})
.initial_offset_high
(
55000
)
.build
(),
StageConfiguration
::
builder
()
.calibration_enabled
(
true
)
.conversion_complete_interrupt_enabled
(
true
)
.pos_afe_offset
(
26
)
.add_input_connection
(
InputConnection
{
cin
:
CapInput
::
CIN12
,
cdc
:
CdcInput
::
Positive
,
})
.initial_offset_high
(
55000
)
.build
(),
])
.build
();
let
ad7147_top
=
Ad7147
::
new
(
i2c_top
,
0b00101100
);
...
...
@@ -560,7 +570,7 @@ async fn update_petals_top(interrupts: u16, measurements: [u16; 12]) {
}
}
static
PETAL_MAPPPING_BOT
:
[(
usize
,
PetalPosition
);
1
2
]
=
[
static
PETAL_MAPPPING_BOT
:
[(
usize
,
PetalPosition
);
1
3
]
=
[
(
9
,
PetalPosition
::
BASE
),
(
9
,
PetalPosition
::
TIP
),
(
7
,
PetalPosition
::
BASE
),
...
...
@@ -573,12 +583,13 @@ static PETAL_MAPPPING_BOT: [(usize, PetalPosition); 12] = [
(
1
,
PetalPosition
::
TIP
),
(
2
,
PetalPosition
::
BASE
),
(
2
,
PetalPosition
::
CW
),
(
2
,
PetalPosition
::
CCW
),
];
async
fn
update_petals_bot
(
interrupts
:
u16
,
measurements
:
[
u16
;
1
2
])
{
async
fn
update_petals_bot
(
interrupts
:
u16
,
measurements
:
[
u16
;
1
3
])
{
let
mut
petals
=
PETALS
.lock
()
.await
;
for
(
i
,
m
)
in
PETAL_MAPPPING_BOT
.iter
()
.enumerate
()
{
let
pressed
=
measurements
[
i
]
>
4
0000
;
let
pressed
=
measurements
[
i
]
>
5
0000
;
match
petals
[
m
.0
]
{
Flow3rPetal
::
TOP
{
ref
mut
ccw
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment