Skip to content

Commit

Permalink
Sync with local development
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvught committed Mar 20, 2024
1 parent 145c0a5 commit 51edbaa
Show file tree
Hide file tree
Showing 28 changed files with 101 additions and 115 deletions.
2 changes: 1 addition & 1 deletion Board-tester/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.1518033914" name="Default">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-670292905767657691" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="738745039391822833" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
4 changes: 2 additions & 2 deletions lib-configstore/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1300392770808688630" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1683160601416118334" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -14,7 +14,7 @@
</configuration>
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.999241968.974157274.211492271.1465431049.1736081614" name="GD32">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-693518655739115654" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="715519289420364870" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
4 changes: 2 additions & 2 deletions lib-configstore/src/configstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ void ConfigStore::Dump() {
}

debug_dump(s_SpiFlashData, OFFSET_STORES);
printf("\n");
puts("");

for (uint32_t j = 0; j < static_cast<uint32_t>(Store::LAST); j++) {
printf("Store [%s]:%d\n", s_aStoreName[j], j);

auto *p = &s_SpiFlashData[GetStoreOffset(static_cast<Store>(j))];
debug_dump(p, static_cast<uint16_t>(s_aStorSize[j]));

printf("\n");
puts("");
}

if (IsWatchDog) {
Expand Down
2 changes: 1 addition & 1 deletion lib-debug/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.346413883.1633890158" name="GD32">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-731362886142772829" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="677675059016707695" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
2 changes: 1 addition & 1 deletion lib-device/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="([^/\\\\]*)((g?cc)|([gc]\+\+)|(clang))" prefer-non-shared="true"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-657217473143545791" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="751820472015934733" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
2 changes: 1 addition & 1 deletion lib-display/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.999241968.1710679266" name="GD32">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-705771573412182471" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="703266371747298053" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
8 changes: 5 additions & 3 deletions lib-display/include/i2c/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,14 @@ class Display {
display::Type m_tType { display::Type::UNKNOWN };
uint32_t m_nMillis { 0 };
HAL_I2C m_I2C;
bool m_bIsSleep { false };
bool m_bHave7Segment { false };
uint32_t m_nSleepTimeout { 1000 * 60 * display::Defaults::SEEP_TIMEOUT };

uint8_t m_nContrast { 0x7F };

bool m_bIsSleep { false };
bool m_bIsFlippedVertically { false };
#if defined (CONFIG_DISPLAY_HAVE_7SEGMENT)
bool m_bHave7Segment { false };
#endif

DisplaySet *m_LcdDisplay { nullptr };
static Display *s_pThis;
Expand Down
2 changes: 1 addition & 1 deletion lib-displayudf/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.999241968.770898614" name="GD32">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-757387761275323852" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="651650183884156672" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
2 changes: 1 addition & 1 deletion lib-gd32/src/f/i2s_psc_config_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define RCU_CFG1_PREDV1_OFFSET 4U /* PREDV1 offset in RCU_CFG1 */
#define RCU_CFG1_PLL2MF_OFFSET 12U /* PLL2MF offset in RCU_CFG1 */

void i2s_psc_config_dump(__attribute__((unused)) uint32_t spi_periph, uint32_t audiosample, uint32_t frameformat, uint32_t mckout) {
void i2s_psc_config_dump([[maybe_unused]] uint32_t spi_periph, uint32_t audiosample, uint32_t frameformat, uint32_t mckout) {
uint32_t i2sdiv = 2U, i2sof = 0U;
uint32_t clks = 0U;
uint32_t i2sclock = 0U;
Expand Down
36 changes: 18 additions & 18 deletions lib-gd32/src/gd32_uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,72 +180,72 @@ static void gpio_config(const uint32_t usart_periph) {
static void gpio_config(const uint32_t usart_periph) {
switch (usart_periph) {
case USART0:
gpio_af_set(USART0_GPIOx, GPIO_AF_7, USART0_TX_GPIO_PINx);
gpio_af_set(USART0_GPIOx, USART0_GPIO_AFx, USART0_TX_GPIO_PINx);
gpio_mode_set(USART0_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART0_TX_GPIO_PINx);
gpio_output_options_set(USART0_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART0_TX_GPIO_PINx);
gpio_af_set(USART0_GPIOx, GPIO_AF_7, USART0_RX_GPIO_PINx);
gpio_af_set(USART0_GPIOx, USART0_GPIO_AFx, USART0_RX_GPIO_PINx);
gpio_mode_set(USART0_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART0_RX_GPIO_PINx);
gpio_output_options_set(USART0_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART0_RX_GPIO_PINx);
break;
case USART1:
gpio_af_set(USART1_GPIOx, GPIO_AF_7, USART1_TX_GPIO_PINx);
gpio_af_set(USART1_GPIOx, USART1_GPIO_AFx, USART1_TX_GPIO_PINx);
gpio_mode_set(USART1_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART1_TX_GPIO_PINx);
gpio_output_options_set(USART1_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART1_TX_GPIO_PINx);
gpio_af_set(USART1_GPIOx, GPIO_AF_7, USART1_RX_GPIO_PINx);
gpio_af_set(USART1_GPIOx, USART1_GPIO_AFx, USART1_RX_GPIO_PINx);
gpio_mode_set(USART1_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART1_RX_GPIO_PINx);
gpio_output_options_set(USART1_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART1_RX_GPIO_PINx);
break;
case USART2:
gpio_af_set(USART2_GPIOx, GPIO_AF_7, USART2_TX_GPIO_PINx);
gpio_af_set(USART2_GPIOx, USART2_GPIO_AFx, USART2_TX_GPIO_PINx);
gpio_mode_set(USART2_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART2_TX_GPIO_PINx);
gpio_output_options_set(USART2_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART2_TX_GPIO_PINx);
gpio_af_set(USART2_GPIOx, GPIO_AF_7, USART2_RX_GPIO_PINx);
gpio_af_set(USART2_GPIOx, USART2_GPIO_AFx, USART2_RX_GPIO_PINx);
gpio_mode_set(USART2_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART2_RX_GPIO_PINx);
gpio_output_options_set(USART2_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART2_RX_GPIO_PINx);
break;
case UART3:
gpio_af_set(UART3_GPIOx, GPIO_AF_8, UART3_TX_GPIO_PINx);
gpio_af_set(UART3_GPIOx, UART3_GPIO_AFx, UART3_TX_GPIO_PINx);
gpio_mode_set(UART3_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART3_TX_GPIO_PINx);
gpio_output_options_set(UART3_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART3_TX_GPIO_PINx);
gpio_af_set(UART3_GPIOx, GPIO_AF_8, UART3_RX_GPIO_PINx);
gpio_af_set(UART3_GPIOx, UART3_GPIO_AFx, UART3_RX_GPIO_PINx);
gpio_mode_set(UART3_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART3_RX_GPIO_PINx);
gpio_output_options_set(UART3_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART3_RX_GPIO_PINx);
break;
case UART4:
gpio_af_set(UART4_TX_GPIOx, GPIO_AF_8, UART4_TX_GPIO_PINx);
gpio_af_set(UART4_TX_GPIOx, UART4_GPIO_AFx, UART4_TX_GPIO_PINx);
gpio_mode_set(UART4_TX_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART4_TX_GPIO_PINx);
gpio_output_options_set(UART4_TX_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART4_TX_GPIO_PINx);
gpio_af_set(UART4_RX_GPIOx, GPIO_AF_8, UART4_RX_GPIO_PINx);
gpio_af_set(UART4_RX_GPIOx, UART4_GPIO_AFx, UART4_RX_GPIO_PINx);
gpio_mode_set(UART4_RX_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART4_RX_GPIO_PINx);
gpio_output_options_set(UART4_RX_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART4_RX_GPIO_PINx);
break;
#if defined (USART5)
case USART5:
gpio_af_set(USART5_GPIOx, GPIO_AF_8, USART5_TX_GPIO_PINx);
gpio_af_set(USART5_GPIOx, USART5_GPIO_AFx, USART5_TX_GPIO_PINx);
gpio_mode_set(USART5_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART5_TX_GPIO_PINx);
gpio_output_options_set(USART5_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART5_TX_GPIO_PINx);
gpio_af_set(USART5_GPIOx, GPIO_AF_8, USART5_RX_GPIO_PINx);
gpio_af_set(USART5_GPIOx, USART5_GPIO_AFx, USART5_RX_GPIO_PINx);
gpio_mode_set(USART5_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, USART5_RX_GPIO_PINx);
gpio_output_options_set(USART5_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, USART5_RX_GPIO_PINx);

break;
#endif
#if defined (UART6)
case UART6:
gpio_af_set(UART6_GPIOx, GPIO_AF_8, UART6_TX_GPIO_PINx);
gpio_af_set(UART6_GPIOx, UART6_GPIO_AFx, UART6_TX_GPIO_PINx);
gpio_mode_set(UART6_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART6_TX_GPIO_PINx);
gpio_output_options_set(UART6_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART6_TX_GPIO_PINx);
gpio_af_set(UART6_GPIOx, GPIO_AF_8, UART6_RX_GPIO_PINx);
gpio_af_set(UART6_GPIOx, UART6_GPIO_AFx, UART6_RX_GPIO_PINx);
gpio_mode_set(UART6_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART6_RX_GPIO_PINx);
gpio_output_options_set(UART6_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART6_RX_GPIO_PINx);
break;
#endif
#if defined (UART7)
case UART7:
gpio_af_set(UART7_GPIOx, GPIO_AF_8, UART7_TX_GPIO_PINx);
gpio_af_set(UART7_GPIOx, UART7_GPIO_AFx, UART7_TX_GPIO_PINx);
gpio_mode_set(UART7_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART7_TX_GPIO_PINx);
gpio_output_options_set(UART7_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART7_TX_GPIO_PINx);
gpio_af_set(UART7_GPIOx, GPIO_AF_8, UART7_RX_GPIO_PINx);
gpio_af_set(UART7_GPIOx, UART7_GPIO_AFx, UART7_RX_GPIO_PINx);
gpio_mode_set(UART7_GPIOx, GPIO_MODE_AF, GPIO_PUPD_PULLUP, UART7_RX_GPIO_PINx);
gpio_output_options_set(UART7_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED, UART7_RX_GPIO_PINx);
break;
Expand Down Expand Up @@ -310,7 +310,7 @@ void gd32_uart_transmit(const uint32_t usart_periph, const uint8_t *data, uint32
#if defined (GD32H7XX)
USART_TDATA(usart_periph) = USART_TDATA_TDATA & (uint32_t)*data++;
#else
USART_DATA(usart_periph) = ((uint16_t) USART_DATA_DATA & *data++);
USART_DATA(usart_periph) = (USART_DATA_DATA & *data++);
#endif
}

Expand All @@ -325,7 +325,7 @@ void gd32_uart_transmit_string(const uint32_t usart_periph, const char *data) {
#if defined (GD32H7XX)
USART_TDATA(usart_periph) = USART_TDATA_TDATA & (uint32_t)*data++;
#else
USART_DATA(usart_periph) = ((uint16_t) USART_DATA_DATA & *data++);
USART_DATA(usart_periph) = (USART_DATA_DATA & *data++);
#endif
}
}
7 changes: 3 additions & 4 deletions lib-gd32/src/systick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ volatile uint32_t s_nSysTickMillis;

extern "C" {
void systick_config() {
/* setup systick timer for 1000Hz interrupts */
/* Setup systick timer for 1000Hz interrupts */
if (SysTick_Config(SystemCoreClock / 1000U)) {
/* capture error */
while (1) {
}
}
/* configure the systick handler priority */
NVIC_SetPriority(SysTick_IRQn, 0x00U);

NVIC_SetPriority(SysTick_IRQn, (1UL<<__NVIC_PRIO_BITS)-1UL); // Lowest priority
}

void SysTick_Handler() {
Expand Down
49 changes: 24 additions & 25 deletions lib-hal/console/i2c/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
* THE SOFTWARE.
*/

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <cstdint>
#include <cstddef>

#include "console.h"

Expand All @@ -34,57 +33,57 @@
static bool s_isConnected;

#if !defined (CONSOLE_I2C_ADDRESS)
# define CONSOLE_I2C_ADDRESS ((uint8_t)0x4D)
# define CONSOLE_I2C_ADDRESS (0x4D)
#endif

#if !defined (CONSOLE_I2C_ONBOARD_CRYSTAL)
# define CONSOLE_I2C_ONBOARD_CRYSTAL 14745600UL
# define CONSOLE_I2C_ONBOARD_CRYSTAL (14745600UL)
#endif

#if !defined (CONSOLE_I2C_BAUDRATE)
# define CONSOLE_I2C_BAUDRATE 115200U
# define CONSOLE_I2C_BAUDRATE (115200U)
#endif

#define SC16IS7X0_REG_SHIFT 3

#define SC16IS7X0_THR ((uint8_t)(0x00 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_FCR ((uint8_t)(0x02 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_LCR ((uint8_t)(0x03 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_MCR ((uint8_t)(0x04 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_SPR ((uint8_t)(0x07 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_TLR ((uint8_t)(0x07 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_TXLVL ((uint8_t)(0x08 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_THR (0x00 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_FCR (0x02 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_LCR (0x03 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_MCR (0x04 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_SPR (0x07 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_TLR (0x07 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_TXLVL (0x08 << SC16IS7X0_REG_SHIFT)

#define SC16IS7X0_DLL ((uint8_t)(0x00 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_DLH ((uint8_t)(0x01 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_EFR ((uint8_t)(0x02 << SC16IS7X0_REG_SHIFT))
#define SC16IS7X0_DLL (0x00 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_DLH (0x01 << SC16IS7X0_REG_SHIFT)
#define SC16IS7X0_EFR (0x02 << SC16IS7X0_REG_SHIFT)

/** See section 8.3 of the datasheet for definitions
* of bits in the FIFO Control Register (FCR)
*/
#define FCR_TX_FIFO_RST ((uint8_t)(1U << 2))
#define FCR_ENABLE_FIFO ((uint8_t)(1U << 0))
#define FCR_TX_FIFO_RST (1U << 2)
#define FCR_ENABLE_FIFO (1U << 0)

/** See section 8.4 of the datasheet for definitions
* of bits in the Line Control Register (LCR)
*/

#define LCR_BITS8 ((uint8_t)0x03)
#define LCR_BITS1 ((uint8_t)0x00)
#define LCR_NONE ((uint8_t)0x00)
#define LCR_ENABLE_DIV ((uint8_t)0x80)
#define LCR_BITS8 (0x03)
#define LCR_BITS1 (0x00)
#define LCR_NONE (0x00)
#define LCR_ENABLE_DIV (0x80)

/**
* 8.6 Modem Control Register (MCR)
*/
//MCR[2] only accessible when EFR[4] is set
#define MCR_ENABLE_TCR_TLR ((uint8_t)(1U << 2))
#define MCR_PRESCALE_4 ((uint8_t)(1U << 7))
#define MCR_ENABLE_TCR_TLR (1U << 2)
#define MCR_PRESCALE_4 (1U << 7)

/**
* 8.11 Enhanced Features Register (EFR)
*/
#define EFR_ENABLE_ENHANCED_FUNCTIONS ((uint8_t)(1U << 4))
#define EFR_ENABLE_ENHANCED_FUNCTIONS (1U << 4)

static bool is_connected(const uint8_t address, const uint32_t baudrate) {
char buf;
Expand Down
8 changes: 1 addition & 7 deletions lib-hal/include/gd32/hal_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file hal_spi.h
*
*/
/* Copyright (C) 2021-2022 by Arjan van Vught mailto:[email protected]
/* Copyright (C) 2021-2024 by Arjan van Vught mailto:[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -28,12 +28,6 @@

#include "gd32_spi.h"

namespace hal {
namespace spi {

} // namespace spi
} // namespace hal

#define SPI_MODE0 GD32_SPI_MODE0
#define SPI_MODE1 GD32_SPI_MODE1
#define SPI_MODE2 GD32_SPI_MODE2
Expand Down
Loading

0 comments on commit 51edbaa

Please sign in to comment.