Update screen graphics
This commit is contained in:
2
Makefile
2
Makefile
@@ -12,7 +12,7 @@ else
|
|||||||
CFLAGS := $(CFLAGS) -lX11
|
CFLAGS := $(CFLAGS) -lX11
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TARGETS := pm3-lvgl cvend audio_test
|
TARGETS := pm3-lvgl cvend_test audio_test
|
||||||
EXES := $(patsubst %,bin/%,$(TARGETS))
|
EXES := $(patsubst %,bin/%,$(TARGETS))
|
||||||
SRCS := $(shell find src inc -type f -iname '*.c')
|
SRCS := $(shell find src inc -type f -iname '*.c')
|
||||||
OBJS := $(patsubst src/%.c,obj/%.o,$(patsubst inc/%.c,obj/lib/%.o,$(SRCS)))
|
OBJS := $(patsubst src/%.c,obj/%.o,$(patsubst inc/%.c,obj/lib/%.o,$(SRCS)))
|
||||||
|
|||||||
BIN
assets/hop.xcf
BIN
assets/hop.xcf
Binary file not shown.
Binary file not shown.
Binary file not shown.
86
inc/cvend.h
Normal file
86
inc/cvend.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
#ifndef CVEND_H_WNGPTXM7
|
||||||
|
#define CVEND_H_WNGPTXM7
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
enum message_type {
|
||||||
|
MTYPE_VERSION = 0x02,
|
||||||
|
MTYPE_VERSION_REPLY = 0x03,
|
||||||
|
MTYPE_STATUS = 0x04,
|
||||||
|
MTYPE_STATUS_REPLY = 0x05,
|
||||||
|
MTYPE_HEARTBEAT = 0x07,
|
||||||
|
MTYPE_STARTUP = 0x0f,
|
||||||
|
MTYPE_RESET = 0x10,
|
||||||
|
MTYPE_RESET_REPLY = 0x11,
|
||||||
|
MTYPE_LEDS = 0x20,
|
||||||
|
MTYPE_BUZZER = 0x22,
|
||||||
|
MTYPE_CARD_RELEASE = 0x32,
|
||||||
|
MTYPE_ABORT_CARD_HANDLING = 0x46,
|
||||||
|
MTYPE_PUT_FILE = 0x96,
|
||||||
|
MTYPE_PUT_FILE_REPLY = 0x97,
|
||||||
|
MTYPE_GET_FILE = 0x98,
|
||||||
|
MTYPE_GET_FILE_REPLY = 0x99,
|
||||||
|
MTYPE_DELETE_FILE = 0x9a,
|
||||||
|
MTYPE_DELETE_FILE_REPLY = 0x9b,
|
||||||
|
MTYPE_FILE_INFO = 0x9c,
|
||||||
|
MTYPE_FILE_INFO_REPLY = 0x9d,
|
||||||
|
MTYPE_FILE_LIST = 0xa4,
|
||||||
|
MTYPE_FILE_LIST_REPLY = 0xa5,
|
||||||
|
MTYPE_SET_TIME = 0xaa,
|
||||||
|
MTYPE_SET_TIME_REPLY = 0xab,
|
||||||
|
MTYPE_ITSO_DATA = 0xac,
|
||||||
|
MTYPE_ITSO_DATA_REPLY = 0xad,
|
||||||
|
MTYPE_ITSO_CTRL = 0xae,
|
||||||
|
MTYPE_ITSO_CTRL_REPLY = 0xaf,
|
||||||
|
MTYPE_ITSO_READ = 0xb1,
|
||||||
|
MTYPE_APDU_PROX = 0xb4,
|
||||||
|
MTYPE_APDU_PROX_REPLY = 0xb5,
|
||||||
|
MTYPE_SAM_CTRL = 0xb6,
|
||||||
|
MTYPE_SAM_CTRL_REPLY = 0xb7,
|
||||||
|
MTYPE_DESFIRE_READ = 0xb9,
|
||||||
|
MTYPE_DESFIRE_STATUS = 0xba,
|
||||||
|
MTYPE_DESFIRE_STATUS_REPLY = 0xbb,
|
||||||
|
MTYPE_DESFIRE_COMMAND = 0xbc,
|
||||||
|
MTYPE_DESFIRE_COMMAND_REPLY = 0xbd,
|
||||||
|
MTYPE_UNHANDLED_CARD = 0xbe,
|
||||||
|
MTYPE_EMV = 0xd0,
|
||||||
|
MTYPE_EMV_STATUS = 0xd1,
|
||||||
|
MTYPE_PROX_CARD_FUNCTION = 0xe4,
|
||||||
|
MTYPE_PROX_CARD_FUNCTION_REPLY = 0xe5,
|
||||||
|
MTYPE_SECURITY_SERVICES = 0xe8,
|
||||||
|
MTYPE_SECURITY_SERVICES_REPLY = 0xe9,
|
||||||
|
MTYPE_LOG = 0xed
|
||||||
|
};
|
||||||
|
|
||||||
|
enum card_type {
|
||||||
|
CTYPE_VDV_KA = 0x04,
|
||||||
|
CTYPE_MIFARE_CLASSIC = 0x05,
|
||||||
|
CTYPE_ISO = 0x06,
|
||||||
|
CTYPE_DESFIRE = 0x07,
|
||||||
|
CTYPE_GIROGO = 0x08,
|
||||||
|
CTYPE_ITSO = 0x09,
|
||||||
|
CTYPE_ULTRALIGHT_C = 0x0a
|
||||||
|
};
|
||||||
|
|
||||||
|
enum function_status { FUNC_DISABLE = 0x00, FUNC_ENABLE = 0x01 };
|
||||||
|
|
||||||
|
typedef struct cvend_packet {
|
||||||
|
uint8_t magic;
|
||||||
|
uint8_t seq;
|
||||||
|
uint8_t flags;
|
||||||
|
uint8_t msg_type;
|
||||||
|
uint16_t msg_len;
|
||||||
|
uint8_t hdr_crc;
|
||||||
|
uint8_t *msg_data;
|
||||||
|
uint32_t msg_crc;
|
||||||
|
} cvend_packet;
|
||||||
|
|
||||||
|
const char *stringify_msg_type(uint8_t msg_type);
|
||||||
|
|
||||||
|
void print_packet(cvend_packet *packet);
|
||||||
|
cvend_packet *cvend_read(FILE *file);
|
||||||
|
void cvend_write(FILE *file, uint8_t msg_type, uint8_t *msg_data,
|
||||||
|
uint16_t msg_len);
|
||||||
|
void cvend_free(cvend_packet *packet);
|
||||||
|
|
||||||
|
#endif /* end of include guard: CVEND_H_WNGPTXM7 */
|
||||||
124
src/cvend.c
124
src/cvend.c
@@ -4,73 +4,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "crc8.h"
|
#include "crc8.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
|
#include "cvend.h"
|
||||||
|
|
||||||
int last_seq = 0;
|
int last_seq = 0;
|
||||||
|
|
||||||
enum message_type {
|
|
||||||
MTYPE_VERSION = 0x02,
|
|
||||||
MTYPE_VERSION_REPLY = 0x03,
|
|
||||||
MTYPE_STATUS = 0x04,
|
|
||||||
MTYPE_STATUS_REPLY = 0x05,
|
|
||||||
MTYPE_HEARTBEAT = 0x07,
|
|
||||||
MTYPE_STARTUP = 0x0f,
|
|
||||||
MTYPE_RESET = 0x10,
|
|
||||||
MTYPE_RESET_REPLY = 0x11,
|
|
||||||
MTYPE_LEDS = 0x20,
|
|
||||||
MTYPE_BUZZER = 0x22,
|
|
||||||
MTYPE_CARD_RELEASE = 0x32,
|
|
||||||
MTYPE_ABORT_CARD_HANDLING = 0x46,
|
|
||||||
MTYPE_PUT_FILE = 0x96,
|
|
||||||
MTYPE_PUT_FILE_REPLY = 0x97,
|
|
||||||
MTYPE_GET_FILE = 0x98,
|
|
||||||
MTYPE_GET_FILE_REPLY = 0x99,
|
|
||||||
MTYPE_DELETE_FILE = 0x9a,
|
|
||||||
MTYPE_DELETE_FILE_REPLY = 0x9b,
|
|
||||||
MTYPE_FILE_INFO = 0x9c,
|
|
||||||
MTYPE_FILE_INFO_REPLY = 0x9d,
|
|
||||||
MTYPE_FILE_LIST = 0xa4,
|
|
||||||
MTYPE_FILE_LIST_REPLY = 0xa5,
|
|
||||||
MTYPE_SET_TIME = 0xaa,
|
|
||||||
MTYPE_SET_TIME_REPLY = 0xab,
|
|
||||||
MTYPE_ITSO_DATA = 0xac,
|
|
||||||
MTYPE_ITSO_DATA_REPLY = 0xad,
|
|
||||||
MTYPE_ITSO_CTRL = 0xae,
|
|
||||||
MTYPE_ITSO_CTRL_REPLY = 0xaf,
|
|
||||||
MTYPE_ITSO_READ = 0xb1,
|
|
||||||
MTYPE_APDU_PROX = 0xb4,
|
|
||||||
MTYPE_APDU_PROX_REPLY = 0xb5,
|
|
||||||
MTYPE_SAM_CTRL = 0xb6,
|
|
||||||
MTYPE_SAM_CTRL_REPLY = 0xb7,
|
|
||||||
MTYPE_DESFIRE_READ = 0xb9,
|
|
||||||
MTYPE_DESFIRE_STATUS = 0xba,
|
|
||||||
MTYPE_DESFIRE_STATUS_REPLY = 0xbb,
|
|
||||||
MTYPE_DESFIRE_COMMAND = 0xbc,
|
|
||||||
MTYPE_DESFIRE_COMMAND_REPLY = 0xbd,
|
|
||||||
MTYPE_UNHANDLED_CARD = 0xbe,
|
|
||||||
MTYPE_EMV = 0xd0,
|
|
||||||
MTYPE_EMV_STATUS = 0xd1,
|
|
||||||
MTYPE_PROX_CARD_FUNCTION = 0xe4,
|
|
||||||
MTYPE_PROX_CARD_FUNCTION_REPLY = 0xe5,
|
|
||||||
MTYPE_SECURITY_SERVICES = 0xe8,
|
|
||||||
MTYPE_SECURITY_SERVICES_REPLY = 0xe9,
|
|
||||||
MTYPE_LOG = 0xed
|
|
||||||
};
|
|
||||||
|
|
||||||
enum card_type {
|
|
||||||
CTYPE_VDV_KA = 0x04,
|
|
||||||
CTYPE_MIFARE_CLASSIC = 0x05,
|
|
||||||
CTYPE_ISO = 0x06,
|
|
||||||
CTYPE_DESFIRE = 0x07,
|
|
||||||
CTYPE_GIROGO = 0x08,
|
|
||||||
CTYPE_ITSO = 0x09,
|
|
||||||
CTYPE_ULTRALIGHT_C = 0x0a
|
|
||||||
};
|
|
||||||
|
|
||||||
enum function_status {
|
|
||||||
FUNC_DISABLE = 0x00,
|
|
||||||
FUNC_ENABLE = 0x01
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *stringify_msg_type(uint8_t msg_type)
|
const char *stringify_msg_type(uint8_t msg_type)
|
||||||
{
|
{
|
||||||
switch (msg_type) {
|
switch (msg_type) {
|
||||||
@@ -171,16 +108,6 @@ const char *stringify_msg_type(uint8_t msg_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct cvend_packet {
|
|
||||||
uint8_t magic;
|
|
||||||
uint8_t seq;
|
|
||||||
uint8_t flags;
|
|
||||||
uint8_t msg_type;
|
|
||||||
uint16_t msg_len;
|
|
||||||
uint8_t hdr_crc;
|
|
||||||
uint8_t *msg_data;
|
|
||||||
uint32_t msg_crc;
|
|
||||||
} cvend_packet;
|
|
||||||
|
|
||||||
void calc_hdr_crc(cvend_packet *packet)
|
void calc_hdr_crc(cvend_packet *packet)
|
||||||
{
|
{
|
||||||
@@ -198,7 +125,8 @@ void calc_msg_crc(cvend_packet *packet)
|
|||||||
packet->msg_crc = 0;
|
packet->msg_crc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_packet(cvend_packet *packet) {
|
void print_packet(cvend_packet *packet)
|
||||||
|
{
|
||||||
printf("seq = %u\n", packet->seq);
|
printf("seq = %u\n", packet->seq);
|
||||||
printf("flags = %x\n", packet->flags);
|
printf("flags = %x\n", packet->flags);
|
||||||
printf("msg_type = %s", stringify_msg_type(packet->msg_type));
|
printf("msg_type = %s", stringify_msg_type(packet->msg_type));
|
||||||
@@ -244,7 +172,8 @@ cvend_packet *cvend_read(FILE *file)
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cvend_write(FILE *file, uint8_t msg_type, uint8_t *msg_data, uint16_t msg_len)
|
void cvend_write(FILE *file, uint8_t msg_type, uint8_t *msg_data,
|
||||||
|
uint16_t msg_len)
|
||||||
{
|
{
|
||||||
cvend_packet packet;
|
cvend_packet packet;
|
||||||
packet.seq = ++last_seq;
|
packet.seq = ++last_seq;
|
||||||
@@ -275,46 +204,3 @@ void cvend_free(cvend_packet *packet)
|
|||||||
free(packet->msg_data);
|
free(packet->msg_data);
|
||||||
free(packet);
|
free(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
FILE *file = fopen(argc > 1 ? argv[1] : "/dev/ttymxc3", "w+");
|
|
||||||
uint8_t desfire_enable[] = { 0x00, CTYPE_DESFIRE, 0x01, FUNC_ENABLE };
|
|
||||||
// uint8_t desfire_get_version[] = { 0x60 };
|
|
||||||
uint8_t desfire_select_application[] = { 0x5a, 0xF2, 0x10, 0xE0 };
|
|
||||||
uint8_t desfire_fid_list[] = { 0xf5, 0x00 };
|
|
||||||
uint8_t desfire_read[] = { 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
||||||
uint8_t desfire_free[] = { 0x6e };
|
|
||||||
|
|
||||||
cvend_write(file, MTYPE_PROX_CARD_FUNCTION, desfire_enable, 4);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
cvend_packet *packet;
|
|
||||||
do {
|
|
||||||
packet = cvend_read(file);
|
|
||||||
} while (!packet);
|
|
||||||
|
|
||||||
if (packet->msg_type != MTYPE_HEARTBEAT)
|
|
||||||
print_packet(packet);
|
|
||||||
|
|
||||||
if (packet->msg_type == MTYPE_DESFIRE_READ) {
|
|
||||||
//cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_get_version, 1);
|
|
||||||
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_select_application, 4);
|
|
||||||
cvend_packet *response;
|
|
||||||
do {
|
|
||||||
response = cvend_read(file);
|
|
||||||
} while (!response);
|
|
||||||
print_packet(response);
|
|
||||||
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_fid_list, 1);
|
|
||||||
cvend_free(response);
|
|
||||||
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_read, 8);
|
|
||||||
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_free, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cvend_free(packet);
|
|
||||||
}
|
|
||||||
fclose(file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
42
src/cvend_test.c
Normal file
42
src/cvend_test.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#include "cvend.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
FILE *file = fopen(argc > 1 ? argv[1] : "/dev/ttymxc3", "w+");
|
||||||
|
uint8_t desfire_enable[] = { 0x00, CTYPE_DESFIRE, 0x01, FUNC_ENABLE };
|
||||||
|
// uint8_t desfire_get_version[] = { 0x60 };
|
||||||
|
uint8_t desfire_select_application[] = { 0x5a, 0xF2, 0x10, 0xE0 };
|
||||||
|
uint8_t desfire_fid_list[] = { 0xf5, 0x00 };
|
||||||
|
uint8_t desfire_read[] = { 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
uint8_t desfire_free[] = { 0x6e };
|
||||||
|
|
||||||
|
cvend_write(file, MTYPE_PROX_CARD_FUNCTION, desfire_enable, 4);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
cvend_packet *packet;
|
||||||
|
do {
|
||||||
|
packet = cvend_read(file);
|
||||||
|
} while (!packet);
|
||||||
|
|
||||||
|
if (packet->msg_type != MTYPE_HEARTBEAT)
|
||||||
|
print_packet(packet);
|
||||||
|
|
||||||
|
if (packet->msg_type == MTYPE_DESFIRE_READ) {
|
||||||
|
//cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_get_version, 1);
|
||||||
|
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_select_application, 4);
|
||||||
|
cvend_packet *response;
|
||||||
|
do {
|
||||||
|
response = cvend_read(file);
|
||||||
|
} while (!response);
|
||||||
|
print_packet(response);
|
||||||
|
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_fid_list, 1);
|
||||||
|
cvend_free(response);
|
||||||
|
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_read, 8);
|
||||||
|
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_free, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cvend_free(packet);
|
||||||
|
}
|
||||||
|
fclose(file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -14,7 +14,8 @@ void key_pressed(lv_event_t *event)
|
|||||||
{
|
{
|
||||||
lv_key_t key = lv_indev_get_key(lv_indev_active());
|
lv_key_t key = lv_indev_get_key(lv_indev_active());
|
||||||
printf("%u\n", key);
|
printf("%u\n", key);
|
||||||
screen_response("Testing", "$2.80", 0, 2000);
|
screen_response("Valid until 1:09pm", "$2.50", 0, 2000);
|
||||||
|
ma_engine_play_sound(&engine, "assets/hop_adult.wav", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -24,8 +25,6 @@ int main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ma_engine_play_sound(&engine, "assets/hop_adult.wav", NULL);
|
|
||||||
|
|
||||||
lv_init();
|
lv_init();
|
||||||
#ifdef LV_TARGET_FB
|
#ifdef LV_TARGET_FB
|
||||||
display = lv_linux_fbdev_create();
|
display = lv_linux_fbdev_create();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -147,7 +147,7 @@ void screen_create(lv_obj_t *screen)
|
|||||||
// hop logo
|
// hop logo
|
||||||
img_logo = lv_img_create(screen);
|
img_logo = lv_img_create(screen);
|
||||||
lv_img_set_src(img_logo, &hop_logo);
|
lv_img_set_src(img_logo, &hop_logo);
|
||||||
lv_obj_align(img_logo, LV_ALIGN_CENTER, 0, -103);
|
lv_obj_align(img_logo, LV_ALIGN_CENTER, 5, -108);
|
||||||
|
|
||||||
// flickering arrow
|
// flickering arrow
|
||||||
img_arrow = lv_img_create(screen);
|
img_arrow = lv_img_create(screen);
|
||||||
@@ -230,7 +230,7 @@ void screen_create(lv_obj_t *screen)
|
|||||||
lv_label_set_text(label_reply_small, "at 3:00am");
|
lv_label_set_text(label_reply_small, "at 3:00am");
|
||||||
lv_obj_set_style_text_font(label_reply_small, &dejavu_52, 0);
|
lv_obj_set_style_text_font(label_reply_small, &dejavu_52, 0);
|
||||||
lv_obj_set_style_text_color(label_reply_small, WHITE, 0);
|
lv_obj_set_style_text_color(label_reply_small, WHITE, 0);
|
||||||
lv_obj_align(label_reply_small, LV_ALIGN_CENTER, 0, 111);
|
lv_obj_align(label_reply_small, LV_ALIGN_CENTER, 0, 121);
|
||||||
lv_obj_add_flag(label_reply_small, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(label_reply_small, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
// ID required symbol
|
// ID required symbol
|
||||||
|
|||||||
Reference in New Issue
Block a user