<commit_before>#include "LPC17xx.h"
#include "lpc_types.h"
#include "lpc17xx_timer.h"
#include "timer.h"

#define SYSTEM_CLOCK_TIMER LPC_TIM3
#define DELAY_TIMER LPC_TIM0

void TIMER3_IRQHandler() { }

void resetTimer(LPC_TIM_TypeDef* timer) {
    timer->TCR = 2;
}

void delayMs(int delayInMs) {
    resetTimer(DELAY_TIMER);
    DELAY_TIMER->PR  = 0x00;        /* set prescaler to zero */
    DELAY_TIMER->MR0 = (SystemCoreClock / 4) / (1000 / delayInMs);  //enter delay time
    DELAY_TIMER->IR  = 0xff;        /* reset all interrrupts */
    DELAY_TIMER->MCR = 0x04;        /* stop timer on match */
    TIM_Cmd(DELAY_TIMER, ENABLE);

    /* wait until delay time has elapsed */
    while (DELAY_TIMER->TCR & 0x01);
}

unsigned long systemTimeMs() {
    return SYSTEM_CLOCK_TIMER->TC;
}

void initializeTimers() {
    TIM_TIMERCFG_Type systemClockTimerConfig;
    TIM_ConfigStructInit(TIM_TIMER_MODE, &systemClockTimerConfig);
    TIM_Init(SYSTEM_CLOCK_TIMER, TIM_TIMER_MODE, &systemClockTimerConfig);
    TIM_Cmd(SYSTEM_CLOCK_TIMER, ENABLE);
}<commit_msg>Use CMSIS/CDL library for delay timer, too.<commit_after>#include "LPC17xx.h"
#include "lpc_types.h"
#include "lpc17xx_timer.h"
#include "timer.h"

#define SYSTEM_CLOCK_TIMER LPC_TIM3
#define DELAY_TIMER LPC_TIM0

void TIMER3_IRQHandler() { }

void delayMs(int delayInMs) {
    TIM_TIMERCFG_Type delayTimerConfig;
    TIM_ConfigStructInit(TIM_TIMER_MODE, &delayTimerConfig);
    TIM_Init(DELAY_TIMER, TIM_TIMER_MODE, &delayTimerConfig);

    DELAY_TIMER->PR  = 0x00;        /* set prescaler to zero */
    DELAY_TIMER->MR0 = (SystemCoreClock / 4) / (1000 / delayInMs);  //enter delay time
    DELAY_TIMER->IR  = 0xff;        /* reset all interrupts */
    DELAY_TIMER->MCR = 0x04;        /* stop timer on match */

    TIM_Cmd(DELAY_TIMER, ENABLE);

    /* wait until delay time has elapsed */
    while (DELAY_TIMER->TCR & 0x01);
}

unsigned long systemTimeMs() {
    return SYSTEM_CLOCK_TIMER->TC;
}

void initializeTimers() {
    TIM_TIMERCFG_Type systemClockTimerConfig;
    TIM_ConfigStructInit(TIM_TIMER_MODE, &systemClockTimerConfig);
    TIM_Init(SYSTEM_CLOCK_TIMER, TIM_TIMER_MODE, &systemClockTimerConfig);
    TIM_Cmd(SYSTEM_CLOCK_TIMER, ENABLE);
}
{'fraction_non_alphanumeric': 0.10865644724977457, 'fraction_numerical': 0.021190261496844005, 'mean_word_length': 4.054669703872437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4398000', 'n_tokens_mistral': 892, 'n_tokens_neox': 817, 'n_words': 161}