@@ -43,7 +43,7 @@ static void (*block_received)(void);
4343static pbio_os_process_t reader_process ;
4444static pbio_os_process_t writer_process ;
4545
46- static pbdrv_uart_dev_t * uart_device () {
46+ static pbdrv_uart_dev_t * pbdrv_bluetooth_btstack_uart_block_ev3_uart_device () {
4747 const pbdrv_bluetooth_btstack_uart_block_ev3_platform_data_t * pdata =
4848 & pbdrv_bluetooth_btstack_uart_block_ev3_platform_data ;
4949 pbdrv_uart_dev_t * uart ;
@@ -53,15 +53,15 @@ static pbdrv_uart_dev_t *uart_device() {
5353 return uart ;
5454}
5555
56- static int btstack_uart_block_ev3_init (const btstack_uart_config_t * config ) {
57- pbdrv_uart_set_baud_rate (uart_device (), config -> baudrate );
56+ static int pbdrv_bluetooth_btstack_uart_block_ev3_init (const btstack_uart_config_t * config ) {
57+ pbdrv_uart_set_baud_rate (pbdrv_bluetooth_btstack_uart_block_ev3_uart_device (), config -> baudrate );
5858 // TODO: add parity, flow control APIs and obey them.
5959
6060 return 0 ;
6161}
6262
63- static pbio_error_t do_read_process (pbio_os_state_t * state , void * context ) {
64- pbdrv_uart_dev_t * const uart = uart_device ();
63+ static pbio_error_t pbdrv_bluetooth_btstack_uart_block_ev3_do_read_process (pbio_os_state_t * state , void * context ) {
64+ pbdrv_uart_dev_t * const uart = pbdrv_bluetooth_btstack_uart_block_ev3_uart_device ();
6565
6666 pbio_os_state_t read_state ;
6767 PBIO_OS_ASYNC_BEGIN (state );
@@ -85,8 +85,8 @@ static pbio_error_t do_read_process(pbio_os_state_t *state, void *context) {
8585 PBIO_OS_ASYNC_END (PBIO_SUCCESS );
8686}
8787
88- static pbio_error_t do_write_process (pbio_os_state_t * state , void * context ) {
89- pbdrv_uart_dev_t * const uart = uart_device ();
88+ static pbio_error_t pbdrv_bluetooth_btstack_uart_block_ev3_do_write_process (pbio_os_state_t * state , void * context ) {
89+ pbdrv_uart_dev_t * const uart = pbdrv_bluetooth_btstack_uart_block_ev3_uart_device ();
9090
9191 pbio_os_state_t write_state ;
9292
@@ -112,7 +112,7 @@ static pbio_error_t do_write_process(pbio_os_state_t *state, void *context) {
112112}
113113
114114
115- static int btstack_uart_block_ev3_open (void ) {
115+ static int pbdrv_bluetooth_btstack_uart_block_ev3_open (void ) {
116116 write_buf = NULL ;
117117 write_buf_len = 0 ;
118118 read_buf = NULL ;
@@ -122,13 +122,13 @@ static int btstack_uart_block_ev3_open(void) {
122122 block_received = NULL ;
123123 block_sent = NULL ;
124124
125- pbio_os_process_start (& reader_process , do_read_process , NULL );
126- pbio_os_process_start (& writer_process , do_write_process , NULL );
125+ pbio_os_process_start (& reader_process , pbdrv_bluetooth_btstack_uart_block_ev3_do_read_process , NULL );
126+ pbio_os_process_start (& writer_process , pbdrv_bluetooth_btstack_uart_block_ev3_do_write_process , NULL );
127127
128128 return 0 ;
129129}
130130
131- static int btstack_uart_block_ev3_close (void ) {
131+ static int pbdrv_bluetooth_btstack_uart_block_ev3_close (void ) {
132132 start_shutdown = true;
133133 while (threads_shutdown_complete < 2 ) {
134134 pbio_os_run_processes_and_wait_for_event ();
@@ -137,57 +137,57 @@ static int btstack_uart_block_ev3_close(void) {
137137 return 0 ;
138138}
139139
140- static void btstack_uart_block_ev3_set_block_received (void (* handler )(void )) {
140+ static void pbdrv_bluetooth_btstack_uart_block_ev3_set_block_received (void (* handler )(void )) {
141141 block_received = handler ;
142142}
143143
144- static void btstack_uart_block_ev3_set_block_sent (void (* handler )(void )) {
144+ static void pbdrv_bluetooth_btstack_uart_block_ev3_set_block_sent (void (* handler )(void )) {
145145 block_sent = handler ;
146146}
147147
148- static int btstack_uart_block_ev3_set_baudrate (uint32_t baud ) {
149- pbdrv_uart_set_baud_rate (uart_device (), baud );
148+ static int pbdrv_bluetooth_btstack_uart_block_ev3_set_baudrate (uint32_t baud ) {
149+ pbdrv_uart_set_baud_rate (pbdrv_bluetooth_btstack_uart_block_ev3_uart_device (), baud );
150150 return 0 ;
151151}
152152
153- static int btstack_uart_block_ev3_set_parity (int parity ) {
153+ static int pbdrv_bluetooth_btstack_uart_block_ev3_set_parity (int parity ) {
154154 // TODO: maybe implement the parity setting.
155155 return 0 ;
156156}
157157
158- static void btstack_uart_block_ev3_receive_block (uint8_t * buffer ,
158+ static void pbdrv_bluetooth_btstack_uart_block_ev3_receive_block (uint8_t * buffer ,
159159 uint16_t len ) {
160160 read_buf = buffer ;
161161 read_buf_len = len ;
162162 pbio_os_request_poll ();
163163}
164164
165- static void btstack_uart_block_ev3_send_block (const uint8_t * data ,
165+ static void pbdrv_bluetooth_btstack_uart_block_ev3_send_block (const uint8_t * data ,
166166 uint16_t size ) {
167167 write_buf = data ;
168168 write_buf_len = size ;
169169 pbio_os_request_poll ();
170170}
171171
172- static const btstack_uart_block_t btstack_uart_block_ev3 = {
173- .init = btstack_uart_block_ev3_init ,
174- .open = btstack_uart_block_ev3_open ,
175- .close = btstack_uart_block_ev3_close ,
176- .set_block_received = btstack_uart_block_ev3_set_block_received ,
177- .set_block_sent = btstack_uart_block_ev3_set_block_sent ,
178- .set_baudrate = btstack_uart_block_ev3_set_baudrate ,
179- .set_parity = btstack_uart_block_ev3_set_parity ,
172+ static const btstack_uart_block_t pbdrv_bluetooth_btstack_uart_block_ev3_block_ev3 = {
173+ .init = pbdrv_bluetooth_btstack_uart_block_ev3_init ,
174+ .open = pbdrv_bluetooth_btstack_uart_block_ev3_open ,
175+ .close = pbdrv_bluetooth_btstack_uart_block_ev3_close ,
176+ .set_block_received = pbdrv_bluetooth_btstack_uart_block_ev3_set_block_received ,
177+ .set_block_sent = pbdrv_bluetooth_btstack_uart_block_ev3_set_block_sent ,
178+ .set_baudrate = pbdrv_bluetooth_btstack_uart_block_ev3_set_baudrate ,
179+ .set_parity = pbdrv_bluetooth_btstack_uart_block_ev3_set_parity ,
180180 .set_flowcontrol = NULL ,
181- .receive_block = btstack_uart_block_ev3_receive_block ,
182- .send_block = btstack_uart_block_ev3_send_block ,
181+ .receive_block = pbdrv_bluetooth_btstack_uart_block_ev3_receive_block ,
182+ .send_block = pbdrv_bluetooth_btstack_uart_block_ev3_send_block ,
183183 .get_supported_sleep_modes = NULL ,
184184 .set_sleep = NULL ,
185185 .set_wakeup_handler = NULL ,
186186};
187187
188188const btstack_uart_block_t * pbdrv_bluetooth_btstack_uart_block_ev3_instance (
189189 void ) {
190- return & btstack_uart_block_ev3 ;
190+ return & pbdrv_bluetooth_btstack_uart_block_ev3_block_ev3 ;
191191}
192192
193193#endif // PBDRV_CONFIG_BLUETOOTH_BTSTACK_EV3_UART
0 commit comments