ridhaOs/drivers/Src/led.c

24 lines
400 B
C

#include "led.h"
#define PORT1 (1U<<15)
#define GPIO1_4 (1U<<4)
void led_init(void){
/* ENable Clock access to led port (PORT1) */
SYSCON->AHBCLKCTRLX[0] |= PORT1;
/* Set led pin as output pin */
GPIO->W[1][4] = 1;
GPIO->DIRSET[1] = GPIO1_4;
}
void led_on(void){
/* Set Led pin HIGH (P1-4) */
GPIO->W[1][4] = 0;
}
void led_off(void){
/* Set Led pin LOW (P1-4) */
GPIO->W[1][4] = 1;
}