# danysr8/ece_528l_ble_uart architecture

> Architecture diagram of the GitHub repository danysr8/ece_528l_ble_uart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danysr8/ece_528l_ble_uart
- Repository: https://github.com/danysr8/ece_528l_ble_uart
- Video tour (about a minute): https://gitdiagram.com/danysr8/ece_528l_ble_uart/video

## Overview

This repository is MSP432 firmware for a BLE-controlled robot. The main workflow is Bluefruit Connect sending UART data to the board; firmware receives and decodes packets, then commands motor movement or stop. The firmware also supports command-driven LED changes and switch-selected/fixed-byte UART transmissions, with a separate UART used for terminal output. Driver layers provide clock, GPIO, UART, PWM, motor, and interrupt primitives. The map follows README capabilities and shown calls; links for unsampled implementation details are omitted.

Main entry points: [`ece528L_ble_uart/BLE_UART/main.c`](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c) (Firmware Main), [`ece528L_ble_uart/BLE_UART/src/BLE_UART.c`](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/BLE_UART.c) (BLE UART Driver), [`ece528L_ble_uart/BLE_UART/src/Motor.c`](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Motor.c) (Motor Control), [`ece528L_ble_uart/BLE_UART/src/GPIO.c`](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/GPIO.c) (GPIO and Switches)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Firmware Main<br/>[main.c]"]
  node_command_processing["Command Processing<br/>[main.c]"]
  node_fixed_switch_tx["Fixed/Switch TX<br/>[main.c]"]
end

subgraph group_ble["BLE Communication"]
  node_ble_uart["BLE UART Driver<br/>[BLE_UART.c]"]
  node_packet_decoder["Control Packet Decoder<br/>[BLE_UART.c]"]
  node_terminal_uart["Terminal UART<br/>[EUSCI_A0_UART.c]"]
end

subgraph group_robot["Robot I/O"]
  node_motor_control["Motor Control<br/>[Motor.c]"]
  node_pwm["Timer A0 PWM<br/>[Timer_A0_PWM.c]"]
  node_gpio["GPIO and Switches<br/>[GPIO.c]"]
end

subgraph group_platform["Platform Drivers"]
  node_clock["Clock Driver<br/>[Clock.c]"]
  node_interrupt_control["Interrupt Control<br/>[CortexM.c]"]
  node_systick["SysTick Driver"]
end

node_bluefruit_app(("Bluefruit Connect"))
node_bluefruit_module["Bluefruit UART Module"]
node_motors["Gearmotors"]
node_launchpad_leds["LaunchPad LEDs"]

node_bluefruit_app -->|"sends commands"| node_bluefruit_module
node_bluefruit_module -->|"UART data"| node_ble_uart
node_main -->|"reads packets"| node_ble_uart
node_main -->|"dispatches commands"| node_command_processing
node_command_processing -->|"checks commands"| node_ble_uart
node_ble_uart -->|"decodes packets"| node_packet_decoder
node_packet_decoder -->|"commands movement"| node_motor_control
node_motor_control -->|"sets duty cycles"| node_pwm
node_motor_control -.->|"drives"| node_motors
node_command_processing -->|"sets LED state"| node_gpio
node_gpio -.->|"controls"| node_launchpad_leds
node_main -->|"runs transmit tasks"| node_fixed_switch_tx
node_fixed_switch_tx -->|"transmits bytes"| node_ble_uart
node_fixed_switch_tx -.->|"reads switches"| node_gpio
node_main -->|"initializes console"| node_terminal_uart
node_main -->|"sets clock"| node_clock
node_main -->|"controls interrupts"| node_interrupt_control
node_main -.->|"configures timing"| node_systick

