/******************************************************************************
�� �� ����Flash_synchronizer.h
������������˸ͬ���źŷ��������ļ�
��    �ߣ�����
��    ����V1.0
��    �ڣ�2017.04.02
******************************************************************************/

#include "Flash_synchronizer.h"

volatile uint8_t FlashSync1Hz;
volatile uint8_t FlashSync2Hz;
volatile uint8_t FlashSync5Hz;
volatile uint8_t FlashSync7Hz;

const uint8_t FlashSync1HzTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                     1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                                    };
const uint8_t FlashSync2HzTable[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
                                     0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
                                    };
const uint8_t FlashSync5HzTable[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
                                     1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
                                    };
const uint8_t FlashSync7HzTable[] = {0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
                                     0, 1, 0, 0, 1, 0, 0, 1, 0, 1,
                                    };

uint8_t FlashTimer;

/******************************************************************************
��������Flash_Sync_Signal_Generation_Service
��  �ܣ���˸ͬ���źŷ�������
��  ������
����ֵ����
*******************************************************************************
ע  �⣺�÷���������ÿ50ms������һ��
******************************************************************************/
void Flash_Sync_Signal_Generation_Service(void)
{
  FlashTimer++;       //50msһ�� ��  1
  if (FlashTimer >= 20)
    FlashTimer = 0;
  FLASH_SYNC_1Hz = FlashSync1HzTable[FlashTimer]; //500ms
  FLASH_SYNC_2Hz = FlashSync2HzTable[FlashTimer]; //250ms
  FLASH_SYNC_5Hz = FlashSync5HzTable[FlashTimer]; //200ms
  FLASH_SYNC_7Hz = FlashSync7HzTable[FlashTimer]; //100ms
}