0
Atmel에서 새로운 SAMC21 Xplained Pro를 사용하는 데 문제가 있습니다. 저는 현재 Cortex M0 +의 기초를 이해하려고 노력하고 있습니다.하지만 저는 붙어 있습니다. Atmel Studio에서 ASF를 사용하고 있습니다. 나는 스위치에서 LED를 토글하는 방법을 배우면서 기본부터 시작했다. 이것은, 아트멜의 코드 완벽 작동합니다 GPIO 핀 컨트롤 SAMC21
void configure_port_pins(void)
{
struct port_config config_port_pin;
port_get_config_defaults(&config_port_pin);
config_port_pin.direction = PORT_PIN_DIR_INPUT;
config_port_pin.input_pull = PORT_PIN_PULL_UP;
port_pin_set_config(BUTTON_0_PIN, &config_port_pin);
config_port_pin.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(LED_0_PIN, &config_port_pin);
}
int main (void)
{
system_init();
configure_port_pins();
while (true) {
bool pin_state = port_pin_get_input_level(BUTTON_0_PIN);
port_pin_set_output_level(LED_0_PIN, !pin_state);
}
그런 다음 내가 좋아하는 뭔가 간단, 원했고 :
int main (void)
{
system_init();
configure_port_pins();
port_pin_set_output_level(LED_0_PIN,0);
while (1)
{
port_pin_set_output_level(LED_0_PIN,0);
delay_ms(500);
port_pin_set_output_level(LED_0_PIN,1);
}
}
을하지만 그것은 작동하지 않습니다. 그것은 bool 데이터 타입을 인식하지 못하는 것과 같습니다. 어쩌면 내가 뭔가를 놓친 것 같아. 귀하의 답변에 감사드립니다.
그래 당신 말이 있지만이 작업 중 하나를하지 않습니다 동안 (1) \t { \t \t port_pin_set_output_level (LED_0_PIN, 0); \t \t 지연 _ms (500); \t \t port_pin_set_output_level (LED_0_PIN, 1); \t \t 지연 _ms (500); \t} –