Files
pi-pm3/LED_MAPPINGS.md
michael 2ec89041ef Phase 4 enhancements: WebSocket auth, HTTPS UI, plugin hooks, build fixes
Security:
- Add token-based WebSocket authentication (closes critical security gap)
  - In-memory token store with 24h TTL (token_store.py)
  - POST /api/auth/token exchanges Basic Auth for WS token
  - GET /api/auth/status public endpoint for auth check
  - WebSocket validates token query param, rejects with close code 4401
  - Frontend LoginPrompt modal for credential entry
  - WebSocket manager handles full auth flow with auth_required state
  - No-op when AUTH_ENABLED=false (preserves existing behavior)

HTTPS:
- Wire HTTPS toggle in Settings UI (POST /api/system/ssl/toggle)
- Add certificate regeneration button
- Display SSL info (expiration, SANs, SHA256 fingerprint)

Plugins:
- Wire trigger_hook("pm3_command") in PM3 service
- Wire trigger_hook("update_check") in update manager

Build/Infrastructure:
- Enable NetworkManager in pi-gen AP setup stage
- Add HF booster board detection patch for Proxmark3
- Update LED PWM control patch
- Fix BLE adapter, UPS drivers, WiFi manager improvements
- Update HTTPS support stage script

Documentation:
- Update PROJECT_STATUS.md and IMPLEMENTATION_PRIORITIES.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 11:45:11 -08:00

146 lines
4.9 KiB
Markdown

# Proxmark3 LED Mappings Reference
## Proxmark3 Easy
Based on hardware testing with Proxmark3 Easy and `LED_ORDER=PM3EASY`:
### LED Configuration
| LED | Color | GPIO Pin | PWM Channel | Brightness | Effects | Physical Position |
|-----|--------|----------|-------------|------------|---------|-------------------|
| A | Green | PA0 | PWM0 | ✅ 0-100% | All | 1st (leftmost) |
| B | Blue | PA2 | PWM2 | ✅ 0-100% | All | 4th (rightmost) |
| C | Orange | PA9 | None | On/Off | Blink | 2nd |
| D | Red | PA8 | None | On/Off | Blink | 3rd |
**Physical LED order (left to right):** Green, Orange, Red, Blue
### GPIO Pin Details
From `include/config_gpio.h` with `LED_ORDER_PM3EASY`:
```c
#define GPIO_LED_A AT91C_PIO_PA0 // Green - PWM0 capable
#define GPIO_LED_B AT91C_PIO_PA2 // Blue - PWM2 capable
#define GPIO_LED_C AT91C_PIO_PA9 // Orange - GPIO only
#define GPIO_LED_D AT91C_PIO_PA8 // Red - GPIO only
```
### LED Bitmask Values
| LED | Bitmask (decimal) | Bitmask (hex) | Binary |
|-----|-------------------|---------------|--------|
| A | 1 | 0x01 | 0001 |
| B | 2 | 0x02 | 0010 |
| C | 4 | 0x04 | 0100 |
| D | 8 | 0x08 | 1000 |
| All | 15 | 0x0F | 1111 |
## Standard Proxmark3 (Non-Easy)
With default LED ordering (no `LED_ORDER_PM3EASY`):
| LED | Color | GPIO Pin | PWM Channel | Brightness | Effects |
|-----|---------|----------|-------------|------------|---------|
| A | Orange | PA0 | PWM0 | ✅ 0-100% | All |
| B | Green | PA8 | None | On/Off | Blink |
| C | Red | PA9 | None | On/Off | Blink |
| D | Red2 | PA2 | PWM2 | ✅ 0-100% | All |
**Note:** Only LEDs on PA0 and PA2 can use PWM brightness control and PWM effects (pulse, fade) on any PM3 variant.
## Usage Examples
### Basic LED Control
```bash
# Green LED at 50% brightness
hw led --led a --brightness 50
# Blue LED at 75% brightness
hw led --led b --brightness 75
# Orange LED on (no brightness control)
hw led --led c --on
# Red LED toggle
hw led --led d --toggle
# Both PWM LEDs at 30%
hw led --led a,b --brightness 30
```
### LED Effects
Three effects are available: **pulse**, **fade**, and **blink**.
```bash
# Pulse effect (PWM LEDs only: A, B)
# Smoothly fades in and out
hw led --led a --pulse # 5 cycles @ 500ms default
hw led --led a,b --pulse --count 10 # 10 cycles
hw led --led a --pulse --speed 300 # Faster pulse (300ms cycle)
hw led --led b --pulse --count 0 # Infinite until button press
# Fade effect (PWM LEDs only: A, B)
# Starts at full brightness, fades to off
hw led --led a --fade # Default 500ms fade
hw led --led a,b --fade --speed 1000 # Slower 1-second fade
# Blink effect (ALL LEDs supported: A, B, C, D)
# Alternates on/off
hw led --led a,b,c,d --blink # All LEDs, 5 blinks
hw led --led c,d --blink --count 20 # Non-PWM LEDs work too
hw led --led all --blink --speed 200 # Fast blink (200ms cycle)
hw led --led a --blink --count 0 # Infinite until stopped
```
### Effect Parameters
| Parameter | Description | Range | Default |
|-----------|-------------|-------|---------|
| `--speed` | Cycle time in milliseconds | 50-10000 | 500 |
| `--count` | Number of effect cycles | 0-65535 | 5 |
**Note:** `--count 0` runs the effect indefinitely until interrupted by:
- Pressing the button on the Proxmark3 device
- Sending any other command
### Multi-Device Identification
Use brightness levels and effects to distinguish between multiple Proxmark3 devices:
```bash
# Device 1: Dim green
hw led --led a --brightness 20
# Device 2: Bright blue
hw led --led b --brightness 100
# Device 3: Pulsing green (easy to spot)
hw led --led a --pulse --count 0
# Device 4: Fast blinking all LEDs
hw led --led all --blink --speed 200 --count 0
```
## Hardware Testing Notes
- Confirmed via individual LED testing on PM3 Easy hardware
- During `hw tune`: Red (D) and Blue (B) LEDs typically active
- During flashing: Orange (C) and sometimes Green (A) visible
- LED polarity: Active-low (PWM duty cycle is inverted)
## Code References
- LED definitions: [armsrc/util.h](/.pm3-test/proxmark3/armsrc/util.h) lines 45-63
- LED macros: [include/proxmark3_arm.h](/.pm3-test/proxmark3/include/proxmark3_arm.h) lines 91-102
- GPIO mapping: [include/config_gpio.h](/.pm3-test/proxmark3/include/config_gpio.h) lines 22-39
- PWM functions: [armsrc/util.c](/.pm3-test/proxmark3/armsrc/util.c) lines 419-504
---
**Last Updated:** 2026-01-06
**Hardware:** Proxmark3 Easy with LED_ORDER=PM3EASY
**Effects Added:** pulse, fade, blink (v1.1)