Since this is my first "quasi-professional" project that I actually want others to use, I wanted there to be decent quality documentation for all the functions and structs that the end user would need to use. I had tried Doxygen before but never had much luck, mostly because I didn't bother to put in the effort to read the documentation closely. So this time around I did, and the output so far looks quite good and has a lot of detail about the functions, and the two typedef structs that are key to everything working. Added code to check if wifi is connected before allowing the TCP connection to be attempted. Similar code for mqtt_connect, checking if we have a valid TCP connection to the server. Waiting for wifi uses a new global timer. These changes affected the indentation of huge chunks of the code, as they got wrapped in ifs. We now take advantage of the void *reverse pointer in the espconn struct to point to the mqtt_session_t that is active. This is a nice touch that Espressif added, so you can access arbitrary data from within callbacks. This will allow us to (soon) have user callbacks to deal with MQTT messages. Also added license notices to all the source code files.
29 lines
826 B
Makefile
29 lines
826 B
Makefile
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
P=mqtt
|
|
CC=xtensa-lx106-elf-gcc
|
|
AR=xtensa-lx106-elf-ar
|
|
LDLIBS=-nostdlib -ggdb -Wl,-Map=output.map -Wl,--start-group -lm -lc -lhal -lpp -llwip -lphy -lnet80211 -lwpa -lat -lwpa2 -lmain -Wl,--end-group -lgcc
|
|
CFLAGS= -I. -mlongcalls -std=gnu11
|
|
LDFLAGS=-Teagle.app.v6.ld
|
|
OBJ=mqtt.o
|
|
DEPS=mqtt.h
|
|
|
|
$(P)-0x00000.bin: $(P)
|
|
esptool.py elf2image $^
|
|
|
|
$(P): $(OBJ)
|
|
|
|
%.o: %.c $(DEPS)
|
|
|
|
flash: $(P)-0x00000.bin
|
|
esptool.py --port /dev/feather1 write_flash 0 $(P)-0x00000.bin 0x10000 $(P)-0x10000.bin
|
|
|
|
clean:
|
|
rm -f $(P) $(P).o $(P)-0x00000.bin $(P)-0x10000.bin
|
|
|
|
library:
|
|
$(CC) -c -fPIC $(CFLAGS) $(P).c -o $(P).o
|
|
$(AR) rcs lib$(P).a $(P).o
|