일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- everon
- 서버리스
- 보안
- 홈어시스턴트
- dynamodb
- 전기차충전
- raspberry
- 완속충전기
- 라즈베리파이
- flask
- 전기차
- 안드로이드
- esp8266
- YMODEM
- IOT Core
- 전기차충전기
- STM32
- 디자인패턴
- 에버온
- AWS
- 충전기
- 플라스크
- Android
- 파이썬
- 펌웨어
- thread
- OCPP
- 급속충전기
- lambda
- homeassistant
Archives
- Today
- Total
Louie NRT Story
[Firmware] M058 - gpio_timer_delay 본문
반응형
[설명]
- P0.3에 LED를 설피함
- 0.5초마다 LED가 깜빡임
[기본코드]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include <stdio.h>
#include "M051Series.h"
#define PLL_CLOCK 50000000
void TMR1_init(void)
{
CLK_EnableModuleClock(TMR1_MODULE);
CLK_SetModuleClock(TMR1_MODULE, CLK_CLKSEL1_TMR1_S_HIRC, 1);
}
void SYS_Init(void)
{
/*---------------------------------------------------------------------------------------------------------*/
/* Init System Clock */
/*---------------------------------------------------------------------------------------------------------*/
/* Enable Internal RC 22.1184MHz clock */
CLK_EnableXtalRC(CLK_PWRCON_OSC22M_EN_Msk);
/* Waiting for Internal RC clock ready */
CLK_WaitClockReady(CLK_CLKSTATUS_OSC22M_STB_Msk);
/* Switch HCLK clock source to Internal RC and HCLK source divide 1 */
CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_HIRC, CLK_CLKDIV_HCLK(1));
/* Set core clock as PLL_CLOCK from PLL */
CLK_SetCoreClock(PLL_CLOCK);
/* Enable UART module clock */
CLK_EnableModuleClock(UART0_MODULE);
/* Select UART module clock source */
CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UART_S_PLL, CLK_CLKDIV_UART(1));
}
int main(void)
{
/* Unlock protected registers */
SYS_UnlockReg();
/* Init System, peripheral clock and multi-function I/O */
SYS_Init();
/* Lock protected registers */
SYS_LockReg();
TMR1_init();
GPIO_SetMode(P0, BIT3, GPIO_PMD_OUTPUT); //Water LED
P03 = 0;
while(1)
{
P03 ^= 1;
//Delay period in micro seconds. Valid values are between 100~1000000 (100 micro second ~ 1 second).
TIMER_Delay(TIMER1, 500000); //0.5 sec
}
}
|
반응형
'스마트홈' 카테고리의 다른 글
[Firmware] M058 - UART (0) | 2019.05.03 |
---|---|
[Firmware] M058 - PWM (0) | 2019.05.03 |
[Firmware] M058 - gpio_output/input (0) | 2019.05.03 |
[인공지능] Recurrent Neural Network (0) | 2017.12.04 |
[인공지능] Convolutional Neural Network (0) | 2017.12.04 |
Comments