[ECOS] Re: How to create a GPIO driver
Morris, Richard
Richard.Morris@lifetech.com
Thu Mar 14 21:10:00 GMT 2013
You will need to adapt the macro to the needs of the LPC17XX. It will have different configuration that the STM32.
To do this you will need to read the GPIO section of the LPC17XX user manual and adapt the code from the STM32 to the LPC17XX.
--Richard
On Mar 14, 2013, at 12:59 PM, EnneGi <enricogiordano1992@gmail.com> wrote:
I use this test main:
#include <cyg/infra/diag.h>
#include <cyg/hal/var_io.h>
int main (void)
{
diag_printf("setting gpio\n");
cyg_uint32 v_led_ok = CYGHWR_HAL_LPC17XX_PIN_OUT(B, 14, OPENDRAIN, NONE,
2MHZ);
// Turn the LED on
CYGHWR_HAL_LPC17XX_GPIO_OUT(v_led_ok, 1);
// Turn the LED off
CYGHWR_HAL_LPC17XX_GPIO_OUT(v_led_ok, 0);
diag_printf("DONE\n");
while(1)
{;}
return 0;
}
and, when I compile, the compiler give me this error:
gpio.c:9: warning: implicit declaration of function
‘CYGHWR_HAL_LPC17XX_GPIO’
gpio.c:9: error: ‘B’ undeclared (first use in this function)
gpio.c:9: error: (Each undeclared identifier is reported only once
gpio.c:9: error: for each function it appears in.)
gpio.c:9: error: ‘OUT_2MHZ’ undeclared (first use in this function)
gpio.c:9: error: ‘OUT_OPENDRAIN’ undeclared (first use in this function)
make: *** [gpio.o] Error 1
what should I change?
Thanks a lot!
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list