Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
a224c1fa
Commit
a224c1fa
authored
Jan 25, 2022
by
Eric Duminil
Browse files
Update NeoPixel to 1.10.3
parent
9d9f4ebf
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/src/lib/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp
View file @
a224c1fa
This diff is collapsed.
Click to expand it.
ampel-firmware/src/lib/Adafruit_NeoPixel/Adafruit_NeoPixel.h
View file @
a224c1fa
This diff is collapsed.
Click to expand it.
ampel-firmware/src/lib/Adafruit_NeoPixel/README.md
View file @
a224c1fa
...
...
@@ -56,6 +56,10 @@ Compatibility notes: Port A is not supported on any AVR processors at this time
-
ESP8266 any speed
-
ESP32 any speed
-
Nordic nRF52 (Adafruit Feather nRF52), nRF51 (micro:bit)
-
Infineon XMC1100 BootKit @ 32 MHz
-
Infineon XMC1100 2Go @ 32 MHz
-
Infineon XMC1300 BootKit @ 32 MHz
-
Infineon XMC4700 RelaxKit, XMC4800 RelaxKit, XMC4800 IoT Amazon FreeRTOS Kit @ 144 MHz
Check forks for other architectures not listed here!
...
...
ampel-firmware/src/lib/Adafruit_NeoPixel/esp.c
View file @
a224c1fa
...
...
@@ -22,6 +22,12 @@
#include
<Arduino.h>
#include
"driver/rmt.h"
#if defined(ESP_IDF_VERSION)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
#define HAS_ESP_IDF_4
#endif
#endif
// This code is adapted from the ESP-IDF v3.4 RMT "led_strip" example, altered
// to work with the Arduino version of the ESP-IDF (3.2)
...
...
@@ -89,6 +95,7 @@ void espShow(uint8_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz)
if
(
!
rmt_reserved_channels
[
i
])
{
rmt_reserved_channels
[
i
]
=
true
;
channel
=
i
;
break
;
}
}
if
(
channel
==
ADAFRUIT_RMT_CHANNEL_MAX
)
{
...
...
@@ -96,6 +103,10 @@ void espShow(uint8_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz)
return
;
}
#if defined(HAS_ESP_IDF_4)
rmt_config_t
config
=
RMT_DEFAULT_CONFIG_TX
(
pin
,
channel
);
config
.
clk_div
=
2
;
#else
// Match default TX config from ESP-IDF version 3.4
rmt_config_t
config
=
{
.
rmt_mode
=
RMT_MODE_TX
,
...
...
@@ -113,12 +124,16 @@ void espShow(uint8_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz)
.
idle_output_en
=
true
,
}
};
#endif
rmt_config
(
&
config
);
rmt_driver_install
(
config
.
channel
,
0
,
0
);
// Convert NS timings to ticks
uint32_t
counter_clk_hz
=
0
;
#if defined(HAS_ESP_IDF_4)
rmt_get_counter_clock
(
channel
,
&
counter_clk_hz
);
#else
// this emulates the rmt_get_counter_clock() function from ESP-IDF 3.4
if
(
RMT_LL_HW_BASE
->
conf_ch
[
config
.
channel
].
conf1
.
ref_always_on
==
RMT_BASECLK_REF
)
{
uint32_t
div_cnt
=
RMT_LL_HW_BASE
->
conf_ch
[
config
.
channel
].
conf0
.
div_cnt
;
...
...
@@ -129,6 +144,7 @@ void espShow(uint8_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz)
uint32_t
div
=
div_cnt
==
0
?
256
:
div_cnt
;
counter_clk_hz
=
APB_CLK_FREQ
/
(
div
);
}
#endif
// NS to tick converter
float
ratio
=
(
float
)
counter_clk_hz
/
1e9
;
...
...
ampel-firmware/src/lib/Adafruit_NeoPixel/esp8266.c
View file @
a224c1fa
...
...
@@ -17,16 +17,16 @@ static inline uint32_t _getCycleCount(void) {
}
#ifdef ESP8266
void
ICACHE_
RAM_ATTR
espShow
(
uint8_t
pin
,
uint8_t
*
pixels
,
uint32_t
numBytes
,
boolean
is800KHz
)
{
I
RAM_ATTR
void
espShow
(
uint8_t
pin
,
uint8_t
*
pixels
,
uint32_t
numBytes
,
__attribute__
((
unused
))
boolean
is800KHz
)
{
#else
void
espShow
(
uint8_t
pin
,
uint8_t
*
pixels
,
uint32_t
numBytes
,
boolean
is800KHz
)
{
#endif
#define CYCLES_800_T0H (F_CPU / 250000
0
) // 0.4us
#define CYCLES_800_T1H (F_CPU / 125000
0
) // 0.8us
#define CYCLES_800 (F_CPU / 80000
0
) // 1.25us per bit
#define CYCLES_800_T0H (F_CPU / 250000
1
) // 0.4us
#define CYCLES_800_T1H (F_CPU / 125000
1
) // 0.8us
#define CYCLES_800 (F_CPU / 80000
1
) // 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
...
...
ampel-firmware/src/lib/Adafruit_NeoPixel/library.properties
View file @
a224c1fa
name
=
Adafruit NeoPixel
version
=
1.
7.0
version
=
1.
10.3
author
=
Adafruit
maintainer
=
Adafruit <info@adafruit.com>
sentence
=
Arduino library for controlling single-wire-based LED pixels and strip.
...
...
ampel-firmware/src/lib/Adafruit_NeoPixel/rp2040_pio.h
0 → 100644
View file @
a224c1fa
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
// Unless you know what you are doing...
// Lines 47 and 52 have been edited to set transmit bit count
#if !PICO_NO_HARDWARE
#include
"hardware/pio.h"
#endif
// ------ //
// ws2812 //
// ------ //
#define ws2812_wrap_target 0
#define ws2812_wrap 3
#define ws2812_T1 2
#define ws2812_T2 5
#define ws2812_T3 3
static
const
uint16_t
ws2812_program_instructions
[]
=
{
// .wrap_target
0x6221
,
// 0: out x, 1 side 0 [2]
0x1123
,
// 1: jmp !x, 3 side 1 [1]
0x1400
,
// 2: jmp 0 side 1 [4]
0xa442
,
// 3: nop side 0 [4]
// .wrap
};
#if !PICO_NO_HARDWARE
static
const
struct
pio_program
ws2812_program
=
{
.
instructions
=
ws2812_program_instructions
,
.
length
=
4
,
.
origin
=
-
1
,
};
static
inline
pio_sm_config
ws2812_program_get_default_config
(
uint
offset
)
{
pio_sm_config
c
=
pio_get_default_sm_config
();
sm_config_set_wrap
(
&
c
,
offset
+
ws2812_wrap_target
,
offset
+
ws2812_wrap
);
sm_config_set_sideset
(
&
c
,
1
,
false
,
false
);
return
c
;
}
#include
"hardware/clocks.h"
static
inline
void
ws2812_program_init
(
PIO
pio
,
uint
sm
,
uint
offset
,
uint
pin
,
float
freq
,
uint
bits
)
{
pio_gpio_init
(
pio
,
pin
);
pio_sm_set_consecutive_pindirs
(
pio
,
sm
,
pin
,
1
,
true
);
pio_sm_config
c
=
ws2812_program_get_default_config
(
offset
);
sm_config_set_sideset_pins
(
&
c
,
pin
);
sm_config_set_out_shift
(
&
c
,
false
,
true
,
bits
);
// <----<<< Length changed to "bits"
sm_config_set_fifo_join
(
&
c
,
PIO_FIFO_JOIN_TX
);
int
cycles_per_bit
=
ws2812_T1
+
ws2812_T2
+
ws2812_T3
;
float
div
=
clock_get_hz
(
clk_sys
)
/
(
freq
*
cycles_per_bit
);
sm_config_set_clkdiv
(
&
c
,
div
);
pio_sm_init
(
pio
,
sm
,
offset
,
&
c
);
pio_sm_set_enabled
(
pio
,
sm
,
true
);
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment