static function in ASF driver

Discussions around product based on ARM Cortex M0+ core.

Moderator: nferre

Posts: 3
Joined: Mon Jun 30, 2014 11:30 pm

static function in ASF driver

Mon Jul 07, 2014 4:04 am

does anyone know if the static functions in ASF files can be called in user program?

for example: in port.h

Code: Select all

static inline bool port_pin_get_input_level(
		const uint8_t gpio_pin)
	PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin);
	uint32_t pin_mask  = (1UL << (gpio_pin % 32));

	return (port_base->IN.reg & pin_mask);
this function is a static function from port.h in atmel ASF. can it be called from my main.c? by definition "static" functions are limited to it's local access. however, in atmel's examples all static functions are called directly in main.c. in my own application, when ever i call a static function from atmel ASF library, the debugger is saying that breakpoint can not be reached on those static functions. i dont see have my setup is different from atmel example files. does anyone knows how to fix it?
Posts: 67
Joined: Fri Jun 13, 2014 2:55 pm

Re: static function in ASF driver

Mon Jul 07, 2014 9:17 am

You're right, they are static functions, but defined in .h files and defined as inline.

You can freely use those kind of functions in your app: they will be coded as inline, so the compiler puts directly the instructions of the functions and not a simple call.

I don't understand the problem with the debugger breakpoint: can you post an complete source code and detail your problem?

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 1 guest