From f97e987d13982c15f871d532566367ce453ebe56 Mon Sep 17 00:00:00 2001 From: but0n Date: Sun, 11 Sep 2016 10:52:45 +0800 Subject: [PATCH] DEL: Remove OLED Componente --- README.md | 12 +- .../STM32F10x_StdPeriph_Driver/inc/oled.h | 20 -- .../STM32F10x_StdPeriph_Driver/src/oled.c | 249 ------------------ 3 files changed, 6 insertions(+), 275 deletions(-) delete mode 100644 libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/oled.h delete mode 100644 libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/oled.c diff --git a/README.md b/README.md index e460705..8a0ad61 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ [UAV] - [STM32F103] - 6 Axes sensor MPU6050 - Quaternion & Euler Angles Compute - PID Controller # GPIO List -MPU6050 | BLDC | Wi-Fi | OLED Screen | LED +MPU6050 | BLDC | Wi-Fi | LED :------:|:----:|:-----:|:-----------:|:--- -**`SCL`** PB15|**`PWM`** PA7|**`USART3_TX`** PB10|**`SDIN`** PB3|**`LED0`** PA8 -**`SDA`** PB13||**`USART3_RX`** PB11|**`SCLK`** PB4|**`LED1`** PD2 -**`AD0`** PC6 |||**`DC`** PB5 -||||**`RST`** PB6 -||||**`CS`** PB7 +**`SCL`** PB15|**`PWM`** PA7|**`USART3_TX`** PB10|**`LED0`** PA8 +**`SDA`** PB13||**`USART3_RX`** PB11|**`LED1`** PD2 +**`AD0`** PC6 | + + # Todolist * Software **I2C** diff --git a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/oled.h b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/oled.h deleted file mode 100644 index 47000fb..0000000 --- a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/oled.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#ifndef OLED_H_ -#define OLED_H_ - -#define SDIN_OLED BIT_ADDR((GPIOB_BASE+12), 3) -#define SCLK_OLED BIT_ADDR((GPIOB_BASE+12), 4) -#define DC_OLED BIT_ADDR((GPIOB_BASE+12), 5) -#define RST_OLED BIT_ADDR((GPIOB_BASE+12), 6) -#define CS_OLED BIT_ADDR((GPIOB_BASE+12), 7) - - -void delay_us(volatile unsigned int nus); -void oled_portInit(); -void oled_sendData(unsigned char dat); -void oled_sendCmd(unsigned char cmd); -void oled_init(); -void fill_ram (unsigned char h, unsigned char l); - - -#endif diff --git a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/oled.c b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/oled.c deleted file mode 100644 index ad3eb91..0000000 --- a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/oled.c +++ /dev/null @@ -1,249 +0,0 @@ -#include "oled.h" -#include "bit.h" -#include "stm32f10x.h" - - -void delay_oled(volatile unsigned int nus) { - for(nus *= 4; nus; nus--); -} - - -void oled_portInit() { - RCC->APB2ENR |= 1<<3; //GPIOB enable - RCC->APB2ENR |= 1; //AFIO enable - AFIO->MAPR &= 0xF8FFFFFF; //Clean SWJ_CFG[2:0] - AFIO->MAPR |= 0x04000000; //Set SWJ_CFG[2:0] = 100 - - - GPIOB->CRL &= 0x00000FFF; - GPIOB->CRL |= 0x33333FFF; - - SDIN_OLED = 0; - SCLK_OLED = 0; - DC_OLED = 0; - RST_OLED = 0; - CS_OLED = 0; - -} - -void oled_sendData(unsigned char dat) { - CS_OLED = 0; - DC_OLED = 0; - - unsigned char i; - for(i = 0; i < 8; i++) { - SDIN_OLED = (dat&0x80)>>7; - dat <<= 1; - delay_oled(10); - SCLK_OLED = 1; - delay_oled(10); - SCLK_OLED = 0; - } - delay_oled(10); - CS_OLED = 1; -} - -void oled_sendCmd(unsigned char cmd) { - CS_OLED = 0; - DC_OLED = 1; - - unsigned char i; - for(i = 0; i < 8; i++) { - SDIN_OLED = (cmd&0x80)>>7; - cmd <<= 1; - delay_oled(10); - SCLK_OLED = 1; - delay_oled(10); - SCLK_OLED = 0; - } - delay_oled(10); - CS_OLED = 1; -} - -void oled_init() { - - oled_portInit(); - - RST_OLED = 1; - delay_oled(10); - RST_OLED = 0; - delay_oled(10); - RST_OLED = 1; - - //Command Lock - oled_sendCmd (0xFD); - oled_sendData (0x12); - - //Command Lock - oled_sendCmd (0xFD); - oled_sendData (0xB1); - - //Set Sleep Mode On - oled_sendCmd (0xAE); - - //Set Display Clock Divide Ratio/Oscillator Frequency - oled_sendCmd (0xB3); - oled_sendData (0xF1); - - //Set Multiplex Ratio - oled_sendCmd (0xCA); - oled_sendData (0x7F); - - //Set Display Offset - oled_sendCmd (0xA2); - oled_sendData (0x00); - - //Set Display Start Line - oled_sendCmd (0xA1); - oled_sendData (0x00); - - //Set Re-Map & Color Depth - oled_sendCmd (0xA0); - oled_sendData (0x74); - - //Set GPIO - oled_sendCmd (0xB5); - oled_sendData (0x00); - - - //Function Selection - oled_sendCmd (0xAB); - oled_sendData (0x01); - - //Set Segment Low Voltage - oled_sendCmd (0xB4); - oled_sendData (0xA0); - oled_sendData (0xB5); - oled_sendData (0x55); - - //Set Contrast Current - oled_sendCmd (0xC1); - oled_sendData (0xC8); - oled_sendData (0x80); - oled_sendData (0xC8); - - //Set Master Current Control - oled_sendCmd (0xC7); - oled_sendData (0x0F); - - //Gamma Look up Table - oled_sendCmd (0xB8); - oled_sendData (0x02); - oled_sendData (0x03); - oled_sendData (0x04); - oled_sendData (0x05); - oled_sendData (0x06); - oled_sendData (0x07); - oled_sendData (0x08); - oled_sendData (0x09); - oled_sendData (0x0A); - oled_sendData (0x0B); - oled_sendData (0x0C); - oled_sendData (0x0D); - oled_sendData (0x0E); - oled_sendData (0x0F); - oled_sendData (0x10); - oled_sendData (0x11); - oled_sendData (0x12); - oled_sendData (0x13); - oled_sendData (0x15); - oled_sendData (0x17); - oled_sendData (0x19); - oled_sendData (0x1B); - oled_sendData (0x1D); - oled_sendData (0x1F); - oled_sendData (0x21); - oled_sendData (0x23); - oled_sendData (0x25); - oled_sendData (0x27); - oled_sendData (0x2A); - oled_sendData (0x2D); - oled_sendData (0x30); - oled_sendData (0x33); - oled_sendData (0x36); - oled_sendData (0x39); - oled_sendData (0x3C); - oled_sendData (0x3F); - oled_sendData (0x42); - oled_sendData (0x45); - oled_sendData (0x48); - oled_sendData (0x4C); - oled_sendData (0x50); - oled_sendData (0x54); - oled_sendData (0x58); - oled_sendData (0x5C); - oled_sendData (0x60); - oled_sendData (0x64); - oled_sendData (0x68); - oled_sendData (0x6C); - oled_sendData (0x70); - oled_sendData (0x74); - oled_sendData (0x78); - oled_sendData (0x7D); - oled_sendData (0x82); - oled_sendData (0x87); - oled_sendData (0x8C); - oled_sendData (0x91); - oled_sendData (0x96); - oled_sendData (0x9B); - oled_sendData (0xA0); - oled_sendData (0xA5); - oled_sendData (0xAA); - oled_sendData (0xAF); - oled_sendData (0xB4); - oled_sendData (0x00); - - //Set Phase Length - oled_sendCmd (0xB1); - oled_sendData (0x32); - - - //Enhance Driving Scheme Capability - oled_sendCmd (0xB2); - oled_sendData (0xA4); - oled_sendData (0x00); - oled_sendData (0x00); - - //Set Pre-Charge Voltage - oled_sendCmd (0xBB); - oled_sendData (0x17); - - //Set Second Pre-Charge Period - oled_sendCmd (0xB6); - oled_sendData (0x01); - - //Set VCOMH Voltage - oled_sendCmd (0xBE); - oled_sendData (0x05); - - //Set Display Mode - oled_sendCmd (0xA6); - - //Clear Screen - fill_ram (0x03, 0x00); - - //Set Sleep Mode Off - oled_sendCmd (0xAF); - -} - -void fill_ram (unsigned char h, unsigned char l) { - unsigned char i, c; - oled_sendCmd (0x15); - oled_sendData (0x00); - oled_sendData (0x7F); - - oled_sendCmd (0x75); - oled_sendData (0x00); - oled_sendData (0x7F); - - oled_sendCmd (0x5C); - - for (i = 0; i < 128; i++) { - for (c = 0; c < 128; c++) { - oled_sendData (h); - oled_sendData (l); - } - } - -}