목록All (635)
Brise
1234567891011121314151617181920212223242526272829303132333435363738394041#include "stm32f4xx.h" __IO uint16_t verti;__IO float v = 0.0f; int main(void) { GPIO_InitTypeDef GPIO_InitStructure; ADC_CommonInitTypeDef ADC_CommonInitStructure; ADC_InitTypeDef ADC_InitStructure; RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOA, ENABLE); GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GP..
123456789101112131415161718192021222324252627#include "stm32f4xx.h" __IO uint16_t verti;__IO float v = 0.0f; int main(void) { RCC->AHB1ENR |= RCC_AHB1Periph_GPIOA; GPIOA->MODER |= 0x3 CCR &= ~ADC_CCR_ADCPRE; ADC->CCR |= (ADC_CCR_ADCPRE_1 | ADC_CCR_ADCPRE_0); ADC1->SQR1 &= ~ADC_SQR1_L; ADC1->SMPR2 &= ~ADC_SMPR2_SMP1; ADC1->SQR3 &= ~ADC_SQR3_SQ1; ADC1->SQR3 |= ADC_SQR3_SQ1_0; ADC1->CR2 |= ADC_CR2_..
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100#include #include "stm32f4xx.h" void UART2_init(){ GPIO_InitTypeDef GPIO_InitStruct; GPIO_StructInit(&GPIO_InitStruct); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF; GPIO_..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162#include #include "stm32f4xx.h" int fputc(int ch, FILE *f) { while(USART_GetFlagStatus(USART2, USART_FLAG_TXE)==0); /* TX가 가능할 때까지 blocking*/ USART_SendData(USART2, ch); /* 데이터를 보낸다. */ return (ch);} int main(){ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); GPIO_InitTypeDef ..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#include "stm32f4xx.h" int main(){ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); GPIO_InitTypeDef GPIO_InitStruct; GPIO_StructInit(&GPIO_InitStruct); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF; GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_StructInit(&GPIO_InitStruct..
12345678910111213141516171819202122232425#include "stm32f4xx.h"int main(){ RCC->AHB1ENR |= RCC_AHB1Periph_GPIOA; GPIOA->MODER &= ~((0x3
디스커버리 보드의 BSP는 사용자에게 여러 기능들을 편리하게 사용할 수 있는 기능들을 제공하지만, 예제 프로젝트가 CubeMX기반이 아니다 보니 유저가 설정을 추가하거나 바꾸기 힘든 부분이 있습니다. 때문에 CubeMX로 생성하고 BSP설정을 추가하는 노가다를 해야하는데, 이 부분의 수고를 덜기 위해 CubeMX프로젝트에 BSP을 추가하여 연동하는 방법을 이 포스트에서 소개합니다. 전체 프로젝트를 올리면 편하겠지만, 용량 문제로 필요한 파일만 업로드 합니다. 1. CubeMX를 설치합니다. 2. 첨부된 파일을 이용하여 프로젝트 코드를 생성합니다. (프로젝트 생성 디렉토리 변경 필요)3. 생성된 프로젝트를 엽니다. 4. BSP 관련 파일을 추가합니다. C:\Users\${UserName}\STM32Cube..