fix adc/dac funciton error on edu-arm32 baord

This commit is contained in:
Liu_Weichao
2023-08-09 15:10:11 +08:00
parent 8c1ad40f81
commit 5f642507b4
8 changed files with 546 additions and 293 deletions
@@ -28,11 +28,11 @@
static uint16_t pin_fd=0;
static struct PinStat pin_led;
void ledflip(void *parameter)
void LedFlip(void *parameter)
{
pin_led.pin = BSP_LED_PIN;
pin_led.val = !pin_led.val;
PrivWrite(pin_fd,&pin_led,NULL_PARAMETER);
PrivWrite(pin_fd, &pin_led, NULL_PARAMETER);
}
void TestHwTimer(void)
@@ -40,22 +40,22 @@ void TestHwTimer(void)
x_ticks_t period = 100000;
pin_fd = PrivOpen(HWTIMER_PIN_DEV_DRIVER, O_RDWR);
if(pin_fd<0){
if(pin_fd<0) {
printf("open pin fd error:%d\n",pin_fd);
return;
}
int timer_fd = PrivOpen(HWTIMER_TIMER_DEV_DRIVER, O_RDWR);
if(timer_fd<0){
if(timer_fd<0) {
printf("open timer fd error:%d\n",timer_fd);
return;
}
//config led pin in board
struct PinParam parameter;
parameter.cmd = GPIO_CONFIG_MODE;
parameter.pin = BSP_LED_PIN;
parameter.mode = GPIO_CFG_OUTPUT;
struct PinParam parameter;
parameter.cmd = GPIO_CONFIG_MODE;
parameter.pin = BSP_LED_PIN;
parameter.mode = GPIO_CFG_OUTPUT;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = PIN_TYPE;
@@ -68,7 +68,7 @@ void TestHwTimer(void)
}
ioctl_cfg.ioctl_driver_type = TIME_TYPE;
ioctl_cfg.args = (void *)&ledflip;
ioctl_cfg.args = (void *)&LedFlip;
if (0 != PrivIoctl(timer_fd, OPE_INT, &ioctl_cfg)) {
printf("timer pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
@@ -82,13 +82,10 @@ void TestHwTimer(void)
return;
}
while(1){
while(1) {
}
// int32 timer_handle = KCreateTimer("LED on and off by 1s",&ledflip,&pin_fd,period,TIMER_TRIGGER_PERIODIC);
// KTimerStartRun(timer_handle);
PrivClose(pin_fd);
PrivClose(timer_fd);
}