start implementing Arduino abstraction layer and add Makefile
This commit is contained in:
parent
2d228f2f86
commit
121cef72e6
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
build
|
||||||
tests/bin
|
tests/bin
|
||||||
.pioenvs
|
.pioenvs
|
||||||
.piolibdeps
|
.piolibdeps
|
||||||
|
9
AAL/Arduino.cpp
Normal file
9
AAL/Arduino.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t HAL_GetTick(void);
|
||||||
|
|
||||||
|
millis_t millis() {
|
||||||
|
return HAL_GetTick();
|
||||||
|
}
|
14
AAL/Arduino.h
Normal file
14
AAL/Arduino.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _ARDUINO_H_
|
||||||
|
#define _ARDUINO_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef uint32_t millis_t;
|
||||||
|
typedef bool boolean;
|
||||||
|
|
||||||
|
|
||||||
|
millis_t millis();
|
||||||
|
|
||||||
|
#endif // _ARDUINO_H_
|
6
AAL/Client.h
Normal file
6
AAL/Client.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _CLIENT_H_
|
||||||
|
#define _CLIENT_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _CLIENT_H_
|
10
AAL/IPAddress.cpp
Normal file
10
AAL/IPAddress.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <IPAddress.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
15
AAL/IPAddress.h
Normal file
15
AAL/IPAddress.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef _IPADDRESS_H_
|
||||||
|
#define _IPADDRESS_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
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_
|
12
AAL/Stream.cpp
Normal file
12
AAL/Stream.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <Stream.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
Stream::Stream() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t Stream::write(uint8_t c) {
|
||||||
|
return 0;
|
||||||
|
}
|
13
AAL/Stream.h
Normal file
13
AAL/Stream.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _STREAM_H_
|
||||||
|
#define _STREAM_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
class Stream {
|
||||||
|
public:
|
||||||
|
Stream();
|
||||||
|
size_t write(uint8_t c);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _STREAM_H_
|
30
Makefile
Normal file
30
Makefile
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user