Skip to content

Commit 8af402f

Browse files
Update buzzer.c
1 parent a97b461 commit 8af402f

File tree

1 file changed

+9
-6
lines changed
  • arc_design_contest/2018/XDU_Autofollowing_suitcase/src/driver/buzzer

1 file changed

+9
-6
lines changed

arc_design_contest/2018/XDU_Autofollowing_suitcase/src/driver/buzzer/buzzer.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ static void delay_ms(volatile int z) //1ms
1414
void beep(void)
1515
{
1616
port_alarm = gpio_get_dev(DW_GPIO_PORT_C);
17-
port_alarm->gpio_open(0x10000000);//C28
18-
port_alarm->gpio_control(GPIO_CMD_SET_BIT_DIR_OUTPUT, (void *)10000000);
17+
port_alarm->gpio_open(0x10000000);
18+
port_alarm->gpio_control(GPIO_CMD_SET_BIT_DIR_OUTPUT, (void *)0x10000000);
1919

2020
port_alarm->gpio_write(0x10000000, 0x10000000);
21-
22-
delay_ms(5000);
23-
21+
port_alarm->gpio_read(&data, 0x10000000);
22+
EMBARC_PRINTF(" gpio is :%x\n", data);
23+
delay_ms(1000);
2424
port_alarm->gpio_write(0x00000000, 0x10000000);
25+
port_alarm->gpio_read(&data, 0x10000000);
26+
EMBARC_PRINTF(" gpio is :%x\n", data);
27+
delay_ms(1000);
2528
EMBARC_PRINTF("beep");
2629

2730
}
28-
31+

0 commit comments

Comments
 (0)