2091 views|4 replies

1455

Posts

1

Resources
The OP
 

[Evaluation of Anxinke Bluetooth Development Board PB-02-Kit] KEY and LED Control [Copy link]

In the use of GPIO, there is both the output function of controlling the LED light and the input function of identifying the key.

Since there is no dedicated button for user testing on the board, testing can be performed through an external plug-in.

When the external key is connected to pin P31, the statements for configuring and reading the key pin are:

hal_gpio_pin_init(P31, IE);

while(hal_gpio_read(P31));

The main program to control the LED with buttons is:

int app_main(void)
{
       /* Initialize the operating system */
      osal_init_system();
      osal_pwrmgr_device( PWRMGR_BATTERY );
 hal_gpio_pin_init(P0, OEN);
 hal_gpio_write(P0, 1);
 hal_gpio_pin_init(P34, OEN);
 hal_gpio_write(P34, 1);
 hal_gpio_pin_init(P14, OEN);
 hal_gpio_write(P14, 1);
 hal_gpio_pin_init(P31, IE);
 while(1)
 {
                delay(1000);
 hal_gpio_write(P34, 1);
 hal_gpio_write(P0, 1);
 delay(1000);
 hal_gpio_write(P34, 0);
 hal_gpio_write(P0, 0);
  if(hal_gpio_read(P31))
 hal_gpio_write(P14, 1); // G ON
 else
 hal_gpio_write(P14, 0); // G OFF
 }
 /* Start OSAL */
      osal_start_system(); // No Return from here
      return 0;
}

After program download and testing, the control effect is normal.

With the basic usage of GPIO port, you can use GPIO port to simulate I2C communication to drive OLED screen.

This post is from RF/Wirelessly

Latest reply

Please introduce your development environment.   Details Published on 2021-12-10 15:46
 

6593

Posts

0

Resources
2
 

GPIO port control and button use are the basis, starting from the 51 single-chip microcomputer learning

Thanks for sharing

This post is from RF/Wirelessly

Comments

Yes, mastering GPIO is the basic skill every time you come into contact with a new type of board, without it you can't get going.  Details Published on 2021-11-25 08:21
 
 

1455

Posts

1

Resources
3
 
Jacktang posted on 2021-11-25 07:33 GPIO port control and button usage are the basis, starting from the 51 single-chip microcomputer learning, the same is true. Thank you for sharing

Yes, mastering GPIO is the basic skill every time you come into contact with a new type of board, without it you can't get going.

This post is from RF/Wirelessly
 
 
 

305

Posts

0

Resources
4
 

Please introduce your development environment.

This post is from RF/Wirelessly

Comments

https://bbs.eeworld.com.cn/thread-1186095-1-1.html   Details Published on 2021-12-11 00:06
Personal signature

“Everyone wants the project to be good, fast, and cheap... pick two.”

- Unknown

 
 
 

1455

Posts

1

Resources
5
 
MianQi posted on 2021-12-10 15:46 Let me introduce the development environment of the host.

https://bbs.eeworld.com.cn/thread-1186095-1-1.html

This post is from RF/Wirelessly
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

快速回复 返回顶部 Return list