Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIOI keyboards: use core UART driver #21879

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <http://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