stm32l010 oled hal
Dependencies: mbed SSD1308_128x64_I2C
Revision 0:a7a2ca5b41fe, committed 22 months ago
- Comitter:
- caa45040
- Date:
- Thu Aug 04 22:34:46 2022 +0000
- Commit message:
- stm32l010 oled hal
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SSD1308_128x64_I2C.lib Thu Aug 04 22:34:46 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/caa45040/code/SSD1308_128x64_I2C/#20e48680a5f8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Aug 04 22:34:46 2022 +0000 @@ -0,0 +1,90 @@ + +//HAL_oled_16x24_010_1 + + +#include "mbed.h" +#include "SSD1308.h" + + +#define ADDR (0x70<<1) // address + +int main() { + + __HAL_RCC_GPIOA_CLK_ENABLE(); + + GPIO_InitTypeDef GPIO_InitStruct = {0}; + + GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10; + GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF1_I2C1; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = GPIO_PIN_4; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + __HAL_RCC_I2C1_CLK_ENABLE(); + + + I2C_HandleTypeDef hi2c1; + + hi2c1.Instance = I2C1; + hi2c1.Init.Timing = 0x00000708; + hi2c1.Init.OwnAddress1 = 0; + hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; + hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; + hi2c1.Init.OwnAddress2 = 0; + hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK; + hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; + hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; + HAL_I2C_Init(&hi2c1); + + HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE); + + HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0); + + +wait_ms(200); + + + SSD1308 oled = SSD1308( &hi2c1 , SSD1308_SA0); + //SSD1308 oled = SSD1308( &hi2c1 , ADDR); + + + + //char n1_8[] = "12345678"; + char n1_8[] = "87654321"; + //char n1_8[] = "88888888"; + + int ii=0; + for(int nn=0; nn<8; nn++) { + // y x + oled.writeBigChar(0, ii*16,n1_8[nn]); + ii = ii + 1; + } //for + //pc.printf("Printed something\r\n"); +// printf("Printed something\r\n"); + + //oled.writeString(0, 0, "Hello World !"); + + + + + + + +}//main + + + + +//容量削減 +void error(const char* format, ...) {} + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Aug 04 22:34:46 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/86740a56073b \ No newline at end of file