├── (stm32) └── 1.4.0 │ ├── boards-EXCERPT.txt │ └── variants │ └── DEMO_F030F4 │ ├── PeripheralPins.c │ ├── PinNamesVar.h │ ├── ldscript.ld │ ├── stm32f0xx_hal_conf.h │ ├── variant.cpp │ └── variant.h ├── Arduino └── libraries │ ├── Alternative SSD1306 library.txt │ ├── miniOled │ ├── LICENSE │ ├── examples │ │ ├── Draw_Bitmap │ │ │ └── Draw_Bitmap.ino │ │ ├── Hello_World │ │ │ └── Hello_World.ino │ │ ├── Horizontal_Addressing_Mode │ │ │ └── Horizontal_Addressing_Mode.ino │ │ └── PrintNumbers │ │ │ └── PrintNumbers.ino │ ├── miniOled.cpp │ └── miniOled.h │ └── miniSerial │ ├── LICENSE │ ├── charQueue.h │ ├── examples │ ├── Tx-Rx-demo │ │ └── Tx-Rx-demo.ino │ └── Tx-demo │ │ └── Tx-demo.ino │ ├── miniSerial.cpp │ └── miniSerial.h ├── LICENSE ├── P1070121.JPG ├── P1070122.JPG ├── README.md ├── STM32F030-Dev-Brd.jpg └── ss66.jpg /(stm32)/1.4.0/boards-EXCERPT.txt: -------------------------------------------------------------------------------- 1 | # INTELLIGENTLY PATCH THE FOLLOWING GenF030 CONTENT INTO boards.txt 2 | # AT START OF "OTHER BOARDS" SECTION 3 | 4 | 5 | 6 | ################################################################################ 7 | # Other boards 8 | 9 | ############################### 10 | # Generic F030 11 | GenF030.name=Generic STM32F030 series 12 | 13 | GenF030.build.core=arduino 14 | GenF030.build.board=GenF030 15 | GenF030.build.extra_flags=-D{build.product_line} {build.xSerial} 16 | 17 | # DEMO_F030F4 board 18 | # Support: Serial1 (USART1 on PA3, PA2) 19 | GenF030.menu.pnum.DEMO_F030F4=STM32F030F4 Demo board 20 | GenF030.menu.pnum.DEMO_F030F4.upload.maximum_data_size=4096 21 | GenF030.menu.pnum.DEMO_F030F4.upload.maximum_size=16384 22 | GenF030.menu.pnum.DEMO_F030F4.build.mcu=cortex-m0 23 | GenF030.menu.pnum.DEMO_F030F4.build.board=DEMO_F030F4 24 | GenF030.menu.pnum.DEMO_F030F4.build.series=STM32F0xx 25 | GenF030.menu.pnum.DEMO_F030F4.build.product_line=STM32F030x6 26 | GenF030.menu.pnum.DEMO_F030F4.build.variant=DEMO_F030F4 27 | GenF030.menu.pnum.DEMO_F030F4.build.cmsis_lib_gcc=arm_cortexM0l_math 28 | 29 | # Upload menu 30 | GenF030.menu.upload_method.STLinkMethod=STLink 31 | GenF030.menu.upload_method.STLinkMethod.upload.protocol=STLink 32 | GenF030.menu.upload_method.STLinkMethod.upload.tool=stlink_upload 33 | 34 | GenF030.menu.upload_method.serialMethod=Serial 35 | GenF030.menu.upload_method.serialMethod.upload.protocol=maple_serial 36 | GenF030.menu.upload_method.serialMethod.upload.tool=serial_upload 37 | 38 | ############################### 39 | # 40 | -------------------------------------------------------------------------------- /(stm32)/1.4.0/variants/DEMO_F030F4/PeripheralPins.c: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (c) 2018, STMicroelectronics 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | ******************************************************************************* 29 | * Automatically generated from STM32F030F4Px.xml 30 | */ 31 | #include "Arduino.h" 32 | #include "PeripheralPins.h" 33 | 34 | /* ===== 35 | * Note: Commented lines are alternative possibilities which are not used per default. 36 | * If you change them, you will have to know what you do 37 | * ===== 38 | */ 39 | 40 | 41 | //*** ADC *** 42 | #ifdef HAL_ADC_MODULE_ENABLED 43 | const PinMap PinMap_ADC[] = { 44 | {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC_IN0 45 | {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC_IN1 46 | {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC_IN2 47 | {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC_IN3 48 | {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC_IN4 49 | {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC_IN5 - LED 50 | {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC_IN6 51 | {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC_IN7 52 | {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC_IN9 53 | {NC, NP, 0} 54 | }; 55 | #endif 56 | 57 | //*** DAC *** 58 | //*** No DAC *** 59 | 60 | //*** I2C *** 61 | 62 | #ifdef HAL_I2C_MODULE_ENABLED 63 | const PinMap PinMap_I2C_SDA[] = { 64 | {PA_10, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, 65 | {NC, NP, 0} 66 | }; 67 | #endif 68 | 69 | #ifdef HAL_I2C_MODULE_ENABLED 70 | const PinMap PinMap_I2C_SCL[] = { 71 | {PA_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, 72 | {NC, NP, 0} 73 | }; 74 | #endif 75 | 76 | //*** PWM *** 77 | 78 | #ifdef HAL_TIM_MODULE_ENABLED 79 | const PinMap PinMap_PWM[] = { 80 | {PA_4, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1 81 | {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 1, 0)}, // TIM3_CH1 82 | // {PA_6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM16, 1, 0)}, // TIM16_CH1 83 | // {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 1)}, // TIM1_CH1N 84 | {PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2 85 | // {PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1 86 | // {PA_7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM17, 1, 0)}, // TIM17_CH1 87 | {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 0)}, // TIM1_CH2 88 | {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3 89 | // {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 1)}, // TIM1_CH3N 90 | {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 4, 0)}, // TIM3_CH4 91 | // {PB_1, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_TIM14, 1, 0)}, // TIM14_CH1 92 | {NC, NP, 0} 93 | }; 94 | #endif 95 | 96 | //*** SERIAL *** 97 | 98 | #ifdef HAL_UART_MODULE_ENABLED 99 | const PinMap PinMap_UART_TX[] = { 100 | {PA_2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 101 | {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 102 | {PA_14, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 103 | {NC, NP, 0} 104 | }; 105 | #endif 106 | 107 | #ifdef HAL_UART_MODULE_ENABLED 108 | const PinMap PinMap_UART_RX[] = { 109 | {PA_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 110 | {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 111 | {NC, NP, 0} 112 | }; 113 | #endif 114 | 115 | #ifdef HAL_UART_MODULE_ENABLED 116 | const PinMap PinMap_UART_RTS[] = { 117 | {PA_1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 118 | {NC, NP, 0} 119 | }; 120 | #endif 121 | 122 | #ifdef HAL_UART_MODULE_ENABLED 123 | const PinMap PinMap_UART_CTS[] = { 124 | {PA_0, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, 125 | {NC, NP, 0} 126 | }; 127 | #endif 128 | 129 | //*** SPI *** 130 | 131 | #ifdef HAL_SPI_MODULE_ENABLED 132 | const PinMap PinMap_SPI_MOSI[] = { 133 | {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, 134 | {NC, NP, 0} 135 | }; 136 | #endif 137 | 138 | #ifdef HAL_SPI_MODULE_ENABLED 139 | const PinMap PinMap_SPI_MISO[] = { 140 | {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, 141 | {NC, NP, 0} 142 | }; 143 | #endif 144 | 145 | #ifdef HAL_SPI_MODULE_ENABLED 146 | const PinMap PinMap_SPI_SCLK[] = { 147 | {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, // LED 148 | {NC, NP, 0} 149 | }; 150 | #endif 151 | 152 | #ifdef HAL_SPI_MODULE_ENABLED 153 | const PinMap PinMap_SPI_SSEL[] = { 154 | {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, 155 | {NC, NP, 0} 156 | }; 157 | #endif 158 | 159 | 160 | //*** CAN *** 161 | //*** No CAN_RD *** 162 | 163 | //*** No CAN_TD *** 164 | 165 | //*** ETHERNET *** 166 | 167 | //*** No Ethernet *** 168 | 169 | //*** QUADSPI *** 170 | 171 | //*** No QUADSPI *** 172 | -------------------------------------------------------------------------------- /(stm32)/1.4.0/variants/DEMO_F030F4/PinNamesVar.h: -------------------------------------------------------------------------------- 1 | /* SYS_WKUP */ 2 | #ifdef PWR_WAKEUP_PIN1 3 | SYS_WKUP1 = PA_0, 4 | #endif 5 | #ifdef PWR_WAKEUP_PIN2 6 | SYS_WKUP2 = NC, 7 | #endif 8 | #ifdef PWR_WAKEUP_PIN3 9 | SYS_WKUP3 = NC, 10 | #endif 11 | #ifdef PWR_WAKEUP_PIN4 12 | SYS_WKUP4 = NC, 13 | #endif 14 | #ifdef PWR_WAKEUP_PIN5 15 | SYS_WKUP5 = NC, 16 | #endif 17 | #ifdef PWR_WAKEUP_PIN6 18 | SYS_WKUP6 = NC, 19 | #endif 20 | #ifdef PWR_WAKEUP_PIN7 21 | SYS_WKUP7 = NC, 22 | #endif 23 | #ifdef PWR_WAKEUP_PIN8 24 | SYS_WKUP8 = NC, 25 | #endif 26 | -------------------------------------------------------------------------------- /(stm32)/1.4.0/variants/DEMO_F030F4/ldscript.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Abstract : Linker script for STM32F030F4Px Device with 8 | ** 16KByte FLASH, 4KByte RAM 9 | ** 10 | ** Set heap size, stack size and stack location according 11 | ** to application requirements. 12 | ** 13 | ** Set memory bank area and size if external memory is used. 14 | ** 15 | ** Target : STMicroelectronics STM32 16 | ** 17 | ** 18 | ** Distribution: The file is distributed as is, without any warranty 19 | ** of any kind. 20 | ** 21 | ***************************************************************************** 22 | ** @attention 23 | ** 24 | **

© COPYRIGHT(c) 2014 Ac6

25 | ** 26 | ** Redistribution and use in source and binary forms, with or without modification, 27 | ** are permitted provided that the following conditions are met: 28 | ** 1. Redistributions of source code must retain the above copyright notice, 29 | ** this list of conditions and the following disclaimer. 30 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 31 | ** this list of conditions and the following disclaimer in the documentation 32 | ** and/or other materials provided with the distribution. 33 | ** 3. Neither the name of Ac6 nor the names of its contributors 34 | ** may be used to endorse or promote products derived from this software 35 | ** without specific prior written permission. 36 | ** 37 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 38 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 39 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 41 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 42 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 43 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 44 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 45 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 46 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | ** 48 | ***************************************************************************** 49 | */ 50 | 51 | /* Entry Point */ 52 | ENTRY(Reset_Handler) 53 | 54 | /* Highest address of the user mode stack */ 55 | _estack = 0x20001000; /* end of RAM */ 56 | /* Generate a link error if heap and stack don't fit into RAM */ 57 | _Min_Heap_Size = 0x200; /* required amount of heap */ 58 | _Min_Stack_Size = 0x400; /* required amount of stack */ 59 | 60 | /* Specify the memory areas */ 61 | MEMORY 62 | { 63 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K 64 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K 65 | } 66 | 67 | /* Define output sections */ 68 | SECTIONS 69 | { 70 | /* The startup code goes first into FLASH */ 71 | .isr_vector : 72 | { 73 | . = ALIGN(4); 74 | KEEP(*(.isr_vector)) /* Startup code */ 75 | . = ALIGN(4); 76 | } >FLASH 77 | 78 | /* The program code and other data goes into FLASH */ 79 | .text : 80 | { 81 | . = ALIGN(4); 82 | *(.text) /* .text sections (code) */ 83 | *(.text*) /* .text* sections (code) */ 84 | *(.glue_7) /* glue arm to thumb code */ 85 | *(.glue_7t) /* glue thumb to arm code */ 86 | *(.eh_frame) 87 | 88 | KEEP (*(.init)) 89 | KEEP (*(.fini)) 90 | 91 | . = ALIGN(4); 92 | _etext = .; /* define a global symbols at end of code */ 93 | } >FLASH 94 | 95 | /* Constant data goes into FLASH */ 96 | .rodata : 97 | { 98 | . = ALIGN(4); 99 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 100 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 101 | . = ALIGN(4); 102 | } >FLASH 103 | 104 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 105 | .ARM : { 106 | __exidx_start = .; 107 | *(.ARM.exidx*) 108 | __exidx_end = .; 109 | } >FLASH 110 | 111 | .preinit_array : 112 | { 113 | PROVIDE_HIDDEN (__preinit_array_start = .); 114 | KEEP (*(.preinit_array*)) 115 | PROVIDE_HIDDEN (__preinit_array_end = .); 116 | } >FLASH 117 | .init_array : 118 | { 119 | PROVIDE_HIDDEN (__init_array_start = .); 120 | KEEP (*(SORT(.init_array.*))) 121 | KEEP (*(.init_array*)) 122 | PROVIDE_HIDDEN (__init_array_end = .); 123 | } >FLASH 124 | .fini_array : 125 | { 126 | PROVIDE_HIDDEN (__fini_array_start = .); 127 | KEEP (*(SORT(.fini_array.*))) 128 | KEEP (*(.fini_array*)) 129 | PROVIDE_HIDDEN (__fini_array_end = .); 130 | } >FLASH 131 | 132 | /* used by the startup to initialize data */ 133 | _sidata = LOADADDR(.data); 134 | 135 | /* Initialized data sections goes into RAM, load LMA copy after code */ 136 | .data : 137 | { 138 | . = ALIGN(4); 139 | _sdata = .; /* create a global symbol at data start */ 140 | *(.data) /* .data sections */ 141 | *(.data*) /* .data* sections */ 142 | 143 | . = ALIGN(4); 144 | _edata = .; /* define a global symbol at data end */ 145 | } >RAM AT> FLASH 146 | 147 | 148 | /* Uninitialized data section */ 149 | . = ALIGN(4); 150 | .bss : 151 | { 152 | /* This is used by the startup in order to initialize the .bss secion */ 153 | _sbss = .; /* define a global symbol at bss start */ 154 | __bss_start__ = _sbss; 155 | *(.bss) 156 | *(.bss*) 157 | *(COMMON) 158 | 159 | . = ALIGN(4); 160 | _ebss = .; /* define a global symbol at bss end */ 161 | __bss_end__ = _ebss; 162 | } >RAM 163 | 164 | /* User_heap_stack section, used to check that there is enough RAM left */ 165 | ._user_heap_stack : 166 | { 167 | . = ALIGN(8); 168 | PROVIDE ( end = . ); 169 | PROVIDE ( _end = . ); 170 | . = . + _Min_Heap_Size; 171 | . = . + _Min_Stack_Size; 172 | . = ALIGN(8); 173 | } >RAM 174 | 175 | 176 | 177 | /* Remove information from the standard libraries */ 178 | /DISCARD/ : 179 | { 180 | libc.a ( * ) 181 | libm.a ( * ) 182 | libgcc.a ( * ) 183 | } 184 | 185 | .ARM.attributes 0 : { *(.ARM.attributes) } 186 | } 187 | 188 | 189 | -------------------------------------------------------------------------------- /(stm32)/1.4.0/variants/DEMO_F030F4/stm32f0xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_hal_conf.h 4 | * @author MCD Application Team 5 | * @brief HAL configuration file. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© COPYRIGHT(c) 2016 STMicroelectronics

