remove dead code
This commit is contained in:
@@ -5,37 +5,34 @@
|
|||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "tim.h"
|
#include "tim.h"
|
||||||
|
|
||||||
|
// this is a stm8 rtc demo UART1 print,the baud rate is 57600.
|
||||||
|
// LED GPIOB0
|
||||||
|
|
||||||
//this is a stm8 rtc demo UART1 print,the baud rate is 57600.
|
// Init LED IO
|
||||||
//LED GPIOB0
|
|
||||||
|
|
||||||
//Init LED IO
|
|
||||||
void LED_GPIO_Init(void)
|
void LED_GPIO_Init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
GPIO_Init(GPIOB, GPIO_Pin_0, GPIO_Mode_Out_PP_Low_Slow);
|
GPIO_Init(GPIOB, GPIO_Pin_0, GPIO_Mode_Out_PP_Low_Slow);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the GPIOB0 Pin to high
|
// set the GPIOB0 Pin to high
|
||||||
void LED_On(void)
|
void LED_On(void)
|
||||||
{
|
{
|
||||||
GPIO_SetBits(GPIOB, GPIO_Pin_0);
|
GPIO_SetBits(GPIOB, GPIO_Pin_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the GPIOB0 Pin to low
|
// set the GPIOB0 Pin to low
|
||||||
void LED_Off(void)
|
void LED_Off(void)
|
||||||
{
|
{
|
||||||
GPIO_ResetBits(GPIOB, GPIO_Pin_0);
|
GPIO_ResetBits(GPIOB, GPIO_Pin_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//About 1 second, not exactly, just for demonstration purposes
|
// About 1 second, not exactly, just for demonstration purposes
|
||||||
void Delay(unsigned int time)
|
void Delay(unsigned int time)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
while (time--)
|
while (time--) {
|
||||||
{
|
for (i = 300; i > 0; --i) {
|
||||||
for (i = 300; i > 0; i--)
|
|
||||||
{
|
|
||||||
asm("nop");
|
asm("nop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,45 +57,6 @@ void disp_rtc(void)
|
|||||||
UART1_Send_String(" \r\n");
|
UART1_Send_String(" \r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
LED_GPIO_Init();
|
|
||||||
LED_On();
|
|
||||||
|
|
||||||
UART1_Init(57600); //Init the UART1 and the baud rate is 57600
|
|
||||||
UART1_Send_String("RTC Demo Code\r\n");
|
|
||||||
|
|
||||||
RTC_Setting_Init(); //Init RTC
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
|
|
||||||
RTC_Get_Time();
|
|
||||||
UART1_Send_String("Current Time:");
|
|
||||||
UART1_Send_Dec(clock.cYear, 2); //YY-MM-DD
|
|
||||||
UART1_Send_String("-");
|
|
||||||
UART1_Send_Dec(clock.cMonth, 2);
|
|
||||||
UART1_Send_String("-");
|
|
||||||
UART1_Send_Dec(clock.cDay, 2);
|
|
||||||
|
|
||||||
UART1_Send_String(" "); //HH:MM:SS
|
|
||||||
UART1_Send_Dec(clock.cHour, 2);
|
|
||||||
UART1_Send_String(":");
|
|
||||||
UART1_Send_Dec(clock.cMinute, 2);
|
|
||||||
UART1_Send_String(":");
|
|
||||||
UART1_Send_Dec(clock.cSecond, 2);
|
|
||||||
UART1_Send_String(" ");
|
|
||||||
|
|
||||||
LED_On();
|
|
||||||
Delay(200);
|
|
||||||
LED_Off();
|
|
||||||
Delay(200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void task1_entry(void *arg)
|
void task1_entry(void *arg)
|
||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -139,12 +97,11 @@ int main(void)
|
|||||||
4,
|
4,
|
||||||
task1_stack, sizeof(task1_stack),
|
task1_stack, sizeof(task1_stack),
|
||||||
0);
|
0);
|
||||||
#if 1
|
|
||||||
tos_task_create(&task2, "task2", task2_entry, NULL,
|
tos_task_create(&task2, "task2", task2_entry, NULL,
|
||||||
4,
|
4,
|
||||||
task2_stack, sizeof(task2_stack),
|
task2_stack, sizeof(task2_stack),
|
||||||
0);
|
0);
|
||||||
#endif
|
|
||||||
|
|
||||||
tos_knl_start();
|
tos_knl_start();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user