diff --git a/.gitignore b/.gitignore index a42cc40..51f03c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build tests/bin .pioenvs .piolibdeps diff --git a/AAL/Arduino.cpp b/AAL/Arduino.cpp new file mode 100644 index 0000000..2513b5c --- /dev/null +++ b/AAL/Arduino.cpp @@ -0,0 +1,9 @@ +#include +#include + + +uint32_t HAL_GetTick(void); + +millis_t millis() { + return HAL_GetTick(); +} \ No newline at end of file diff --git a/AAL/Arduino.h b/AAL/Arduino.h new file mode 100644 index 0000000..e12310c --- /dev/null +++ b/AAL/Arduino.h @@ -0,0 +1,14 @@ +#ifndef _ARDUINO_H_ +#define _ARDUINO_H_ + +#include +#include + + +typedef uint32_t millis_t; +typedef bool boolean; + + +millis_t millis(); + +#endif // _ARDUINO_H_ \ No newline at end of file diff --git a/AAL/Client.h b/AAL/Client.h new file mode 100644 index 0000000..4af4ac7 --- /dev/null +++ b/AAL/Client.h @@ -0,0 +1,6 @@ +#ifndef _CLIENT_H_ +#define _CLIENT_H_ + + + +#endif // _CLIENT_H_ \ No newline at end of file diff --git a/AAL/IPAddress.cpp b/AAL/IPAddress.cpp new file mode 100644 index 0000000..009c56f --- /dev/null +++ b/AAL/IPAddress.cpp @@ -0,0 +1,10 @@ +#include + +#include + +IPAddress::IPAddress(uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4) { + _address[0] = o1; + _address[1] = o2; + _address[2] = o3; + _address[3] = o4; +} \ No newline at end of file diff --git a/AAL/IPAddress.h b/AAL/IPAddress.h new file mode 100644 index 0000000..8e2cca9 --- /dev/null +++ b/AAL/IPAddress.h @@ -0,0 +1,15 @@ +#ifndef _IPADDRESS_H_ +#define _IPADDRESS_H_ + +#include + +class IPAddress { + private: + uint8_t _address[4]; + uint8_t *raw_address() { return _address; }; + public: + IPAddress(uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4); +}; + + +#endif // _IPADDRESS_H_ \ No newline at end of file diff --git a/AAL/Stream.cpp b/AAL/Stream.cpp new file mode 100644 index 0000000..063742d --- /dev/null +++ b/AAL/Stream.cpp @@ -0,0 +1,12 @@ +#include + +#include +#include + +Stream::Stream() { + +} + +size_t Stream::write(uint8_t c) { + return 0; +} \ No newline at end of file diff --git a/AAL/Stream.h b/AAL/Stream.h new file mode 100644 index 0000000..703f32e --- /dev/null +++ b/AAL/Stream.h @@ -0,0 +1,13 @@ +#ifndef _STREAM_H_ +#define _STREAM_H_ + +#include +#include + +class Stream { + public: + Stream(); + size_t write(uint8_t c); +}; + +#endif // _STREAM_H_ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ea9f144 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +CFLAGS?=-mcpu=cortex-m3 -mthumb -Og -fdata-sections -ffunction-sections -g -gdwarf-2 + +CC=arm-none-eabi-gcc +CXX=arm-none-eabi-g++ +AR=arm-none-eabi-ar + +CFLAGS+=-I../ioLibrary_Driver/Ethernet -Isrc -IAAL + +OBJDIR=build +VPATH=src AAL + +OBJS=$(addprefix $(OBJDIR)/,PubSubClient.o IPAddress.o Stream.o Arduino.o) + +all: $(OBJS) + $(AR) rcs pubsub.a $^ + +$(OBJDIR)/%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.cpp + $(CXX) $(CFLAGS) -c $< -o $@ + +$(OBJS): | $(OBJDIR) + +$(OBJDIR): + mkdir $(OBJDIR) + +.PHONY: clean +clean: + -rm -rf $(OBJDIR)