Skip to content

전광판 디스플레이 드라이버 추가

오병준 requested to merge feature/display into main

5개의 32*16픽셀 LED 매트릭스로 구성된 전광판 드라이버를 추가합니다.

rpi-rgb-led-matrix 라이브러리를 사용합니다.

4개의 축을 가진 그래프를 그리는 간단한 함수를 작성해 놓았습니다.
동예님 amp 모듈에서 스레드 하나 더 써서 각 파이에서 수신한 값을 디스플레이로도 띄우면 좋을 것 같습니다.

핀을 다소 많이 사용하는데(13개), PWM 핀이랑은 겹치지 않으니 사용하실 수 있을 것 같습니다.

사용하는 핀은 다음과 같습니다.

Connection Pin Pin Connection
1 2
3 4
5 6 GND
strobe 7 8
9 10
clock 11 12 OE-
[1] G1 13 14
A 15 16 B
17 18 C
[1] B2 19 20
[1] G2 21 22
[1] R1 23 24 [1] R2
25 26 [1] B1
27 28
29 30
31 32
33 34
35 36
37 38
39 40

usage

#include "drivers/ledmatrix.h"

int main(void) {
  ledmatrix_setup();

  ...

  int arr[4] = { 30, 60, 90, 150 }; // 각 축 높이(최대 160)
  ledmatrix_drawgraph(arr, sizeof(arr) / sizeof(int));

  ...
}
example code
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/socket.h>

#include "types.h"
#include "drivers/ledmatrix.h"

int main(void) {
  int ret = ledmatrix_setup();

  if (ret < 0) {
    return -1;
  }

  int arr[4] = { 0, };

  int cnt = 0;
  while (1) {
    arr[0] = (cnt * 1) % 160;
    arr[1] = (cnt * 2) % 160;
    arr[2] = ((cnt * 1) + 10) % 160;
    arr[3] = ((cnt * 3) + 10) % 160;
    ledmatrix_drawgraph(arr, sizeof(arr) / sizeof(arr[0]));
    usleep(10000);

    cnt++;
  }

  usleep(10000000);

  return 0;
}

test

image

Edited by 오병준

Merge request reports