firmware/saa1064.c File Reference

I2C-connection to the SAA1064 LED-driver. More...

#include <avr/io.h>
#include <util/delay.h>
#include "saa1064.h"

Include dependency graph for saa1064.c:

Go to the source code of this file.

Defines

#define LEDPORT   PORTC
 the Port used for the connection
#define LEDPIN   PINC
 the Port used for the connection
#define LEDDDR   DDRC
 the Port used for the connection
#define SDAPIN   PC4
 which pins of the port
#define SCLPIN   PC5
 which pins of the port
#define SAA_ADR   0x70
 the I2C addresses of the SAA 1064 LED drivers
#define I2C_READ   0x01
 command used to read from I2C
#define I2C_WRITE   0x00
 command used to write to I2C
#define DELAYVAL   3
 pause between certain actions on the bus.

Functions

void led_init (void)
 Initialize the LED module.
void set_led_digit (uint8_t digit, uint8_t val)
 This sets one digit on the LED module.
void set_led_brightness (uint8_t led_brightness)
 Configures the brightness of the LEDs.


Detailed Description

I2C-connection to the SAA1064 LED-driver.

Author:
Ronald Schaten
Version:
Id
saa1064.c,v 1.2 2007/01/03 12:38:55 rschaten Exp
License: See documentation.

Definition in file saa1064.c.


Define Documentation

#define DELAYVAL   3

pause between certain actions on the bus.

Should be at least (10 * freq) / 3, so we set 3 at 1 MHz

Definition at line 28 of file saa1064.c.

#define I2C_READ   0x01

command used to read from I2C

Definition at line 25 of file saa1064.c.

#define I2C_WRITE   0x00

command used to write to I2C

Definition at line 26 of file saa1064.c.

Referenced by set_led_brightness(), and set_led_digit().

#define LEDDDR   DDRC

the Port used for the connection

Definition at line 18 of file saa1064.c.

#define LEDPIN   PINC

the Port used for the connection

Definition at line 17 of file saa1064.c.

#define LEDPORT   PORTC

the Port used for the connection

Definition at line 16 of file saa1064.c.

#define SAA_ADR   0x70

the I2C addresses of the SAA 1064 LED drivers

Definition at line 23 of file saa1064.c.

Referenced by set_led_brightness(), and set_led_digit().

#define SCLPIN   PC5

which pins of the port

Definition at line 21 of file saa1064.c.

#define SDAPIN   PC4

which pins of the port

Definition at line 20 of file saa1064.c.


Function Documentation

void led_init ( void   ) 

Initialize the LED module.

This basically enables the pullups on the I2C Bus pins.

Definition at line 30 of file saa1064.c.

Referenced by main().

void set_led_brightness ( uint8_t  led_brightness  ) 

Configures the brightness of the LEDs.

Or rather: the current the driver allows through them.

Parameters:
led_brightness The values 0 through 7 can be used, corresponding to 0 through 21 mA

Definition at line 126 of file saa1064.c.

References I2C_WRITE, and SAA_ADR.

Referenced by main().

void set_led_digit ( uint8_t  digit,
uint8_t  val 
)

This sets one digit on the LED module.

Parameters:
digit the number of the digit (0 - 3)
val a bitfield that contains the values to set

Definition at line 117 of file saa1064.c.

References I2C_WRITE, and SAA_ADR.

Referenced by main(), and setLeds().


Generated on Wed Jan 3 22:22:48 2007 for Binary DCF-77 Clock by  doxygen 1.5.1