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))
|
||||
|
||||
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_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_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_ELF = $(RECV_ELF) $(SEND_ELF)
|
||||
|
@ -55,10 +55,10 @@ $(RECV_ELF): $(RECV_OBJS)
|
|||
$(OBJS): %.o: %.c $(HEADERS_BUILD)
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
flash-send: $(SEND_BIN)
|
||||
flash-print: $(SEND_BIN)
|
||||
$(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
|
||||
|
||||
clean:
|
||||
|
|
|
@ -150,7 +150,7 @@ int main() {
|
|||
if (sum_footer != sum_calc) {
|
||||
response.status |= TABBY_PRINTER_SUM;
|
||||
} else if (header.type == TABBY_PRINTER_PACKET_JOB) {
|
||||
tabby_avr_printer_send_sheet(sheet,
|
||||
tabby_avr_printer_sheet_send(sheet,
|
||||
offset_sheet,
|
||||
&response);
|
||||
|
||||
|
@ -158,7 +158,7 @@ int main() {
|
|||
|
||||
offset_sheet = 0;
|
||||
} else if (header.type == TABBY_PRINTER_PACKET_INQUIRY) {
|
||||
tabby_avr_printer_send_inquiry(&response);
|
||||
tabby_avr_printer_inquiry_send(&response);
|
||||
}
|
||||
|
||||
respond:
|
|
@ -37,7 +37,7 @@ static uint16_t checksum(tabby_printer_packet *header, uint8_t *body) {
|
|||
return sum;
|
||||
}
|
||||
|
||||
void tabby_avr_printer_send_packet(uint8_t type,
|
||||
void tabby_avr_printer_packet_send(uint8_t type,
|
||||
uint8_t *body,
|
||||
uint16_t size,
|
||||
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) {
|
||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_INIT,
|
||||
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_INIT,
|
||||
NULL,
|
||||
0,
|
||||
response);
|
||||
}
|
||||
|
||||
void tabby_avr_printer_send_inquiry(tabby_printer_response *response) {
|
||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_INQUIRY,
|
||||
void tabby_avr_printer_inquiry_send(tabby_printer_response *response) {
|
||||
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_INQUIRY,
|
||||
NULL,
|
||||
0,
|
||||
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,
|
||||
tabby_printer_response *response) {
|
||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_JOB,
|
||||
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_JOB,
|
||||
job->data,
|
||||
sizeof(*job),
|
||||
response);
|
||||
}
|
||||
|
||||
void tabby_avr_printer_send_data(uint8_t *data,
|
||||
void tabby_avr_printer_data_send(uint8_t *data,
|
||||
uint16_t size,
|
||||
tabby_printer_response *response) {
|
||||
tabby_avr_printer_send_packet(TABBY_PRINTER_PACKET_DATA,
|
||||
tabby_avr_printer_packet_send(TABBY_PRINTER_PACKET_DATA,
|
||||
data,
|
||||
size,
|
||||
response);
|
||||
}
|
||||
|
||||
void tabby_avr_printer_send_sheet(uint8_t *sheet,
|
||||
void tabby_avr_printer_sheet_send(uint8_t *sheet,
|
||||
uint16_t size,
|
||||
tabby_printer_response *response) {
|
||||
int i;
|
||||
|
@ -106,11 +106,11 @@ void tabby_avr_printer_send_sheet(uint8_t *sheet,
|
|||
tabby_avr_printer_init(response);
|
||||
|
||||
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,
|
||||
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 =
|
||||
|
||||
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_HEADERS = commands.h
|
||||
TABBY_LDFLAGS =
|
||||
|
|
|
@ -19,12 +19,12 @@ static void usage(int argc, char **argv, char *message, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
fprintf(stderr, "usage: %s grab device\n", argv[0]);
|
||||
fprintf(stderr, "usage: %s capture device\n", argv[0]);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int tabby_command_grab(int argc, char **argv) {
|
||||
int tabby_command_capture(int argc, char **argv) {
|
||||
tabby_printer *printer;
|
||||
tabby_printer_packet header;
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef _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);
|
||||
|
||||
#endif /* _COMMANDS_H */
|
||||
|
|
|
@ -22,7 +22,7 @@ static void usage(int argc, char **argv, char *message, ...) {
|
|||
}
|
||||
|
||||
fprintf(stderr, "usage: %1$s print ...\n"
|
||||
" %1$s grab ...\n",
|
||||
" %1$s capture ...\n",
|
||||
argv[0]);
|
||||
|
||||
exit(1);
|
||||
|
@ -32,8 +32,8 @@ static struct {
|
|||
char *name;
|
||||
int (*fun)(int, char **);
|
||||
} commands[] = {
|
||||
{ "print", tabby_command_print },
|
||||
{ "grab", tabby_command_grab },
|
||||
{ "print", tabby_command_print },
|
||||
{ "capture", tabby_command_capture },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -7,23 +7,23 @@
|
|||
|
||||
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,
|
||||
uint16_t size,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
tabby_printer_response *response);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue