Hallo Interssierte.
ich habe irgendwie Verstaendnissprobleme, was das generelle Aufteilen
von .c und .h files in Projekten betrifft.
Hier mal ein Beispiel:
1 | .
|
2 | ├── components
|
3 | │ ├── esp32-ds18b20
|
4 | │ │ ├── component.mk
|
5 | │ │ ├── doc
|
6 | │ │ │ └── Doxyfile
|
7 | │ │ ├── ds18b20.c
|
8 | │ │ ├── include
|
9 | │ │ │ └── ds18b20.h
|
10 | │ │ ├── LICENSE
|
11 | │ │ └── README.md
|
12 | │ ├── esp32-i2c-ssd1306-oled
|
13 | │ │ ├── main
|
14 | │ │ │ ├── component.mk
|
15 | │ │ │ ├── font_glcd_5x7.c
|
16 | │ │ │ ├── fonts.c
|
17 | │ │ │ ├── font_tahoma_8pt.c
|
18 | │ │ │ ├── i2c.c
|
19 | │ │ │ ├── include
|
20 | │ │ │ │ ├── fonts.h
|
21 | │ │ │ │ ├── i2c.h
|
22 | │ │ │ │ └── ssd1306.h
|
23 | │ │ │ ├── main.c
|
24 | │ │ │ ├── main.c.dist
|
25 | │ │ │ └── ssd1306_i2c.c
|
26 | │ │ ├── Makefile
|
27 | │ │ ├── README.md
|
28 | │ │ └── sdkconfig
|
29 | │ └── esp32-owb
|
30 | │ ├── component.mk
|
31 | │ ├── doc
|
32 | │ │ └── Doxyfile
|
33 | │ ├── include
|
34 | │ │ ├── owb_gpio.h
|
35 | │ │ ├── owb.h
|
36 | │ │ └── owb_rmt.h
|
37 | │ ├── LICENSE
|
38 | │ ├── owb.c
|
39 | │ ├── owb_gpio.c
|
40 | │ ├── owb_rmt.c
|
41 | │ └── README.md
|
42 | ├── main
|
43 | │ ├── component.mk
|
44 | │ ├── main.c
|
45 | │ └── wifi.c
|
46 | ├── Makefile
|
47 | ├── README.md
|
48 | └── sdkconfig
|
Im Project Root liegt die [sdkconfig] und ein [makefile], soweit klar.
Im main liegt mein eigentliches Programm [main.c], die Wifi-Fuktionen
habe ich schon in ein extra File ausgelagert [wifi.c].
Unter [components] habe ich mir nun verschiedene ?Librarys?
zusammengeklaut und abgelegt.
Mir ist nun nicht klar, wie ich in/aus [main.c] oder [wifi.c] die
Funktionen in den ?Librarys? unter [components] zugreiffen kann.
Was mir auch nicht klar ist, wenn ich im [main.c] #include einbinde, ich
das in [wifi.c] auch nochmal machen muss??
[main.c]
1 | #include "freertos/FreeRTOS.h"
|
2 | #include "freertos/event_groups.h"
|
3 | #include "freertos/task.h"
|
[wifi.c]
1 | #include "freertos/FreeRTOS.h"
|
2 | #include "freertos/event_groups.h"
|
3 | #include "freertos/task.h"
|
4 |
|
5 | #include "esp_wifi.h"
|
6 | #include "esp_event_loop.h"
|
7 |
|
8 | #include "lwip/err.h"
|
9 | #include "lwip/sockets.h"
|
10 | #include "lwip/sys.h"
|
11 | #include "lwip/netdb.h"
|
12 | #include "lwip/dns.h"
|
ich wollte in [wifi.c] nur [freertos/event_groups.h] einbinden, weil ich
das nur dort brauche, das mault der Compiler aber an ... ich muesse
[freertos/event_groups.h] vorher einbinden. Was ich ja schon in [main.c]
getan habe.
Ja, Fragen Fragen.