Skip to content

Commit b18385c

Browse files
committed
[board] Fix DISCO-F469NI rev B-03 touch sensor address
1 parent 52ea9b3 commit b18385c

File tree

8 files changed

+34
-10
lines changed

8 files changed

+34
-10
lines changed

docs/src/guide/custom-project.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,16 @@ discover all of modm yet. You can now choose from two levels of customization:
9393

9494
## Using a Board Support Package
9595

96-
Use lbuild to discover the specific BSP configuration you want to use:
96+
Use lbuild to discover the specific BSP configuration you want to use.
97+
Some board configurations support different hardware revisions, so check your
98+
hardware to select the right one:
9799

98100
```
99101
$ lbuild discover
100102
Parser(lbuild)
101103
╰── Repository(modm @ ../../ext/modm) modm: a barebone embedded library generator
102104
├── Option(target) = REQUIRED in [stm32f469ngh6, stm32f469nih6, stm32f469vet6, ...
103-
├── Config(modm:disco-f469ni) STM32F469IDISCOVERY
105+
├── Config(modm:disco-f469ni:b-03) in [b-01, b-03] STM32F469IDISCOVERY
104106
...
105107
```
106108

@@ -113,7 +115,7 @@ cannot remove any inherited modules.
113115
<library>
114116
<repositories>...</repositories>
115117

116-
<extends>modm:disco-f469ni</extends>
118+
<extends>modm:disco-f469ni:b-03</extends>
117119

118120
<options>...</options>
119121
<modules>...</modules>

docs/src/guide/discover.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ format. The `modm/repo.lb` file must be declared to find all modm modules:
2020
Parser(lbuild)
2121
╰── Repository(modm @ .) modm: a barebone embedded library generator
2222
├── Option(target) = REQUIRED in [stm32f469ngh6, stm32f469nih6, stm32f469vet6, ...
23-
├── Config(modm:disco-f469ni) STM32F469IDISCOVERY
23+
├── Config(modm:disco-f469ni:b-03) in [b-01, b-03] STM32F469IDISCOVERY
2424
...
2525
```
2626

@@ -54,7 +54,7 @@ modules for this specific target. We will choose the `stm32f469nih6` device:
5454
Parser(lbuild)
5555
╰── Repository(modm @ .) modm: a barebone embedded library generator
5656
├── Option(target) = stm32f469nih6 in [stm32f407vgt6, stm32f469nih6, ...
57-
├── Config(modm:disco-f469ni) STM32F469IDISCOVERY
57+
├── Config(modm:disco-f469ni:b-03) in [b-01, b-03] STM32F469IDISCOVERY
5858
...
5959
├── Module(modm:board) Board Support Packages
6060
│ ╰── Module(modm:board:disco-f469ni) STM32F469IDISCOVERY

examples/stm32f469_discovery/game_of_life/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ constexpr modm::MemoryTraits traits = SCALE >= 4 ? modm::MemoryFastData : modm::
3636
void read_touch()
3737
{
3838
static Touch::Data touchData;
39-
static Touch touchSensor(touchData);
39+
static Touch touchSensor(touchData, TouchAddress);
4040
static bool initialized = false;
4141
if (not initialized) {
4242
// Configure the touchscreen to sample with 60Hz in active and monitor mode.

examples/stm32f469_discovery/lvgl/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static lv_color_t* buf;
3232
static constexpr size_t buf_size = LV_HOR_RES_MAX * LV_VER_RES_MAX;
3333

3434
Touch::Data touchData;
35-
Touch touch{touchData};
35+
Touch touch{touchData, TouchAddress};
3636

3737
void my_touchpad_read(lv_indev_drv_t*, lv_indev_data_t* data)
3838
{

examples/stm32f469_discovery/touchscreen/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class LineDrawer : public modm::pt::Protothread
2020
{
2121
public:
2222
LineDrawer() :
23-
touch(touchData),
23+
touch(touchData, TouchAddress),
2424
display{Board::getDisplay()},
2525
px{-1, -1}, py{-1, -1},
2626
c{modm::color::html::White, modm::color::html::White}

src/modm/board/disco_f469ni/board.hpp renamed to src/modm/board/disco_f469ni/board.hpp.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ using Scl = GpioB8;
164164
using Sda = GpioB9;
165165
using I2cMaster = I2cMaster1;
166166
using Touch = modm::Ft6x06< I2cMaster >;
167+
constexpr uint8_t TouchAddress = {{touch_address}};
167168
}
168169

169170
namespace usb

src/modm/board/disco_f469ni/module.lb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
def init(module):
1515
module.name = ":board:disco-f469ni"
1616
module.description = FileReader("module.md")
17+
# Revisions = [b-03, b-01]
1718

1819
def prepare(module, options):
1920
if not options[":target"].partname.startswith("stm32f469nih"):
@@ -39,10 +40,16 @@ def build(env):
3940
env.outbasepath = "modm/src/modm/board"
4041
env.substitutions = {
4142
"with_logger": True,
42-
"with_assert": env.has_module(":architecture:assert")
43+
"with_assert": env.has_module(":architecture:assert"),
44+
"touch_address": 0x38 if env[":disco-f469ni"] == "b-03" else 0x2a,
4345
}
4446
env.template("../board.cpp.in", "board.cpp")
45-
env.copy('.')
47+
env.copy("board_display.cpp")
48+
env.copy("board_dsi.cpp")
49+
env.copy("board_init.cpp")
50+
env.copy("board_otm8009a.cpp")
51+
env.copy("board_sdram.cpp")
52+
env.template("board.hpp.in")
4653
env.collect(":build:openocd.source", "board/stm32f469discovery.cfg")
4754

4855
env.collect(":platform:cortex-m:linkerscript.memory", linkerscript_memory)

src/modm/board/disco_f469ni/module.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,17 @@ Access to the capacitive touchscreen is provided in the `Board::ft6` namespace.
2626
Call `Board::initializeTouchscreen()` to setup the peripherals.
2727

2828
[Product Link](https://www.st.com/en/evaluation-tools/32f469idiscovery.html)
29+
30+
31+
## Hardware Revisions
32+
33+
The revision B-03 has a different touch sensor address from B-01, which is
34+
provided as `Board::ft6::TouchAddress`:
35+
36+
```cpp
37+
Board::ft6::Touch::Data data;
38+
Board::ft6::Touch touchSensor(data, Board::ft6::TouchAddress);
39+
```
40+
41+
If you have an earlier revision, you can extend your configuration from
42+
`modm:disco-f469ni:b-01`.

0 commit comments

Comments
 (0)