init ws2812_chains during platform_init
This commit is contained in:
parent
10e96a3b51
commit
a56a7b2775
|
@ -228,6 +228,7 @@ int platform_dht_read( uint8_t gpio_num, uint8_t wakeup_ms, uint8_t *data );
|
|||
// *****************************************************************************
|
||||
// WS2812 platform interface
|
||||
|
||||
void platform_ws2812_init( void );
|
||||
int platform_ws2812_setup( uint8_t gpio_num, uint8_t num_mem, const uint8_t *data, size_t len );
|
||||
int platform_ws2812_release( void );
|
||||
int platform_ws2812_send( void );
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
int platform_init (void)
|
||||
{
|
||||
platform_ws2812_init();
|
||||
return PLATFORM_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ int platform_ws2812_release( void )
|
|||
rmt_driver_uninstall( channel );
|
||||
|
||||
platform_rmt_release( channel );
|
||||
chain->valid = false;
|
||||
|
||||
// attach GPIO to pin, driving 0
|
||||
gpio_set_level( chain->gpio, 0 );
|
||||
|
@ -235,3 +236,10 @@ int platform_ws2812_send( void )
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
void platform_ws2812_init( void )
|
||||
{
|
||||
for (rmt_channel_t channel = 0; channel < RMT_CHANNEL_MAX; channel++) {
|
||||
ws2812_chains[channel].valid = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue