using new language feature

This commit is contained in:
Martin Brodbeck 2023-01-12 08:49:02 +01:00
parent 2e62919999
commit e9fef4f4d3
2 changed files with 4 additions and 2 deletions

View file

@ -3,7 +3,7 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 23)
# Initialise pico_sdk from installed location # Initialise pico_sdk from installed location
# (note this can come from environment, CMake cache etc) # (note this can come from environment, CMake cache etc)

View file

@ -1,10 +1,12 @@
#include "ws2812.h" #include "ws2812.h"
#include <utility>
WS2812::WS2812(uint gpio, PIO pio, uint sm) : m_pio{pio}, m_gpio{gpio}, m_sm{sm} { init(); } WS2812::WS2812(uint gpio, PIO pio, uint sm) : m_pio{pio}, m_gpio{gpio}, m_sm{sm} { init(); }
WS2812::~WS2812() { deinit(); } WS2812::~WS2812() { deinit(); }
void WS2812::switchColor(Color color) { putPixel(static_cast<uint32_t>(color)); } void WS2812::switchColor(Color color) { putPixel(std::to_underlying(color)); }
void WS2812::blinkReady() { void WS2812::blinkReady() {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {