Skip to content

Commit 87f15ef

Browse files
committed
Add section for plaform selection
1 parent a0a6d52 commit 87f15ef

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

_posts/2025-09-03-OLED-Parameters.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,57 @@ layout: post
33
title: oled.h - OLED parameter definition
44
categories: [Parameters]
55
introduction: "Descriptions of parameters that can be adapted in the oled header"
6+
modified_date: 2025-08-17 13:37:37 +0200
67
---
78

9+
## Platform selection
10+
11+
The hardware abstraction layer (`HAL`) of the OLED display currently supports the microcontrollers `avr` (ATmega16A, ...) and `avr0` (ATmegaXX08/ATTinyXX06, ...), which can be easily switched using the `OLED_HAL_PLATFORM` macro.
12+
13+
```c
14+
// For AVR platform
15+
#define OLED_HAL_PTATFORM avr
16+
17+
// For AVR0 platform
18+
#define OLED_HAL_PLATFORM avr0
19+
```
20+
21+
### Folder structure setup:
22+
23+
#### For AVR platform
24+
25+
```
26+
- ./lib/ + oled.h
27+
+ oled.c
28+
+ hal/ + avr/ + twi/ + twi.h
29+
| + twi.c
30+
+ twi_soft/ + twi_soft.h
31+
+ twi_soft.c
32+
...
33+
```
34+
35+
#### For AVR0 platform
36+
37+
```
38+
- ./lib/ + oled.h
39+
+ oled.c
40+
+ hal/ + avr0/ + twi/ + twi.h
41+
| + twi.c
42+
+ twi_soft/ + twi_soft.h
43+
+ twi_soft.c
44+
...
45+
```
46+
47+
> `Microchip Studio` compiles all libraries in the folders by default. Therefore, either `avr` or `avr0` should be created in the folder structure and the library that is not used should be removed. To select the correct platform and set the clock speed correctly in the libraries, it is best to create a `global define` under `Project-Settings -> AVR/GNU C-Compiler -> Symbols` in `Microchip studio`.
48+
49+
```c
50+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51+
// !! GLOBAL DEFINES FOR AVR0 PLATFORM !!
52+
// !! F_CPU=20000000UL !!
53+
// !! OLED_HAL_PLATFORM=avr0 !!
54+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
55+
```
56+
857
## Communication mode of the display
958

1059
Communication between the display and the microcontroller can be achieved either via software-defined TWI or via the microcontroller's internal hardware in `oled.h`. Software-defined TWI makes communication more flexible because the ports can be switched.

0 commit comments

Comments
 (0)