Skip to content

Commit

Permalink
Remove references to the deprecated SYSTEM_CORE_CLOCK and clean up un…
Browse files Browse the repository at this point in the history
…necessary APB_CLOCK #defines

SYSTEM_CORE_CLOCK went away in favor of FUNCONF_SYSTEM_CORE_CLOCK

APB_CLOCK is only used in the i2c_slave.h and ch32v003_SPI.h files
so the references there have been maintained.
  • Loading branch information
fr0sty1 committed Jul 14, 2023
1 parent bbe0e83 commit 199a171
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 42 deletions.
2 changes: 0 additions & 2 deletions attic/external_crystal_run_from_ram_turbo.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "ch32v003fun.h"
#include <stdio.h>

#define APB_CLOCK SYSTEM_CORE_CLOCK

uint32_t count;

void RamFunction() __attribute__((naked));
Expand Down
3 changes: 0 additions & 3 deletions examples/MCOtest/MCOtest.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#define SYSTEM_CORE_CLOCK 48000000
#define APB_CLOCK SYSTEM_CORE_CLOCK

#include "ch32v003fun.h"
#include <stdio.h>

Expand Down
5 changes: 0 additions & 5 deletions examples/bootload/bootload.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Could be defined here, or in the processor defines.
#define SYSTEM_CORE_CLOCK 48000000

#include "ch32v003fun.h"
#include <stdio.h>

#define APB_CLOCK SYSTEM_CORE_CLOCK

uint32_t count;

// You can override the interrupt vector this way:
Expand Down
4 changes: 0 additions & 4 deletions examples/cpp_virtual_methods/cpp_virtual_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
* 05/21/2023 A. Mandera
*/

// Could be defined here, or in the processor defines.
#define SYSTEM_CORE_CLOCK 48000000
#define APB_CLOCK SYSTEM_CORE_CLOCK

#include "ch32v003fun.h"
#include "example.h"
#include <stdio.h>
Expand Down
3 changes: 0 additions & 3 deletions examples/dma_gpio/dma_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
// The interrupt fires once at the beginning and
// once at the end.
//
#define SYSTEM_CORE_CLOCK 48000000

#include "ch32v003fun.h"
#include <stdio.h>

#define APB_CLOCK SYSTEM_CORE_CLOCK

volatile uint32_t count;

#define MBSAMPS 1024
Expand Down
1 change: 0 additions & 1 deletion examples/self_modify_code/self_modify_code.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Small example showing how to use the SWIO programming pin to
do printf through the debug interface */

#define SYSTEM_CORE_CLOCK 24000000
#include "ch32v003fun.h"
#include <stdio.h>

Expand Down
2 changes: 0 additions & 2 deletions examples/spi_24L01_rx/nrf24l01_low_level.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define SYSTEM_CORE_CLOCK 48000000
#define APB_CLOCK SYSTEM_CORE_CLOCK
#include "ch32v003fun.h"


Expand Down
2 changes: 0 additions & 2 deletions examples/spi_24L01_tx/nrf24l01_low_level.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define SYSTEM_CORE_CLOCK 48000000
#define APB_CLOCK SYSTEM_CORE_CLOCK
#include "ch32v003fun.h"


Expand Down
4 changes: 0 additions & 4 deletions examples/standby_autowake/standby_autowake.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
// based on https://paste.sr.ht/blob/b9b4fb45cbc70f2db7e31a77a6ef7dd2a7f220fb
// Could be defined here, or in the processor defines.
#define SYSTEM_CORE_CLOCK 48000000

#include "ch32v003fun.h"
#include <stdio.h>

#define APB_CLOCK SYSTEM_CORE_CLOCK

/* somehow this ISR won't get called??
void AWU_IRQHandler( void ) __attribute__((interrupt));
void AWU_IRQHandler( void ) {
Expand Down
4 changes: 0 additions & 4 deletions examples/standby_btn/standby_btn.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
// based on https://paste.sr.ht/blob/b9b4fb45cbc70f2db7e31a77a6ef7dd2a7f220fb
// Could be defined here, or in the processor defines.
#define SYSTEM_CORE_CLOCK 48000000

#include "ch32v003fun.h"
#include <stdio.h>

#define APB_CLOCK SYSTEM_CORE_CLOCK

void EXTI7_0_IRQHandler( void ) __attribute__((interrupt));
void EXTI7_0_IRQHandler( void ) {
//GPIOD->OUTDR ^= (1 << 4);
Expand Down
4 changes: 0 additions & 4 deletions examples/ws2812bdemo/ws2812bdemo.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Could be defined here, or in the processor defines.
#define SYSTEM_CORE_CLOCK 48000000
#define APB_CLOCK SYSTEM_CORE_CLOCK

// NOTE: CONNECT WS2812's to PC6

#include "ch32v003fun.h"
Expand Down
8 changes: 0 additions & 8 deletions extralibs/ch32v003_GPIO_branchless.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,6 @@ static inline void GPIO_tim2_init();
#define GPIO_timer_prescaler TIM_CKD_DIV2 // APB_CLOCK / 1024 / 2 = 23.4kHz
#endif

// maintenance define
#if !defined(SYSTEM_CORE_CLOCK)
#define SYSTEM_CORE_CLOCK 48000000
#define APB_CLOCK SYSTEM_CORE_CLOCK
#endif



//######## define requirements / maintenance defines


Expand Down
5 changes: 5 additions & 0 deletions extralibs/ch32v003_SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ in the .c files that use this library, you'll need to #define some configuration
SYSTEM_CORE_CLOCK and APB_CLOCK should be defined already as APB_CLOCK is used by this library
#ifndef APB_CLOCK
#define APB_CLOCK FUNCONF_SYSTEM_CORE_CLOCK
#endif
to enable using the functions of this library:
#define CH32V003_SPI_IMPLEMENTATION
Expand Down

0 comments on commit 199a171

Please sign in to comment.