34 lines
1.0 KiB
C
34 lines
1.0 KiB
C
#include <stdio.h>
|
|
|
|
/* Board */
|
|
#include "board.h"
|
|
|
|
/* SDK drivers */
|
|
#include "fsl_ctimer.h"
|
|
#include "fsl_gpio.h"
|
|
#include "fsl_iocon.h"
|
|
|
|
/* Gem private */
|
|
#include "machine-pwm/src/pwm.h"
|
|
|
|
#define PWM_IMPL_CT_ID (x)((x >> 2) & 0x07)
|
|
|
|
static const uint32_t pwm_channel_map[5][4] = {
|
|
{0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL}, // CTIMER0
|
|
{0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL}, // CTIMER1
|
|
{0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL}, // CTIMER2
|
|
{0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL}, // CTIMER3
|
|
{0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL}, // CTIMER4
|
|
};
|
|
|
|
int mrb_machine_pwm_impl_config_set(uint32_t channel, machine_pwm_config_t *config) {
|
|
printf("Init pin: %ld, freq: %ld, duty: %d\n", channel, config->freq, config->duty);
|
|
return 0;
|
|
}
|
|
|
|
int mrb_machine_pwm_impl_config_get(uint32_t channel, machine_pwm_config_t *config) {
|
|
config->freq = 1000;
|
|
config->duty = 32768;
|
|
config->enabled = true;
|
|
return 0;
|
|
} |