# What Mappers to use for this setup?

**URL:** <https://rpi-rgb-led-matrix.discourse.group/t/what-mappers-to-use-for-this-setup/308>\
**Category:** Uncategorized\
**Created:** [August 19, 2021, 8:34pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/what-mappers-to-use-for-this-setup/308 "2021-08-19T20:34:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrueger](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hrueger](https://rpi-rgb-led-matrix.discourse.group/u/hrueger)\
**Post date:** [August 19, 2021, 8:34pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/what-mappers-to-use-for-this-setup/308/1 "2021-08-19T20:34:55Z")

</div>

Hi Makers,  
first of all, thanks for sticking around and reading this post. I hope that someone can help me with what mappers to use for the matrix described below. I think it is possible using the included Pixel Mappers. If not, I’ll try to write a custom mapper but I don’t have a lot of experience with C++.

My Matrix consists of 20 64x32 Panels. I have 4 rows with 5 panels each. They’re all oriented the same way with the input left and the output to the right. The output of he last panel of the first row is connected to the input of the second row, and the output of the last panel of the third row is connected to the input of the first panel of the fourth row. The first panel of he first and the third row is connected to the RPI.

Here’s a visualization:

```auto
PI Output 1 ---> [P] --> [P] --> [P] --> [P] --> [P] -- |
                                                              |
                       | ---------<----------<--------<-------|
                       |
                       [P] --> [P] --> [P] --> [P] --> [P]

PI Output 2 ---> [P] --> [P] --> [P] --> [P] --> [P] -- |
                                                              |
                       | ------<----------<--------<----------|
                       |
                       [P] --> [P] --> [P] --> [P] --> [P]

```

And Idea on how to accomplish that?

---

<div class="post-metadata">

**Author:** ![hrueger](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hrueger](https://rpi-rgb-led-matrix.discourse.group/u/hrueger)\
**Post date:** [August 20, 2021, 8:58am UTC](https://rpi-rgb-led-matrix.discourse.group/t/what-mappers-to-use-for-this-setup/308/2 "2021-08-20T08:58:20Z")

</div>

Got it working with a custom mapper:

```auto
class CustomMapper : public PixelMapper {
public:
  CustomMapper() {}

  virtual const char *GetName() const { return "CustomMapper"; }

  virtual bool SetParameters(int chain, int parallel, const char *param) {
    // ToDo
    return true;
  }

  virtual bool GetSizeMapping(int matrix_width, int matrix_height,
                              int *visible_width, int *visible_height) const {
    *visible_width = matrix_width / 2;
    *visible_height = matrix_height * 2;
    return true;
  }

  virtual void MapVisibleToMatrix(int matrix_width, int matrix_height,
                                  int x, int y,
                                  int *matrix_x, int *matrix_y) const {
    if (y >= 32 && y < 64) {
      *matrix_y = y - 32;
      *matrix_x = x + 320;
    } else if (y >= 64 && y < 96) {
      *matrix_y = y - 32;
      *matrix_x = x;
    } else if (y >= 96 && y < 128) {
      *matrix_y = y - 64;
      *matrix_x = x + 320;
    } else {
      *matrix_x = x;
      *matrix_y = y;
    }
    if (*matrix_y >= 32) {
      *matrix_y = *matrix_y - 32;
    } else {
      *matrix_y = *matrix_y + 32;
    }
  }

};

```

---

<div class="post-metadata">

**Author:** ![hrueger](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hrueger](https://rpi-rgb-led-matrix.discourse.group/u/hrueger)\
**Post date:** [August 21, 2021, 4:31pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/what-mappers-to-use-for-this-setup/308/4 "2021-08-21T16:31:18Z")

</div>

Thanks for the reply. The numbers in the custom mapper were hardcoded because I have been testimg and experimenting.
