Hi There
I have a problem with reading a level on the pins. The code is configured in ATMEL START and int_main() modified in atmel studio. All gpio are defined in driver_init.c and not included to this code but from there I can control the pin level (true/false) also I have a connected a LED to the GPIO_5.
So, the problem is, no mater what level I set on the pin (diode On/OFF) the serial port always displays"low".
#include <atmel_start.h>
#include <atmel_start_pins.h>
#include "driver_init.h"
struct io_descriptor *io1;
void USART_0_test(void)
{
usart_sync_get_io_descriptor(&USART_0, &io1);
usart_sync_enable(&USART_0);
}
int main(void)
{
/* Initializes MCU, drivers and middleware */
atmel_start_init();
USART_0_test();
bool pin_level;
pin_level = gpio_get_pin_level(GPIO_5);
if (pin_level == 1)
{
io_write(io1, (uint8_t *)"high", 4);
}
else
{
io_write(io1, (uint8_t *)"low", 3);
}
}