1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-07-01 03:25:07 +03:00
ben-blinkenlights/libubb/include/ubb/ubb.h
2012-12-17 00:44:48 -03:00

45 lines
1.2 KiB
C

/*
* include/ubb/ubb.h - Access functions for the Universal Breakout Board
*
* Written 2012 by Werner Almesberger
* Copyright 2012 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef UBB_UBB_H
#define UBB_UBB_H
#include <stdint.h>
#include <ubb/regbase.h>
#define UBB_nPWR (1 << 2) /* PD02 */
#define UBB_DAT2 (1 << 12) /* PD12 */
#define UBB_DAT3 (1 << 13) /* PD13 */
#define UBB_CMD (1 << 8) /* PD08 */
#define UBB_CLK (1 << 9) /* PD09 */
#define UBB_DAT0 (1 << 10) /* PD10 */
#define UBB_DAT1 (1 << 11) /* PD11 */
#define UBB_ALL_IO (UBB_DAT2 | UBB_DAT3 | UBB_CMD | UBB_CLK | UBB_DAT0 | \
UBB_DAT1)
#define UBB_ALL (UBB_nPWR | UBB_ALL_IO)
#define SET(mask) PDDATS = (mask)
#define CLR(mask) PDDATC = (mask)
#define OUT(mask) PDDIRS = (mask)
#define IN(mask) PDDIRC = (mask)
#define PIN(mask) (!!(PDPIN & (mask)))
int ubb_open(uint32_t keep);
void ubb_power(int on);
void ubb_close(uint32_t keep);
#endif /* !UBB_UBB_H */