//--------------------------------------------------------------
// File     : main.c
// Datum    : 14.06.2013
// Version  : 1.0
// Autor    : UB
// EMail    : mc-4u(@)t-online.de
// Web      : www.mikrocontroller-4u.de
// CPU      : STM32F4
// IDE      : CooCox CoIDE 1.7.0
// Module   : CMSIS_BOOT, M4_CMSIS_CORE
// Funktion : Demo der IRSND-Library
// Hinweis  : Diese zwei Files muessen auf 8MHz stehen
//              "cmsis_boot/stm32f4xx.h"
//              "cmsis_boot/system_stm32f4xx.c"
//--------------------------------------------------------------

#include "stm32f0xx.h"
#include "stm32_ub_irsnd.h"
#include "stm32f0308_discovery.h"
#include <stdint.h>

void Delay(volatile uint32_t nCount)
{
  while(nCount--)
  {
  }
}


int main(void)
{
  STM_EVAL_LEDInit(LED4);
  STM_EVAL_LEDOn(LED4);

  IRMP_DATA  myIRData;  // Variable für IR-Daten

  SystemInit(); // Quarz Einstellungen aktivieren
  // init vom IRSND
  UB_IRSND_Init();

  // einen festen IR-Code einstellen
  // (am TV auf "ARD" umschalten)
  /*
  myIRData.protocol=5;
  myIRData.address=8194;
  myIRData.command=33024;
  myIRData.flags=0;
  */

  myIRData.protocol=10;
  myIRData.address=1799;
  myIRData.command=40290;
  myIRData.flags=0;

  while(1)
  {
	// kleine Pause (ca 3sec)
	  Delay(10000000);

    // IR-Daten senden
    UB_IRSND_Write(&myIRData);
  }
}

