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
| set(PRJ_NAME CLion_STM_LED) | |
| set(MCU_FAMILY STM32F1xx) | |
| set(MCU_LINE STM32F103xB) | |
| set(MCU_LINKER_SCRIPT STM32F103RBTx_FLASH.ld) | |
| cmake_minimum_required(VERSION 3.6) | |
| project(${PRJ_NAME} C ASM) | |
| add_definitions(-D${MCU_LINE}) |
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 "TCA6424A.h" | |
| /* 7Bit - 0x23 (a0 = 1) | |
| 7Bit - 0x22 (a0 = 0) | |
| */ | |
| const uint8_t SlaveAddress = 0x46; | |
| static uint32_t OUTPUT_Reg = 0x00; | |
| /** 底层调用定义 */ |
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 "INA226.h" | |
| int16_t combi_int16(uint8_t *ptr) | |
| { | |
| return *ptr++ << 8 | *ptr; | |
| } | |
| uint8_t INA226_Reset(INA226_t *ptr) | |
| { |
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 "ADS1115.h" | |
| uint8_t ADS1115_Init(ADS1115_t *ptr) | |
| { | |
| uint16_t buf = 0x8083; | |
| // Pins | |
| buf &= ~(0x03 << 12); //[14:12] | |
| buf |= ptr->Pin << 12; |
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
| int Euclidean(int num_1, int num_2) { | |
| int a = num_1 > num_2 ? num_1 : num_2; | |
| int b = num_1 > num_2 ? num_2 : num_1; | |
| int tmp; | |
| while (a % b = tmp) { | |
| a = b; | |
| b = tmp; | |
| } | |
| return b; | |
| } |
NewerOlder