IO Pin documentation

https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__gpio.html

Inputs

	const uint IO_MY_INPUT = 2;		//RP2040 GPIO number

	//Initialise Pin
	gpio_init(IO_MY_INPUT);
	gpio_set_dir(IO_MY_INPUT, GPIO_IN);
	gpio_set_pulls(IO_MY_INPUT, 1, 0);		//IO, PullUp, PullDown

	//Read pin state
	if gpio_get(IO_MY_INPUT)
	{
	}

	//Read all pins state
	uint32_t AllPins = gpio_get_all	();		//read all 29 GPIO in one call to a uint32

Outputs

	const uint IO_MY_OUPUT = 2;		//RP2040 GPIO number

	//Initialise pin
	gpio_init(IO_MY_OUPUT);
	gpio_set_dir(IO_MY_OUPUT, GPIO_OUT);
	gpio_put(IO_MY_OUPUT, 0);
	gpio_set_drive_strength(IO_MY_OUPUT, GPIO_DRIVE_STRENGTH_12MA);		//GPIO_DRIVE_STRENGTH_2MA, GPIO_DRIVE_STRENGTH_4MA, GPIO_DRIVE_STRENGTH_8MA or GPIO_DRIVE_STRENGTH_12MA

	//Set pin state
	gpio_put(IO_MY_OUPUT, 1);
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *