/**
* \file
*
* \brief Empty user application template
*
*/
/**
* \mainpage User Application template doxygen documentation
*
* \par Empty user application template
*
* Bare minimum empty user application template
*
* \par Content
*
* -# Include the ASF header files (through asf.h)
* -# "Insert system clock initialization code here" comment
* -# Minimal main function that starts with a call to board_init()
* -# "Insert application code here" comment
*
*/
/*
* Include header files for all drivers that have been imported from
* Atmel Software Framework (ASF).
*/
/*
* Support and FAQ: visit Microchip Support
*/
#include
#include "clksys_driver.h"
#include "Paint.h"
#include "sh1107.h"
bool a ;
int i = 0;
uint8_t *BlackImage;
////////////////////////////////////////////////////////
// Static globals
////////////////////////////////////////////////////////
// JTAGUID = 0xFF
// WDWPER = 8CLK
// WDPER = 8CLK
// BOOTRST = APPLICATION
// TOSCSEL = XTAL
// BODPD = DISABLED
// RSTDISBL = [ ]
// STARTUPTIME = 64MS
// WDLOCK = [ ]
// JTAGEN = [X]
// BODACT = DISABLED
// EESAVE = [X]
// BODLEVEL = 2V8
//
// FUSEBYTE0 = 0xFF (valid)
// FUSEBYTE1 = 0x00 (valid)
// FUSEBYTE2 = 0xFF (valid)
// FUSEBYTE4 = 0xF2 (modified)
// FUSEBYTE5 = 0xF1 (modifie
FUSES =
{
.FUSEBYTE0 = FUSE0_DEFAULT,
.FUSEBYTE1 = FUSE1_DEFAULT,
.FUSEBYTE2 = FUSE2_DEFAULT,
//.byte[3] = FUSE3_DEFAULT, // Byte 3 reserviert
.FUSEBYTE4 = 0xF2,
.FUSEBYTE5 = 0xF1
};
void clock_init(void);
int main (void)
{
/* Insert system clock initialization code here (sysclk_init()). */
//sysclk_init();
clock_init();
board_init();
oled_init();
delay_ms(500);
Paint_SelectImage(BlackImage);
Paint_Clear(BLACK);
delay_ms(500);
while (true)
{
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, WHITE);
OLED_Display(BlackImage);
delay_ms(2000);
Paint_Clear(BLACK);
}
free(BlackImage);
BlackImage = NULL;
}
void clock_init(void)
{
CLKSYS_XOSC_Config( OSC_FRQRANGE_12TO16_gc, false, OSC_XOSCSEL_XTAL_16KCLK_gc );
CLKSYS_Enable( OSC_XOSCEN_bm );
do {} while (CLKSYS_IsReady(OSC_XOSCEN_bm) == 0); // warten, bis eingeschwunge
CLKSYS_PLL_Config( OSC_PLLSRC_XOSC_gc, 4 );
CLKSYS_Enable( OSC_PLLEN_bm );
do {} while ( CLKSYS_IsReady( OSC_PLLRDY_bm ) == 0 );
CLKSYS_Prescalers_Config( CLK_PSADIV_1_gc, CLK_PSBCDIV_1_2_gc );
CLKSYS_Main_ClockSource_Select( CLK_SCLKSEL_PLL_gc );
CLKSYS_Disable(OSC_RC2MEN_bm); // 2MHz IntOsc off
CLKSYS_Disable(OSC_RC32MEN_bm); // 32MHz IntOsc off
CLKSYS_Disable(OSC_RC32KEN_bm); // 32kHz IntOsc off
}