| RTOS_MSPM0 1.1 ECE445M starter code

Macros | Functions
LaunchPad.h File Reference
LaunchPad

Initialize LaunchPad switches and LEDs. More...

`#include <stdint.h>`

Go to the source code of this file.

## Macros
#define | RED1 1
| RED1 is a constant to select red LED1 on Port A, PA0.
#define | BLUE (1<<22)
| BLUE is a constant to select blue LED2 on Port B, PB22.
#define | RED (1<<26)
| RED is a constant to select red LED2 on Port B, PB26.
#define | GREEN (1<<27)
| GREEN is a constant to select green LED2 on Port B, PB27.
#define | S1 (1<<18)
| S1 is a constant to select switch S1 on Port A, PA18.
#define | S2 (1<<21)
| S2 is a constant to select switch S2 on Port B, PB21.
#define | PA0INDEX 0
| The following constants are used to index into the PINCM table.
#define | PA1INDEX 1
#define | PA2INDEX 6
#define | PA3INDEX 7
#define | PA4INDEX 8
#define | PA5INDEX 9
#define | PA6INDEX 10
#define | PA7INDEX 13
#define | PA8INDEX 18
#define | PA9INDEX 19
#define | PA10INDEX 20
#define | PA11INDEX 21
#define | PA12INDEX 33
#define | PA13INDEX 34
#define | PA14INDEX 35
#define | PA15INDEX 36
#define | PA16INDEX 37
#define | PA17INDEX 38
#define | PA18INDEX 39
#define | PA19INDEX 40
#define | PA20INDEX 41
#define | PA21INDEX 45
#define | PA22INDEX 46
#define | PA23INDEX 52
#define | PA24INDEX 53
#define | PA25INDEX 54
#define | PA26INDEX 58
#define | PA27INDEX 59
#define | PA28INDEX 2
#define | PA29INDEX 3
#define | PA30INDEX 4
#define | PA31INDEX 5
#define | PB0INDEX 11
#define | PB1INDEX 12
#define | PB2INDEX 14
#define | PB3INDEX 15
#define | PB4INDEX 16
#define | PB5INDEX 17
#define | PB6INDEX 22
#define | PB7INDEX 23
#define | PB8INDEX 24
#define | PB9INDEX 25
#define | PB10INDEX 26
#define | PB11INDEX 27
#define | PB12INDEX 28
#define | PB13INDEX 29
#define | PB14INDEX 30
#define | PB15INDEX 31
#define | PB16INDEX 32
#define | PB17INDEX 42
#define | PB18INDEX 43
#define | PB19INDEX 44
#define | PB20INDEX 47
#define | PB21INDEX 48
#define | PB22INDEX 49
#define | PB23INDEX 50
#define | PB24INDEX 51
#define | PB25INDEX 55
#define | PB26INDEX 56
#define | PB27INDEX 57

## Functions
void | LaunchPad_Init (void)
| Initialize LaunchPad. More...
uint32_t | LaunchPad_InS1 (void)
| Input S1. More...
uint32_t | LaunchPad_InS2 (void)
| Input S2. More...
void | LaunchPad_LED1 (uint32_t led)
| Output to LED1. More...
void | LaunchPad_LED1on (void)
| Turn on LED1. More...
void | LaunchPad_LED1off (void)
| Turn off LED1. More...
void | LaunchPad_LED (uint32_t led)
| Output to LED. More...
void | LaunchPad_LEDwhite (void)
| Make LED white. More...
void | LaunchPad_LEDoff (void)
| Turn off LED. More...

## Detailed Description

Initialize LaunchPad switches and LEDs.

MSPM0G3507 LaunchPad Development Kit (LP-MSPM0G3507)
For more information see
https://www.ti.com/product/LP-MSPM0G3507/part-details/LP-MSPM0G3507

The following is a simplified circuit diagram

- LaunchPad Jumpers
  - J4 Connects PA0 to red LED1
  - J5: Connects PB22 to blue LED2
  - J6: Connects PB26 to red LED2
  - J7: Connects PB27 to green LED2

Version
  ECE319K v1.2

Author
  Daniel Valvano and Jonathan Valvano

Copyright
  Copyright 2025 by Jonathan W. Valvano, valva.nosp@m.no@m.nosp@m.ail.u.nosp@m.texa.nosp@m.s.edu,

Warning
  AS-IS

Note
  For more information see http://users.ece.utexas.edu/~valvano/

