[BACK]Return to gpio7segvar.h CVS log [TXT][DIR] Up to [local] / funnyos / arch / sam7s64 / dev

File: [local] / funnyos / arch / sam7s64 / dev / gpio7segvar.h (download)

Revision 1.1, Wed Jan 2 02:32:28 2008 UTC (16 years, 4 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD

New driver for 7-segment LED now found on my p64 board.
Driver capable to display decimal digit ranged from 0 to 9 and hexadecimal from 'A' to 'F'.
Full LED on/off (e.g. blinking) is a TODO but should be very trivial to implement.

Driver interfaces itself to the rest of the system via devctl.
 ~cool thing ;)

/*
 * $Id: gpio7segvar.h,v 1.1 2008/01/02 02:32:28 nbrk Exp $
 */
#ifndef _ARCH_SAM7S64_DEV_GPIO7SEGVAR_H
#define _ARCH_SAM7S64_DEV_GPIO7SEGVAR_H

#include <sys/gpio.h>

struct gpio7seg_dd {
	/* pins data */
	struct gpio_pin 		gs_pins[7];

	/* indicator mask (8 bits: 0..6 are segments, 7 - global on/off) */
	uint8_t					gs_mask;

	struct gpio_controller 	*gs_gcp;
};

/* bitmask */
#define GPIO7SEG_A	0x01
#define GPIO7SEG_B	0x02
#define GPIO7SEG_C	0x04
#define GPIO7SEG_D	0x08
#define GPIO7SEG_E	0x10
#define GPIO7SEG_F	0x20
#define GPIO7SEG_G	0x40
#define GPIO7SEG_OFF 0x80

/* devctls supported by this device */
#define DCGPIO7SEG_OFF		0x00000000
#define DCGPIO7SEG_ON 		0x00000001
#define DCGPIO7SEG_SETMASK	0x00000002
#define DCGPIO7SEG_SETDIGIT	0x00000004

#endif /* !_ARCH_SAM7S64_DEV_GPIO7SEGVAR_H */