aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/patches-4.14
Commit message (Expand)AuthorAgeFilesLines
* kernel: bump 4.14 to 4.14.147Koen Vandeputte2019-10-081-12/+10
* kernel: bump 4.14 to 4.14.127Koen Vandeputte2019-06-183-4/+4
* kernel: bump 4.14 to 4.14.125 (FS#2305 FS#2297)Koen Vandeputte2019-06-122-3/+3
* kernel: bump 4.14 to 4.14.118Koen Vandeputte2019-05-131-1/+1
* kernel: bump 4.14 to 4.14.114Koen Vandeputte2019-05-021-2/+2
* kernel: bump 4.14 to 4.14.112Koen Vandeputte2019-04-222-3/+3
* kernel: bump 4.14 to 4.14.107Koen Vandeputte2019-03-221-1/+1
* ath79: add support for jjPlus JA76PF2Tomasz Maciej Nowak2019-03-181-0/+44
* kernel: bump 4.14 to 4.14.95Koen Vandeputte2019-01-241-2/+2
* kernel: bump 4.14 to 4.14.79Koen Vandeputte2018-11-053-3/+3
* ar71xx/ath79: fix mtd corruptionFabio Bettoni2018-10-171-0/+64
* kernel: bump 4.14 to 4.14.75Koen Vandeputte2018-10-101-1/+1
* kernel: bump 4.14 to 4.14.73Koen Vandeputte2018-10-021-2/+2
* kernel: bump 4.14 to 4.14.72Koen Vandeputte2018-09-262-38/+3
* kernel: bump 4.14 to 4.14.71Koen Vandeputte2018-09-211-5/+5
* kernel: bump 4.14 to 4.14.70Koen Vandeputte2018-09-171-4/+4
* ath79: port cybertan_part from ar71xxChristian Lamparter2018-09-101-0/+19
* kernel: bump 4.14 to 4.14.67Koen Vandeputte2018-08-284-15/+11
* ath79: fix remove irq code from pci driver patchJohn Crispin2018-08-281-0/+141
* ath79: fix ar7100 PCI IRQ handlingDmitry Tunin2018-08-281-0/+0
* ath79: replace patchesJohn Crispin2018-08-2835-1322/+1332
* ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for AR9344Christian Lamparter2018-08-131-1/+5
* treewide: convert gpio-export to platform driverRené van Dorst2018-08-041-7/+4
* kernel: bump 4.14 to 4.14.60Koen Vandeputte2018-08-031-1/+1
* kernel: bump 4.14 to 4.14.59Stijn Tintel2018-07-312-32/+5
* ath79: fix irq assignment for pci-ar71xx driverMatt Merhar2018-07-301-3/+7
* treewide: gpio-export: add error handlingMathias Kresin2018-06-281-1/+3
* ath79: fix irq-ath79-intc driver and add support for other ath79 SoCsJohann Neuhauser2018-06-201-14/+52
* kernel: bump 4.14 to 4.14.49Koen Vandeputte2018-06-181-3/+3
* ath79: led-resets: add default-trigger propertyJohann Neuhauser2018-06-161-1/+4
* ath79: fix qca956x SoC bootLucian Cristian2018-06-071-0/+17
* kernel: bump 4.14 to 4.14.48Stijn Tintel2018-06-052-7/+7
* kernel: bump 4.14 to 4.14.44Stijn Tintel2018-05-291-8/+4
* ath79: make ahb wifi workJohn Crispin2018-05-241-0/+31
* kernel: bump 4.14 to 4.14.41Koen Vandeputte2018-05-1836-502/+181
* ath79: drop platform data patchesMathias Kresin2018-05-171-68/+0
* ath79: add new OF only target for QCA MIPS siliconJohn Crispin2018-05-0744-0/+8685
.highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#include <FastGPIO.h>
#include <TimerOne.h>

int iByte;
byte col = 0;
byte leds[12][4];
byte pass = 1;
int fadecount = 1;
const int fadelimit = 3000;
const int fadelimitshort = 1000;
byte mode = 4;
byte brightness = 2;
boolean changemode = 0;
int rain = 0;
const int rainlimit = 5000;
const int rainfade = 5000;
byte rx = 0;
byte ry = 0;

// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[17] = {
  -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16, 14, 15, 18, 19, 20, 21
};

// col[xx] of leds = pin yy on led matrix
int cols[12] = {
  pins[8], pins[7], pins[6], pins[5], pins[9], pins[10], pins[11], pins[12], pins[13], pins[14], pins[15], pins[16]
};

// row[xx] of leds = pin yy on led matrix
int rows[4] = {
  pins[1], pins[2], pins[3], pins[4]
};


#define DELAY 0
extern byte leds[12][4];

void setup() {
  Serial1.begin(9600);
  setupLeds();
  for (int s = 0; s < 5; s++) {
    for ( int r = 1; r  < 9; r++)  {
      delayMicroseconds(65000);
      delayMicroseconds(65000);
      for (int j = 0; j < 4; j++) {
        for (int i = 0; i < 12; i++) {
          leds[i][j] = 1;
          for (int p = 0; p < 25; p++) {
          }
          leds[i][j] = r;
        }
      }
    }
    for ( int r = 9; r  > 0; r--)  {
      delayMicroseconds(65000);
      delayMicroseconds(65000);
      delayMicroseconds(65000);
      for (int j = 0; j < 4; j++) {
        for (int i = 0; i < 12; i++) {
          leds[i][j] = 1;
          for (int p = 0; p < 25; p++) {
          }
          leds[i][j] = r;
        }
      }
    }
  }
}

void loop() {

  switch (mode) {
    case 0:
      //Blacklight
      for (int i = 0; i < 12; i++) {
        for (int j = 0; j < 4; j++) {
          leds[i][j] = brightness;
        }
      }
      checkserial();
      break;
    case 1:
      //Breathing
      for ( int r = 1; r  < 9; r++)  {
        checkserial();
        if (changemode == 0) {
          delayMicroseconds(65000);
          delayMicroseconds(65000);
          delayMicroseconds(65000);
          for (int j = 0; j < 4; j++) {
            for (int i = 0; i < 12; i++) {
              leds[i][j] = 1;
              for (int p = 0; p < 25; p++) {
              }
              leds[i][j] = r;
            }
          }
        }
        else {
          break;
        }
      }
      for ( int r = 9; r  > 0; r--)  {
        checkserial();
        if (changemode == 0) {
          delayMicroseconds(65000);
          delayMicroseconds(65000);
          delayMicroseconds(65000);
          delayMicroseconds(65000);
          for (int j = 0; j < 4; j++) {
            for (int i = 0; i < 12; i++) {
              leds[i][j] = 1;
              for (int p = 0; p < 25; p++) {
              }
              leds[i][j] = r;
            }
          }
        }
        else {
          break;
        }
      }
      for ( int r = 1; r  < 30; r++)  {
        checkserial();
        if (changemode == 0) {
          delayMicroseconds(65000);
          delayMicroseconds(65000);
        }
        else {
          break;
        }
      }
      break;
    case 2:
      //Random
      leds[random(12)][random(4)] = random(8);
      delayMicroseconds(10000);
      checkserial();
      break;
    case 3:
      //Rain
      rain++;
      if (rain > rainlimit) {
        rain = 0;
        rx = random(12);
        ry = random(4);
        if (leds[rx][ry] == 0) {
          leds[rx][ry] = 18;
        }
      }
      fadecount++;
      if (fadecount > rainfade) {
        fadecount = 1;
        for (int i = 0; i < 12; i++) {
          for (int j = 0; j < 4; j++) {
            if (leds[i][j] > 0) {
              leds[i][j] = leds[i][j] - 1;
            }
          }
        }
      }
      checkserial();
      break;
    case 4:
      //Reactive
      fadecount++;
      if (fadecount > fadelimit) {
        fadecount = 1;
        for (int i = 0; i < 12; i++) {
          for (int j = 0; j < 4; j++) {
            if (leds[i][j] > 0) {
              leds[i][j] = leds[i][j] - 1;
            }
          }
        }
      }
      checkserial();
      break;
    case 5:
      //Reactive Target
      fadecount++;
      if (fadecount > fadelimitshort) {
        fadecount = 1;
        for (int i = 0; i < 12; i++) {
          for (int j = 0; j < 4; j++) {
            if (leds[i][j] > 0) {
              leds[i][j] = leds[i][j] - 1;
            }
          }
        }
      }
      checkserial();
      break;
    default:
      mode = 0;
      break;
  }
  changemode = 0;
}

void checkserial() {
  if (Serial1.available() > 0) {
    iByte = Serial1.read();
    if (iByte == 100) {
      brightness++;
      if (brightness > 9) {
        brightness = 1;
      }
    }
    if (iByte == 101) {
      mode++;
    }
    if (iByte < 100) {
      if (mode == 4) {
        byte row = iByte / 16;
        byte col = iByte % 16;
        leds[col][row] = 18;
      }
      if (mode == 5) {
        byte row = iByte / 16;
        byte col = iByte % 16;
        for (byte i = 0; i < 12;  i++) {
          leds[i][row] = 18;
        }
        for (byte p = 0; p < 4;  p++) {
          leds[col][p] = 18;
        }
      }
    }
  }
}

