Minor cleanups
This commit is contained in:
parent
9060e0d140
commit
247baf238a
34
src/main.c
34
src/main.c
|
@ -71,15 +71,17 @@ static struct k_thread event_thread_data;
|
|||
static struct k_delayed_work ack_work;
|
||||
//static struct k_delayed_work retx_work;
|
||||
|
||||
#define HCI_3WIRE_ACK_PKT 0x00
|
||||
#define HCI_COMMAND_PKT 0x01
|
||||
#define HCI_ACLDATA_PKT 0x02
|
||||
#define HCI_SCODATA_PKT 0x03
|
||||
#define HCI_EVENT_PKT 0x04
|
||||
#define HCI_3WIRE_LINK_PKT 0x0f
|
||||
#define HCI_VENDOR_PKT 0xff
|
||||
typedef enum {
|
||||
HCI_3WIRE_ACK_PKT = 0x00,
|
||||
HCI_COMMAND_PKT,
|
||||
HCI_ACLDATA_PKT,
|
||||
HCI_SCODATA_PKT,
|
||||
HCI_EVENT_PKT,
|
||||
HCI_VENDOR_SPECIFIC_PKT = 0xd,
|
||||
HCI_3WIRE_LINK_PKT = 0x0f,
|
||||
} h5_pkt_t;
|
||||
|
||||
static bool reliable_packet(u8_t type)
|
||||
static bool reliable_packet(h5_pkt_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
|
@ -117,7 +119,7 @@ typedef enum {
|
|||
UNINIT,
|
||||
INIT,
|
||||
ACTIVE,
|
||||
} linkstate_t;
|
||||
} h5_linkstate_t;
|
||||
|
||||
static struct h5 {
|
||||
//struct net_buf *rx_buf;
|
||||
|
@ -132,15 +134,7 @@ static struct h5 {
|
|||
u8_t next_expected_seq_from_host;
|
||||
u8_t local_seq;
|
||||
|
||||
linkstate_t link_state;
|
||||
|
||||
enum {
|
||||
START,
|
||||
HEADER,
|
||||
PAYLOAD,
|
||||
END,
|
||||
} rx_state;
|
||||
bool initializing;
|
||||
h5_linkstate_t link_state;
|
||||
} h5;
|
||||
|
||||
//static u8_t unack_queue_len;
|
||||
|
@ -275,7 +269,7 @@ static u8_t next_seq(u8_t i) {
|
|||
return (i + 1) % 8;
|
||||
}
|
||||
|
||||
void h5_send(const u8_t *payload, u8_t type, int len)
|
||||
void h5_send(const u8_t *payload, h5_pkt_t type, int len)
|
||||
{
|
||||
h5_hdr_t hdr = {0};
|
||||
|
||||
|
@ -283,8 +277,6 @@ void h5_send(const u8_t *payload, u8_t type, int len)
|
|||
hdr.ack = h5.next_expected_seq_from_host;
|
||||
k_delayed_work_cancel(&ack_work);
|
||||
|
||||
LOG_INF("ACK'd %d", hdr.ack);
|
||||
|
||||
if (reliable_packet(type)) {
|
||||
hdr.is_reliable = true;
|
||||
hdr.seq = h5.local_seq;
|
||||
|
|
Loading…
Reference in New Issue