olikraus / dogm128

Automatically exported from code.google.com/p/dogm128
Other
20 stars 6 forks source link

No apstraction layer #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
No offence, just general points.

We've started using dogm128, and it looks that there is still no abstraction 
layer. Library should be just lib with specified API. But for some reason you 
have SPI driver included in the lib, which does not make this lib flexible in 
any way (for other architectures).

Please google for FatFs to see how the guy solved LIB<=>HW problem. He uses, in 
his lib few functions which 'talk' to the hardware, and those functions are 
empty (like, read, write, poll etc.). When someone uses his lib he only must 
add a call into his driver from that empty function.
For example have a look at 
http://code.google.com/p/be-free/source/browse/tags/be-free-1.00/FatFs/diskio.c?
r=10 you can see in disk_initialize() I call my own driver function sdc_init(). 
I believe this is the way to go with dogm128 (and other display architectures).

If you really want to add drivers, I think you should keep them separately:
> lib
> SPIdrivers
  > atmega128
  > at91sam7256
  > etc.

Other than that you guys are doing great job! Keep developing!

Original issue reported on code.google.com by ytilare@tlen.pl on 21 Dec 2010 at 2:16

GoogleCodeExporter commented 9 years ago
From my point of view, there is a clean abstraction layer for the SPI 
interface. However it is
- not documented
- put into a single file.

What I will do on this issue: I can provide a interface description and a (kind 
of) device driver developer guideline.

Original comment by olikr...@gmail.com on 24 Dec 2010 at 6:55

GoogleCodeExporter commented 9 years ago
current abstraction layer looks like this:

/*

  dogmspi.c

  spi abstraction layer

*/

#include "dogm128.h"

/* setup hardware pins, prepare SPI subsystem */
void dog_spi_init(void)
{
}

/* output a 8 bit value on the SPI bus */
unsigned char dog_spi_out(unsigned char data)
{
}

/* assign low to chip select line */
void dog_spi_enable_client(void)
{
}

/* assign high to chip select line */
void dog_spi_disable_client(void)
{
}

/* assign low to A0 line */
void dog_cmd_mode(void)
{
}

/* assign high to A0 line */
void dog_data_mode(void)
{
}

Original comment by olikr...@gmail.com on 24 Dec 2010 at 8:46

GoogleCodeExporter commented 9 years ago
added template file and function description.
missing: variable description

Original comment by olikr...@gmail.com on 24 Dec 2010 at 11:18

GoogleCodeExporter commented 9 years ago
this looks perfect, so anyone can now insert own calls inside those functions 
and off you go :)

Original comment by ytilare@tlen.pl on 26 Dec 2010 at 3:42

GoogleCodeExporter commented 9 years ago
thanks for your comments.

the wiki page will be here:
http://code.google.com/p/dogm128/wiki/spiapi
however, related issue 107 has to be finished...

Original comment by olikr...@gmail.com on 26 Dec 2010 at 10:15

GoogleCodeExporter commented 9 years ago
issue 107 closed, from my side, all seems to be done

Original comment by olikr...@gmail.com on 29 Dec 2010 at 5:58