096111e983
.claude/ 제외(.gitignore 추가). 기존 초기커밋(5a96a69) 위에 신규·수정·이동분 커밋.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
125 lines
2.0 KiB
C
125 lines
2.0 KiB
C
/**************************************************************************//**
|
|
* @file main.c
|
|
* @version V1.00
|
|
* $Revision: 4 $
|
|
* $Date: 14/09/11 5:23p $
|
|
* @brief Show how to pixel on and off on LCD panel.
|
|
*
|
|
* @note
|
|
* Copyright (C) 2013 Nuvoton Technology Corp. All rights reserved.
|
|
*****************************************************************************/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include "Nano100Series.h"
|
|
#include "adc.h"
|
|
#include "gpio.h"
|
|
#include "pwm.h"
|
|
#include "timer.h"
|
|
#include "uart.h"
|
|
#include "sys.h"
|
|
#include "clk.h"
|
|
#include "EEPROM_Emulate.h"
|
|
|
|
|
|
#include "My_define.h"
|
|
|
|
#define __wdt_setting() SYS_UnlockReg(); WDT_Open(WDT_TIMEOUT_2POW14, 0, TRUE, FALSE); SYS_LockReg();
|
|
#define __wdt_reset() SYS_UnlockReg(); WDT_RESET_COUNTER(); SYS_LockReg();
|
|
|
|
|
|
|
|
uint8_t Sec_Timer = 0;
|
|
uint8_t Blink_Toggle = 0;
|
|
uint8_t Blinking_Count = 0;
|
|
uint8_t FastBlink_Toggle;
|
|
uint32_t Reset_src_value = 0;
|
|
|
|
|
|
void main(void)
|
|
{
|
|
|
|
__disable_interrupt();
|
|
SYS_Init();
|
|
|
|
SYS_EnableBOD(SYS_BODCTL_BOD25_RST_EN_Msk, SYS_BODCTL_BOD25_EN_Msk);
|
|
|
|
// ADC_Init();
|
|
|
|
GPIO_Init();
|
|
|
|
Timer0_Init();
|
|
Timer1_Init();
|
|
Timer2_Init();
|
|
|
|
UART0_Init(); //
|
|
UART1_Init(); // to rs485 - internal
|
|
|
|
|
|
Init_EEPROM(eep_data_size, eep_page_amount);
|
|
Search_Valid_Page();
|
|
|
|
__enable_interrupt();
|
|
|
|
FND_POWER = 1;
|
|
|
|
Reset_src_value = SYS_GetResetSrc();
|
|
if((Reset_src_value & 0x00000037) != 0x00000004) // WDT reset
|
|
{
|
|
Processor_Init();
|
|
}
|
|
SYS_ClearResetSrc(Reset_src_value);
|
|
|
|
__wdt_setting();
|
|
|
|
|
|
|
|
while(1)
|
|
{
|
|
com_FND_process();
|
|
|
|
if(Run_Timer == 0)
|
|
{
|
|
Run_Timer = 99;
|
|
Display_update();
|
|
Display_process();
|
|
}
|
|
|
|
|
|
if(mSec_Timer == 0)
|
|
{
|
|
mSec_Timer = 999;
|
|
}
|
|
|
|
if(FastBlink_Timer == 0)
|
|
{
|
|
FastBlink_Timer = 249;
|
|
FastBlink_Toggle ^= 1;
|
|
}
|
|
|
|
if(Blink_Timer == 0)
|
|
{
|
|
Blink_Timer = 499;
|
|
|
|
if(Blink_Toggle == 0)
|
|
{
|
|
Blink_Toggle = 1;
|
|
}
|
|
else
|
|
{
|
|
Blink_Toggle = 0;
|
|
if(Blinking_Count)
|
|
{
|
|
Blinking_Count--;
|
|
}
|
|
}
|
|
__wdt_reset();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|