Date
  November 3, 2025

  Pins on the MSPM0G3507 LaunchPad
  Pin | GPIO | Hardware
  --- | --- | ---
  PA0 | output | RED LED1, index 0 in IOMUX PINCM table, negative logic
  PB22 | output | BLUE LED2, index 49 in IOMUX PINCM table
  PB26 | output | RED LED2, index 56 in IOMUX PINCM table
  PB27 | output | GREEN LED2, index 57 in IOMUX PINCM table
  PA18 | input | S1 positive logic switch, index 39 in IOMUX PINCM table
  PB21 | input | S2 negative logic switch, index 48 in IOMUX PINCM table

  Mode=0 selects the GPIO pin

  PINCM Mode values for the MSPM0G3507
  Name | Value | Mode=2 | Mode=3 | Mode=4 | Mode=5 | Mode=6 | Mode=7 | Mode=8 | Mode=9
  --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
  PA0INDEX | 0 | UART0_TX | I2C0_SDA | TIMA0_C0 | TIMA_FAL1 | TIMG8_C1 | FCC_IN |  |
  PA1INDEX | 1 | UART0_RX | I2C0_SCL | TIMA0_C1 | TIMA_FAL2 | TIMG8_IDX | TIMG8_C0 |  |
  PA2INDEX | 6 | TIMG8_C1 | SPI0_CS0 | TIMG7_C1 | SPI1_CS0 |  |  |  |
  PA3INDEX | 7 | TIMG8_C0 | SPI0_CS1 | UART2_CTS | TIMA0_C2 | COMP1_OUT | TIMG7_C0 | TIMA0_C1 | I2C1_SDA
  PA4INDEX | 8 | TIMG8_C1 | SPI0_POCI | UART2_RTS | TIMA0_C3 | LFCLK_IN | TIMG7_C1 | TIMA0_C1N | I2C1_SCL
  PA5INDEX | 9 | TIMG8_C0 | SPI0_PICO | TIMA_FAL1 | TIMG0_C0 | TIMG6_C0 | FCC_IN |  |
  PA6INDEX | 10 | TTIMG8_C1 | SPI0_SCK | TIMA_FAL0 | TIMG0_C1 | HFCLK_IN | TIMG6_C1 | TIMA0_C2N |
  PA7INDEX | 13 | COMP0_OUT | CLK_OUT | TIMG8_C0 | TIMA0_C2 | TIMG8_IDX | TIMG7_C1 | TIMA0_C1 |
  PA8INDEX | 18 | UART1_TX | SPI0_CS0 | UART0_RTS | TIMA0_C0 | TIMA1_C0N |  |  |
  PA9INDEX | 19 | UART1_RX | SPI0_PICO | UART0_CTS | TIMA0_C1 | RTC_OUT | TIMA0_C0N | TIMA1_C1N | CLK_OUT
  PA10INDEX | 20 | UART0_TX | SPI0_POCI | I2C0_SDA | TIMA1_C0 | TIMG12_C0 | TIMA0_C2 | I2C1_SDA | CLK_OUT
  PA11INDEX | 21 | UART0_RX | SPI0_SCK | I2C0_SCL | TIMA1_C1 | COMP0_OUT | TIMA0_C2N | I2C1_SCL |
  PA12INDEX | 33 | UART3_CTS | SPI0_SCK | TIMG0_C0 | CAN_TX | TIMA0_C3 | FCC_IN |  |
  PA13INDEX | 34 | UART3_RTS | SPI0_POCI | UART3_RX | TIMG0_C1 | CAN_RX | TIMA0_C3N |  |
  PA14INDEX | 35 | UART0_CTS | SPI0_PICO | UART3_TX | TIMG12_C0 | CLK_OUT |  |  |
  PA15INDEX | 36 | UART0_RTS | SPI1_CS2 | I2C1_SCL | TIMA1_C0 | TIMG8_IDX | TIMA1_C0N | TIMA0_C2 |
  PA16INDEX | 37 | COMP2_OUT | SPI1_POCI | I2C1_SDA | TIMA1_C1 | TIMA1_C1N | TIMA0_C2N | FCC_IN |
  PA17INDEX | 38 | UART1_TX | SPI1_SCK | I2C1_SCL | TIMA0_C3 | TIMG7_C0 | TIMA1_C0 |  |
  PA18INDEX | 39 | UART1_RX | SPI1_PICO | I2C1_SDA | TIMA0_C3N | TIMG7_C1 | TIMA1_C1 |  |
  PA19INDEX | 40 | SWDIO |  |  |  |  |  |  |
  PA20INDEX | 41 | SWCLK |  |  |  |  |  |  |
  PA21INDEX | 45 | UART2_TX | TIMG8_C0 | UART1_CTS | TIMA0_C0 | TIMG6_C0 |  |  |
  PA22INDEX | 46 | UART2_RX | TIMG8_C1 | UART1_RTS | TIMA0_C1 | CLK_OUT | TIMA0_C0N | TIMG6_C1 |
  PA23INDEX | 52 | UART2_TX | SPI0_CS3 | TIMA0_C3 | TIMG0_C0 | UART3_CTS | TIMG7_C0 | TIMG8_C0 |
  PA24INDEX | 53 | UART2_RX | SPI0_CS2 | TIMA0_C3N | TIMG0_C1 | UART3_RTS | TIMG7_C1 | TIMA1_C1 |
  PA25INDEX | 54 | UART3_RX | SPI1_CS3 | TIMG12_C1 | TIMA0_C3 | TIMA0_C1N |  |  |
  PA26INDEX | 58 | UART3_TX | SPI1_CS0 | TIMG8_C0 | TIMA_FAL0 | CAN_TX | TIMG7_C0 |  |
  PA27INDEX | 59 | RTC_OUT | SPI1_CS1 | TIMG8_C1 | TIMA_FAL2 | CAN_RX | TIMG7_C1 |  |
  PA28INDEX | 2 | UART0_TX | I2C0_SDA | TIMA0_C3 | TIMA_FAL0 | TIMG7_C0 | TIMA1_C0 |  |
  PA29INDEX | 3 | I2C1_SCL | UART2_RTS | TIMG8_C0 | TIMG6_C0 |  |  |  |
  PA30INDEX | 4 | I2C1_SDA | UART2_CTS | TIMG8_C1 | TIMG6_C1 |  |  |  |
  PA31INDEX | 5 | UART0_RX | I2C0_SCL | TIMA0_C3N | TIMG12_C1 | CLK_OUT | TIMG7_C1 | TIMA1_C1 |
  PB0INDEX | 11 | UART0_TX | SPI1_CS2 | TIMA1_C0 | TIMA0_C2 |  |  |  |
  PB1INDEX | 12 | UART0_RX | SPI1_CS3 | TIMA1_C1 | TIMA0_C2N |  |  |  |
  PB2INDEX | 14 | UART3_TX | UART2_CTS | I2C1_SCL | TIMA0_C3 | UART1_CTS | TIMG6_C0 | TIMA1_C0 |
  PB3INDEX | 15 | UART3_RX | UART2_RTS | I2C1_SDA | TIMA0_C3N | UART1_RTS | TIMG6_C1 | TIMA1_C1 |
  PB4INDEX | 16 | UART1_TX | UART3_CTS | TIMA1_C0 | TIMA0_C2 | TIMA1_C0N |  |  |
  PB5INDEX | 17 | UART1_RX | UART3_RTS | TIMA1_C1 | TIMA0_C2N | TIMA1_C1N |  |  |
  PB6INDEX | 22 | UART1_TX | SPI1_CS0 | SPI0_CS1 | TIMG8_C0 | UART2_CTS | TIMG6_C0 | TIMA1_C0N |
  PB7INDEX | 23 | UART1_RX | SPI1_POCI | SPI0_CS2 | TIMG8_C1 | UART2_RTS | TIMG6_C1 | TIMA1_C1N |
  PB8INDEX | 24 | UART1_CTS | SPI1_PICO | TIMA0_C0 | COMP1_OUT |  |  |  |
  PB9INDEX | 25 | UART1_RTS | SPI1_SCK | TIMA0_C1 | TIMA0_C0N |  |  |  |
  PB10INDEX | 26 | TIMG0_C0 | TIMG8_C0 | COMP1_OUT | TIMG6_C0 |  |  |  |
  PB11INDEX | 27 | TIMG0_C1 | TIMG8_C1 | CLK_OUT | TIMG6_C1 |  |  |  |
  PB12INDEX | 28 | UART3_TX | TIMA0_C2 | TIMA_FAL1 | TIMA0_C1 |  |  |  |
  PB13INDEX | 29 | UART3_RX | TIMA0_C3 | TIMG12_C0 | TIMA0_C1N |  |  |  |
  PB14INDEX | 30 | SPI1_CS3 | SPI1_POCI | SPI0_CS3 | TIMG12_C1 | TIMG8_IDX | TIMA0_C0 |  |
  PB15INDEX | 31 | UART2_TX | SPI1_PICO | UART3_CTS | TIMG8_C0 | TIMG7_C0 |  |  |
  PB16INDEX | 32 | UART2_RX | SPI1_SCK | UART3_RTS | TIMG8_C1 | TIMG7_C1 |  |  |
  PB17INDEX | 42 | UART2_TX | SPI0_PICO | SPI1_CS1 | TIMA1_C0 | TIMA0_C2 |  |  |
  PB18INDEX | 43 | UART2_RX | SPI0_SCK | SPI1_CS2 | TIMA1_C1 | TIMA0_C2N |  |  |
  PB19INDEX | 44 | COMP2_OUT | SPI0_POCI | TIMG8_C1 | UART0_CTS | TIMG7_C1 |  |  |
  PB20INDEX | 47 | SPI0_CS2 | SPI1_CS0 | TIMA0_C2 | TIMG12_C0 | TIMA_FAL1 | TIMA0_C1 | TIMA1_C1N |
  PB21INDEX | 48 | SPI1_POCI | TIMG8_C0 |  |  |  |  |  |
  PB22INDEX | 49 | SPI1_PICO | TIMG8_C1 |  |  |  |  |  |
  PB23INDEX | 50 | SPI1_SCK | COMP0_OUT | TIMA_FAL0 |  |  |  |  |
  PB24INDEX | 51 | SPI0_CS3 | SPI0_CS1 | TIMA0_C3 | TIMG12_C1 | TIMA0_C1N | TIMA1_C0N |  |
  PB25INDEX | 55 | UART0_CTS | SPI0_CS0 | TIMA_FAL2 |  |  |  |  |
  PB26INDEX | 56 | UART0_RTS | SPI0_CS1 | TIMA0_C3 | TIMG6_C0 | TIMA1_C0 |  |  |
  PB27INDEX | 57 | COMP2_OUT | SPI1_CS1 | TIMA0_C3N | TIMG6_C1 | TIMA1_C1 |  |  |