Skip to content

Commit

Permalink
add KB2040
Browse files Browse the repository at this point in the history
  • Loading branch information
caternuson committed Jul 7, 2023
1 parent 2667e7c commit b0b8c36
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions firmware/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pico_sdk_init()


set(BOARD "PICO" CACHE STRING "BaseName chosen by the user at CMake configure time")
set_property(CACHE BOARD PROPERTY STRINGS PICO FEATHER FEATHER_CAN FEATHER_EPD FEATHER_RFM ITSYBITSY QTPY QT2040_TRINKEY)
set_property(CACHE BOARD PROPERTY STRINGS PICO FEATHER FEATHER_CAN FEATHER_EPD FEATHER_RFM ITSYBITSY QTPY QT2040_TRINKEY KB2040)
message(STATUS "Selected board:'${BOARD}'")

# might help for feather?
Expand Down Expand Up @@ -68,7 +68,7 @@ pico_generate_pio_header(u2if ${CMAKE_CURRENT_LIST_DIR}/interfaces/hub75.pio OUT

target_include_directories(u2if PRIVATE ${CMAKE_CURRENT_LIST_DIR})

target_link_libraries(u2if PRIVATE pico_stdlib pico_unique_id tinyusb_device tinyusb_board
target_link_libraries(u2if PRIVATE pico_stdlib pico_unique_id tinyusb_device tinyusb_board
hardware_i2c hardware_watchdog hardware_pwm hardware_adc hardware_spi
hardware_pio hardware_dma pico_sync pico_multicore)

Expand Down
24 changes: 22 additions & 2 deletions firmware/source/board_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define FEATHER_EPD 6
#define FEATHER_RFM 7
#define FEATHER_CAN 8
#define KB2040 9


#define BOARD ${BOARD}

Expand All @@ -29,7 +31,7 @@
#define HUB75_MAX_LEDS ${HUB75_MAX_LEDS}

//---------------------------------------------------------
// Feather
// Feather
//---------------------------------------------------------
#if BOARD == FEATHER
// I2C0
Expand Down Expand Up @@ -205,6 +207,24 @@
#define U2IF_UART0_TX 0
#define U2IF_UART0_RX 1

//---------------------------------------------------------
// KB2040
//---------------------------------------------------------
#elif BOARD == KB2040
// I2C0
#define I2C0_ENABLED 1
#define U2IF_I2C0_SDA 12
#define U2IF_I2C0_SCL 13
// SPI0
#define SPI0_ENABLED 1
#define U2IF_SPI0_CK 18
#define U2IF_SPI0_MOSI 19
#define U2IF_SPI0_MISO 20
// UART0
#define UART0_ENABLED 1
#define U2IF_UART0_TX 0
#define U2IF_UART0_RX 1

//---------------------------------------------------------
// Pico (default)
//---------------------------------------------------------
Expand Down Expand Up @@ -242,7 +262,7 @@
#define U2IF_I2S_SD 12
// HUB75
#define HUB75_ENABLED HUB75_ALLOW

#else
#warning "Please define board type"
#endif
Expand Down
9 changes: 7 additions & 2 deletions firmware/source/usb_descriptors.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org)
Expand Down Expand Up @@ -74,6 +74,11 @@
#define USB_PRD "QT2040 Trinkey U2IF"
#define USB_VID 0x239A
#define USB_PID 0x0109
#elif BOARD == KB2040
#define USB_MFG "Adafruit"
#define USB_PRD "KB2040 Kee Boar U2IF"
#define USB_VID 0x239A
#define USB_PID 0x0105
#elif BOARD == PICO
#define USB_MFG "Pico"
#define USB_PRD "U2IF"
Expand All @@ -99,7 +104,7 @@ tusb_desc_device_t const desc_device =
.bDeviceClass = TUSB_CLASS_MISC,
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,

.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,

.idVendor = USB_VID,
Expand Down

0 comments on commit b0b8c36

Please sign in to comment.