Skip to content

Update SDK #176

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion cores/arduino/ch32/pinmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,19 @@ void pin_function(PinName pin, int function)
case CH_CNF_OUTPUT_PP:
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
break;
#if !defined(CH32X035)
case CH_CNF_OUTPUT_OD:
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
break;
#endif
case CH_CNF_OUTPUT_AFPP:
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
break;
#if !defined(CH32X035)
case CH_CNF_OUTPUT_AFOD:
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
break;
break;
#endif
default:
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
break;
Expand Down
3 changes: 3 additions & 0 deletions system/CH32L10x/SRC/Debug/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,6 @@ void *_sbrk(ptrdiff_t incr)
curbrk += incr;
return curbrk - incr;
}

void _fini() {}
void _init() {}
107 changes: 54 additions & 53 deletions system/CH32L10x/SRC/Debug/debug.h
Original file line number Diff line number Diff line change
@@ -1,53 +1,54 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : debug.h
* Author : WCH
* Version : V1.0.0
* Date : 2023/07/08
* Description : This file contains all the functions prototypes for UART
* Printf , Delay functions.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef __DEBUG_H
#define __DEBUG_H

#include "stdio.h"
#include "ch32l103.h"

#ifdef __cplusplus
extern "C" {
#endif

/* UART Printf Definition */
#define DEBUG_UART1 1
#define DEBUG_UART2 2
#define DEBUG_UART3 3

/* DEBUG UATR Definition */
#ifndef DEBUG
#define DEBUG DEBUG_UART1
#endif

extern uint32_t OPA_Trim;
extern uint16_t ADC_Trim;
extern uint32_t TS_Val;
extern uint32_t CHIPID;

void Delay_Init(void);
void Delay_Us(uint32_t n);
void Delay_Ms(uint32_t n);
void USART_Printf_Init(uint32_t baudrate);

#if(DEBUG)
#define PRINT(format, ...) printf(format, ##__VA_ARGS__)
#else
#define PRINT(X...)
#endif

#ifdef __cplusplus
}
#endif

#endif
/********************************** (C) COPYRIGHT *******************************
* File Name : debug.h
* Author : WCH
* Version : V1.0.0
* Date : 2023/11/06
* Description : This file contains all the functions prototypes for UART
* Printf , Delay functions.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef __DEBUG_H
#define __DEBUG_H

#include "stdio.h"
#include "ch32l103.h"

#ifdef __cplusplus
extern "C" {
#endif

/* UART Printf Definition */
#define DEBUG_UART1 1
#define DEBUG_UART2 2
#define DEBUG_UART3 3

/* DEBUG UATR Definition */
#ifndef DEBUG
#define DEBUG DEBUG_UART1
#endif

extern uint32_t OPA_Trim;
extern uint16_t ADC_Trim;
extern uint32_t TS_Val;
extern uint32_t CHIPID;
extern uint16_t USBPD_CFG;

void Delay_Init(void);
void Delay_Us(uint32_t n);
void Delay_Ms(uint32_t n);
void USART_Printf_Init(uint32_t baudrate);

#if(DEBUG)
#define PRINT(format, ...) printf(format, ##__VA_ARGS__)
#else
#define PRINT(X...)
#endif

#ifdef __cplusplus
}
#endif

#endif
Loading