hsk_libs-dev  163:b63ae088cc97
High Speed Karlsruhe XC878 library collection
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
main.c File Reference

Simple test file that is not linked into the library. More...

#include <Infineon/XC878.h>
#include "config.h"
#include "hsk_boot/hsk_boot.h"
#include "hsk_timers/hsk_timer01.h"
#include "hsk_can/hsk_can.h"
#include "hsk_icm7228/hsk_icm7228.h"
#include "hsk_adc/hsk_adc.h"
#include "hsk_pwm/hsk_pwm.h"
#include "hsk_pwc/hsk_pwc.h"
#include "hsk_flash/hsk_flash.h"
#include "hsk_wdt/hsk_wdt.h"
#include "hsk_io/hsk_io.h"
Include dependency graph for main.c:

Data Structures

struct  hsk_flash_struct
 This struct is a template for data that can be written to the D-Flash. More...
 

Macros

#define PERSIST_VERSION   1
 The version of the persist struct. More...
 

Functions

void p1_init (void)
 Set up buffer and ports for display driver at I/O port P1 . More...
 
void p1_refresh (void)
 Reflesh displays at I/O port P1 with the buffered data. More...
 
void p1_writeString (const char *const str, const ubyte pos, const ubyte len)
 Write an ASCII encoded string into p1_buffer. More...
 
void p1_writeDec (const uword value, const char power, const ubyte pos, const ubyte len)
 Write a decimal number into p1_buffer. More...
 
void p1_writeHex (const uword value, const char power, const ubyte pos, const ubyte len)
 Write a hexadecimal number into p1_buffer. More...
 
void p1_illuminate (const ubyte segments, const ubyte pos, const ubyte len)
 Illuminate a number of segments in p1_buffer. More...
 
void main (void)
 Call init functions and invoke the run routine. More...
 
void init (void)
 Initialize ports, timers and ISRs. More...
 
void run (void)
 The main test code body. More...
 
void tick0 (void)
 A ticking function called back by the timer T0 ISR. More...
 

Variables

ubyte p1_buffer [8]
 Buffer for display driver at I/O port P1 . More...
 
struct hsk_flash_struct persist
 This structure is used to persist data between resets. More...
 
volatile uword tick0_count_250 = 0
 A counter used to detecting that 250ms have passed. More...
 
volatile ubyte tick0_count_20 = 10
 A counter used to detecting that 20ms have passed. More...
 
volatile uword adc7
 The storage variable for the potentiometer on the eval board. More...
 

Detailed Description

Simple test file that is not linked into the library.

This file is normally rigged to run on the XC800 Starter Kit eval board and used for testing whatever code is currently under development.

Author
kami

Macro Definition Documentation

#define PERSIST_VERSION   1

The version of the persist struct.

Function Documentation

void init ( void  )

Initialize ports, timers and ISRs.

Here is the call graph for this function:

void main ( void  )

Call init functions and invoke the run routine.

Here is the call graph for this function:

void p1_illuminate ( const ubyte  segments,
const ubyte  pos,
const ubyte  len 
)

Illuminate a number of segments in p1_buffer.

Parameters
segmentsThe number of segments to illuminate
posThe target position in the buffer
lenThe number of digits available to encode the number
See Also
ICM7228_FACTORY
hsk_icm7228_illuminate
void p1_init ( void  )

Set up buffer and ports for display driver at I/O port P1 .

See Also
ICM7228_FACTORY
void p1_refresh ( void  )

Reflesh displays at I/O port P1 with the buffered data.

See Also
ICM7228_FACTORY
void p1_writeDec ( const uword  value,
const char  power,
const ubyte  pos,
const ubyte  len 
)

Write a decimal number into p1_buffer.

Parameters
valueThe number to encode
powerThe 10 base power of the number to encode
posThe target position in the buffer
lenThe number of digits available to encode the number
See Also
ICM7228_FACTORY
hsk_icm7228_writeDec
void p1_writeHex ( const uword  value,
const char  power,
const ubyte  pos,
const ubyte  len 
)

Write a hexadecimal number into p1_buffer.

Parameters
valueThe number to encode
powerThe 16 base power of the number to encode
posThe target position in the buffer
lenThe number of digits available to encode the number
See Also
ICM7228_FACTORY
hsk_icm7228_writeHex
void p1_writeString ( const char *const  str,
const ubyte  pos,
const ubyte  len 
)

Write an ASCII encoded string into p1_buffer.

Parameters
strThe buffer to read the ASCII string from
posThe position in the buffer to write the encoded string to
lenThe target length of the encoded string
See Also
ICM7228_FACTORY
hsk_icm7228_writeString
void run ( void  )

The main test code body.

Here is the call graph for this function:

void tick0 ( void  )

A ticking function called back by the timer T0 ISR.

Variable Documentation

volatile uword adc7

The storage variable for the potentiometer on the eval board.

ubyte p1_buffer[8]

Buffer for display driver at I/O port P1 .

See Also
ICM7228_FACTORY
persist

This structure is used to persist data between resets.

volatile ubyte tick0_count_20 = 10

A counter used to detecting that 20ms have passed.

volatile uword tick0_count_250 = 0

A counter used to detecting that 250ms have passed.