This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SPI.h> | |
| #include <Wire.h> | |
| #include <Adafruit_GFX.h> | |
| #include <Adafruit_SSD1306.h> | |
| #define I2C_SLAVE_ADDRESS 0x4 | |
| #define MEASURE_TEMPERATURE 0xA0 | |
| #define SEND_TEMPERATURE 0xB0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const int reset_pin = 5; | |
| uint32_t count = 10; | |
| void software_reset(void) | |
| { | |
| digitalWrite(reset_pin, LOW); | |
| } | |
| void setup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint32_t count = 10; | |
| void wdt_reset(void) | |
| { | |
| // Watchdog Timer initialization | |
| // Watchdog Timer Prescaler: OSC/2k (2048 cycles) | |
| // Watchdog timeout action: Reset | |
| WDTCSR = (0 << WDIF) | (0 << WDIE) | (0 << WDP3) | (1 << WDCE) | (1 << WDE) | (0 << WDP2) | (0 << WDP1) | (0 << WDP0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "inc/hw_types.h" | |
| #include "driverlib/prcm.h" | |
| #include "driverlib/wdt.h" | |
| void wdt_reset(void) | |
| { | |
| // Watchdog 활성화, clock source 지정 | |
| MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK); | |
| // WDT 레지스터 잠금 해제 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "inc/hw_types.h" | |
| #include "driverlib/prcm.h" | |
| #define SLOW_CLK_FREQ (32*1024) | |
| void hibernate_reset(void) | |
| { | |
| // 동면에서 깨어날 시간(RTC) 설정 (본 예제는 1초) | |
| MAP_PRCMHibernateIntervalSet(1 * SLOW_CLK_FREQ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stm32f1xx_hal.h" | |
| UART_HandleTypeDef UartHandle; /* UART 핸들러 */ | |
| __IO ITStatus UartReady = RESET; /* UART 상태 지시자 */ | |
| #define RXBUFFERSIZE 10 | |
| uint8_t aRxBuffer[RXBUFFERSIZE]; /* UART 수신 버퍼 */ | |
| int main(void) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void loop() | |
| { | |
| char ch; | |
| while (Serial.available()) { | |
| ch = Serial.read(); | |
| /* 수신된 데이터 처리 */ | |
| /* ... */ | |
| } | |
| /* UART 데이터가 없을 때 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stm32f1xx_hal.h" | |
| #include "ringbuf.h" | |
| UART_HandleTypeDef huart2; | |
| #define RBSIZE 256 | |
| ringbuffer_t rb; // 링버퍼 변수 | |
| uint8_t rbrawbuffer[RBSIZE]; // 링버퍼의 raw 버퍼 | |
| uint8_t userbuffer[RBSIZE]; // 링버러에서 데이터를 꺼낼 사용자 버퍼 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**************************************************************************//** | |
| * @file | |
| * @brief Empty Project | |
| * @author Energy Micro AS | |
| * @version 3.20.2 | |
| ****************************************************************************** | |
| * @section License | |
| * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b> | |
| ******************************************************************************* | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //========================================================= | |
| // src/InitDevice.c: generated by Hardware Configurator | |
| // | |
| // This file will be regenerated when saving a document. | |
| // leave the sections inside the "$[...]" comment tags alone | |
| // or they will be overwritten! | |
| //========================================================= | |
| // USER INCLUDES | |
| #include "InitDevice.h" |