Merge branch 'master' into arduino-port
This commit is contained in:
commit
b09b1960f3
|
@ -14,7 +14,8 @@ OBJCOPY = avr-objcopy
|
||||||
OBJDUMP = avr-objdump
|
OBJDUMP = avr-objdump
|
||||||
SIZE = avr-size
|
SIZE = avr-size
|
||||||
|
|
||||||
OBJ = $(SRC:%.c=$(OBJDIR)/$(AVRMCU)/%.o)
|
SRC_TMP = $(subst ../,,$(SRC))
|
||||||
|
OBJ = $(SRC_TMP:%.c=$(OBJDIR)/$(AVRMCU)/%.o)
|
||||||
|
|
||||||
CFLAGS = -I ../sss7core/ -Os -Wall -Wstrict-prototypes
|
CFLAGS = -I ../sss7core/ -Os -Wall -Wstrict-prototypes
|
||||||
CFLAGS += -ffunction-sections -fdata-sections
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
@ -27,8 +28,8 @@ all: start $(OBJDIR)/$(AVRMCU)/$(TARGET).hex size
|
||||||
@echo ":: Done !"
|
@echo ":: Done !"
|
||||||
|
|
||||||
start:
|
start:
|
||||||
@echo "AS5043 demo version $(VERSION)"
|
@echo "SSS7 AVR port $(VERSION)"
|
||||||
@echo "=============================="
|
@echo "========================"
|
||||||
@echo ":: Building for $(AVRMCU)"
|
@echo ":: Building for $(AVRMCU)"
|
||||||
@echo ":: MCU operating frequency is $(F_CPU)Hz"
|
@echo ":: MCU operating frequency is $(F_CPU)Hz"
|
||||||
|
|
||||||
|
@ -36,6 +37,10 @@ $(OBJDIR)/$(AVRMCU)/%.o : %.c $(HEADERS) Makefile
|
||||||
@mkdir -p $$(dirname $@)
|
@mkdir -p $$(dirname $@)
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/$(AVRMCU)/sss7core/%.o : ../sss7core/%.c $(HEADERS) Makefile
|
||||||
|
@mkdir -p $$(dirname $@)
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/$(AVRMCU)/$(TARGET).elf : $(OBJ)
|
$(OBJDIR)/$(AVRMCU)/$(TARGET).elf : $(OBJ)
|
||||||
$(CC) $(LDFLAGS) $+ -o $@
|
$(CC) $(LDFLAGS) $+ -o $@
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
|
#include "timer.h"
|
||||||
#include "sss7.h"
|
#include "sss7.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,37 +12,37 @@
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
||||||
uint8_t msg[SSS7_PAYLOAD_SIZE];
|
uint8_t msg[SSS7_PAYLOAD_SIZE];
|
||||||
memset(msg, 0, SSS7_PAYLOAD_SIZE);
|
memset(msg, 0, SSS7_PAYLOAD_SIZE);
|
||||||
msg[0] = 'H';
|
msg[0] = 'H';
|
||||||
msg[1] = 'e';
|
msg[1] = 'e';
|
||||||
msg[2] = 'l';
|
msg[2] = 'l';
|
||||||
msg[3] = 'l';
|
msg[3] = 'l';
|
||||||
msg[4] = 'o';
|
msg[4] = 'o';
|
||||||
msg[5] = ' ';
|
msg[5] = ' ';
|
||||||
msg[6] = 'W';
|
msg[6] = 'W';
|
||||||
msg[7] = 'o';
|
msg[7] = 'o';
|
||||||
msg[8] = 'r';
|
msg[8] = 'r';
|
||||||
msg[9] = 'l';
|
msg[9] = 'l';
|
||||||
msg[10] = 'd';
|
msg[10] = 'd';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uart_init();
|
uart_init();
|
||||||
sss7_init();
|
timer_init();
|
||||||
sei();
|
sss7_init();
|
||||||
|
sei();
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
while(!sss7_can_send());
|
while(!sss7_can_send());
|
||||||
sss7_send(msg);
|
sss7_send(msg);
|
||||||
while(!sss7_can_send());
|
while(!sss7_can_send());
|
||||||
if(sss7_send_failed()) {
|
if(sss7_send_failed()) {
|
||||||
PORTB ^= (1 << PB2);
|
PORTB ^= (1 << PB2);
|
||||||
|
}
|
||||||
|
|
||||||
|
_delay_ms(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
_delay_ms(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import serial
|
||||||
|
|
||||||
|
|
||||||
|
def send_byte(ser, byte):
|
||||||
|
ser.reset_input_buffer()
|
||||||
|
ser.write(byte)
|
||||||
|
read_byte = ser.read()
|
||||||
|
if read_byte != byte:
|
||||||
|
print "Written %s read %s" % (hex(ord(byte)), hex(ord(read_byte)))
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print "Usage %s <port>" % (sys.argv[0])
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
ser = serial.Serial(sys.argv[1], 9600, timeout=0.40)
|
||||||
|
|
||||||
|
send_byte(ser, chr(0xAA))
|
||||||
|
send_byte(ser, chr(0xFE))
|
||||||
|
|
||||||
|
for byte in "Unfinished":
|
||||||
|
send_byte(ser, byte)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in New Issue