#include <xc.h>
#include <stdint.h>
#include "led.h"
#include "aspect.h"

/* 現示パターン2Aでの点灯データ列 (モジュール2A使用) */
const uint8_t aspect_pattern_2a[] = {
  0,
  (AP_2A_RED_1),
  (AP_2A_YELLOW_1 | LIGHT_END) 
};
/* 現示パターン2Bでの表示データ列 (モジュール2B使用) */
const uint8_t aspect_pattern_2b[] = {
  0, 
  (AP_2B_RED_1),
  (AP_2B_GREEN_1 | LIGHT_END)
};
/* 現示パターン3Aでの表示データ列 (モジュール3A使用) */
const uint8_t aspect_pattern_3a[] = {
  0,
  (AP_3A_RED_1),
  (AP_3A_YELLOW_1),
  (AP_3A_GREEN_1 | LIGHT_END)
};
/* 現示パターン4Aの表示データ列 (モジュール4A使用) */
const uint8_t aspect_pattern_4a[] = {
  0, 
  (AP_4A_RED_1),
  (AP_4A_YELLOW_1 | AP_4A_YELLOW_2),
  (AP_4A_YELLOW_2),
  (AP_4A_GREEN_1 | LIGHT_END)
};
/* 現示パターン4Bの表示データ列 (モジュール4B使用) */
const uint8_t aspect_pattern_4b[] = {
  0,
  (AP_4B_RED_1),
  (AP_4B_YELLOW_2),            
  (AP_4B_YELLOW_1 | AP_4B_GREEN_1),
  (AP_4B_GREEN_1 | LIGHT_END)
};
/* 現示パターン4Cの表示データ列 (モジュール4B使用) */
const uint8_t aspect_pattern_4c[] = {
  0, 
  (AP_4C_RED_1),
  (AP_4C_YELLOW_2),
  (AP_4C_YELLOW_1 | AP_4C_GREEN_1),
  (AP_4C_YELLOW_1 | AP_4C_GREEN_1 | LIGHT_FLICKER),
  (AP_4C_GREEN_1 | LIGHT_END)
};
/* 現示パターン5Aの表示データ列 (モジュール5A使用) */
const uint8_t aspect_pattern_5a[] = {
  0, 
  (AP_5A_RED_1),
  (AP_5A_YELLOW_1 | AP_5A_YELLOW_3),
  (AP_5A_YELLOW_3),
  (AP_5A_YELLOW_2 | AP_5A_GREEN_1),
  (AP_5A_GREEN_1 | LIGHT_END)
};
/* 現示パターン5Bの表示データ列 (モジュール5B使用) */
const uint8_t aspect_pattern_5b[] = {
  0,
  (AP_5B_RED_1),
  (AP_5B_YELLOW_1), 
  AP_5B_GREEN_2,
  (AP_5B_GREEN_1 | AP_5B_GREEN_3 | LIGHT_END)
};
/* 現示パターン5Cの表示データ列 (モジュール5C使用) */
const uint8_t aspect_pattern_5c[] = {
  0,
  (AP_5C_RED_1),
  (AP_5C_YELLOW_1 | AP_5C_YELLOW_3),
  (AP_5C_YELLOW_3),
  (AP_5C_YELLOW_2 | AP_5C_GREEN_1),
  (AP_5C_YELLOW_2 | AP_5C_GREEN_1 | LIGHT_FLICKER),
  (AP_5C_GREEN_1 | LIGHT_END)
};
/* 現示パターン6Aの表示データ列 (モジュール6A使用) */
const uint8_t aspect_pattern_6a[] = {
  0, 
  (AP_6A_RED_1),
  (AP_6A_YELLOW_2), 
  (AP_6A_YELLOW_1 | AP_6A_GREEN_2),
  (AP_6A_GREEN_2),
  (AP_6A_GREEN_1 | AP_6A_GREEN_3 | LIGHT_END)
};
/* 現示パターン6Bの表示データ列 (モジュール6B使用) */
const uint8_t aspect_pattern_6b[] = {
  0, 
  (AP_6B_RED_1),
  (AP_6B_YELLOW_1 | AP_6B_YELLOW_3), 
  (AP_6B_YELLOW_3),
  (AP_6B_YELLOW_2 | AP_6B_GREEN_2),
  (AP_6B_GREEN_2),
  (AP_6B_GREEN_1 | AP_6B_GREEN_2 | LIGHT_END)
};

/* 現示パターン表 */
const uint8_t *aspect_patterns[ASPECT_N_PATTERNS] = {
  /*       DIPスイッチ   1   2   3   4  */
  aspect_pattern_2a, /* OFF OFF OFF OFF */
  aspect_pattern_2b, /* ON  OFF OFF OFF */
  aspect_pattern_3a, /* OFF ON  OFF OFF */
  aspect_pattern_4a, /* ON  ON  OFF OFF */
  aspect_pattern_4b, /* OFF OFF ON  OFF */
  aspect_pattern_4c, /* ON  OFF ON  OFF */
  aspect_pattern_5a, /* OFF ON  ON  OFF */
  aspect_pattern_5b, /* ON  ON  ON  OFF */
  aspect_pattern_5c, /* OFF OFF OFF ON  */
  aspect_pattern_6a, /* ON  OFF OFF ON  */
  aspect_pattern_6b, /* OFF ON  OFF ON  */
};
