Skip to content

Commit

Permalink
Add finger present API and bit. Update README
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Str枚mbergson <joachim@assured.se>
  • Loading branch information
secworks committed Apr 22, 2024
1 parent d7b8bb2 commit 3411021
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
23 changes: 18 additions & 5 deletions hw/application_fpga/core/touch_sense/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,27 @@ The user is expected to lift the finger between multiple touch events.


## API

The API has a single address, and a single bit in that address:
The API has two addresses.

```
ADDR_STATUS: 0x09
STATUS_EVENT_BIT: 0
ADDR_PRESENT: 0x0a
FINGER_PRESENT_BIT: 0
```

SW should clear any stray attempts before signalling to the user that
a touch event is expected. Clearing an event is done by writing the
the status address, the value written does not matter.
In order to detect an event, SW should clear any stray attempts before
signalling to the user that a touch event is expected. Clearing an
event is done by writing the the status address, the value written
does not matter.

When an event has been detected, that is the sampled input from the
sensor has gone from low to high, the STATUS_EVENT_BIT will be high
(set). When SW reads a high bit, the SW should as soon as possible
clear the event by writing to the status register. The value written
does not matter.

The FINGER_PRESENT bit is the sampled input from the sensor. The bit
will be high as long as a finger is present on the sensor. When a
finger is present the bit will be low.
16 changes: 11 additions & 5 deletions hw/application_fpga/core/touch_sense/rtl/touch_sense.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ module touch_sense(
//----------------------------------------------------------------
// Internal constant and parameter definitions.
//----------------------------------------------------------------
localparam ADDR_STATUS = 8'h09;
localparam STATUS_EVENT_BIT = 0;
localparam ADDR_STATUS = 8'h09;
localparam STATUS_EVENT_BIT = 0;
localparam ADDR_PRESENT = 8'h0a;
localparam FINGER_PRESENT_BIT = 0;

localparam CTRL_IDLE = 2'h0;
localparam CTRL_EVENT = 2'h1;
localparam CTRL_WAIT = 2'h2;
localparam CTRL_IDLE = 2'h0;
localparam CTRL_EVENT = 2'h1;
localparam CTRL_WAIT = 2'h2;


//----------------------------------------------------------------
Expand Down Expand Up @@ -120,6 +122,10 @@ module touch_sense(
if (address == ADDR_STATUS) begin
tmp_read_data[STATUS_EVENT_BIT] = touch_event_reg;
end

if (address == ADDR_PRESENT) begin
tmp_read_data[FINGER_PRESENT_BIT] = touch_event_sample1_reg;
end
end
end
end // api
Expand Down

0 comments on commit 3411021

Please sign in to comment.