#ifndef NL_BOARD_H #define NL_BOARD_H #include #include #include /* GPIO numbers are identical to enum tls_io_name of the W600 SDK (PA_00 = 0, PB_00 = 16). */ #define NL_PB(n) ((uint8_t)(16u + (n))) #define NL_PIN_NONE 0xFFu typedef enum { NL_CH_R = 0, NL_CH_G, NL_CH_B, NL_CH_CW, NL_CH_WW, NL_CH_COUNT } nl_channel_t; typedef enum { NL_DRV_PWM = 0, NL_DRV_SM2135EH } nl_led_driver_t; typedef struct { int8_t pwm_ch; /* PWM unit channel 0..4, -1 = channel not populated */ uint8_t pin; /* NL_PB(x) or NL_PIN_NONE */ bool active_low; /* LED lights up while the pin is low */ bool antiphase; /* inverted PWM output, shifts the pulse (e27_cw cold white) */ } nl_pwm_chan_t; typedef struct { const char *id; const char *name; nl_led_driver_t driver; bool has_rgb; uint16_t ct_min; /* Kelvin, warmest */ uint16_t ct_max; /* Kelvin, coldest */ uint32_t pwm_freq_hz; /* PWM boards */ nl_pwm_chan_t pwm[NL_CH_COUNT]; uint8_t sm_clk_pin; /* SM2135EH boards */ uint8_t sm_dat_pin; uint8_t sm_current; /* (rgb_code << 4) | wy_code, see SM2135EH datasheet */ } nl_board_t; extern const nl_board_t nl_boards[]; extern const size_t nl_boards_count; const nl_board_t *nl_board_find(const char *id); /* Board selected at build time via NINLIGHT_DEVICE_ID. */ const nl_board_t *nl_board_get(void); /* Slots, die eine Lampe im DMX-Universe belegt: Dimmer + R,G,B,CW,WW bzw. Dimmer + CW,WW. * Steht hier, damit API, Uebernahme-Schicht und Doku dieselbe Zahl benutzen. */ uint8_t nl_board_dmx_slots(const nl_board_t *b); #endif