void setupLeds() {
  // sets the pins as output
  FastGPIO::Pin<2>::setOutputLow();
  FastGPIO::Pin<3>::setOutputLow();
  FastGPIO::Pin<4>::setOutputLow();
  FastGPIO::Pin<5>::setOutputLow();
  FastGPIO::Pin<6>::setOutputLow();
  FastGPIO::Pin<7>::setOutputLow();
  FastGPIO::Pin<8>::setOutputLow();
  FastGPIO::Pin<9>::setOutputLow();
  FastGPIO::Pin<10>::setOutputLow();
  FastGPIO::Pin<16>::setOutputLow();
  FastGPIO::Pin<14>::setOutputLow();
  FastGPIO::Pin<15>::setOutputLow();
  FastGPIO::Pin<18>::setOutputLow();
  FastGPIO::Pin<19>::setOutputLow();
  FastGPIO::Pin<20>::setOutputLow();
  FastGPIO::Pin<21>::setOutputLow();

  // set up Cols
  FastGPIO::Pin<6>::setOutputValueLow();
  FastGPIO::Pin<7>::setOutputValueLow();
  FastGPIO::Pin<8>::setOutputValueLow();
  FastGPIO::Pin<9>::setOutputValueLow();
  FastGPIO::Pin<10>::setOutputValueLow();
  FastGPIO::Pin<16>::setOutputValueLow();
  FastGPIO::Pin<14>::setOutputValueLow();
  FastGPIO::Pin<15>::setOutputValueLow();
  FastGPIO::Pin<18>::setOutputValueLow();
  FastGPIO::Pin<19>::setOutputValueLow();
  FastGPIO::Pin<20>::setOutputValueLow();
  FastGPIO::Pin<21>::setOutputValueLow();

  // set up Rows
  FastGPIO::Pin<2>::setOutputValueLow();
  FastGPIO::Pin<3>::setOutputValueLow();
  FastGPIO::Pin<4>::setOutputValueLow();
  FastGPIO::Pin<5>::setOutputValueLow();

  clearLeds();
  Timer1.initialize(25);
  Timer1.attachInterrupt(display);

}

void clearLeds() {
  // Clear display array
  for (int i = 0; i < 12; i++) {
    for (int j = 0; j < 4; j++) {
      leds[i][j] = 0;
    }
  }
}

void onLeds() {
  // Clear display array
  for (int i = 0; i < 12; i++) {
    for (int j = 0; j < 4; j++) {
      leds[i][j] = 7;
    }
  }
}

// Interrupt routine
void display() {

  switch (col) { // Turn whole previous column off
    case 0:
      FastGPIO::Pin<6>::setOutputValueLow();
      break;
    case 1:
      FastGPIO::Pin<7>::setOutputValueLow();
      break;
    case 2:
      FastGPIO::Pin<8>::setOutputValueLow();
      break;
    case 3:
      FastGPIO::Pin<9>::setOutputValueLow();
      break;
    case 4:
      FastGPIO::Pin<10>::setOutputValueLow();
      break;
    case 5:
      FastGPIO::Pin<16>::setOutputValueLow();
      break;
    case 6:
      FastGPIO::Pin<14>::setOutputValueLow();
      break;
    case 7:
      FastGPIO::Pin<15>::setOutputValueLow();
      break;
    case 8:
      FastGPIO::Pin<18>::setOutputValueLow();
      break;
    case 9:
      FastGPIO::Pin<19>::setOutputValueLow();
      break;
    case 10:
      FastGPIO::Pin<20>::setOutputValueLow();
      break;
    case 11:
      FastGPIO::Pin<21>::setOutputValueLow();
      break;
  }

  col++;
  if (col == 12) {
    col = 0;
    pass++;
    if (pass > 8) {
      pass = 1;
    }
  }
  for (int row = 0; row < 4; row++) {
    if (leds[col][row] > pass) {
      switch (row) { // Turn on this led
        case 0:
          FastGPIO::Pin<2>::setOutputValueLow();
          break;
        case 1:
          FastGPIO::Pin<3>::setOutputValueLow();
          break;
        case 2:
          FastGPIO::Pin<4>::setOutputValueLow();
          break;
        case 3:
          FastGPIO::Pin<5>::setOutputValueLow();
          break;
      }
    }
    else {
      switch (row) { // Turn off this led
        case 0:
          FastGPIO::Pin<2>::setOutputValueHigh();
          break;
        case 1:
          FastGPIO::Pin<3>::setOutputValueHigh();
          break;
        case 2:
          FastGPIO::Pin<4>::setOutputValueHigh();
          break;
        case 3:
          FastGPIO::Pin<5>::setOutputValueHigh();
          break;
      }
    }
  }
  switch (col) { // Turn column on
    case 0:
      FastGPIO::Pin<6>::setOutputValueHigh();
      break;
    case 1:
      FastGPIO::Pin<7>::setOutputValueHigh();
      break;
    case 2:
      FastGPIO::Pin<8>::setOutputValueHigh();
      break;
    case 3:
      FastGPIO::Pin<9>::setOutputValueHigh();
      break;
    case 4:
      FastGPIO::Pin<10>::setOutputValueHigh();
      break;
    case 5:
      FastGPIO::Pin<16>::setOutputValueHigh();
      break;
    case 6:
      FastGPIO::Pin<14>::setOutputValueHigh();
      break;
    case 7:
      FastGPIO::Pin<15>::setOutputValueHigh();
      break;
    case 8:
      FastGPIO::Pin<18>::setOutputValueHigh();
      break;
    case 9:
      FastGPIO::Pin<19>::setOutputValueHigh();
      break;
    case 10:
      FastGPIO::Pin<20>::setOutputValueHigh();
      break;
    case 11:
      FastGPIO::Pin<21>::setOutputValueHigh();
      break;
  }

}