spi_7seg.c File Reference

Routines for 7 segment display. More...

Go to the source code of this file.

Defines

#define SEG_NOOP   0x00
#define SEG_DIG0   0x01
#define SEG_DIG1   0x02
#define SEG_DIG2   0x03
#define SEG_DIG3   0x04
#define SEG_DIG4   0x05
#define SEG_DIG5   0x06
#define SEG_DIG6   0x07
#define SEG_DIG7   0x08
#define SEG_DEC_MODE   0x09
#define SEG_INTENSITY   0x0a
#define SEG_SCAN_LIM   0x0b
#define SEG_SHUTDOWN   0x0c
#define SEG_FEATURE   0x0e
#define SEG_DSP_TEST   0x0f
#define SHUTDOWN_RESET   0x00
#define SHUTDOWN_SOFT   0x80
#define NORM_OP_RESET   0x01
#define NORM_OP_SOFT   0x81
#define NO_DIG_DECODE   0x00
#define DIG_0_DECODE   0x01
#define DIG_0_3_DECODE   0x0f
#define DIG_0_7_DECODE   0xff
#define TEST_MODE_OFF   0x00
#define TEST_MODE_ON   0x01
#define DISPLAY_LIMIT   2
#define MAX_7SEG_DIGITS   3
#define DISP_7SEG_WRITE_POLLS   1000
#define SPI_RATE_DISP_7SEG   1000000
#define SPI_MODE_DISP_7SEG   SPI_MODE_3
#define HUNDRED   2
#define TENNER   1
#define ANY   0

Functions

int Spi7segInit (NUTDEVICE *dev)
 Initialize the 7seg device.
void display_7seg (NUTDEVICE *dev, uint16_t number)
void print_7seg (NUTDEVICE *dev, char *chars)
void dot_7seg (NUTDEVICE *dev, uint8_t dotNumber, uint8_t dotCommand)

Variables

NUTSPINODE nodeSpi7SEG
 7seg SPI node implementation structure.
NUTDEVICE devSpi7SEG
 7seg device implementation structure.
uint8_t display_buffer [MAX_7SEG_DIGITS] = { 0, 0, 0 }


Detailed Description

Routines for 7 segment display.

 * $Id: spi_7seg.c,$
 * 

Definition in file spi_7seg.c.


Define Documentation

#define SEG_NOOP   0x00

Definition at line 62 of file spi_7seg.c.

#define SEG_DIG0   0x01

Definition at line 63 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_DIG1   0x02

Definition at line 64 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_DIG2   0x03

Definition at line 65 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_DIG3   0x04

Definition at line 66 of file spi_7seg.c.

#define SEG_DIG4   0x05

Definition at line 67 of file spi_7seg.c.

#define SEG_DIG5   0x06

Definition at line 68 of file spi_7seg.c.

#define SEG_DIG6   0x07

Definition at line 69 of file spi_7seg.c.

#define SEG_DIG7   0x08

Definition at line 70 of file spi_7seg.c.

#define SEG_DEC_MODE   0x09

Definition at line 71 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_INTENSITY   0x0a

Definition at line 72 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_SCAN_LIM   0x0b

Definition at line 73 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_SHUTDOWN   0x0c

Definition at line 74 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SEG_FEATURE   0x0e

Definition at line 75 of file spi_7seg.c.

#define SEG_DSP_TEST   0x0f

Definition at line 76 of file spi_7seg.c.

Referenced by Spi7segInit().

#define SHUTDOWN_RESET   0x00

Definition at line 79 of file spi_7seg.c.

#define SHUTDOWN_SOFT   0x80

Definition at line 80 of file spi_7seg.c.

#define NORM_OP_RESET   0x01

Definition at line 81 of file spi_7seg.c.

Referenced by Spi7segInit().

#define NORM_OP_SOFT   0x81

Definition at line 82 of file spi_7seg.c.

#define NO_DIG_DECODE   0x00

Definition at line 85 of file spi_7seg.c.

