Skip to content

Commit

Permalink
Added support for VEGA ARIES Boards
Browse files Browse the repository at this point in the history
The VEGA ARIES boards is a fully indigenous and a “Made in India” product to get started with basic microprocessor programming and embedded systems. This board is built upon a RISC-V ISA compliant VEGA Processor with easy-to-use hardware and software. The board is added in Arduino IDE.
  • Loading branch information
himanshudiwane committed Dec 28, 2023
1 parent 97b5a93 commit a2a2486
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions Adafruit_NeoPixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,64 @@ if(is800KHz) {
}
}

#elif defined(VEGA_ARIES_V2) || defined(VEGA_ARIES_V3) || defined(VEGA_ARIES_IOT) || defined(VEGA_ARIES_MICRO)

#define CYCLES_800_T0H (F_CPU / 2500000) // 0.4us
#define CYCLES_800_T1H (F_CPU / 1250000) // 0.8us
#define CYCLES_800 (F_CPU / 800000) // 1.25us per bit
#define CYCLES_400_T0H (F_CPU / 2000000) // 0.5uS
#define CYCLES_400_T1H (F_CPU / 833333) // 1.2us
#define CYCLES_400 (F_CPU / 400000) // 2.5us per bit

uint8_t *p, *end, pix, mask;
uint32_t t, time0, time1, period, c, startTime;

p = pixels;
end = p + numBytes;
pix = *p++;
mask = 0x80;
startTime = 0;

#ifdef NEO_KHZ400
if (is800KHz)
{
#endif
time0 = CYCLES_800_T0H;
time1 = CYCLES_800_T1H;
period = CYCLES_800;
#ifdef NEO_KHZ400
}
else
{ // 400 KHz bitstream
time0 = CYCLES_400_T0H;
time1 = CYCLES_400_T1H;
period = CYCLES_400;
}
#endif

for (t = time0;; t = time0)
{
if (pix & mask)
t = time1; // Bit high duration
while (((c = read_csr(mcycle)) - startTime) < period)
; // Wait for bit start
digitalWrite(pin, HIGH);
startTime = c; // Save start time
while (((c = read_csr(mcycle)) - startTime) < t)
; // Wait high duration
digitalWrite(pin, LOW);

if (!(mask >>= 1))
{ // Next bit/byte
if (p >= end)
break;
pix = *p++;
mask = 0x80;
}
}
while ((read_csr(mcycle) - startTime) < period)
; // Wait for last bit

#else
#error Architecture not supported
#endif
Expand Down

0 comments on commit a2a2486

Please sign in to comment.