/** \file .h
 *  \brief This module
 */

#if !defined(__RPI_PARAM_H__)
#define __RPI_PARAM_H__

/***************************************************************************************************
 * Includes
 **************************************************************************************************/

#include <stdbool.h>
#include <stdint.h>

/***************************************************************************************************
 * Preprocessor Constants and Macros
 **************************************************************************************************/

#define CHAN_MAXLEDS 60 // Maximum number of LEDs per channel
#define LED_NCHANS 8    // Number of LED channels (8 or 16)

#define GLOBAL_CHANNEL 15

#define HUE_MAX 359
#define HUEBASE_MIN 0
#define HUEBASE_MAX HUE_MAX
#define HUEINTERVAL_MIN -HUE_MAX
#define HUEINTERVAL_MAX HUE_MAX
#define LUMINOSITY_MIN 0
#define LUMINOSITY_MAX 255
#define SATURATION_MIN 0
#define SATURATION_MAX 255

/***************************************************************************************************
 * Type and Contant Definitions
 **************************************************************************************************/

/**
 *
 */
typedef struct {
  unsigned int chanLedCount;
} pixled_param_t;

/**
 *
 */
typedef struct {
  float sensitivity;
  unsigned int gravity;
  unsigned int pattern;
  bool isHueAutoShiftEnabled;
} auton_param_t;

/**
 *
 */
typedef struct {
  float sensitivity;
  unsigned int hueBase;
  int hueInterval;
  unsigned int hueAutoShift;
  int hueAutoShiftInterval;
  float hueAutoShiftSpeed;
  bool isIncreasing;
  unsigned int luminosity;
  unsigned int saturation;
} ledbar_param_t;

/**
 *
 */
typedef struct {
  pixled_param_t pixled;
  auton_param_t auton;
  ledbar_param_t ledbar[LED_NCHANS];
} param_t;

/***************************************************************************************************
 * Global Variables
 **************************************************************************************************/

param_t *param_access;

/***************************************************************************************************
 * External Function Prototypes
 **************************************************************************************************/

/**
 * \brief
 */
void param_setup();

/**
 * \brief
 *
 * \param[in] pattern
 */
void set_pattern(unsigned int pattern);

/**
 * \brief
 *
 * \param[in] HasToBeEnabled
 */
void set_hue_auto_shift(bool HasToBeEnabled);

/**
 * \brief
 *
 * \param[in] gravity8
 */
void set_gravity(int8_t gravity8);

/**
 * \brief
 *
 * \param[in] channel
 *
 * \param[in] sensitivity8
 */
void set_sensitivity(int channel, int8_t sensitivity8);

void set_hue_base(int channel, int8_t hueBase8);

void set_hue_interval(int channel, int8_t hueInterval8);

void set_hue_auto_shift_interval(int channel, int8_t hueInterval8);

void set_hue_auto_shift_speed(int channel, int8_t hueSpeed8);

void set_luminosity(int channel, int8_t luminosity8);

void set_saturation(int channel, int8_t saturation8);

#endif /* __RPI_PARAM_H__ */