At least now my naming is consistent!
This commit is contained in:
parent
19ad83a02d
commit
a1f4353878
9 changed files with 31 additions and 30 deletions
14
avr/Makefile
14
avr/Makefile
|
@ -24,17 +24,17 @@ HEADERS_BUILD = $(HEADERS_LOCAL) \
|
||||||
$(addprefix $(INCLUDE_PATH)/$(HEADER_SUBDIR)/,$(HEADERS))
|
$(addprefix $(INCLUDE_PATH)/$(HEADER_SUBDIR)/,$(HEADERS))
|
||||||
|
|
||||||
HEADERS = avr.h avr/uart.h avr/link.h avr/printer.h link.h printer.h
|
HEADERS = avr.h avr/uart.h avr/link.h avr/printer.h link.h printer.h
|
||||||
OBJS = send.o recv.o printer.o link.o uart.o
|
OBJS = print.o capture.o printer.o link.o uart.o
|
||||||
|
|
||||||
RECV_NAME = recv
|
RECV_NAME = capture
|
||||||
RECV_BIN = $(RECV_NAME).bin
|
RECV_BIN = $(RECV_NAME).bin
|
||||||
RECV_ELF = $(RECV_NAME).elf
|
RECV_ELF = $(RECV_NAME).elf
|
||||||
RECV_OBJS = recv.o printer.o link.o uart.o
|
RECV_OBJS = capture.o printer.o link.o uart.o
|
||||||
|
|
||||||
SEND_NAME = send
|
SEND_NAME = print
|
||||||
SEND_BIN = $(SEND_NAME).bin
|
SEND_BIN = $(SEND_NAME).bin
|
||||||
SEND_ELF = $(SEND_NAME).elf
|
SEND_ELF = $(SEND_NAME).elf
|
||||||
SEND_OBJS = send.o printer.o link.o uart.o
|
SEND_OBJS = print.o printer.o link.o uart.o
|
||||||
|
|
||||||
IMAGES_BIN = $(RECV_BIN) $(SEND_BIN)
|
IMAGES_BIN = $(RECV_BIN) $(SEND_BIN)
|
||||||
IMAGES_ELF = $(RECV_ELF) $(SEND_ELF)
|
IMAGES_ELF = $(RECV_ELF) $(SEND_ELF)
|
||||||
|
@ -55,10 +55,10 @@ $(RECV_ELF): $(RECV_OBJS)
|
||||||
$(OBJS): %.o: %.c $(HEADERS_BUILD)
|
$(OBJS): %.o: %.c $(HEADERS_BUILD)
|
||||||
$(CC) $(CFLAGS) -c $<
|
$(CC) $(CFLAGS) -c $<
|
||||||
|
|
||||||
flash-send: $(SEND_BIN)
|
flash-print: $(SEND_BIN)
|
||||||
$(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(SEND_BIN):r
|
$(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(SEND_BIN):r
|
||||||
|
|
||||||
flash-recv: $(RECV_BIN)
|
flash-capture: $(RECV_BIN)
|
||||||
$(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(RECV_BIN):r
|
$(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(RECV_BIN):r
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -150,7 +150,7 @@ int main() {
|
||||||
if (sum_footer != sum_calc) {
|
if (sum_footer != sum_calc) {
|
||||||
response.status |= TABBY_PRINTER_SUM;
|
response.status |= TABBY_PRINTER_SUM;
|
||||||
} else if (header.type == TABBY_PRINTER_PACKET_JOB) {
|
} else if (header.type == TABBY_PRINTER_PACKET_JOB) {
|
||||||
tabby_avr_printer_send_sheet(sheet,
|
tabby_avr_printer_sheet_send(sheet,
|
||||||
offset_sheet,
|
offset_sheet,
|
||||||
&response);
|
&response);
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ int main() {
|
||||||
|
|
||||||
offset_sheet = 0;
|
offset_sheet = 0;
|
||||||
} else if (header.type == TABBY_PRINTER_PACKET_INQUIRY) {
|
} else if (header.type == TABBY_PRINTER_PACKET_INQUIRY) {
|
||||||
tabby_avr_printer_send_inquiry(&response);
|
tabby_avr_printer_inquiry_send(&response);
|
||||||
}
|
}
|
||||||
|
|
||||||
respond:
|
respond:
|
|
@ -37,7 +37,7 @@ static uint16_t checksum(tabby_printer_packet *header, uint8_t *body) {
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tabby_avr_printer_send_packet(uint8_t type,
|
void tabby_avr_printer_packet_send(uint8_t type,
|
||||||
uint8_t *body,
|
uint8_t *body,
|
||||||
uint16_t size,
|
uint16_t size,
|
||||||
tabby_printer_response *response) {
|
tabby_printer_response *response) {
|
||||||
|
@ -68,14 +68,14 @@ void tabby_avr_printer_send_packet(uint8_t type,
|
||||||
}
|
}
|
||||||
|
|
||||||
void tabby_avr_printer_init(tabby_printer_response *response) {
|
void tabby_avr_printer_init(tabby_printer_response *response) {
|
||||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_INIT,
|
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_INIT,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
response);
|
response);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tabby_avr_printer_send_inquiry(tabby_printer_response *response) {
|
void tabby_avr_printer_inquiry_send(tabby_printer_response *response) {
|
||||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_INQUIRY,
|
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_INQUIRY,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
response);
|
response);
|
||||||
|
@ -83,22 +83,22 @@ void tabby_avr_printer_send_inquiry(tabby_printer_response *response) {
|
||||||
|
|
||||||
void tabby_avr_printer_job_start(tabby_printer_job *job,
|
void tabby_avr_printer_job_start(tabby_printer_job *job,
|
||||||
tabby_printer_response *response) {
|
tabby_printer_response *response) {
|
||||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_JOB,
|
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_JOB,
|
||||||
job->data,
|
job->data,
|
||||||
sizeof(*job),
|
sizeof(*job),
|
||||||
response);
|
response);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tabby_avr_printer_send_data(uint8_t *data,
|
void tabby_avr_printer_data_send(uint8_t *data,
|
||||||
uint16_t size,
|
uint16_t size,
|
||||||
tabby_printer_response *response) {
|
tabby_printer_response *response) {
|
||||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_DATA,
|
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_DATA,
|
||||||
data,
|
data,
|
||||||
size,
|
size,
|
||||||
response);
|
response);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tabby_avr_printer_send_sheet(uint8_t *sheet,
|
void tabby_avr_printer_sheet_send(uint8_t *sheet,
|
||||||
uint16_t size,
|
uint16_t size,
|
||||||
tabby_printer_response *response) {
|
tabby_printer_response *response) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -106,11 +106,11 @@ void tabby_avr_printer_send_sheet(uint8_t *sheet,
|
||||||
tabby_avr_printer_init(response);
|
tabby_avr_printer_init(response);
|
||||||
|
|
||||||
for (i=0; i<size; i+=TABBY_PRINTER_BAND_SIZE) {
|
for (i=0; i<size; i+=TABBY_PRINTER_BAND_SIZE) {
|
||||||
tabby_avr_printer_send_data(sheet + i,
|
tabby_avr_printer_data_send(sheet + i,
|
||||||
TABBY_PRINTER_BAND_SIZE,
|
TABBY_PRINTER_BAND_SIZE,
|
||||||
response);
|
response);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabby_avr_printer_send_data(NULL, 0, response);
|
tabby_avr_printer_data_send(NULL, 0, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ CFLAGS += -I$(INCLUDE_PATH)
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
TABBY = tabby
|
TABBY = tabby
|
||||||
TABBY_OBJS = main.o grab.o print.o
|
TABBY_OBJS = main.o capture.o print.o
|
||||||
TABBY_STATIC = ../src/lib$(LIBNAME).a
|
TABBY_STATIC = ../src/lib$(LIBNAME).a
|
||||||
TABBY_HEADERS = commands.h
|
TABBY_HEADERS = commands.h
|
||||||
TABBY_LDFLAGS =
|
TABBY_LDFLAGS =
|
||||||
|
|
|
@ -19,12 +19,12 @@ static void usage(int argc, char **argv, char *message, ...) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "usage: %s grab device\n", argv[0]);
|
fprintf(stderr, "usage: %s capture device\n", argv[0]);
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tabby_command_grab(int argc, char **argv) {
|
int tabby_command_capture(int argc, char **argv) {
|
||||||
tabby_printer *printer;
|
tabby_printer *printer;
|
||||||
tabby_printer_packet header;
|
tabby_printer_packet header;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef _COMMANDS_H
|
#ifndef _COMMANDS_H
|
||||||
#define _COMMANDS_H
|
#define _COMMANDS_H
|
||||||
|
|
||||||
int tabby_command_grab(int argc, char **argv);
|
int tabby_command_capture(int argc, char **argv);
|
||||||
|
|
||||||
int tabby_command_print(int argc, char **argv);
|
int tabby_command_print(int argc, char **argv);
|
||||||
|
|
||||||
#endif /* _COMMANDS_H */
|
#endif /* _COMMANDS_H */
|
||||||
|
|
|
@ -22,7 +22,7 @@ static void usage(int argc, char **argv, char *message, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "usage: %1$s print ...\n"
|
fprintf(stderr, "usage: %1$s print ...\n"
|
||||||
" %1$s grab ...\n",
|
" %1$s capture ...\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -33,7 +33,7 @@ static struct {
|
||||||
int (*fun)(int, char **);
|
int (*fun)(int, char **);
|
||||||
} commands[] = {
|
} commands[] = {
|
||||||
{ "print", tabby_command_print },
|
{ "print", tabby_command_print },
|
||||||
{ "grab", tabby_command_grab },
|
{ "capture", tabby_command_capture },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,23 +7,23 @@
|
||||||
|
|
||||||
int tabby_avr_printer_packet_toolarge(uint8_t type, uint16_t size);
|
int tabby_avr_printer_packet_toolarge(uint8_t type, uint16_t size);
|
||||||
|
|
||||||
void tabby_avr_printer_send_packet(uint8_t type,
|
void tabby_avr_printer_packet_send(uint8_t type,
|
||||||
uint8_t *body,
|
uint8_t *body,
|
||||||
uint16_t size,
|
uint16_t size,
|
||||||
tabby_printer_response *response);
|
tabby_printer_response *response);
|
||||||
|
|
||||||
void tabby_avr_printer_init(tabby_printer_response *response);
|
void tabby_avr_printer_init(tabby_printer_response *response);
|
||||||
|
|
||||||
void tabby_avr_printer_send_inquiry(tabby_printer_response *response);
|
void tabby_avr_printer_inquiry_send(tabby_printer_response *response);
|
||||||
|
|
||||||
void tabby_avr_printer_job_start(tabby_printer_job *job,
|
void tabby_avr_printer_job_start(tabby_printer_job *job,
|
||||||
tabby_printer_response *response);
|
tabby_printer_response *response);
|
||||||
|
|
||||||
void tabby_avr_printer_send_data(uint8_t *data,
|
void tabby_avr_printer_data_send(uint8_t *data,
|
||||||
uint16_t size,
|
uint16_t size,
|
||||||
tabby_printer_response *response);
|
tabby_printer_response *response);
|
||||||
|
|
||||||
void tabby_avr_printer_send_sheet(uint8_t *sheet,
|
void tabby_avr_printer_sheet_send(uint8_t *sheet,
|
||||||
uint16_t size,
|
uint16_t size,
|
||||||
tabby_printer_response *response);
|
tabby_printer_response *response);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue