enabled an led to see if it works (it doesn't)

This commit is contained in:
Aria Nolan 2024-01-27 12:43:49 -05:00
parent a061a0abd9
commit 6c833f5ea7

46
main.c
View file

@ -1,7 +1,49 @@
#include "MKL05Z4.h"
// *********** LED Defines ******************
#define POS_RED (8)
#define POS_GREEN (9)
#define POS_BLUE (10)
#define PORTB_LED_RED_MASK (1 << POS_RED)
#define PORTB_LED_GREEN_MASK (1 << POS_GREEN)
#define PORTB_LED_BLUE_MASK (1 << POS_BLUE)
#define PORTB_LEDS_MASK (PORTB_LED_RED_MASK | \
PORTB_LED_GREEN_MASK | \
PORTB_LED_BLUE_MASK)
/* Port Pin GPIO for LED */
#define PORT_PCR_MUX_SELECT_1_MASK \
(1 << PORT_PCR_MUX_SHIFT)
#define PORT_PCR_SET_GPIO \
(PORT_PCR_ISF_MASK | PORT_PCR_MUX_SELECT_1_MASK)
// *********************************************
void Init_LEDs (void) {
/* Enable clock for PORT B module */
SIM_SCGC4 |= SIM_SCGC5_PORTB_MASK;
/* Select PORT B Pin 8 for GPIO to red LED */
PORTB_PCR(POS_RED) = PORT_PCR_SET_GPIO;
/* Select PORT B Pin 9 for GPIO to green LED */
PORTB_PCR(POS_GREEN) = PORT_PCR_SET_GPIO;
/* Select PORT B Pin 10 for GPIO to blue LED */
PORTB_PCR(POS_BLUE) = PORT_PCR_SET_GPIO;
// FGPIOB_PDDR = PORTB_LEDS_MASK;
FGPIOB_PCOR = PORTB_LED_BLUE_MASK;
FGPIOB_PSOR = PORTB_LED_GREEN_MASK;
FGPIOB_PSOR = PORTB_LED_RED_MASK;
/* Turn off LEDs */
// FGPIOB_PSOR = PORTB_LEDS_MASK;
}
void main() void main()
{ {
Init_LEDs();
for (;;); for (;;);
return;
} }