click node_main "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c"
click node_command_processing "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c"
click node_fixed_switch_tx "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c"
click node_ble_uart "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/BLE_UART.c"
click node_packet_decoder "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/BLE_UART.c"
click node_terminal_uart "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/EUSCI_A0_UART.c"
click node_motor_control "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Motor.c"
click node_pwm "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Timer_A0_PWM.c"
click node_gpio "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/GPIO.c"
click node_clock "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Clock.c"
click node_interrupt_control "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/CortexM.c"
click node_systick "https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/SysTick_Interrupt.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_command_processing,node_fixed_switch_tx toneBlue
class node_ble_uart,node_packet_decoder,node_terminal_uart toneAmber
class node_motor_control,node_pwm,node_gpio toneMint
class node_clock,node_interrupt_control,node_systick toneRose
class node_bluefruit_app,node_bluefruit_module,node_motors,node_launchpad_leds toneIndigo
```

## Components

### Application

- [Firmware Main](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c): `ece528L_ble_uart/BLE_UART/main.c`
- [Command Processing](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c): `ece528L_ble_uart/BLE_UART/main.c`
- [Fixed/Switch TX](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/main.c): `ece528L_ble_uart/BLE_UART/main.c`

### BLE Communication

- [BLE UART Driver](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/BLE_UART.c): `ece528L_ble_uart/BLE_UART/src/BLE_UART.c`
- [Control Packet Decoder](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/BLE_UART.c): `ece528L_ble_uart/BLE_UART/src/BLE_UART.c`
- [Terminal UART](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/EUSCI_A0_UART.c): `ece528L_ble_uart/BLE_UART/src/EUSCI_A0_UART.c`

### Robot I/O

- [Motor Control](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Motor.c): `ece528L_ble_uart/BLE_UART/src/Motor.c`
- [Timer A0 PWM](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Timer_A0_PWM.c): `ece528L_ble_uart/BLE_UART/src/Timer_A0_PWM.c`
- [GPIO and Switches](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/GPIO.c): `ece528L_ble_uart/BLE_UART/src/GPIO.c`

### Platform Drivers

- [Clock Driver](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/Clock.c): `ece528L_ble_uart/BLE_UART/src/Clock.c`
- [Interrupt Control](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/CortexM.c): `ece528L_ble_uart/BLE_UART/src/CortexM.c`
- [SysTick Driver](https://github.com/danysr8/ece_528l_ble_uart/blob/main/ece528L_ble_uart/BLE_UART/src/SysTick_Interrupt.c): `ece528L_ble_uart/BLE_UART/src/SysTick_Interrupt.c`

### Other components

- **Bluefruit Connect**
- **Bluefruit UART Module**
- **Gearmotors**
- **LaunchPad LEDs**

## Connections

- Bluefruit Connect → Bluefruit UART Module: sends commands (evidence: `README.md`)
- Bluefruit UART Module → BLE UART Driver: UART data (evidence: `ece528L_ble_uart/BLE_UART/src/BLE_UART.c`)
- Firmware Main → BLE UART Driver: reads packets (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Firmware Main → Command Processing: dispatches commands (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Command Processing → BLE UART Driver: checks commands (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- BLE UART Driver → Control Packet Decoder: decodes packets (evidence: `ece528L_ble_uart/BLE_UART/src/BLE_UART.c`)
- Control Packet Decoder → Motor Control: commands movement (evidence: `ece528L_ble_uart/BLE_UART/src/BLE_UART.c`)
- Motor Control → Timer A0 PWM: sets duty cycles
- Motor Control → Gearmotors: drives
- Command Processing → GPIO and Switches: sets LED state (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- GPIO and Switches → LaunchPad LEDs: controls
- Firmware Main → Fixed/Switch TX: runs transmit tasks (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Fixed/Switch TX → BLE UART Driver: transmits bytes (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Fixed/Switch TX → GPIO and Switches: reads switches
- Firmware Main → Terminal UART: initializes console (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Firmware Main → Clock Driver: sets clock (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Firmware Main → Interrupt Control: controls interrupts (evidence: `ece528L_ble_uart/BLE_UART/main.c`)
- Firmware Main → SysTick Driver: configures timing
