47 lines
817 B
C
47 lines
817 B
C
![]() |
/*
|
||
|
* bsp_pwm.c
|
||
|
*
|
||
|
* Created on: 2025年4月8日
|
||
|
* Author: 22332
|
||
|
*/
|
||
|
#include "cola_init.h"
|
||
|
#include "cola_device.h"
|
||
|
#include "drv_pwm.h"
|
||
|
|
||
|
static cola_device_t g_dev_pwm;
|
||
|
|
||
|
static int bsp_pwm_open(cola_device_t *dev, int oflag){
|
||
|
bsp_drv_pwm_init();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static int bsp_pwm_close(cola_device_t *dev){
|
||
|
bsp_drv_pwm_deinit();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
static int bsp_pwm_config(cola_device_t *dev, int pos, void *buffer, int size){
|
||
|
bsp_drv_change_duty(pos);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
static struct cola_device_ops master_pwm_Ops ={
|
||
|
.open = bsp_pwm_open,
|
||
|
.close = bsp_pwm_close,
|
||
|
.config = bsp_pwm_config,
|
||
|
};
|
||
|
|
||
|
static void bsp_pwm_configuration(void){
|
||
|
g_dev_pwm.name = "DEVICE_PWM";
|
||
|
g_dev_pwm.dops = &master_pwm_Ops;
|
||
|
cola_device_register(&g_dev_pwm);
|
||
|
}
|
||
|
register_initcall(bsp_pwm_configuration);
|
||
|
|