| RTOS_MSPM0 1.1 ECE445M starter code

Files | Macros | Functions
LaunchPad

LaunchPad input/output. More...

## Files
file | LaunchPad.h
| Initialize LaunchPad switches and LEDs.

## 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

LaunchPad input/output.

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

## Function Documentation

## ◆ LaunchPad_Init()

void LaunchPad_Init | ( | void |  | ) |

Initialize LaunchPad.

Initialize LEDs and switches on MSPM0G3507 LaunchPad

- PA0 output RED LED1, negative logic
- PB22 output BLUE LED2, positive logic
- PB26 output RED LED2, positive logic
- PB27 output GREEN LED2,positive logic
- PA18 input S1 switch, positive logic
- PB21 input S2 switch, negative logic

Parameters

  none |

Returns
  none

Note
  In most ECE319K example code, this function is called first and will reset and enable power to Port A and Port B

Warning
  Do not call this twice

## ◆ LaunchPad_InS1()

uint32_t LaunchPad_InS1 | ( | void |  | ) |

Input S1.

Read S1, positive logic switch on PA18

Parameters

  none |

Returns
  0 if S1 is not pressed, 0x00040000 if S1 is pressed

See also
  LaunchPad_Init()

## ◆ LaunchPad_InS2()

uint32_t LaunchPad_InS2 | ( | void |  | ) |

Input S2.

Read S2, negative logic switch on PA18. The software converts to positive logic.

Parameters

  none |

Returns
  0 if S3 is not pressed, 0x00200000 if S2 is pressed

See also
  LaunchPad_Init()

## ◆ LaunchPad_LED()

void LaunchPad_LED | ( | uint32_t | led | ) |

Output to LED.

Set LED, 3-color positive logic LED on PB22,PB26,PB27

- led=0 to turn off LED
- led bit 22 sets blue color
- led bit 26 sets red color
- led bit 27 sets green color

Parameters

  led | sets the color of LED

Returns
  none

## ◆ LaunchPad_LED1()

void LaunchPad_LED1 | ( | uint32_t | led | ) |

Output to LED1.

Set LED1, negative logic LED on PA0

- led=0 to PA0=1, turn off LED1
- led=1 to PA0=0, turn on LED1

Parameters

  led | 1 to turn on, 0 to turn off

Returns
  none

## ◆ LaunchPad_LED1off()

void LaunchPad_LED1off | ( | void |  | ) |

Turn off LED1.

Turn off LED1. Makes PA0=1 to turn off LED

Parameters

  none |

Returns
  none

## ◆ LaunchPad_LED1on()

void LaunchPad_LED1on | ( | void |  | ) |

Turn on LED1.

Turn on LED1. Makes PA0=0 to turn on LED1

Parameters

  none |

Returns
  none

## ◆ LaunchPad_LEDoff()

void LaunchPad_LEDoff | ( | void |  | ) |

Turn off LED.

Turn off LED. Make PB22=0,PB26=0,PB27=0 to turn off LED

Parameters

  none |

Returns
  none

## ◆ LaunchPad_LEDwhite()

void LaunchPad_LEDwhite | ( | void |  | ) |

Make LED white.

Set LED to white. Make PB22=1,PB26=1,PB27=1 to create white

Parameters

  none |

Returns
  none