/*
  Name:    PdResponse.cpp
  Author:  Roman Schönfeld & Daniel Hausherr
*/

/***************************************************************************************************
  This work is licensed under a Creative Commons Attribution 4.0 International (CC BY 4.0) License.

  You are free to:

  Share — copy and redistribute the material in any medium or format
  Adapt — remix, transform, and build upon the material
  for any purpose, even commercially.

  The licensor cannot revoke these freedoms as long as you follow the license terms.

  Under the following terms:

  Attribution — You must give appropriate credit, provide a link to the license, and indicate if
  changes were made. You may do so in any reasonable manner, but not in any way that suggests
  the licensor endorses you or your use.

  No additional restrictions — You may not apply legal terms or technological measures that
  legally restrict others from doing anything the license permits.

  Credits:
  Laboratory for Physics and Illumination Technologies,
  University of Applied Sciences Southern Westfalia
  Germany

  Make Light! Support by the BMBF in the development of this device is gratefully acknowledged
***************************************************************************************************/

#include "PdResponse.h"

void get_sfh_203_characteristic(void *value) {
  double counts_mw[(uint8_t)NM_COUNT] = {
    7997.526d,                                          // 785
    7777.000d,                                          // 750
    7771.610d,                                          // 725
    7672.149d,                                          // 700
    7716.898d,                                          // 670
    6573.333d,                                          // 650
    6500.877d,                                          // 632.8
    5299.200d,                                          // 605
    4451.561d,                                          // 575
    4292.413d,                                          // 568
    3733.181d,                                          // 550
    2961.704d,                                          // 532
    2393.682d,                                          // 505
    2107.248d,                                          // 488
    1584.656d,                                          // 475
    859.044d,                                           // 445
    593.956d,                                           // 425
    337.328d                                            // 405
  };

  (*(double*)value) = counts_mw[(unsigned int)current_wavelenght];
}
char* numtochar(uint8_t num) {
  char* nm = "";

  switch (num) {
    case 0:
      nm = "785nm";
      break;
    case 1:
      nm = "750nm";
      break;
    case 2:
      nm = "725nm";
      break;
    case 3:
      nm = "700nm";
      break;
    case 4:
      nm = "670nm";
      break;
    case 5:
      nm = "650nm";
      break;
    case 6:
      nm = "632nm";
      break;
    case 7:
      nm = "605nm";
      break;
    case 8:
      nm = "575nm";
      break;
    case 9:
      nm = "568nm";
      break;
    case 10:
      nm = "550nm";
      break;
    case 11:
      nm = "532nm";
      break;
    case 12:
      nm = "505nm";
      break;
    case 13:
      nm = "488nm";
      break;
    case 14:
      nm = "475nm";
      break;
    case 15:
      nm = "445nm";
      break;
    case 16:
      nm = "425nm";
      break;
    case 17:
      nm = "405nm";
      break;
  }
  return nm;
}
char* colortowavelenght(uint8_t wave) {
  char* color = "";

  switch (wave) {
    case 0:
      color = "Rot";
      break;
    case 1:
      color = "Rot";
      break;
    case 2:
      color = "Rot";
      break;
    case 3:
      color = "Rot";
      break;
    case 4:
      color = "Rot";
      break;
    case 5:
      color = "Rot";
      break;
    case 6:
      color = "Rot";
      break;
    case 7:
      color = "Orange";
      break;
    case 8:
      color = "Gelb";
      break;
    case 9:
      color = "Gelb";
      break;
    case 10:
      color = "Gruen";
      break;
    case 11:
      color = "Gruen";
      break;
    case 12:
      color = "Cyan";
      break;
    case 13:
      color = "Blau";
      break;
    case 14:
      color = "Blau";
      break;
    case 15:
      color = "Blau";
      break;
    case 16:
      color = "Violett";
      break;
    case 17:
      color = "Violett";
      break;
  }
  return color;
}
