mirror of
git://projects.qi-hardware.com/f32xbase.git
synced 2024-12-03 21:15:22 +02:00
46 lines
918 B
C
46 lines
918 B
C
/*
|
|
* f32x/c2-ben.c - Basic C2 messages, driver for Ben NanoNote
|
|
*
|
|
* Written 2010 by Werner Almesberger
|
|
* Copyright 2010 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.
|
|
*/
|
|
|
|
|
|
#include "gpio-xburst.h"
|
|
#include "c2-drv.h"
|
|
|
|
|
|
#define POWER_OFF 3, 2 /* PD02, drive low to enable power */
|
|
#define C2CK 3, 8 /* PD08 */
|
|
#define C2D 3, 12 /* PD12 */
|
|
|
|
|
|
#include "c2-bitbang.c"
|
|
|
|
|
|
static void ben_init(int power)
|
|
{
|
|
gpio_init();
|
|
if (power)
|
|
gpio_low(POWER_OFF);
|
|
else
|
|
gpio_high(POWER_OFF);
|
|
c2_init();
|
|
|
|
}
|
|
|
|
|
|
struct c2_ops c2_ben = {
|
|
.init = ben_init,
|
|
.reset = c2_reset,
|
|
.addr_write = c2_addr_write,
|
|
.addr_read = c2_addr_read,
|
|
.data_write = c2_data_write,
|
|
.data_read = c2_data_read,
|
|
};
|