From a2dee7fb5041d19ace9078d295a2e4c95574d869 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 7 Apr 2020 23:07:25 +0700 Subject: rename saola to saola_1 --- examples/device/board_test/src/CMakeLists.txt | 2 +- .../device/cdc_msc_freertos/src/CMakeLists.txt | 2 +- .../hid_composite_freertos/src/CMakeLists.txt | 2 +- hw/bsp/esp32s2_saola/board.mk | 2 - hw/bsp/esp32s2_saola/esp32s2_saola.c | 85 ---------------------- hw/bsp/esp32s2_saola_1/board.mk | 2 + hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c | 85 ++++++++++++++++++++++ 7 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 hw/bsp/esp32s2_saola/board.mk delete mode 100644 hw/bsp/esp32s2_saola/esp32s2_saola.c create mode 100644 hw/bsp/esp32s2_saola_1/board.mk create mode 100644 hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c diff --git a/examples/device/board_test/src/CMakeLists.txt b/examples/device/board_test/src/CMakeLists.txt index 66746502c..676159ac9 100644 --- a/examples/device/board_test/src/CMakeLists.txt +++ b/examples/device/board_test/src/CMakeLists.txt @@ -15,5 +15,5 @@ target_include_directories(${COMPONENT_TARGET} PUBLIC ) target_sources(${COMPONENT_TARGET} PUBLIC - "${TOP}/hw/bsp/esp32s2_saola/esp32s2_saola.c" + "${TOP}/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c" ) diff --git a/examples/device/cdc_msc_freertos/src/CMakeLists.txt b/examples/device/cdc_msc_freertos/src/CMakeLists.txt index ab4c1aa6d..7f8eeca17 100644 --- a/examples/device/cdc_msc_freertos/src/CMakeLists.txt +++ b/examples/device/cdc_msc_freertos/src/CMakeLists.txt @@ -14,7 +14,7 @@ target_include_directories(${COMPONENT_TARGET} PUBLIC ) target_sources(${COMPONENT_TARGET} PUBLIC - "${TOP}/hw/bsp/esp32s2_saola/esp32s2_saola.c" + "${TOP}/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c" "${TOP}/src/tusb.c" "${TOP}/src/common/tusb_fifo.c" "${TOP}/src/device/usbd.c" diff --git a/examples/device/hid_composite_freertos/src/CMakeLists.txt b/examples/device/hid_composite_freertos/src/CMakeLists.txt index fbe5f6389..c674873b2 100644 --- a/examples/device/hid_composite_freertos/src/CMakeLists.txt +++ b/examples/device/hid_composite_freertos/src/CMakeLists.txt @@ -14,7 +14,7 @@ target_include_directories(${COMPONENT_TARGET} PUBLIC ) target_sources(${COMPONENT_TARGET} PUBLIC - "${TOP}/hw/bsp/esp32s2_saola/esp32s2_saola.c" + "${TOP}/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c" "${TOP}/src/tusb.c" "${TOP}/src/common/tusb_fifo.c" "${TOP}/src/device/usbd.c" diff --git a/hw/bsp/esp32s2_saola/board.mk b/hw/bsp/esp32s2_saola/board.mk deleted file mode 100644 index 167ef6226..000000000 --- a/hw/bsp/esp32s2_saola/board.mk +++ /dev/null @@ -1,2 +0,0 @@ -# Cross Compiler for ESP32 -CROSS_COMPILE = xtensa-esp32s2-elf- diff --git a/hw/bsp/esp32s2_saola/esp32s2_saola.c b/hw/bsp/esp32s2_saola/esp32s2_saola.c deleted file mode 100644 index 16d054f75..000000000 --- a/hw/bsp/esp32s2_saola/esp32s2_saola.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2020, Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * This file is part of the TinyUSB stack. - */ - -#include "bsp/board.h" -#include "driver/gpio.h" -#include "hal/usb_hal.h" - -//--------------------------------------------------------------------+ -// MACRO TYPEDEF CONSTANT ENUM DECLARATION -//--------------------------------------------------------------------+ - -#define LED_PIN 21 - -#define BUTTON_PIN 0 -#define BUTTON_STATE_ACTIVE 0 - -// Initialize on-board peripherals : led, button, uart and USB -void board_init(void) -{ - // LED - gpio_pad_select_gpio(LED_PIN); - gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT); - - // Button - gpio_pad_select_gpio(BUTTON_PIN); - gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT); - gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY); - - // USB Controller Hal init - usb_hal_context_t hal = { - .use_external_phy = false // use built-in PHY - }; - usb_hal_init(&hal); -} - -// Turn LED on or off -void board_led_write(bool state) -{ - gpio_set_level(LED_PIN, state); -} - -// Get the current state of button -// a '1' means active (pressed), a '0' means inactive. -uint32_t board_button_read(void) -{ - return gpio_get_level(BUTTON_PIN) == BUTTON_STATE_ACTIVE; -} - -// Get characters from UART -int board_uart_read(uint8_t* buf, int len) -{ - (void) buf; (void) len; - return 0; -} - -// Send characters to UART -int board_uart_write(void const * buf, int len) -{ - (void) buf; (void) len; - return 0; -} - diff --git a/hw/bsp/esp32s2_saola_1/board.mk b/hw/bsp/esp32s2_saola_1/board.mk new file mode 100644 index 000000000..167ef6226 --- /dev/null +++ b/hw/bsp/esp32s2_saola_1/board.mk @@ -0,0 +1,2 @@ +# Cross Compiler for ESP32 +CROSS_COMPILE = xtensa-esp32s2-elf- diff --git a/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c b/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c new file mode 100644 index 000000000..16d054f75 --- /dev/null +++ b/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c @@ -0,0 +1,85 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2020, Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + +#include "bsp/board.h" +#include "driver/gpio.h" +#include "hal/usb_hal.h" + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM DECLARATION +//--------------------------------------------------------------------+ + +#define LED_PIN 21 + +#define BUTTON_PIN 0 +#define BUTTON_STATE_ACTIVE 0 + +// Initialize on-board peripherals : led, button, uart and USB +void board_init(void) +{ + // LED + gpio_pad_select_gpio(LED_PIN); + gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT); + + // Button + gpio_pad_select_gpio(BUTTON_PIN); + gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT); + gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY); + + // USB Controller Hal init + usb_hal_context_t hal = { + .use_external_phy = false // use built-in PHY + }; + usb_hal_init(&hal); +} + +// Turn LED on or off +void board_led_write(bool state) +{ + gpio_set_level(LED_PIN, state); +} + +// Get the current state of button +// a '1' means active (pressed), a '0' means inactive. +uint32_t board_button_read(void) +{ + return gpio_get_level(BUTTON_PIN) == BUTTON_STATE_ACTIVE; +} + +// Get characters from UART +int board_uart_read(uint8_t* buf, int len) +{ + (void) buf; (void) len; + return 0; +} + +// Send characters to UART +int board_uart_write(void const * buf, int len) +{ + (void) buf; (void) len; + return 0; +} + -- cgit v1.3.1