Referenced by Spi7segInit().

#define DIG_0_DECODE   0x01

Definition at line 86 of file spi_7seg.c.

#define DIG_0_3_DECODE   0x0f

Definition at line 87 of file spi_7seg.c.

#define DIG_0_7_DECODE   0xff

Definition at line 88 of file spi_7seg.c.

#define TEST_MODE_OFF   0x00

Definition at line 90 of file spi_7seg.c.

Referenced by Spi7segInit().

#define TEST_MODE_ON   0x01

Definition at line 91 of file spi_7seg.c.

#define DISPLAY_LIMIT   2

Definition at line 94 of file spi_7seg.c.

#define MAX_7SEG_DIGITS   3

Definition at line 96 of file spi_7seg.c.

Referenced by dot_7seg(), and print_7seg().

#define DISP_7SEG_WRITE_POLLS   1000

Definition at line 99 of file spi_7seg.c.

#define SPI_RATE_DISP_7SEG   1000000

Definition at line 104 of file spi_7seg.c.

#define SPI_MODE_DISP_7SEG   SPI_MODE_3

Definition at line 108 of file spi_7seg.c.

#define HUNDRED   2

Definition at line 295 of file spi_7seg.c.

Referenced by display_7seg().

#define TENNER   1

Definition at line 296 of file spi_7seg.c.

Referenced by display_7seg().

#define ANY   0

Definition at line 297 of file spi_7seg.c.

Referenced by display_7seg().


Function Documentation

int Spi7segInit ( NUTDEVICE *  dev  ) 

Initialize the 7seg device.

This routine determines the 7seg type. It is internally called by Nut/OS during device registration.

The driver framework may call this function more than once.

Parameters:
dev Specifies the 7seg device.
Returns:
0 on success or -1 if no valid 7seg was found.

Definition at line 200 of file spi_7seg.c.

References NO_DIG_DECODE, NORM_OP_RESET, NUTASSERT, SEG_DEC_MODE, SEG_DIG0, SEG_DIG1, SEG_DIG2, SEG_DSP_TEST, SEG_INTENSITY, SEG_SCAN_LIM, SEG_SHUTDOWN, and TEST_MODE_OFF.

void display_7seg ( NUTDEVICE *  dev,
uint16_t  number 
)

Definition at line 298 of file spi_7seg.c.

References ANY, HUNDRED, NUTASSERT, and TENNER.

void print_7seg ( NUTDEVICE *  dev,
char *  chars 
)

Definition at line 326 of file spi_7seg.c.

References MAX_7SEG_DIGITS, and NUTASSERT.

void dot_7seg ( NUTDEVICE *  dev,
uint8_t  dotNumber,
uint8_t  dotCommand 
)

Definition at line 362 of file spi_7seg.c.

References DOT_7SEG_CLEAR, DOT_7SEG_FLIP, DOT_7SEG_SET, MAX_7SEG_DIGITS, and NUTASSERT.


Variable Documentation

NUTSPINODE nodeSpi7SEG

Initial value:

 {
    NULL,                   
    NULL,                   
    SPI_RATE_DISP_7SEG,     
    SPI_MODE_DISP_7SEG,     
    8,                      
    0                       
}
7seg SPI node implementation structure.

Definition at line 115 of file spi_7seg.c.

NUTDEVICE devSpi7SEG

Initial value:

 {
    NULL,                               
    {'7', 'S', 'E', 'G', 0, 0, 0},      
    IFTYP_BLKIO,                        
    0,                                  
    0,                                  
    &nodeSpi7SEG,                       
    0,                                  
    Spi7segInit,                        
    0,                                  
    0,                                  
    0,                                  

    0,                                  

    0,                                  
    0,                                  
    0                                   
}
7seg device implementation structure.

Definition at line 127 of file spi_7seg.c.

uint8_t display_buffer[MAX_7SEG_DIGITS] = { 0, 0, 0 }

Definition at line 324 of file spi_7seg.c.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/