10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | ****************************************************************************** 34 | */ 35 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ 37 | #ifndef __STM32F0xx_HAL_CONF_H 38 | #define __STM32F0xx_HAL_CONF_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /* Exported types ------------------------------------------------------------*/ 45 | /* Exported constants --------------------------------------------------------*/ 46 | 47 | /* ########################## Module Selection ############################## */ 48 | /** 49 | * @brief This is the list of modules to be used in the HAL driver 50 | */ 51 | #define HAL_MODULE_ENABLED 52 | #define HAL_ADC_MODULE_ENABLED 53 | /*#define HAL_CAN_MODULE_ENABLED*/ 54 | /*#define HAL_CEC_MODULE_ENABLED*/ 55 | /*#define HAL_COMP_MODULE_ENABLED*/ 56 | #define HAL_CORTEX_MODULE_ENABLED 57 | #define HAL_CRC_MODULE_ENABLED 58 | /*#define HAL_DAC_MODULE_ENABLED*/ 59 | #define HAL_DMA_MODULE_ENABLED 60 | #define HAL_FLASH_MODULE_ENABLED 61 | #define HAL_GPIO_MODULE_ENABLED 62 | #define HAL_I2C_MODULE_ENABLED 63 | /*#define HAL_I2S_MODULE_ENABLED*/ 64 | /*#define HAL_IRDA_MODULE_ENABLED*/ 65 | #define HAL_IWDG_MODULE_ENABLED 66 | /*#define HAL_PCD_MODULE_ENABLED*/ 67 | /*#define HAL_PWR_MODULE_ENABLED*/ 68 | #define HAL_RCC_MODULE_ENABLED 69 | /*#define HAL_RTC_MODULE_ENABLED*/ 70 | /*#define HAL_SMARTCARD_MODULE_ENABLED*/ 71 | /*#define HAL_SMBUS_MODULE_ENABLED*/ 72 | #define HAL_SPI_MODULE_ENABLED 73 | #define HAL_TIM_MODULE_ENABLED 74 | /*#define HAL_TSC_MODULE_ENABLED*/ 75 | /*#define HAL_UART_MODULE_ENABLED*/ 76 | /*#define HAL_USART_MODULE_ENABLED*/ 77 | /*#define HAL_WWDG_MODULE_ENABLED*/ 78 | 79 | /* ######################### Oscillator Values adaptation ################### */ 80 | /** 81 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 82 | * This value is used by the RCC HAL module to compute the system frequency 83 | * (when HSE is used as system clock source, directly or through the PLL). 84 | */ 85 | #if !defined (HSE_VALUE) 86 | #define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ 87 | #endif /* HSE_VALUE */ 88 | 89 | /** 90 | * @brief In the following line adjust the External High Speed oscillator (HSE) Startup 91 | * Timeout value 92 | */ 93 | #if !defined (HSE_STARTUP_TIMEOUT) 94 | #define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ 95 | #endif /* HSE_STARTUP_TIMEOUT */ 96 | 97 | /** 98 | * @brief Internal High Speed oscillator (HSI) value. 99 | * This value is used by the RCC HAL module to compute the system frequency 100 | * (when HSI is used as system clock source, directly or through the PLL). 101 | */ 102 | #if !defined (HSI_VALUE) 103 | #define HSI_VALUE 8000000U /*!< Value of the Internal oscillator in Hz*/ 104 | #endif /* HSI_VALUE */ 105 | 106 | /** 107 | * @brief In the following line adjust the Internal High Speed oscillator (HSI) Startup 108 | * Timeout value 109 | */ 110 | #if !defined (HSI_STARTUP_TIMEOUT) 111 | #define HSI_STARTUP_TIMEOUT 5000U /*!< Time out for HSI start up */ 112 | #endif /* HSI_STARTUP_TIMEOUT */ 113 | 114 | /** 115 | * @brief Internal High Speed oscillator for ADC (HSI14) value. 116 | */ 117 | #if !defined (HSI14_VALUE) 118 | #define HSI14_VALUE 14000000U /*!< Value of the Internal High Speed oscillator for ADC in Hz. 119 | The real value may vary depending on the variations 120 | in voltage and temperature. */ 121 | #endif /* HSI14_VALUE */ 122 | 123 | /** 124 | * @brief Internal High Speed oscillator for USB (HSI48) value. 125 | */ 126 | #if !defined (HSI48_VALUE) 127 | #define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB in Hz. 128 | The real value may vary depending on the variations 129 | in voltage and temperature. */ 130 | #endif /* HSI48_VALUE */ 131 | 132 | /** 133 | * @brief Internal Low Speed oscillator (LSI) value. 134 | */ 135 | #if !defined (LSI_VALUE) 136 | #define LSI_VALUE 40000U 137 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 138 | The real value may vary depending on the variations 139 | in voltage and temperature. */ 140 | /** 141 | * @brief External Low Speed oscillator (LSE) value. 142 | */ 143 | #if !defined (LSE_VALUE) 144 | #define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */ 145 | #endif /* LSE_VALUE */ 146 | 147 | /** 148 | * @brief Time out for LSE start up value in ms. 149 | */ 150 | #if !defined (LSE_STARTUP_TIMEOUT) 151 | #define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ 152 | #endif /* LSE_STARTUP_TIMEOUT */ 153 | 154 | 155 | /* Tip: To avoid modifying this file each time you need to use different HSE, 156 | === you can define the HSE value in your toolchain compiler preprocessor. */ 157 | 158 | /* ########################### System Configuration ######################### */ 159 | /** 160 | * @brief This is the HAL system configuration section 161 | */ 162 | #define VDD_VALUE 3300U /*!< Value of VDD in mv */ 163 | #define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */ 164 | /* Warning: Must be set to higher priority for HAL_Delay() */ 165 | /* and HAL_GetTick() usage under interrupt context */ 166 | #define USE_RTOS 0U 167 | #define PREFETCH_ENABLE 1U 168 | #define INSTRUCTION_CACHE_ENABLE 0U 169 | #define DATA_CACHE_ENABLE 0U 170 | #define USE_SPI_CRC 0U 171 | 172 | /* ########################## Assert Selection ############################## */ 173 | /** 174 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 175 | * HAL drivers code 176 | */ 177 | /*#define USE_FULL_ASSERT 1*/ 178 | 179 | /* Includes ------------------------------------------------------------------*/ 180 | /** 181 | * @brief Include module's header file 182 | */ 183 | 184 | #ifdef HAL_RCC_MODULE_ENABLED 185 | #include "stm32f0xx_hal_rcc.h" 186 | #endif /* HAL_RCC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_GPIO_MODULE_ENABLED 189 | #include "stm32f0xx_hal_gpio.h" 190 | #endif /* HAL_GPIO_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_DMA_MODULE_ENABLED 193 | #include "stm32f0xx_hal_dma.h" 194 | #endif /* HAL_DMA_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_CORTEX_MODULE_ENABLED 197 | #include "stm32f0xx_hal_cortex.h" 198 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_ADC_MODULE_ENABLED 201 | #include "stm32f0xx_hal_adc.h" 202 | #endif /* HAL_ADC_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_CAN_MODULE_ENABLED 205 | #include "stm32f0xx_hal_can.h" 206 | #endif /* HAL_CAN_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_CEC_MODULE_ENABLED 209 | #include "stm32f0xx_hal_cec.h" 210 | #endif /* HAL_CEC_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_COMP_MODULE_ENABLED 213 | #include "stm32f0xx_hal_comp.h" 214 | #endif /* HAL_COMP_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_CRC_MODULE_ENABLED 217 | #include "stm32f0xx_hal_crc.h" 218 | #endif /* HAL_CRC_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_DAC_MODULE_ENABLED 221 | #include "stm32f0xx_hal_dac.h" 222 | #endif /* HAL_DAC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_FLASH_MODULE_ENABLED 225 | #include "stm32f0xx_hal_flash.h" 226 | #endif /* HAL_FLASH_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_I2C_MODULE_ENABLED 229 | #include "stm32f0xx_hal_i2c.h" 230 | #endif /* HAL_I2C_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_I2S_MODULE_ENABLED 233 | #include "stm32f0xx_hal_i2s.h" 234 | #endif /* HAL_I2S_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_IRDA_MODULE_ENABLED 237 | #include "stm32f0xx_hal_irda.h" 238 | #endif /* HAL_IRDA_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_IWDG_MODULE_ENABLED 241 | #include "stm32f0xx_hal_iwdg.h" 242 | #endif /* HAL_IWDG_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_PCD_MODULE_ENABLED 245 | #include "stm32f0xx_hal_pcd.h" 246 | #endif /* HAL_PCD_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_PWR_MODULE_ENABLED 249 | #include "stm32f0xx_hal_pwr.h" 250 | #endif /* HAL_PWR_MODULE_ENABLED */ 251 | 252 | #ifdef HAL_RTC_MODULE_ENABLED 253 | #include "stm32f0xx_hal_rtc.h" 254 | #endif /* HAL_RTC_MODULE_ENABLED */ 255 | 256 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 257 | #include "stm32f0xx_hal_smartcard.h" 258 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 259 | 260 | #ifdef HAL_SMBUS_MODULE_ENABLED 261 | #include "stm32f0xx_hal_smbus.h" 262 | #endif /* HAL_SMBUS_MODULE_ENABLED */ 263 | 264 | #ifdef HAL_SPI_MODULE_ENABLED 265 | #include "stm32f0xx_hal_spi.h" 266 | #endif /* HAL_SPI_MODULE_ENABLED */ 267 | 268 | #ifdef HAL_TIM_MODULE_ENABLED 269 | #include "stm32f0xx_hal_tim.h" 270 | #endif /* HAL_TIM_MODULE_ENABLED */ 271 | 272 | #ifdef HAL_TSC_MODULE_ENABLED 273 | #include "stm32f0xx_hal_tsc.h" 274 | #endif /* HAL_TSC_MODULE_ENABLED */ 275 | 276 | #ifdef HAL_UART_MODULE_ENABLED 277 | #include "stm32f0xx_hal_uart.h" 278 | #endif /* HAL_UART_MODULE_ENABLED */ 279 | 280 | #ifdef HAL_USART_MODULE_ENABLED 281 | #include "stm32f0xx_hal_usart.h" 282 | #endif /* HAL_USART_MODULE_ENABLED */ 283 | 284 | #ifdef HAL_WWDG_MODULE_ENABLED 285 | #include "stm32f0xx_hal_wwdg.h" 286 | #endif /* HAL_WWDG_MODULE_ENABLED */ 287 | 288 | /* Exported macro ------------------------------------------------------------*/ 289 | #ifdef USE_FULL_ASSERT 290 | /** 291 | * @brief The assert_param macro is used for function's parameters check. 292 | * @param expr If expr is false, it calls assert_failed function 293 | * which reports the name of the source file and the source 294 | * line number of the call that failed. 295 | * If expr is true, it returns no value. 296 | * @retval None 297 | */ 298 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__)) 299 | /* Exported functions ------------------------------------------------------- */ 300 | void assert_failed(char* file, uint32_t line); 301 | #else 302 | #define assert_param(expr) ((void)0U) 303 | #endif /* USE_FULL_ASSERT */ 304 | 305 | #ifdef __cplusplus 306 | } 307 | #endif 308 | 309 | #endif /* __STM32F0xx_HAL_CONF_H */ 310 | 311 | 312 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 313 | -------------------------------------------------------------------------------- /(stm32)/1.4.0/variants/DEMO_F030F4/variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (c) 2017, STMicroelectronics 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | ******************************************************************************* 29 | */ 30 | 31 | #include "variant.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | // Pin number 38 | // This array allows to wrap Arduino pin number(Dx or x) 39 | // to STM32 PinName (PX_n) 40 | const PinName digitalPin[] = { 41 | // USB connector on the top, MCU side 42 | // Left Side 43 | PA_0, //D0 44 | PA_1, //D1 45 | PA_2, //D2 - TX 46 | PA_3, //D3 - RX 47 | PA_4, //D4 - LED 48 | // Right side 49 | PA_5, //D5 - SCK 50 | PA_6, //D6 - MISO 51 | PA_7, //D7 - MOSI 52 | PB_1, //D8 - SS 53 | PA_9, //D9 - SCL (TX UART Header) 54 | PA_10, //D10 - SDA (RX UART Header) 55 | PA_13, //D11 - SWDIO 56 | PA_14, //D12 - SWCLK 57 | // Duplicated pins in order to be aligned with PinMap_ADC 58 | // A0 have to be greater than NUM_ANALOG_INPUTS 59 | PA_0, //D13/A0 ~ D0 60 | PA_1, //D14/A1 ~ D1 61 | PA_2, //D15/A2 ~ D2 62 | PA_3, //D16/A3 ~ D3 63 | PA_4, //D17/A4 ~ D4 64 | PA_5, //D18/A5 ~ D5 65 | PA_6, //D19/A6 ~ D6 66 | PA_7, //D20/A7 ~ D7 67 | PB_1 //D21/A8 ~ D8 68 | }; 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | // ---------------------------------------------------------------------------- 75 | 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | /** 81 | * @brief System Clock Configuration 82 | * @param None 83 | * @retval None 84 | */ 85 | WEAK void SystemClock_Config(void) 86 | { 87 | RCC_OscInitTypeDef RCC_OscInitStruct; 88 | RCC_ClkInitTypeDef RCC_ClkInitStruct; 89 | 90 | /* Initializes the CPU, AHB and APB busses clocks */ 91 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI14|RCC_OSCILLATORTYPE_HSE; 92 | RCC_OscInitStruct.HSEState = RCC_HSE_ON; 93 | RCC_OscInitStruct.HSI14State = RCC_HSI14_ON; 94 | RCC_OscInitStruct.HSI14CalibrationValue = 16; 95 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; 96 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; 97 | RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6; 98 | RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1; 99 | if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { 100 | _Error_Handler(__FILE__, __LINE__); 101 | } 102 | 103 | /* Initializes the CPU, AHB and APB busses clocks */ 104 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK 105 | |RCC_CLOCKTYPE_PCLK1; 106 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; 107 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 108 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; 109 | 110 | if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) { 111 | _Error_Handler(__FILE__, __LINE__); 112 | } 113 | 114 | /* Configure the Systick interrupt time */ 115 | HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); 116 | 117 | /* Configure the Systick */ 118 | HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); 119 | 120 | /* SysTick_IRQn interrupt configuration */ 121 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); 122 | } 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | -------------------------------------------------------------------------------- /(stm32)/1.4.0/variants/DEMO_F030F4/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (c) 2018, STMicroelectronics 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | ******************************************************************************* 29 | */ 30 | #ifndef _VARIANT_ARDUINO_STM32_ 31 | #define _VARIANT_ARDUINO_STM32_ 32 | 33 | /*---------------------------------------------------------------------------- 34 | * Headers 35 | *----------------------------------------------------------------------------*/ 36 | #include "PeripheralPins.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C"{ 40 | #endif // __cplusplus 41 | 42 | /*---------------------------------------------------------------------------- 43 | * Pins 44 | *----------------------------------------------------------------------------*/ 45 | extern const PinName digitalPin[]; 46 | 47 | // USB connector on the top, MCU side 48 | // Left Side 49 | #define PA0 0 //D0/A0 50 | #define PA1 1 //D1/A1 51 | #define PA2 2 //D2/A2 - TX 52 | #define PA3 3 //D3/A3 - RX 53 | #define PA4 4 //D4/A4 - LED 54 | // Right side 55 | #define PA5 5 //D5/A5 - SCK 56 | #define PA6 6 //D6/A6 - MISO 57 | #define PA7 7 //D7/A7 - MOSI 58 | #define PB1 8 //D8/A8 - SS 59 | #define PA9 9 //D9 - SCL (TX UART header) 60 | #define PA10 10 //D10 - SDA (RX UART header) 61 | #define PA13 11 //D11 - SWDIO 62 | #define PA14 12 //D12 - SWCLK 63 | 64 | // This must be a literal with the same value as PEND 65 | #define NUM_DIGITAL_PINS 22 66 | // This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS 67 | #define NUM_ANALOG_INPUTS 9 68 | #define NUM_ANALOG_FIRST 13 69 | 70 | // On-board LED pin number 71 | #define LED_BUILTIN PA4 72 | #define LED_GREEN LED_BUILTIN 73 | 74 | // SPI Definitions 75 | #define PIN_SPI_SS PB1 76 | #define PIN_SPI_MOSI PA7 77 | #define PIN_SPI_MISO PA6 78 | #define PIN_SPI_SCK PA5 79 | 80 | // I2C Definitions 81 | #define PIN_WIRE_SDA PA10 // Default for Arduino connector compatibility 82 | #define PIN_WIRE_SCL PA9 // Default for Arduino connector compatibility 83 | 84 | // Timer Definitions 85 | // Do not use timer used by PWM pins when possible. See PinMap_PWM. 86 | #define TIMER_TONE TIM17 87 | 88 | // Do not use basic timer: OC is required 89 | #define TIMER_SERVO TIM16 //TODO: advanced-control timers don't work 90 | 91 | // UART Definitions 92 | #define SERIAL_UART_INSTANCE 1 93 | // Default pin used for 'Serial' instance 94 | // Mandatory for Firmata 95 | #define PIN_SERIAL_RX PA3 96 | #define PIN_SERIAL_TX PA2 97 | 98 | #ifdef __cplusplus 99 | } // extern "C" 100 | #endif 101 | /*---------------------------------------------------------------------------- 102 | * Arduino objects - C++ only 103 | *----------------------------------------------------------------------------*/ 104 | 105 | #ifdef __cplusplus 106 | // These serial port names are intended to allow libraries and architecture-neutral 107 | // sketches to automatically default to the correct port name for a particular type 108 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 109 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 110 | // 111 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 112 | // 113 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 114 | // 115 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 116 | // 117 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 118 | // 119 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 120 | // pins are NOT connected to anything by default. 121 | #define SERIAL_PORT_MONITOR Serial 122 | #define SERIAL_PORT_HARDWARE Serial 123 | #endif 124 | 125 | #endif /* _VARIANT_ARDUINO_STM32_ */ 126 | -------------------------------------------------------------------------------- /Arduino/libraries/Alternative SSD1306 library.txt: -------------------------------------------------------------------------------- 1 | Notes on getting ACROBOTIC SSD1306 library working on 'F030F4P6 with SoftWire I2C 2 | 3 | ACROBOTIC library is lightweight and is easily run on the 'F030F4P6, 4 | either with native Wire (Pins PA10, PA9), or with SoftWire for choice of SDA / SCL. 5 | 6 | Here is how to adapt to SoftWire: 7 | 8 | In ACROBOTIC_SSD1306.cpp, add 2 lines near top: 9 | 10 | #include "SoftWire.h" 11 | extern SoftWire Wire; 12 | 13 | This configures it to use SoftWire instead of native Wire. 14 | 15 | 16 | In each example .ino file, you need to replace ... 17 | 18 | #include "Wire.h" 19 | 20 | ... at top with these 3 lines ... 21 | 22 | #include 23 | SoftWire Wire(PA6, PA5); // your choice of SDA / SCL pins 24 | char ibuffer[60]; 25 | 26 | ... and add this inside top of setup(): 27 | 28 | Wire.setRxBuffer(ibuffer, 60); 29 | Wire.setTxBuffer(ibuffer, 60); 30 | 31 | B Lavery Nov 2018 32 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/LICENSE: -------------------------------------------------------------------------------- 1 | OzOLED.h - 0.96' I2C 128x64 OLED Driver Library 2 | 2014 Copyright (c) OscarLiang.net All right reserved. 3 | 4 | Author: Oscar Liang 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/examples/Draw_Bitmap/Draw_Bitmap.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | const unsigned char FlowerLogo[] ={ 5 | 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 7 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 8 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF8, 9 | 0xF8, 0xF0, 0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xF0, 0xFC, 0xFE, 10 | 0xFE, 0xF8, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xE0, 0xF0, 0xF0, 0xF8, 11 | 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 12 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 13 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 14 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 15 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 16 | 0xFE, 0xFC, 0xFC, 0xF8, 0xF8, 0xF8, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80, 0x1F, 0x3F, 0x7F, 17 | 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x03, 0xC0, 0xF0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 18 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0x82, 0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 19 | 0x3F, 0x3F, 0x1C, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC, 0xFE, 0xFC, 20 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 21 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0xFF, 24 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x01, 0xC0, 0xFC, 0xFC, 25 | 0xF8, 0xF0, 0xE1, 0xC1, 0x83, 0x00, 0x38, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 26 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x00, 0x01, 0x83, 0xC1, 0xE0, 0xF0, 0xF8, 27 | 0xFC, 0xF8, 0x00, 0x03, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 28 | 0xFF, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x02, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0xFF, 32 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 33 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0xE1, 0xC3, 0x0F, 0x1F, 0x7F, 0xFF, 0xFF, 34 | 0xFF, 0xFF, 0x3F, 0x1F, 0x87, 0xC3, 0xF1, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 35 | 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 36 | 0x07, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x07, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x01, 0x03, 0x8F, 0x8F, 0xCF, 0xC7, 0xE7, 0xE3, 0xF3, 0xF1, 0xF0, 0x80, 0x01, 40 | 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 41 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0x20, 0x03, 42 | 0x03, 0xE0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 43 | 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x07, 44 | 0x00, 0xE0, 0xF1, 0xF3, 0xE3, 0xE7, 0xC7, 0xC7, 0x8F, 0x8F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF8, 0xF8, 47 | 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 48 | 0xE0, 0x81, 0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xC0, 0x00, 0x1F, 0xFF, 0xFF, 49 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x03, 0x00, 0xF8, 50 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 51 | 0xFF, 0x3F, 0x01, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x03, 0xC0, 0xF8, 52 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, 53 | 0xF8, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 55 | 0x07, 0x07, 0x0F, 0x0F, 0x1F, 0x1F, 0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 56 | 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0xE1, 0xC7, 0x8F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7E, 0xF0, 0xE0, 0xC3, 57 | 0x8F, 0x1F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x7F, 58 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x87, 59 | 0xC1, 0xF0, 0xFC, 0x7F, 0x7F, 0x3F, 0x1F, 0x8F, 0xC7, 0xE3, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 60 | 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 61 | 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 64 | 0x3C, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x79, 0x79, 0x78, 0x70, 0x70, 0x70, 0x38, 0x38, 0x39, 65 | 0x39, 0x19, 0x18, 0x18, 0x18, 0x18, 0x19, 0x11, 0x13, 0x13, 0x13, 0x13, 0x13, 0x03, 0x00, 0x00, 66 | 0x00, 0x01, 0x03, 0x13, 0x13, 0x13, 0x13, 0x13, 0x19, 0x19, 0x18, 0x18, 0x18, 0x18, 0x39, 0x39, 67 | 0x38, 0x38, 0x70, 0x70, 0x70, 0x78, 0x79, 0x79, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x3C, 0x38, 68 | 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 70 | 71 | }; 72 | 73 | void setup(){ 74 | Oled.init(6,5); //initialze OLED display, custom pin #s 75 | Oled.drawBitmap(FlowerLogo, 0, 0, 16, 8); 76 | } 77 | 78 | void loop(){ 79 | 80 | } 81 | 82 | // Bitmaps? 83 | // http://en.radzio.dxp.pl/bitmap_converter/LCDAssistant.zip 84 | // Prepare as BMP 128x64, monochrome, 2 colour, in negative. 85 | // Load to LCDAssistant & save to C file. 86 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/examples/Hello_World/Hello_World.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | void setup(){ 5 | 6 | delay(700); 7 | 8 | Oled.init(); //initialze OLED display 9 | Oled.wideFont = true; 10 | Oled.chrSpace=3; 11 | Oled.drawLine(3, 0xe0); 12 | Oled.printString("Hello",0,0); 13 | Oled.printInt(F_CPU/1000000,0,5); 14 | Oled.printString("MHz",0,6); 15 | Oled.wideFont = false; 16 | Oled.chrSpace=1; 17 | Oled.printString("Hello Brian",0,2); 18 | delay(1000); 19 | // Oled.clearDisplay(); 20 | Oled.printBigNumber("-31",6,4); 21 | Oled.printBigNumber("9",12,0); 22 | // delay(1000); 23 | // Oled.printBigNumber("8",9,4); 24 | // Oled.printBigNumber("5",12,4); 25 | delay(1000); 26 | Oled.printBigNumber(" ", 6,4); // clear those positions 27 | Oled.printBigNumber(62, 6,4); 28 | //Oled.setPowerOff(); 29 | 30 | 31 | } 32 | 33 | void loop(){ 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/examples/Horizontal_Addressing_Mode/Horizontal_Addressing_Mode.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup(){ 4 | Oled.init(6,5); //initialze OLED display 5 | Oled.setHorizontalMode(); //Set addressing mode to Horizontal Mode 6 | Oled.printString("!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); //Print String (ASCII 32 - 126 ) 7 | Oled.wideFont=true; 8 | Oled.printString("!\"#$%&'()*+,-./0123456789"); //Print String (ASCII 32 - 126 ) 9 | } 10 | 11 | void loop(){ 12 | 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/examples/PrintNumbers/PrintNumbers.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup(){ 4 | Oled.init(); //initialze OLED display 5 | Oled.printNumber((long)123, 0, 0); 6 | delay(2000); 7 | Oled.setPageMode(); //Set addressing mode to Page Mode 8 | Oled.printNumber((long)0xFFFF, 0, 0); 9 | Oled.printNumber((long)0xFFFFFFFF, 6, 0); 10 | Oled.printNumber((long)-12345, 3, 3); 11 | } 12 | 13 | void loop(){ 14 | 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/miniOled.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | V 0.4.0 miniOled.cpp 3 | 4 | A VERY BASIC oled SSD1306 (0.96" I2C) library, compatible with SoftWire I2C library. 5 | Designed initially to fit on STM32F030F4P6 board (16K flash, 48 MHz): 6 | for software I2C able to have custom pin selection 7 | for small flash memory footprint 8 | 9 | 1. Text. (Very) small characters. Optional double width. Variable chr-spacing. 10 | page mode: always in one of 8 fixed horizontal lines ("pages" of SSD1306) 11 | horizontal mode: streaming over many lines (no interline spacing control). 12 | 2. Also big font 18x24 (inside 24x32) numbers 0-9 only, plus " " "-" "." "/" and ":" 13 | still aligned to start on one of the 8 pages/lines. 14 | 3.
horizontal line. 15 | 4. Load bitmap image. 16 | 17 | I2C pins (software) configurable. 18 | 19 | I2C output is unbuffered, one byte transfer at a time. Slow. 20 | Derived by substantial hacking (down) of following: 21 | https://github.com/mistertwo/ozoled-oled-display-096-i2c-driver-library 2014/2015 22 | 23 | You need to download & install two other-party libraries 24 | https://www.arduinolibraries.info/libraries/soft-wire The 2.0.0 version of SoftWire 25 | https://github.com/stevemarple/AsyncDelay The AsyncDelay library, used by SoftWire 26 | */ 27 | 28 | #include "miniOled.h" 29 | #define SOFTWIRE 30 | // define SOFTWIRE, and software library SoftWire will be used, with choice of pins 31 | // undefine SOFTWIRE, and native Wire on sda PA10 scl PA9 will apply 32 | 33 | 34 | #ifdef SOFTWIRE 35 | #include 36 | SoftWire Wire(PA6, PA5); // default gpio (SoftWire needs a default) 37 | #else 38 | #include 39 | #endif 40 | 41 | // 6x8 Font ASCII 32 - 127 Implemented 42 | 43 | const byte BasicFont[][5] = { // 5x8 in a 6x8 space. 44 | {0x00,0x00,0x00,0x00,0x00}, 45 | {0x00,0x5F,0x00,0x00,0x00}, 46 | {0x00,0x07,0x00,0x07,0x00}, 47 | {0x14,0x7F,0x14,0x7F,0x14}, 48 | {0x24,0x2A,0x7F,0x2A,0x12}, 49 | {0x23,0x13,0x08,0x64,0x62}, 50 | {0x36,0x49,0x55,0x22,0x50}, 51 | {0x00,0x05,0x03,0x00,0x00}, 52 | {0x1C,0x22,0x41,0x00,0x00}, 53 | {0x41,0x22,0x1C,0x00,0x00}, 54 | {0x08,0x2A,0x1C,0x2A,0x08}, 55 | {0x08,0x08,0x3E,0x08,0x08}, 56 | {0xA0,0x60,0x00,0x00,0x00}, 57 | {0x08,0x08,0x08,0x08,0x08}, 58 | {0x60,0x60,0x00,0x00,0x00}, 59 | {0x20,0x10,0x08,0x04,0x02}, 60 | {0x3E,0x51,0x49,0x45,0x3E}, 61 | {0x00,0x42,0x7F,0x40,0x00}, 62 | {0x62,0x51,0x49,0x49,0x46}, 63 | {0x22,0x41,0x49,0x49,0x36}, 64 | {0x18,0x14,0x12,0x7F,0x10}, 65 | {0x27,0x45,0x45,0x45,0x39}, 66 | {0x3C,0x4A,0x49,0x49,0x30}, 67 | {0x01,0x71,0x09,0x05,0x03}, 68 | {0x36,0x49,0x49,0x49,0x36}, 69 | {0x06,0x49,0x49,0x29,0x1E}, 70 | {0x00,0x36,0x36,0x00,0x00}, 71 | {0x00,0xAC,0x6C,0x00,0x00}, 72 | {0x08,0x14,0x22,0x41,0x00}, 73 | {0x14,0x14,0x14,0x14,0x14}, 74 | {0x41,0x22,0x14,0x08,0x00}, 75 | {0x02,0x01,0x51,0x09,0x06}, 76 | {0x32,0x49,0x79,0x41,0x3E}, 77 | {0x7E,0x09,0x09,0x09,0x7E}, 78 | {0x7F,0x49,0x49,0x49,0x36}, 79 | {0x3E,0x41,0x41,0x41,0x22}, 80 | {0x7F,0x41,0x41,0x22,0x1C}, 81 | {0x7F,0x49,0x49,0x49,0x41}, 82 | {0x7F,0x09,0x09,0x09,0x01}, 83 | {0x3E,0x41,0x41,0x51,0x72}, 84 | {0x7F,0x08,0x08,0x08,0x7F}, 85 | {0x41,0x7F,0x41,0x00,0x00}, 86 | {0x20,0x40,0x41,0x3F,0x01}, 87 | {0x7F,0x08,0x14,0x22,0x41}, 88 | {0x7F,0x40,0x40,0x40,0x40}, 89 | {0x7F,0x02,0x0C,0x02,0x7F}, 90 | {0x7F,0x04,0x08,0x10,0x7F}, 91 | {0x3E,0x41,0x41,0x41,0x3E}, 92 | {0x7F,0x09,0x09,0x09,0x06}, 93 | {0x3E,0x41,0x51,0x21,0x5E}, 94 | {0x7F,0x09,0x19,0x29,0x46}, 95 | {0x26,0x49,0x49,0x49,0x32}, 96 | {0x01,0x01,0x7F,0x01,0x01}, 97 | {0x3F,0x40,0x40,0x40,0x3F}, 98 | {0x1F,0x20,0x40,0x20,0x1F}, 99 | {0x3F,0x40,0x38,0x40,0x3F}, 100 | {0x63,0x14,0x08,0x14,0x63}, 101 | {0x03,0x04,0x78,0x04,0x03}, 102 | {0x61,0x51,0x49,0x45,0x43}, 103 | {0x7F,0x41,0x41,0x00,0x00}, 104 | {0x02,0x04,0x08,0x10,0x20}, 105 | {0x41,0x41,0x7F,0x00,0x00}, 106 | {0x04,0x02,0x01,0x02,0x04}, 107 | {0x80,0x80,0x80,0x80,0x80}, 108 | {0x01,0x02,0x04,0x00,0x00}, 109 | {0x20,0x54,0x54,0x54,0x78}, 110 | {0x7F,0x48,0x44,0x44,0x38}, 111 | {0x38,0x44,0x44,0x28,0x00}, 112 | {0x38,0x44,0x44,0x48,0x7F}, 113 | {0x38,0x54,0x54,0x54,0x18}, 114 | {0x08,0x7E,0x09,0x02,0x00}, 115 | {0x18,0xA4,0xA4,0xA4,0x7C}, 116 | {0x7F,0x08,0x04,0x04,0x78}, 117 | {0x00,0x7D,0x00,0x00,0x00}, 118 | {0x80,0x84,0x7D,0x00,0x00}, 119 | {0x7F,0x10,0x28,0x44,0x00}, 120 | {0x41,0x7F,0x40,0x00,0x00}, 121 | {0x7C,0x04,0x18,0x04,0x78}, 122 | {0x7C,0x08,0x04,0x7C,0x00}, 123 | {0x38,0x44,0x44,0x38,0x00}, 124 | {0xFC,0x24,0x24,0x18,0x00}, 125 | {0x18,0x24,0x24,0xFC,0x00}, 126 | {0x00,0x7C,0x08,0x04,0x00}, 127 | {0x48,0x54,0x54,0x24,0x00}, 128 | {0x04,0x7F,0x44,0x00,0x00}, 129 | {0x3C,0x40,0x40,0x7C,0x00}, 130 | {0x1C,0x20,0x40,0x20,0x1C}, 131 | {0x3C,0x40,0x30,0x40,0x3C}, 132 | {0x44,0x28,0x10,0x28,0x44}, 133 | {0x1C,0xA0,0xA0,0x7C,0x00}, 134 | {0x44,0x64,0x54,0x4C,0x44}, 135 | {0x08,0x36,0x41,0x00,0x00}, 136 | {0x00,0x7F,0x00,0x00,0x00}, 137 | {0x41,0x36,0x08,0x00,0x00}, 138 | {0x02,0x01,0x01,0x02,0x01}, 139 | {0x02,0x05,0x05,0x02,0x00} 140 | }; 141 | 142 | 143 | // Big numbers font, from [ - . / 0 1 2 3 4 5 6 7 8 9 : ] - 72 bytes each. 144 | const byte hugeFont [][72] = { // 18x24 inside a 24x32 cell. 145 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 147 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 148 | 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 149 | 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 151 | 0x00, 0x00, 0x00, 0x00, 0x00}, // - minus 152 | 153 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 154 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 156 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 157 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 159 | 0x0f, 0x00, 0x00, 0x00, 0x00}, // dot 160 | 161 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 162 | 0xE0, 0xF0, 0xF0, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 163 | 0x00, 0x80, 0xE0, 0xF0, 0xFC, 0x7F, 0x3F, 0x0F, 0x03, 0x01, 0x00, 164 | 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xF8, 0xFE, 0x3F, 0x1F, 0x07, 165 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0F, 166 | 0x0F, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 167 | 0x00, 0x00, 0x00, 0x00, 0x00}, // slash / 168 | 169 | {0xC0, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 170 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 172 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 173 | 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x07, 174 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 175 | 0x0F, 0x0F, 0x0F, 0x07, 0x03}, // 0 176 | 177 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 178 | 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 179 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 180 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 181 | 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 183 | 0x07, 0x03, 0x00, 0x00, 0x00}, // 1 184 | 185 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 186 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x81, 0xC1, 0xC0, 0xC0, 0xC0, 187 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 188 | 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x03, 0x03, 0x03, 0x03, 189 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x83, 0x81, 0x00, 0x07, 0x0F, 190 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 191 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 2 192 | 193 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 194 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x81, 0xC1, 0xC0, 0xC0, 0xC0, 195 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 196 | 0x7F, 0x00, 0x81, 0x83, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 197 | 0x03, 0x03, 0x03, 0x87, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x07, 0x0F, 198 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 199 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 3 200 | 201 | {0xE0, 0xF0, 0xF0, 0xF0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 202 | 0x30, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 203 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xFF, 0xFF, 0xFF, 204 | 0xFF, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 205 | 0x03, 0x03, 0x03, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 206 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 207 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 4 208 | 209 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 210 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 211 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC1, 212 | 0x81, 0x00, 0x81, 0x83, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 213 | 0x03, 0x03, 0x03, 0x87, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x07, 0x0F, 214 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 215 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 5 216 | 217 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 218 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 219 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC1, 220 | 0x81, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x03, 0x03, 0x03, 0x03, 221 | 0x03, 0x03, 0x03, 0x87, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x07, 0x0F, 222 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 223 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 6 224 | 225 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 226 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 228 | 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 229 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 231 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 7 232 | 233 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 234 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xE1, 235 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 236 | 0x3F, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x87, 0x03, 0x03, 0x03, 0x03, 237 | 0x03, 0x03, 0x03, 0x87, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x07, 0x0F, 238 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 239 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 8 240 | 241 | {0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 242 | 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 243 | 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 244 | 0xFF, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 245 | 0x03, 0x03, 0x03, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 246 | 0x00, 0x0c, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 247 | 0x0F, 0x0F, 0x0F, 0x07, 0x00}, // 9 248 | 249 | 250 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 252 | 0x00, 0x3C, 0x7E, 0x7E, 0x7E, 0x7E, 0x3C, 0x00, 0x00, 0x00, 0x00, 253 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF8, 0xF8, 254 | 0xF8, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 255 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 256 | 0x00, 0x00, 0x00, 0x00, 0x00} // ":" 257 | }; // fortunately, this does not compile into the flash unless it gets referenced in your code. 258 | 259 | 260 | 261 | // ====================== LOW LEVEL ========================= 262 | 263 | void OLED::sendCommand(byte command){ 264 | Wire.beginTransmission(OLED_ADDRESS); // begin transmitting 265 | Wire.write(OLED_COMMAND_MODE);//data mode 266 | Wire.write(command); 267 | Wire.endTransmission(); // stop transmitting 268 | } 269 | 270 | 271 | void OLED::sendData(byte data){ 272 | 273 | Wire.beginTransmission(OLED_ADDRESS); // begin transmitting 274 | Wire.write(OLED_DATA_MODE);//data mode 275 | Wire.write(data); 276 | Wire.endTransmission(); // stop transmitting 277 | } 278 | 279 | 280 | void OLED::printChar(char C, byte X, byte Y){ 281 | 282 | byte i, ch; 283 | //Ignore unused ASCII characters. Modified the range to support multilingual characters. 284 | if(C < 32 || C > 127) 285 | C='*'; //star - indicate characters that can't be displayed 286 | 287 | if ( X < 128 ) 288 | setCursorXY(X, Y); 289 | 290 | for (i=0; i 58) 343 | sendData(0); 344 | else 345 | sendData(hugeFont[number[count]-45][i]); 346 | if(column >= 17){ 347 | sendData(0);sendData(0);sendData(0); 348 | column = 0; 349 | setCursorXY(X, ++Y); 350 | } 351 | else 352 | column++; 353 | } 354 | count++; 355 | X = X + 3; 356 | Y = Y - 4; 357 | } 358 | } 359 | 360 | 361 | byte OLED::printNumber(long long_num, byte X, byte Y){ 362 | 363 | if ( X < 128 ) 364 | setCursorXY(X, Y); 365 | 366 | byte char_buffer[10] = ""; 367 | byte i = 0; 368 | byte f = 0; // number of characters 369 | 370 | if (long_num < 0) { 371 | f++; 372 | printChar('-'); 373 | long_num = -long_num; 374 | } 375 | else if (long_num == 0) { 376 | f++; 377 | printChar('0'); 378 | return f; 379 | } 380 | 381 | while (long_num > 0) { 382 | char_buffer[i++] = long_num % 10; 383 | long_num /= 10; 384 | } 385 | 386 | f += i; 387 | for(; i > 0; i--) { 388 | printChar('0'+ char_buffer[i - 1]); 389 | } 390 | 391 | return f; 392 | 393 | } 394 | 395 | 396 | 397 | 398 | byte OLED::printNumber(float float_num, byte prec, byte X, byte Y){ 399 | 400 | if ( X < 128 ) 401 | setCursorXY(X, Y); 402 | 403 | // precision - use 6 maximum 404 | 405 | byte num_int = 0; 406 | byte num_frac = 0; 407 | byte num_extra = 0; 408 | 409 | long d = float_num; // get the integer part 410 | float f = float_num - d; // get the fractional part 411 | 412 | if (d == 0 && f < 0.0){ 413 | printChar('-'); 414 | num_extra++; 415 | printChar('0'); 416 | num_extra++; 417 | f *= -1; 418 | } 419 | else if (d < 0 && f < 0.0){ 420 | num_int = printNumber(d); // count how many digits in integer part 421 | f *= -1; 422 | } 423 | else{ 424 | num_int = printNumber(d); // count how many digits in integer part 425 | } 426 | 427 | // only when fractional part > 0, we show decimal point 428 | if (f > 0.0){ 429 | printChar('.'); 430 | num_extra++; 431 | long f_shift = 1; 432 | if (num_int + prec > 8) 433 | prec = 8 - num_int; 434 | for (byte j=0; j=0) // SDA SCL optional parameters. Otherwise defaults apply 467 | { 468 | Wire.setSda(sda); // non-default pins 469 | Wire.setScl(scl); 470 | } 471 | #endif 472 | Wire.begin() ; 473 | 474 | static const byte ini[] = {0xae,0xa6,0xAE,0xD5,0x80,0xA8,0x3F,0xD3, 475 | 0x0,0x40 | 0x0,0x8D,0x14,0x20,0x00, 476 | 0xA0 | 0x1,0xC8,0xDA,0x12,0x81,0xCF, 477 | 0xd9,0xF1,0xDB,0x40,0xA4,0xA6,0x2e,0x20,0x00}; 478 | 479 | for (byte i=0; i<29;i++) 480 | sendCommand(ini[i]); 481 | clearDisplay(); 482 | setPowerOn(); 483 | } 484 | 485 | 486 | void OLED::setCursorXY(byte X, byte Y){ 487 | // Y - 1 unit = 1 page (8 pixel rows) 0 - 15 488 | // X - 1 unit = 8 pixel columns 0 - 7 489 | 490 | sendCommand(0x00 + (8*X & 0x0F)); //set column lower address 491 | sendCommand(0x10 + ((8*X>>4)&0x0F)); //set column higher address 492 | sendCommand(0xB0 + Y); //set page address 493 | } 494 | 495 | 496 | void OLED::clearDisplay() { 497 | for(byte page=0; page<8; page++) { 498 | drawLine(page,0); 499 | } 500 | setCursorXY(0,0); 501 | } 502 | 503 | 504 | void OLED::setPowerOff(){ 505 | sendCommand(OLED_CMD_DISPLAY_OFF); 506 | } 507 | 508 | void OLED::setPowerOn(){ 509 | sendCommand(OLED_CMD_DISPLAY_ON); 510 | } 511 | 512 | void OLED::drawLine(int page, byte pattern) 513 | { 514 | setCursorXY(0, page); 515 | for(byte column=0; column<128; column++){ 516 | sendData(pattern); 517 | } 518 | } 519 | 520 | void OLED::setPageMode(){ 521 | addressingMode = PAGE_ADDRESSING; 522 | sendCommand(0x20); //set addressing mode 523 | sendCommand(PAGE_ADDRESSING); //set page addressing mode 524 | } 525 | 526 | void OLED::setHorizontalMode(){ 527 | addressingMode = HORIZONTAL_ADDRESSING; 528 | sendCommand(0x20); //set addressing mode 529 | sendCommand(HORIZONTAL_ADDRESSING); //set page addressing mode 530 | } 531 | 532 | OLED Oled; // Preinstantiate Object 533 | 534 | -------------------------------------------------------------------------------- /Arduino/libraries/miniOled/miniOled.h: -------------------------------------------------------------------------------- 1 | /* 2 | miniOled.h - 0.96' I2C 128x64 OLED Driver Library 3 | */ 4 | 5 | #ifndef OLED_H 6 | #define OLED_H 7 | 8 | #include 9 | 10 | #define OLED_ADDRESS 0x3C 11 | 12 | // registers 13 | #define OLED_COMMAND_MODE 0x80 14 | #define OLED_DATA_MODE 0x40 15 | 16 | // commands 17 | #define OLED_CMD_DISPLAY_OFF 0xAE 18 | #define OLED_CMD_DISPLAY_ON 0xAF 19 | 20 | #define HORIZONTAL_ADDRESSING 0x00 21 | #define PAGE_ADDRESSING 0x02 22 | 23 | class OLED { 24 | 25 | public: 26 | 27 | byte addressingMode; 28 | bool wideFont = false; 29 | int chrSpace = 1; // 1 - 3 30 | void printChar(char c, byte X=255, byte Y=255); 31 | void printString(const char *String, byte X=255, byte Y=255, byte numChar=255); 32 | void printBigNumber(const char *number, byte column=0, byte page=0, byte numChar=255); 33 | void printBigNumber(int i, byte X, byte Y); 34 | void printInt(int j, byte X=255, byte Y=255); 35 | void drawLine(int page, byte data); 36 | byte printNumber(long n, byte X=255, byte Y=255); 37 | byte printNumber(float float_num, byte prec=6, byte Y=255, byte numChar=255); 38 | void drawBitmap(const byte *bitmaparray, byte X, byte Y, byte width, byte height); 39 | void init(int sda= -1, int scl = -1); 40 | void setCursorXY(byte Column, byte Row); 41 | void clearDisplay(); 42 | void setPowerOff(); 43 | void setPowerOn(); 44 | void setPageMode(); 45 | void setHorizontalMode(); 46 | 47 | private: 48 | void sendCommand(byte command); 49 | void sendData(byte Data); 50 | char ibuffer[60]; // for i2c 51 | char buffer[20]; // for integer calc 52 | }; 53 | 54 | extern OLED Oled; // OLED object 55 | 56 | #endif 57 | 58 | 59 | -------------------------------------------------------------------------------- /Arduino/libraries/miniSerial/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | miniSerial 4 | 5 | Copyright (c) [2018] Brian Lavery 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /Arduino/libraries/miniSerial/charQueue.h: -------------------------------------------------------------------------------- 1 | // Very basic class (char) array-as-queue BL Nov 2018 2 | 3 | #define BUF_SIZE 40 4 | 5 | class Queue 6 | { 7 | private: 8 | bool _isFull(){ return (_size == BUF_SIZE); }; 9 | bool _isEmpty(){ return (_size == 0); }; 10 | char _buffer[BUF_SIZE]; 11 | int _head; 12 | int _tail; 13 | int _size; 14 | 15 | public: 16 | Queue(void){ 17 | _head=0; 18 | _tail=BUF_SIZE-1; 19 | _size=0; 20 | }; 21 | bool enqueue(char ch){ 22 | if (_isFull()) 23 | return false; 24 | _tail = (_tail + 1)%BUF_SIZE; 25 | _buffer[_tail] = ch; 26 | _size ++; 27 | return true; 28 | }; 29 | int dequeue(){ 30 | if (_isEmpty()) 31 | return -1; 32 | char ch = _buffer[_head]; 33 | _head = (_head + 1)%BUF_SIZE; 34 | _size --; 35 | return int(ch); 36 | }; 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /Arduino/libraries/miniSerial/examples/Tx-Rx-demo/Tx-Rx-demo.ino: -------------------------------------------------------------------------------- 1 | // echo function 2 | 3 | #include 4 | 5 | 6 | 7 | unsigned long t0; 8 | 9 | void setup(void) 10 | { 11 | Serial.begin(9600); 12 | // Serial.begin(19200, PA2, PA3); 13 | pinMode(LED_BUILTIN, OUTPUT); 14 | delay(500); // IDE's serial terminal may take a bit of wakeup time. Don't lose first chrs. 15 | t0 = millis(); // used by loop() 16 | Serial.print("\nminiSerial RX/TX demo - software based, non native Serial port.\n"); 17 | Serial.print("Transmit is unbuffered, Receive is buffered.\n"); 18 | Serial.print("Type some input. Demo: Buffer is read each second.\n"); 19 | 20 | } 21 | 22 | void loop() 23 | { 24 | Serial.run(); // ESSENTIAL FOR RX BUFFERING SYSTEM. and no delay() allowed below. 25 | 26 | // can't use delay() so delay by a non-blocking method !!! 27 | unsigned long t1 = millis(); 28 | if (t1-t0 < 1000) // 1 sec 29 | return; 30 | t0 = t1; 31 | 32 | // here only every 1 sec: 33 | digitalWrite(LED_BUILTIN, 1-digitalRead(LED_BUILTIN)); 34 | int ch; 35 | while ((ch=Serial.read())>=0) // read any/all chrs from buffer 36 | { 37 | Serial.print("From buffer: "); 38 | Serial.println(ch); // send it back out 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Arduino/libraries/miniSerial/examples/Tx-demo/Tx-demo.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | void setup() { 6 | Serial.begin(9600); // defaults to 19200, tx=PA9, rx=PA10 7 | // Serial.begin(); // other option 8 | // Serial.begin(19200, PA2, PA3); // other option 9 | delay(500); // advise delay before serial output. Display wakeup reasons, not code reasons. 10 | #ifdef STM32F030x6 //this define is board ID 11 | Serial.print("('030F4P6 found)\n\n"); 12 | // original purpose of this library was for '030F4P6 board. We found one! 13 | #endif 14 | Serial.print("\nminiSerial demo.\n"); 15 | 16 | 17 | Serial.println(); 18 | 19 | 20 | } 21 | 22 | 23 | 24 | void loop() { 25 | 26 | 27 | Serial.write('H'); // no linefeed, so flows on 28 | Serial.println("ello..."); 29 | Serial.print(31741); 30 | Serial.print(" = 0x"); Serial.print(31741, HEX); 31 | Serial.print(" = 0b"); Serial.print(31741, BIN); 32 | Serial.println(); 33 | //Serial.println(-88.445, 2); // float is very expensive in flash (3.7k) 34 | delay(2000); 35 | } 36 | -------------------------------------------------------------------------------- /Arduino/libraries/miniSerial/miniSerial.cpp: -------------------------------------------------------------------------------- 1 | 2 | // A bit-banged low-footprint serial transmit/receive 3 | // primarily for low-memory STM32F030F4P6 BL Nov 2018 4 | // By default uses PA9 as TX PA10 as RX -- regular 4-pin RX/TX end connector. 5 | // 8 bit no parity. 19200 seems ideal (default) 6 | 7 | // tx will block during character transfer (abt 0.6 mSec each chr at 19200) 8 | // Your loop() must have free-running Serial.run(). No delay()s. Serial reception will suffer otherwise 9 | // reception is buffered 10 | // Transmit is not buffered, but does NOT stop reception processing. 11 | 12 | // Functions in this "Serial" are an approximation to regular Serial calls. 13 | 14 | // V 0.5.0 15 | 16 | 17 | 18 | #include 19 | #include 20 | 21 | Queue rxBuf; 22 | //Queue txBuf; // Buffered tx not currently implemented 23 | 24 | MiniSerial::MiniSerial(void) 25 | { 26 | 27 | 28 | } 29 | 30 | void MiniSerial::begin(int baud, int tx, int rx) 31 | { 32 | pinRx = rx; 33 | pinTx = tx; 34 | bitDelay = (unsigned long) (1000000 / baud); 35 | pinMode(pinTx, OUTPUT); 36 | digitalWrite(pinTx, HIGH); 37 | pinMode(pinRx, INPUT); 38 | } 39 | 40 | 41 | 42 | int MiniSerial::read(void) // -1 =nothing/empty 43 | { 44 | // fetch from buffer 45 | return rxBuf.dequeue(); 46 | 47 | } 48 | 49 | 50 | 51 | void MiniSerial::run(void) // MUST be called VERY frequently from your loop() 52 | { 53 | int ch = _getChar(); 54 | if(ch >=0) 55 | rxBuf.enqueue((char) ch); 56 | } 57 | 58 | 59 | 60 | 61 | void MiniSerial::print(char* str) 62 | { 63 | for (int i = 0; i 0, we show decimal point 115 | if (f > 0.0){ 116 | write('.'); 117 | int f_shift = 1; 118 | for (byte j=0; j=0 good rx char 136 | { 137 | if(pinTx<0) return ERRNOTBEGIN; 138 | 139 | switch (rxState) { 140 | case RXIDLE : 141 | if (digitalRead(pinRx)) // still idle 142 | return RXNONE; 143 | // ok, we start rx: 144 | rx_reftime = micros() - bitDelay/2; 145 | rx_chr = 0; 146 | rxState = READING; 147 | rx_k = 0; 148 | return RXBUSY; 149 | 150 | case READING : // 10 bit-length passes 151 | if(micros()-rx_reftime < bitDelay) 152 | return RXBUSY; 153 | rx_chr |= (digitalRead(pinRx) << rx_k++); 154 | rx_reftime += bitDelay; 155 | if (rx_k > 9) 156 | rxState = COMPLETE; 157 | return RXBUSY; 158 | 159 | case COMPLETE : 160 | rxState = RXIDLE; 161 | if ((rx_chr & 0b01000000001) != 0b01000000000) // start & stop bits correct? 162 | return ERRFRAME; 163 | return (int) (rx_chr & 0x1FE) >> 1; // a good chr received 164 | 165 | default: 166 | break; 167 | } 168 | } 169 | 170 | 171 | void MiniSerial::write(unsigned char data) // TX one byte 172 | { 173 | if(pinTx<0) return; 174 | 175 | int chr = (data <<1) | 0b011000000000 ; 176 | unsigned long starttime= micros(); 177 | 178 | for (int i=11; i>0; i--) // 1 start (0), 8 data bits, 2 stop (11) 179 | { 180 | digitalWrite(pinTx, chr&1); 181 | chr = (chr >> 1); 182 | while (micros()-starttime 6 | 7 | #define BITDELAY 52 8 | // 104 9600 baud 52 19200 9 | // not good above 19200 10 | 11 | #define HEX 16 12 | #define BIN 2 13 | #define OCT 8 14 | 15 | class MiniSerial 16 | { 17 | public: 18 | MiniSerial(void); 19 | void begin(int baudrate = 19200, int txpin = PA9, int rxpin = PA10); 20 | int read(void); 21 | void run(void); 22 | void write(unsigned char data); 23 | void print(double float_num, int prec=2); // uses lots of flash space! Avoid? 24 | void print(char* str); 25 | void print(int, int = DEC); 26 | void print(long, int = DEC); 27 | void println(double float_num, int prec=2); 28 | void println(char* str = ""); // handles println() also 29 | void println(int, int = DEC); 30 | void println(long, int = DEC); 31 | 32 | private: 33 | 34 | int _getChar(void); 35 | char _rx; // buffered chr 36 | char _rx1 = 0; 37 | int pinTx= -1; // -1 = not begin'd 38 | int pinRx ; 39 | unsigned long bitDelay = 52; // // 104 9600 baud 52 19200 40 | 41 | enum { RXIDLE, READING, COMPLETE } ; 42 | enum { RXBUSY = -4, ERRNOTBEGIN = -3, ERRFRAME = -2, RXNONE = -1 }; 43 | int rxState = RXIDLE; 44 | unsigned long rx_chr = 0; 45 | unsigned long rx_reftime = 0; 46 | int rx_k; 47 | 48 | }; 49 | 50 | extern MiniSerial mSerial; 51 | #define Serial mSerial 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Brian Lavery 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /P1070121.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BLavery/STM32F030F4P6-Arduino/731a060521427db5c2abea6a8af8207251ebf351/P1070121.JPG -------------------------------------------------------------------------------- /P1070122.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BLavery/STM32F030F4P6-Arduino/731a060521427db5c2abea6a8af8207251ebf351/P1070122.JPG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STM32F030F4P6 & Arduino 2 | 3 | THIS IS NOT AN OFFICIAL STM32/ARDUINO PROJECT 4 | 5 | This is an __interim project__ 6 | for getting the STM32F030F4P6 Cortex-M0 "Minimum System Dev" or "Demo" board 7 | up and running on __Arduino_Core_STM32__. eBay and AliExpress are flooded with these boards for $2. This may be a capable 32-bit chip at 48MHz, but it is the baby of the STM32 line because of limited flash memory. 8 | 9 | I expect that the STM32 official core project may shortly release 10 | support for this board, in which case then use the official version, of course. 11 | 12 | In any case, the library modules in this project should still be valid on an official support version. 13 | 14 | ### 2019 - This is no longer being maintained by the original author. 15 | ### Please feel free to fork, copy, adapt if you find it useable 16 | ### However, there is now official support. 17 | 18 | ## Programming? 19 | 20 | The USB micro connector is for 5V power only, not USB data. (The chip does not support USB!) 21 | 22 | The easiest practical programming method is Upload Method = "STLink". 23 | **Get one** ($3). (On Windows, fetch STSW_Link009 from STM for the STlink driver. Otherwise, check elsewhere if you need any further config/setup help.) 24 | Get it running for your scenario, and programming becomes trivially easy thereafter. Simply leave the BOOT0 jumper always on the GND side. 25 | 26 | __No flash bootloader is used or needed__. (And that's a whole other hassle out of the way!) 27 | 28 | And get a 3V TTL USB serial adapter (CP2102 and CH340 are 3V) while you are at it ($1.5). You are going to need that for "terminal", at least. 29 | 30 | But, alternative to STLink, you __can__ use the (ROM-based and undestroyable) factory flashing function using PA9/PA10 (ie TX/RX) and the serial adapter (TX-to-RX and RX-to-TX remember). Upload Method = "Serial". Press reset with boot0 jumper to 3V, upload with IDE, restart with boot0 to GND, and your sketch should run. 31 | 32 | ## Libraries Included Here: 33 | 34 | The F030F4 has only 16K of flash. Compiling the arduino IDE with an empty sketch will use about 8K. 35 | However, including calls in your sketch to arduino's regular __Serial__ will also add __many K__ to the build size, abruptly passing the 16k limit. One Serial.println(int) and you've used 15.5k! Yes, that one-liner just works - on PA2/PA3, note this, not PA9/PA10 - but your sketch now has no code space left. 36 | 37 | And the __Wire__ pin assignments conflict with the uart header use, as built. 38 | 39 | The most obvious implication is that we now have no easy way to "view" any output, even any debug information, 40 | beyond toggling a LED! (No serial terminal. It's not connected at USB connector. 41 | And the native Serial software is too big.) 42 | 43 | There are some new very lightweight arduino libraries included here, so that we now **can** communicate 44 | with the F030F4. We can run a "Serial" on its uart header, we can run an oled display, and we can use Wire/I2C on pins of our choice. These libraries (with example files) are: 45 | 46 | - __miniSerial__ - a simple software non-interrupt low-performance duplex serial driver, max 19200. 47 | So now a terminal can be used with your sketch. TXD/RXD ie PA9/PA10, ie at the correct uart header, 48 | but is also pin configurable if needed. 49 | Syntax is an approximate subset of regular native Serial. 50 | Some miniSerial info: https://github.com/BLavery/miniSerial 51 | - __miniOled__ - a lean and basic driver for the ubiquitous '0.96" I2C SSD1306 Oled' display. 52 | Optionally using I2C writes via SoftWire (allowing pin choice), or native HAL I2C on PA9 PA10. 53 | So now we can see some display output. 54 | Derived out of Daniel Turton's OzOled project 2014/2015. 55 | To use the optional software I2C, you need to also fetch and install other-party libraries SoftWire and AsyncDelay. 56 | Some miniOled info: https://github.com/BLavery/miniOled 57 | 58 | Quality = working, if not elegant. 59 | Code size = comfortable in our tiny flash space. 60 | The library code is intentionally minimal - just enough to get the job done, of being able to "talk" 61 | to this board, leaving code space still available for a modest sketch. 62 | 63 | Other Libraries, needed for miniOled to run on pins other than PA9 PA10: 64 | - __SoftWire__ 2.0 from here: https://www.arduinolibraries.info/libraries/soft-wire 65 | - __AsyncDelay__ (used by SoftWire) from here: https://github.com/stevemarple/AsyncDelay 66 | 67 | (And incidentally, SoftWire should be equally useable with other I2C libraries or devices on the '030F4P6. 68 | For example, there is an instruction note in libraries folder on adapting alternative ACROBOTIC oled library for SoftWire.) 69 | 70 | ## Installation: 71 | 72 | 73 | 1. You must install the STM32 core (official) board support from here: 74 | https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls 75 | If you have an earlier version than 1.4, then upgrade it to 1.4. (1.4 is current as at this date 7 Nov 2018.) 76 | 77 | 2. Find your install location for the STM32 package (mine on Mint was /opt/Arduino1.8.5/portable/packages/STM32/hardware/STM32/1.4.0/ 78 | but yours will be doubtless a bit different. Hunt for a bunch of "variant.h" files and then check 79 | you are indeed in the STM32 region. On my Windows install I found the files here: C:\Users\Brian\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.4.0\ 80 | 81 | a. inside the .../1.4.0/variants/ folder, add the DEMO-F030F4 folder from here, with its 6 files. (Now - 12 Nov - aligned with coming V1.5.) 82 | 83 | b. in the .../1.4.0/ folder, open the existing boards.txt in an editor, and patch in the GenF030 "excerpt" section. 84 | 85 | 3. Find your user sketchbook folder ("(documents).../Arduino/" probably, but File/Preferences in your IDE should tell you). 86 | In its libraries folder, add the libraries supplied here, and the SoftWire & AsyncDelay ones too if needed. 87 | 88 | 89 | ## Digital pin numbering: 90 | 91 | (Revised 12 Nov) 92 | 93 | In your sketch, pins can be referenced by any of (for LED, for example) PA4, D4 or just 4. I find using PA4 style to be intuitive as it agrees with the board markings. 94 | 95 | PA0 D0 96 | 97 | PA1 D1 98 | 99 | PA2 D2 100 | 101 | PA3 D3 102 | 103 | PA4 D4 = On-board LED 104 | 105 | PA5 D5 106 | 107 | PA6 D6 108 | 109 | PA7 D7 110 | 111 | PB1 D8 112 | 113 | PA9 D9 = UART Header "TX" 114 | 115 | PA10 D10 = UART Header "RX" 116 | 117 | PA13 D11 - SWDIO = STlink Header "DIO" 118 | 119 | PA14 D12 - SWCLK = STlink header "CLK" 120 | 121 | 122 | ## Analog pins: 123 | 124 | (Revised 12 Nov) 125 | 126 | A0 ~ PA0 127 | 128 | A1 ~ PA1 129 | 130 | A2 ~ PA2 131 | 132 | A3 ~ PA3 133 | 134 | A4 ~ PA4 135 | 136 | A5 ~ PA5 137 | 138 | A6 ~ PA6 139 | 140 | A7 ~ PA7 141 | 142 | A8 ~ PB1 143 | 144 | 145 | ## Wiring Hint: 146 | 147 | In the second pic above showing USB Serial adapter and (clone) STLink, with BOTH CONNECTED AT ONE TIME, I leave off the +3V wire of the USB-Serial device. Otherwise the STM32 board gets 3V supply from 2 sources. Haven't tested it (!), but that sounds like a "BAD IDEA!" 148 | 149 | Note the pic also shows no USB-micro connection to the STM32 board. That would be a THIRD voltage source in this case! The moral: Whatever is your connection configuration, THINK about where your board supply is coming from. Use just one. 150 | 151 | V. 0.3.0 13 Nov 2018 152 | 153 | ## Acknowledgement: 154 | 155 | The above code for IDE support is now (12 Nov) the same as this (Adminius) version: 156 | https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/DEMO_F030F4 157 | (IE, Earlier version that was here has now been brought into line with forthcoming V1.5.) A couple of pin numberings have changed. 158 | 159 | The Installation parts 1 and 2 above will become obsolete/unnecessary here when 1.5 is released. 160 | But the library files here (Installation part 3 above) will remain working and valid. 161 | 162 | The intention of this project here has been to get something up and running ASAP on this limited-capacity board. The board has been available "out there" now for a while. There will doubtless be in due course more elegant solutions to its limitations than the "mini" libraries above. 163 | 164 | But on second thought ... If it offends you to use simple workarounds for this chip's limited flash space, if you really need something that can load libraries and fit in more than some simple GPIO I/O, then spend another $1 and buy one of the various STM32F103C8T6 / bluepill boards with 4 times the flash. 165 | 166 | __Related:__ 167 | 168 | For my notes on the 'F103 "BluePill", see https://github.com/BLavery/STM32F103-Arduino 169 | For my notes on the 1024k STM32F407VG, see https://github.com/BLavery/STM32F407VG-Arduino 170 | For my notes on the SAMD21-M0-Mini, see https://github.com/BLavery/SAMD21-M0-Mini 171 | For my notes on using STM32 boards with ST Cube and direct C++ coding, see https://github.com/BLavery/STM32-Cube-TrueStudio 172 | -------------------------------------------------------------------------------- /STM32F030-Dev-Brd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BLavery/STM32F030F4P6-Arduino/731a060521427db5c2abea6a8af8207251ebf351/STM32F030-Dev-Brd.jpg -------------------------------------------------------------------------------- /ss66.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BLavery/STM32F030F4P6-Arduino/731a060521427db5c2abea6a8af8207251ebf351/ss66.jpg --------------------------------------------------------------------------------