-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ad3953a
Showing
101 changed files
with
143,747 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# depslib dependency file v1.0 | ||
1400785053 source:d:\stm32\projects\lcd\src\i2c.c | ||
"stm32f10x.h" | ||
"stm32f10x_gpio.h" | ||
"stm32f10x_rcc.h" | ||
"delay.h" | ||
"stm32f10x_i2c.h" | ||
"I2C.h" | ||
|
||
1400567812 d:\stm32\projects\lcd\cmsis_boot\stm32f10x.h | ||
"core_cm3.h" | ||
"system_stm32f10x.h" | ||
<stdint.h> | ||
"stm32f10x_conf.h" | ||
|
||
1400567812 d:\stm32\projects\lcd\cmsis\core_cm3.h | ||
<stdint.h> | ||
<core_cmInstr.h> | ||
<core_cmFunc.h> | ||
|
||
1400567812 d:\stm32\projects\lcd\cmsis\core_cminstr.h | ||
<cmsis_iar.h> | ||
<cmsis_ccs.h> | ||
|
||
1400567812 d:\stm32\projects\lcd\cmsis\core_cmfunc.h | ||
<cmsis_iar.h> | ||
<cmsis_ccs.h> | ||
|
||
1400567812 d:\stm32\projects\lcd\cmsis_boot\system_stm32f10x.h | ||
|
||
1400567812 d:\stm32\projects\lcd\cmsis_boot\stm32f10x_conf.h | ||
|
||
1400567812 d:\stm32\projects\lcd\stm_lib\inc\stm32f10x_gpio.h | ||
"stm32f10x.h" | ||
|
||
1400567812 d:\stm32\projects\lcd\stm_lib\inc\stm32f10x_rcc.h | ||
"stm32f10x.h" | ||
|
||
1400784682 d:\stm32\projects\lcd\src\delay.h | ||
|
||
1299739636 d:\stm32\projects\lcd\stm_lib\inc\stm32f10x_i2c.h | ||
"stm32f10x.h" | ||
|
||
1400784992 d:\stm32\projects\lcd\src\i2c.h | ||
"stm32f10x.h" | ||
"stm32f10x_gpio.h" | ||
"stm32f10x_rcc.h" | ||
"delay.h" | ||
"stm32f10x_i2c.h" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<EmBlocks_project_file> | ||
<FileVersion major="1" minor="0" /> | ||
<Project> | ||
<Option title="LCD" /> | ||
<Option pch_mode="2" /> | ||
<Option compiler="armgcc_eb" /> | ||
<Build> | ||
<Target title="Release"> | ||
<Option output="bin\Release\LCD.elf" /> | ||
<Option object_output="obj\Release\" /> | ||
<Option type="0" /> | ||
<Option create_hex="1" /> | ||
<Option compiler="armgcc_eb" /> | ||
<Option projectDeviceOptionsRelation="0" /> | ||
<Compiler> | ||
<Add option="-O2" /> | ||
<Add option="-g2" /> | ||
<Add option="-fdata-sections" /> | ||
<Add option="-ffunction-sections" /> | ||
</Compiler> | ||
<Assembler> | ||
<Add option="-Wa,--no-warn" /> | ||
</Assembler> | ||
</Target> | ||
<Environment> | ||
<Variable name="cpuname" value="STM32F103C8" /> | ||
</Environment> | ||
</Build> | ||
<Device> | ||
<Add option="$device=cortex-m3" /> | ||
<Add option="$heap=0x0000" /> | ||
<Add option="$stack=0x0100" /> | ||
<Add option="$lscript=gcc_arm.ld" /> | ||
</Device> | ||
<Compiler> | ||
<Add option="-DSTM32F10X_MD" /> | ||
<Add option="-DUSE_STDPERIPH_DRIVER" /> | ||
<Add directory=".\Inc" /> | ||
<Add directory=".\cmsis" /> | ||
<Add directory=".\cmsis_boot" /> | ||
<Add directory=".\stm_lib\src" /> | ||
<Add directory=".\stm_lib\inc" /> | ||
<Add directory=".\STM32_USB-FS-Device_Driver\src" /> | ||
<Add directory=".\STM32_USB-FS-Device_Driver\inc" /> | ||
</Compiler> | ||
<Linker> | ||
<Add option="-eb_start_files" /> | ||
<Add option="-Wl,--gc-sections" /> | ||
</Linker> | ||
<Unit filename="Src\I2C.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="Src\I2C.h" /> | ||
<Unit filename="Src\LiquidCrystal_I2C.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="Src\LiquidCrystal_I2C.h" /> | ||
<Unit filename="Src\USART.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="Src\USART.h" /> | ||
<Unit filename="Src\delay.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="Src\delay.h" /> | ||
<Unit filename="Src\main.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="Svd\STM32F100xx.svd" /> | ||
<Unit filename="Svd\STM32F101xx.svd" /> | ||
<Unit filename="Svd\STM32F102xx.svd" /> | ||
<Unit filename="Svd\STM32F103xx.svd" /> | ||
<Unit filename="Svd\STM32F105xx.svd" /> | ||
<Unit filename="Svd\STM32F107xx.svd" /> | ||
<Unit filename="cmsis\core_cm3.h" /> | ||
<Unit filename="cmsis\core_cmFunc.h" /> | ||
<Unit filename="cmsis\core_cmInstr.h" /> | ||
<Unit filename="cmsis_boot\startup\startup_stm32f10x_md.S"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="cmsis_boot\stm32f10x.h" /> | ||
<Unit filename="cmsis_boot\stm32f10x_conf.h" /> | ||
<Unit filename="cmsis_boot\system_stm32f10x.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="cmsis_boot\system_stm32f10x.h" /> | ||
<Unit filename="gcc_arm.ld" /> | ||
<Unit filename="readme.txt" /> | ||
<Unit filename="stm_lib\inc\stm32f10x_gpio.h" /> | ||
<Unit filename="stm_lib\inc\stm32f10x_rcc.h" /> | ||
<Unit filename="stm_lib\inc\stm32f10x_usart.h" /> | ||
<Unit filename="stm_lib\src\stm32f10x_gpio.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="stm_lib\src\stm32f10x_i2c.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="stm_lib\src\stm32f10x_rcc.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="stm_lib\src\stm32f10x_usart.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Extensions> | ||
<code_completion /> | ||
<debugger> | ||
<target_debugging_settings target="Release" active_interface="ST-link"> | ||
<debug_interface interface_id="ST-link" ip_address="localhost" ip_port="4242" path="${EMBLOCKS}\share\contrib" executable="STLinkGDB.exe" description="" dont_start_server="false" backoff_time="1000" options="0" active_family="STMicroelectronics"> | ||
<family_options family_id="STMicroelectronics"> | ||
<option opt_id="ID_JTAG_SWD" opt_value="swd" /> | ||
<option opt_id="ID_VECTOR_START" opt_value="0x08000000" /> | ||
<option opt_id="ID_LOAD_PROGRAM" opt_value="1" /> | ||
<option opt_id="ID_RAM_EXEC" opt_value="0" /> | ||
<option opt_id="ID_VEC_TABLE" opt_value="1" /> | ||
<option opt_id="ID_VERBOSE_LEVEL" opt_value="3" /> | ||
</family_options> | ||
</debug_interface> | ||
</target_debugging_settings> | ||
</debugger> | ||
<envvars /> | ||
</Extensions> | ||
</Project> | ||
</EmBlocks_project_file> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<EmBlocks_layout_file> | ||
<ActiveTarget name="Release" /> | ||
<File name="Src\I2C.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="213" topLine="0" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\I2C.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="127" topLine="0" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\LiquidCrystal_I2C.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="6072" topLine="194" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\LiquidCrystal_I2C.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="2634" topLine="81" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\USART.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="717" topLine="3" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\delay.c" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="360" topLine="2" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\delay.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="52" topLine="0" /> | ||
</Cursor> | ||
</File> | ||
<File name="Src\main.c" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="894" topLine="11" /> | ||
</Cursor> | ||
</File> | ||
<File name="cmsis_boot\stm32f10x.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="6264" topLine="113" /> | ||
</Cursor> | ||
</File> | ||
<File name="cmsis_boot\stm32f10x_conf.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="3427" topLine="62" /> | ||
</Cursor> | ||
</File> | ||
<File name="stm_lib\inc\stm32f10x_usart.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="3519" topLine="73" /> | ||
</Cursor> | ||
</File> | ||
<File name="stm_lib\src\stm32f10x_i2c.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="27847" topLine="168" /> | ||
</Cursor> | ||
</File> | ||
<File name="stm_lib\src\stm32f10x_rcc.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="31650" topLine="950" /> | ||
</Cursor> | ||
</File> | ||
</EmBlocks_layout_file> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
STM32_LCD_I2C | ||
============= | ||
|
||
This project about connect STM32F103 and LCD 2004 HD44780 through I2C(2Wire). Look this http://habrahabr.ru/post/223947/. | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include "stm32f10x.h" | ||
#include "stm32f10x_gpio.h" | ||
#include "stm32f10x_rcc.h" | ||
#include "delay.h" | ||
#include "stm32f10x_i2c.h" | ||
#include "I2C.h" | ||
|
||
|
||
//äëÿ I2C | ||
GPIO_InitTypeDef i2c_gpio; | ||
I2C_InitTypeDef i2c; | ||
|
||
void init_I2C1(void) | ||
{ | ||
// Âêëþ÷àåì òàêòèðîâàíèå íóæíûõ ìîäóëåé | ||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); | ||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); | ||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE); | ||
|
||
// À âîò è íàñòðîéêà I2C | ||
i2c.I2C_ClockSpeed = 100000; | ||
i2c.I2C_Mode = I2C_Mode_I2C; | ||
i2c.I2C_DutyCycle = I2C_DutyCycle_2; | ||
// Àäðåñ ÿ òóò âçÿë ïåðâûé ïðèøåäøèé â ãîëîâó | ||
i2c.I2C_OwnAddress1 = 0x15; | ||
i2c.I2C_Ack = I2C_Ack_Enable; | ||
i2c.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; | ||
I2C_Init(I2C1, &i2c); | ||
|
||
// I2C èñïîëüçóåò äâå íîãè ìèêðîêîíòðîëëåðà, èõ òîæå íóæíî íàñòðîèòü | ||
i2c_gpio.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; | ||
i2c_gpio.GPIO_Mode = GPIO_Mode_AF_OD; | ||
i2c_gpio.GPIO_Speed = GPIO_Speed_50MHz; | ||
GPIO_Init(GPIOB, &i2c_gpio); | ||
|
||
// Íó è âêëþ÷àåì, ñîáñòâåííî, ìîäóëü I2C1 | ||
I2C_Cmd(I2C1, ENABLE); | ||
} | ||
|
||
/*******************************************************************/ | ||
void I2C_StartTransmission(I2C_TypeDef* I2Cx, uint8_t transmissionDirection, uint8_t slaveAddress) | ||
{ | ||
// Íà âñÿêèé ñëóûàé æäåì, ïîêà øèíà îñîâîáîäèòñÿ | ||
while(I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY)); | ||
// Ãåíåðèðóåì ñòàðò - òóò âñå ïîíÿòíî ) | ||
I2C_GenerateSTART(I2Cx, ENABLE); | ||
// Æäåì ïîêà âçëåòèò íóæíûé ôëàã | ||
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT)); | ||
// Ïîñûëàåì àäðåñ ïîä÷èíåííîìó //âîçìîæíî òóò íóæåí ñäâèã âëåâî //ñóäÿ ïî èñõîäíèêàì - äà, íóæåí ñäâèã âëåâî | ||
//http://microtechnics.ru/stm32-ispolzovanie-i2c/#comment-8109 | ||
I2C_Send7bitAddress(I2Cx, slaveAddress<<1, transmissionDirection); | ||
// À òåïåðü ó íàñ äâà âàðèàíòà ðàçâèòèÿ ñîáûòèé - â çàâèñèìîñòè îò âûáðàííîãî íàïðàâëåíèÿ îáìåíà äàííûìè | ||
if(transmissionDirection== I2C_Direction_Transmitter) | ||
{ | ||
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)); | ||
} | ||
if(transmissionDirection== I2C_Direction_Receiver) | ||
{ | ||
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED)); | ||
} | ||
} | ||
|
||
/*******************************************************************/ | ||
void I2C_WriteData(I2C_TypeDef* I2Cx, uint8_t data) | ||
{ | ||
// Ïðîñòî âûçûâàåì ãîòîâàóþ ôóíêöèþ èç SPL è æäåì, ïîêà äàííûå óëåòÿò | ||
I2C_SendData(I2Cx, data); | ||
while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_TRANSMITTED)); | ||
} | ||
|
||
|
||
|
||
/*******************************************************************/ | ||
uint8_t I2C_ReadData(I2C_TypeDef* I2Cx) | ||
{ | ||
// Òóò êàðòèíà ïîõîæà, êàê òîëüêî äàííûå ïðèøëè áûñòðåíüêî ñ÷èòûâàåì èõ è âîçâðàùàåì | ||
while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) ); | ||
uint8_t data; | ||
data = I2C_ReceiveData(I2Cx); | ||
return data; | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "stm32f10x.h" | ||
#include "stm32f10x_gpio.h" | ||
#include "stm32f10x_rcc.h" | ||
#include "delay.h" | ||
#include "stm32f10x_i2c.h" |
Oops, something went wrong.