Skip to content

Commit

Permalink
BIOI keyboards: use core UART driver (qmk#21879)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and zgagnon committed Dec 15, 2023
1 parent 9e83e60 commit 01ad894
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2,019 deletions.
30 changes: 0 additions & 30 deletions keyboards/bioi/ble.h

This file was deleted.

28 changes: 9 additions & 19 deletions keyboards/bioi/ble.c → keyboards/bioi/bluetooth_custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include "bluetooth.h"
#include "ble.h"
#include "usart.h"
#include "uart.h"
#include "progmem.h"
#include "wait.h"
#include "debug.h"
#include "usb_descriptor.h"
#include "report.h"

keyboard_config_t ble_config;

static void bluefruit_serial_send(uint8_t);

void send_str(const char *str)
{
uint8_t c;
while ((c = pgm_read_byte(str++)))
uart1_putc(c);
uart_write(c);
}

void serial_send(uint8_t data)
Expand All @@ -43,7 +38,7 @@ void send_bytes(uint8_t data)
sprintf(hexStr, "%02X", data);
for (int j = 0; j < sizeof(hexStr) - 1; j++)
{
uart1_putc(hexStr[j]);
uart_write(hexStr[j]);
}
}

Expand Down Expand Up @@ -72,7 +67,12 @@ static void bluefruit_serial_send(uint8_t data)
}

void bluetooth_init(void) {
usart_init();
uart_init(76800);
wait_ms(250);

send_str(PSTR("\r\n"));
send_str(PSTR("\r\n"));
send_str(PSTR("\r\n"));
}

void bluetooth_task(void) {}
Expand Down Expand Up @@ -162,13 +162,3 @@ void bluetooth_send_consumer(uint16_t usage)
bluefruit_trace_footer();
#endif
}

void usart_init(void)
{
uart1_init(UART_BAUD_SELECT_DOUBLE_SPEED(76800, 8000000L));
wait_ms(250);

send_str(PSTR("\r\n"));
send_str(PSTR("\r\n"));
send_str(PSTR("\r\n"));
}
6 changes: 2 additions & 4 deletions keyboards/bioi/g60/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ BLUETOOTH_ENABLE = yes

VIA_ENABLE = yes # VIA support should be enabled here due to the main() loop will be compiled first.

SRC += usart.c ble.c

OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
OPT_DEFS += -DUSART1_ENABLED
QUANTUM_LIB_SRC += uart.c
SRC += bluetooth_custom.c
7 changes: 3 additions & 4 deletions keyboards/bioi/g60ble/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes
LTO_ENABLE = yes

# these lines are all for bluetooth
BLUETOOTH_ENABLE = yes
SRC += usart.c ble.c
OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
OPT_DEFS += -DUSART1_ENABLED

QUANTUM_LIB_SRC += uart.c
SRC += bluetooth_custom.c
6 changes: 2 additions & 4 deletions keyboards/bioi/morgan65/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ BLUETOOTH_ENABLE = yes

VIA_ENABLE = yes # VIA support should be enabled here due to the main() loop will be compiled first.

SRC += usart.c ble.c

OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
OPT_DEFS += -DUSART1_ENABLED
QUANTUM_LIB_SRC += uart.c
SRC += bluetooth_custom.c
Loading

0 comments on commit 01ad894

Please sign in to comment.