@@ -40,13 +40,13 @@ static ubluepy_uuid_obj_t uuid_obj_service = {
40
40
static ubluepy_uuid_obj_t uuid_obj_char_tx = {
41
41
.base .type = & ubluepy_uuid_type ,
42
42
.type = UBLUEPY_UUID_128_BIT ,
43
- .value = {0x02 , 0x00 }
43
+ .value = {0x03 , 0x00 }
44
44
};
45
45
46
46
static ubluepy_uuid_obj_t uuid_obj_char_rx = {
47
47
.base .type = & ubluepy_uuid_type ,
48
48
.type = UBLUEPY_UUID_128_BIT ,
49
- .value = {0x03 , 0x00 }
49
+ .value = {0x02 , 0x00 }
50
50
};
51
51
52
52
static ubluepy_service_obj_t ble_uart_service = {
@@ -55,16 +55,16 @@ static ubluepy_service_obj_t ble_uart_service = {
55
55
.type = UBLUEPY_SERVICE_PRIMARY
56
56
};
57
57
58
- static ubluepy_characteristic_obj_t ble_uart_char_tx = {
58
+ static ubluepy_characteristic_obj_t ble_uart_char_rx = {
59
59
.base .type = & ubluepy_characteristic_type ,
60
- .p_uuid = & uuid_obj_char_tx ,
60
+ .p_uuid = & uuid_obj_char_rx ,
61
61
.props = UBLUEPY_PROP_WRITE | UBLUEPY_PROP_WRITE_WO_RESP ,
62
62
.attrs = 0 ,
63
63
};
64
64
65
- static ubluepy_characteristic_obj_t ble_uart_char_rx = {
65
+ static ubluepy_characteristic_obj_t ble_uart_char_tx = {
66
66
.base .type = & ubluepy_characteristic_type ,
67
- .p_uuid = & uuid_obj_char_rx ,
67
+ .p_uuid = & uuid_obj_char_tx ,
68
68
.props = UBLUEPY_PROP_NOTIFY ,
69
69
.attrs = UBLUEPY_ATTR_CCCD ,
70
70
};
@@ -104,7 +104,7 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
104
104
send_len = len ;
105
105
}
106
106
107
- ubluepy_characteristic_obj_t * p_char = & ble_uart_char_rx ;
107
+ ubluepy_characteristic_obj_t * p_char = & ble_uart_char_tx ;
108
108
109
109
ble_drv_attr_notify (p_char -> p_service -> p_periph -> conn_handle ,
110
110
p_char -> handle ,
@@ -119,8 +119,6 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
119
119
void mp_hal_stdout_tx_strn_cooked (const char * str , mp_uint_t len ) {
120
120
for (uint8_t i = 0 ; i < len ; i ++ ) {
121
121
mp_hal_stdout_tx_strn (& str [i ], 1 );
122
- // for now put in a small delay as it could look like packets are issued to fast.
123
- mp_hal_delay_ms (10 );
124
122
}
125
123
}
126
124
@@ -139,9 +137,9 @@ STATIC void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t at
139
137
(void )self ;
140
138
141
139
if (event_id == 80 ) { // gatts write
142
- if (ble_uart_char_rx .cccd_handle == attr_handle ) {
140
+ if (ble_uart_char_tx .cccd_handle == attr_handle ) {
143
141
cccd_enabled = true;
144
- } else if (ble_uart_char_tx .handle == attr_handle ) {
142
+ } else if (ble_uart_char_rx .handle == attr_handle ) {
145
143
for (uint16_t i = 0 ; i < length ; i ++ ) {
146
144
bufferWrite (mp_rx_ring_buffer , data [i ]);
147
145
}
0 commit comments