SSD1306/main.c

63 lines
1.5 KiB
C
Raw Normal View History

2020-10-13 04:45:09 -04:00
/**
2021-07-19 09:06:29 -04:00
* ---------------------------------------------------------------+
2020-10-13 04:45:09 -04:00
* @desc OLED SSD1306 example
2021-07-19 09:06:29 -04:00
* ---------------------------------------------------------------+
2020-10-13 04:45:09 -04:00
* Copyright (C) 2020 Marian Hrinko.
* Written by Marian Hrinko (mato.hrinko@gmail.com)
*
* @author Marian Hrinko
* @datum 06.10.2020
2021-07-19 09:06:29 -04:00
* @update 19.07.2021
2020-10-13 04:45:09 -04:00
* @file main.c
2021-07-19 09:06:29 -04:00
* @tested AVR Atmega328p
2020-10-13 04:48:57 -04:00
*
* @depend ssd1306.h
2021-07-19 09:06:29 -04:00
* ---------------------------------------------------------------+
* @descr Version 1.0 -> applicable for 1 display
* Version 2.0 -> rebuild to 'cacheMemLcd' array
2021-07-19 09:06:29 -04:00
* ---------------------------------------------------------------+
2020-10-13 04:45:09 -04:00
*/
// include libraries
2020-11-02 07:34:14 -05:00
#include <stdio.h>
2020-10-13 04:45:09 -04:00
#include "lib/ssd1306.h"
/**
2021-07-21 01:22:58 -04:00
* @desc Main function
2020-10-13 04:45:09 -04:00
*
* @param void
*
2021-07-21 01:22:58 -04:00
* @return int
2020-10-13 04:45:09 -04:00
*/
int main(void)
{
2021-07-19 09:06:29 -04:00
uint8_t addr = SSD1306_ADDRESS;
2020-10-13 04:45:09 -04:00
// init ssd1306
2021-07-19 09:06:29 -04:00
SSD1306_Init (addr);
2020-10-13 04:45:09 -04:00
// clear screen
SSD1306_ClearScreen ();
2020-11-02 07:34:14 -05:00
// draw line
SSD1306_DrawLine (0, MAX_X, 4, 4);
// set position
SSD1306_SetPosition (7, 1);
2020-10-13 04:45:09 -04:00
// draw string
SSD1306_DrawString ("SSD1306 OLED DRIVER");
2020-11-02 07:34:14 -05:00
// draw line
SSD1306_DrawLine (0, MAX_X, 18, 18);
// set position
SSD1306_SetPosition (40, 3);
// draw string
SSD1306_DrawString ("MATIASUS");
// set position
SSD1306_SetPosition (53, 5);
// draw string
SSD1306_DrawString ("2021");
2020-11-02 07:34:14 -05:00
// update
SSD1306_UpdateScreen (addr);
2020-10-13 04:45:09 -04:00
// return value
return 0;
}