hooku

Please enjoy some eccentric technologies.

Lineage OS

Run airodump-ng on Xiaomi8(dipper)

The dipper comes with qalcd 3.0 driver, it is possible to do wireless raw packet capture on the device directly.


Compile kernel for dipper

Follow the steps on https://wiki.lineageos.org/devices/dipper/build

cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --git-lfs --depth=1
repo sync
source build/envsetup.sh
breakfast dipper
lunch lineageos_dipper_userdebug
mka kernel
mka boot_image

proj_spacelight

Spacelight

HW

OLED controller: SSD1309

Compile

Prerequisite Software

  • Git for Windows

  • STM32CubeMX 6.8.0 with the following components installed:

    • STM32CubeF4 Firmware Package V1.27.0
    • Azure RTOS STM32Cube expansion package for STM32F4 series V1.1.0
  • IAR 8.40.2

Compile Procedure

  1. create a generate dir(Z:\generated)
  2. run command prompt as administrator, and create a directory symbolic link under spacelight\cubemx: mklink /d generated Z:\generated
  3. update the generate_dir(which stores all the files that cubemx generated) inside generate_code.cmd
  4. run generate_code.cmd, the script will
    • generate the IAR project & code and include the STM32F4 CMSIS lib
    • patch the generated code to call user written code
  5. open cubemx\generated\project\EWARM\Project.eww in IAR
  6. compile and run

Code Structure

  • app: user written code for the project
  • cubemx
    • generate_code.cmd: script to generate the IAR project
    • spacelight.ioc: cubemx config file
    • .extSettings: additional IAR project setting
  • lib
    • u8g2: monochrome graphics library

GUI Block Diagram

requirementDiagram

requirement Flashlight {
  id: 2
  text: main GUI
  risk: medium
  verifymethod: test
}

interfaceRequirement EffectMode {
  id: 2
  text: menu "Effect Mode"
  risk: medium
  verifymethod: test
}

functionalRequirement LampCount {
  id: 3
  text: menu "Lamp Count"
  risk: low
  verifymethod: test
}

functionalRequirement DMXAddr {
  id: 4
  text: menu "Dmx Addr"
  risk: low
  verifymethod: test
}

interfaceRequirement DMXMode {
  id: 5
  text: menu "DMX Mode"
  risk: medium
  verifymethod: test
}

interfaceRequirement Wireless {
  id: 6
  text: menu "Wireless"
  risk: medium
  verifymethod: test
}

functionalRequirement CCT {
  id: 2.1
  text: menu "CCT"
  risk: low
  verifymethod: test
}

functionalRequirement Blink {
  id: 2.2
  text: menu "Blink"
  risk: low
  verifymethod: test
}

functionalRequirement Breather {
  id: 2.3
  text: menu "Breather"
  risk: low
  verifymethod: test
}

functionalRequirement Lightning {
  id: 2.4
  text: menu "Lightning"
  risk: medium
  verifymethod: test
}

functionalRequirement Drift {
  id: 2.5
  text: menu "CCT Drift"
  risk: high
  verifymethod: test
}

functionalRequirement Fire {
  id: 2.6
  text: menu "Fire"
  risk: low
  verifymethod: test
}

functionalRequirement LockTime {
  id: 2
  text: menu "Lock Time"
  risk: medium
  verifymethod: test
}

functionalRequirement Version {
  id: 2
  text: menu "Version"
  risk: medium
  verifymethod: test
}

EffectMode - contains -> CCT
EffectMode - contains -> Blink
EffectMode - contains -> Breather
EffectMode - contains -> Lightning
EffectMode - contains -> Drift
EffectMode - contains -> Fire
Flashlight - contains -> EffectMode
Flashlight - contains -> LampCount
Flashlight - contains -> DMXAddr
Flashlight - contains -> DMXMode
Flashlight - contains -> Wireless
Flashlight - contains -> LockTime
Flashlight - contains -> Version

Menu Item

  • CCT Mode
  • Effect Mode
  • Lamp Count
  • DMX Addr
  • DMX Mode
  • Wireless
  • Lock Time
  • Version
  • Exit

Workload components

  • CMSIS Lib
  • RTOS: Azure RTOS(ThreadX)
  • GUI: u8g2
    • Font library embedding
    • Icon embedding
  • DMX512 protocol stack
  • Algorithm
    • Blink
    • Breather
    • Lightning
    • CCT Drift
    • Fire

Peripherals

The project use the following IOMUX & peripherals:

GPIO

GPIO Input

  • KEY1
  • KEY2
  • KEY3
  • KEY4

GPIO Output

  • R_LED
  • G_LED
  • B_LED

TIM

Thread design

  • GUI thread: draw main interface
  • worker thread:
  • controller thread: handle key input, and

C++ Notes

CPP

Concurrency

Presenter: [email protected]

Mutex

  • Be as constant as possible, be as local as possible

  • Bad

    m.lock();	
    sharedVariable = getVar();
    m.unlock();
    
  • Good

    auto res = getVar();
    m.lock();
    sharedVariable = getVar();
    m.unlock();
    
  • NNN=No Naked New

  • NNM=No Naked Mutex