Skip to content

Commit

Permalink
Merge pull request #36 from Protocentral/serial-display-dev
Browse files Browse the repository at this point in the history
Merge with main
  • Loading branch information
suvarna84 authored Nov 9, 2024
2 parents a9b6313 + a40f0eb commit 77f47c7
Show file tree
Hide file tree
Showing 19 changed files with 182 additions and 224 deletions.
2 changes: 1 addition & 1 deletion app/healthypi5_rp2040_display_ili9488.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ili9488: ili9488@0 {
compatible = "ilitek,ili9488";
reg = <0>;
mipi-max-frequency = <32000000>;
mipi-max-frequency = <48000000>;
rotation = <90>;
width = <480>;
height = <320>;
Expand Down
7 changes: 7 additions & 0 deletions app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ CONFIG_CMSIS_DSP_FILTERING=y
#CONFIG_TENSORFLOW_LITE_MICRO_CMSIS_NN_KERNELS=y

CONFIG_LOG=y
CONFIG_UART_CONSOLE=y

CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

CONFIG_LV_USE_LOG=y
CONFIG_LV_LOG_LEVEL_ERROR=y
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
CONFIG_INPUT_LOG_LEVEL_DBG=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
CONFIG_LOG_DEFAULT_LEVEL=4
25 changes: 8 additions & 17 deletions app/src/ble_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ extern struct k_msgq q_cmd_msg;
#define CMD_RX_CHARACTERISTIC_UUID 0xdc, 0xad, 0x7f, 0xc4, 0x23, 0x90, 0x4d, 0xd4, \
0x96, 0x8d, 0x0f, 0x97, 0x27, 0x15, 0xbf, 0x01


#define HPI_SPO2_SERVICE BT_UUID_DECLARE_16(BT_UUID_POS_VAL)
#define HPI_SPO2_CHAR BT_UUID_DECLARE_16(BT_UUID_GATT_PLX_SCM_VAL)

Expand Down Expand Up @@ -64,7 +63,6 @@ extern struct k_msgq q_cmd_msg;
#define CMD_SERVICE_UUID 0xdc, 0xad, 0x7f, 0xc4, 0x23, 0x90, 0x4d, 0xd4, \
0x96, 0x8d, 0x0f, 0x97, 0x92, 0x74, 0xbf, 0x01


#define CMD_TX_CHARACTERISTIC_UUID 0xdc, 0xad, 0x7f, 0xc4, 0x23, 0x90, 0x4d, 0xd4, \
0x96, 0x8d, 0x0f, 0x97, 0x28, 0x15, 0xbf, 0x01

Expand Down Expand Up @@ -127,7 +125,7 @@ static void cmd_on_cccd_changed(const struct bt_gatt_attr *attr, uint16_t value)
}
}

static ssize_t on_receive_cmd(struct bt_conn *conn, const struct bt_gatt_attr *attr,const void *buf,uint16_t len,uint16_t offset,uint8_t flags)
static ssize_t on_receive_cmd(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{
const uint8_t *buffer = buf;

Expand All @@ -150,7 +148,6 @@ static ssize_t on_receive_cmd(struct bt_conn *conn, const struct bt_gatt_attr *a
return len;
}


static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID16_ALL,
Expand Down Expand Up @@ -267,17 +264,14 @@ void ble_bioz_notify(int32_t *resp_data, uint8_t len)
bt_gatt_notify(NULL, &hpi_ecg_resp_service.attrs[4], &out_data, len * 4);
}

void ble_ppg_notify(int16_t *ppg_data, uint8_t len)
void ble_ppg_notify(int16_t ppg_data)
{
uint8_t out_data[128];
uint8_t out_data[32];

for (int i = 0; i < len; i++)
{
out_data[i * 2] = (uint8_t)ppg_data[i];
out_data[i * 2 + 1] = (uint8_t)(ppg_data[i] >> 8);
}
out_data[0] = (uint8_t)(ppg_data);
out_data[1] = (uint8_t)(ppg_data >> 8);

bt_gatt_notify(NULL, &hpi_ppg_resp_service.attrs[1], &out_data, len * 2);
bt_gatt_notify(NULL, &hpi_ppg_resp_service.attrs[1], &out_data, 2);
}

void ble_temp_notify(int16_t temp_val)
Expand Down Expand Up @@ -442,14 +436,11 @@ void ble_module_init()
// bt_conn_auth_cb_register(&auth_cb_display);
}


void healthypi5_service_send_data(const uint8_t *data, uint16_t len)
{
const struct bt_gatt_attr *attr = &hpi_cmd_service.attrs[4];
//printk("Sending response %d \n", data);
// printk("Sending response %d \n", data);

bt_gatt_notify(NULL, attr, data, len);
//printk("Response sent\n");
// printk("Response sent\n");
}


2 changes: 1 addition & 1 deletion app/src/ble_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ void ble_hrs_notify(uint16_t hr_val);
void ble_resp_rate_notify(uint16_t resp_rate);

void ble_ecg_notify(int32_t *ecg_data, uint8_t len);
void ble_ppg_notify(int16_t *ppg_data, uint8_t len);
void ble_ppg_notify(int16_t ppg_data);
void ble_bioz_notify(int32_t *resp_data, uint8_t len);
2 changes: 1 addition & 1 deletion app/src/cmd_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void hpi_decode_data_packet(uint8_t *in_pkt_buf, uint8_t pkt_len)
printk("Command to end logging\n");
// AKW: Replace with a function to stop logging
settings_log_data_enabled = false;
flush_current_session_logs(true);
flush_current_session_logs();
break;

case CMD_LOGGING_START:
Expand Down
Loading

0 comments on commit 77f47c7

Please sign in to comment.