<commit_before>/*
 * Copyright (C) 2014 Freie Universität Berlin
 *
 * This file is subject to the terms and conditions of the GNU Lesser General
 * Public License v2.1. See the file LICENSE in the top level directory for more
 * details.
 */

/**
 * @ingroup     lpc2387
 * @{
 *
 * @file
 * @brief       CPU specific low-level PWM driver implementation for the LPC2387
 *
 * @author      <NAME> <<EMAIL>>
 *
 * @}
 */

#include "bitarithm.h"
#include "lpc2387.h"
#include "periph/pwm.h"
#include "periph_conf.h"


#define PCPWM1      BIT6

/**
 * @note The PWM is always initialized with left-aligned mode.
 *
 * TODO: add center and right aligned modes
 */
int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int resolution)
{
    switch (dev) {
#if PWM_0_EN
        case PWM_0:
            /* select function PWM[3] for pins */
            PWM_0_PORT &= ~((3 << PWM_0_CH0_PIN * 2) |
                            (3 << PWM_0_CH1_PIN * 2) |
                            (3 << PWM_0_CH2_PIN * 2));
            PWM_0_PORT |= (PWM_0_FUNC << PWM_0_CH0_PIN * 2) |
                          (PWM_0_FUNC << PWM_0_CH1_PIN * 2) |
                          (PWM_0_FUNC << PWM_0_CH2_PIN * 2);

            /* power on PWM1 */
            PCONP |= BIT6;

            /* select PWM1 clock */
            PCLKSEL0 &= ~(BIT13);
            PCLKSEL0 |= (BIT12);

            /* reset PWM1s counter */
            PWM1TCR = BIT1;
<commit_msg>cpu/lpc2387: fix unused parameter warning<commit_after>/*
 * Copyright (C) 2014 Freie Universität Berlin
 *
 * This file is subject to the terms and conditions of the GNU Lesser General
 * Public License v2.1. See the file LICENSE in the top level directory for more
 * details.
 */

/**
 * @ingroup     lpc2387
 * @{
 *
 * @file
 * @brief       CPU specific low-level PWM driver implementation for the LPC2387
 *
 * @author      <NAME> <<EMAIL>>
 *
 * @}
 */

#include "bitarithm.h"
#include "lpc2387.h"
#include "periph/pwm.h"
#include "periph_conf.h"


#define PCPWM1      BIT6

/**
 * @note The PWM is always initialized with left-aligned mode.
 *
 * TODO: add center and right aligned modes
 */
int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int resolution)
{
    (void) mode; /* unused */

    switch (dev) {
#if PWM_0_EN
        case PWM_0:
            /* select function PWM[3] for pins */
            PWM_0_PORT &= ~((3 << PWM_0_CH0_PIN * 2) |
                            (3 << PWM_0_CH1_PIN * 2) |
                            (3 << PWM_0_CH2_PIN * 2));
            PWM_0_PORT |= (PWM_0_FUNC << PWM_0_CH0_PIN * 2) |
                          (PWM_0_FUNC << PWM_0_CH1_PIN * 2) |
                          (PWM_0_FUNC << PWM_0_CH2_PIN * 2);

            /* power on PWM1 */
            PCONP |= BIT6;

            /* select PWM1 clock */
            PCLKSEL0 &= ~(BIT13);
            PCLKSEL0 |= (BIT12);

            /* reset PWM1s counter */
            PWM1TCR = BIT1;

{'fraction_non_alphanumeric': 0.11412123264476803, 'fraction_numerical': 0.04266847273958686, 'mean_word_length': 1.8624031007751938, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 9, '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': '7024030', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1018, 'n_words': 283}