/*
 * local_control.c
 *
 *  Created on: Nov 4, 2025
 *      Author: sowgro
 */

#include <stm32l4xx.h>
#include <stdio.h>
#include "GPIO.h"

void local_control_start() {
	GPIO_Init();
	NVIC_EnableIRQ(EXTI9_5_IRQn);
}

void local_control_loop() {

}

void local_control_stop() {
	NVIC_DisableIRQ(EXTI15_10_IRQn);
}

void EXTI9_5_IRQHandler() {
    if (~EXTI->PR1 & EXTI_PR1_PIF9)
    	return;

    EXTI->PR1 |= EXTI_PR1_PIF9;

    int status = !(GPIOC->IDR & GPIO_PIN_9);
    printf("Other %i\r\n", status);
}
