Update sd project.
[bertos.git] / boards / at91sam7x-ek / examples / sd_fat / main.c
index da45694e08ba2e86b040a560dfe5f29e7b6b537a..05c9ae01ffc107ee9fbb90367275ef01e15c4ced 100644 (file)
  * - wait the sample_time (from ini file)
  * - contine from beginning.
  *
+ * Here we put the ini file that this example uses. To use it copy
+ * the folling configutation line into the file called sd_fat.ini (or see INI_FILE_NAME
+ * define if you want chande the name).
+ * \code
+ *
+ *   # Bertos SD fat project example
+ *   #
+ *   # Basic configurarion
+ *   #
+ *
+ *   [log]
+ *   # Name of log file
+ *   name = test.log
+ *   # Enable the logging on serial device (enable = 1, disable = 0)
+ *   log_on_serial = 1
+ *   # Enable logging on sd file (enable = 1, disable = 0)
+ *   log_on_file = 1
+ *   # Period between two log in millisecond
+ *   sample_time = 1000
+ *
+ *   [serial_log]
+ *   # Select serial port where log
+ *   port = 0
+ *   # Serial port baudrate
+ *   baud = 115200
+ *
+ *   [log_format]
+ *   # Default text to insert on each log line
+ *   line_header = BeRTOS Log:
+ *   # Use this char to separate each log field
+ *   field_sep = ;
+ *
+ *   [temperature]
+ *   unit_label = C
+ *
+ *   [pressure]
+ *   unit_label = hPa
+ *
+ *   [voltage]
+ *   unit_label = V
+ *
+ * \endcode
  */
 
 #include <cfg/debug.h>
 #include <drv/sd.h>
 #include <drv/ser.h>
 #include <drv/tmp123.h>
-#include <drv/spi_dma_at91.h>
+#include <drv/spi_dma.h>
 #include <drv/mpxx6115a.h>
 #include <drv/adc.h>
 
@@ -165,9 +207,10 @@ typedef struct INISetting
 /*
  * Static definition for application devices.
  */
-static SpiDmaAt91 spi_dma;
+static SpiDma spi_dma;
 static Serial temp_sensor_bus;
 static Serial log_port;
+static Sd sd;
 
 static void init(void)
 {
@@ -220,7 +263,7 @@ int main(void)
                INISetting ini_set;
                memset(&ini_set, 0, sizeof(ini_set));
 
-               sd_ok = sd_init(&spi_dma.fd);
+               sd_ok = sd_init(&sd, &spi_dma.fd, 0);
 
                if (sd_ok)
                {