Skip to content

Commit c96363a

Browse files
secworksdehanj
authored andcommitted
Add finger present API and bit. Update README
Signed-off-by: Joachim Strömbergson <[email protected]>
1 parent 0454e02 commit c96363a

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

hw/application_fpga/core/touch_sense/README.md

+18-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,27 @@ before being able to detect another event.
1616

1717

1818
## API
19-
20-
The API has a single address, and a single bit in that address:
19+
The API has two addresses.
2120

2221
```
2322
ADDR_STATUS: 0x09
2423
STATUS_EVENT_BIT: 0
24+
25+
ADDR_PRESENT: 0x0a
26+
FINGER_PRESENT_BIT: 0
2527
```
2628

27-
SW should clear any stray attempts before signalling to the user that
28-
a touch event is expected. Clearing an event is done by writing the
29-
the status address, the value written does not matter.
29+
In order to detect an event, SW should clear any stray attempts before
30+
signalling to the user that a touch event is expected. Clearing an
31+
event is done by writing the the status address, the value written
32+
does not matter.
33+
34+
When an event has been detected, that is the sampled input from the
35+
sensor has gone from low to high, the STATUS_EVENT_BIT will be high
36+
(set). When SW reads a high bit, the SW should as soon as possible
37+
clear the event by writing to the status register. The value written
38+
does not matter.
39+
40+
The FINGER_PRESENT bit is the sampled input from the sensor. The bit
41+
will be high as long as a finger is present on the sensor. When a
42+
finger is present the bit will be low.

hw/application_fpga/core/touch_sense/rtl/touch_sense.v

+11-5
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ module touch_sense(
3131
//----------------------------------------------------------------
3232
// Internal constant and parameter definitions.
3333
//----------------------------------------------------------------
34-
localparam ADDR_STATUS = 8'h09;
35-
localparam STATUS_EVENT_BIT = 0;
34+
localparam ADDR_STATUS = 8'h09;
35+
localparam STATUS_EVENT_BIT = 0;
36+
localparam ADDR_PRESENT = 8'h0a;
37+
localparam FINGER_PRESENT_BIT = 0;
3638

37-
localparam CTRL_IDLE = 2'h0;
38-
localparam CTRL_EVENT = 2'h1;
39-
localparam CTRL_WAIT = 2'h2;
39+
localparam CTRL_IDLE = 2'h0;
40+
localparam CTRL_EVENT = 2'h1;
41+
localparam CTRL_WAIT = 2'h2;
4042

4143

4244
//----------------------------------------------------------------
@@ -120,6 +122,10 @@ module touch_sense(
120122
if (address == ADDR_STATUS) begin
121123
tmp_read_data[STATUS_EVENT_BIT] = touch_event_reg;
122124
end
125+
126+
if (address == ADDR_PRESENT) begin
127+
tmp_read_data[FINGER_PRESENT_BIT] = touch_event_sample1_reg;
128+
end
123129
end
124130
end
125131
end // api

hw/application_fpga/fw/tk1_mem.h

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
#define TK1_MMIO_TOUCH_BASE 0xc4000000
9999
#define TK1_MMIO_TOUCH_STATUS 0xc4000024
100100
#define TK1_MMIO_TOUCH_STATUS_EVENT_BIT 0
101+
#define TK1_MMIO_TOUCH_PRESENT 0xc4000028
102+
#define TK1_MMIO_TOUCH_PRESENT_BIT 0
101103

102104
// This only exists in QEMU, not real hardware
103105
#define TK1_MMIO_QEMU_BASE 0xfe000000

0 commit comments

Comments
 (0)