[riot-notifications] [RIOT-OS/RIOT] ds323x: Minimal driver for DS323x extremely accurate RTC (#9838)

Peter Kietzmann notifications at github.com
Mon Feb 18 13:22:40 CET 2019


PeterKietzmann commented on this pull request.

@leandrolanzieri I left a few comments, please address them. Furthermore, what is your opinion about the pseudo-module preparation in this PR?

Other than that I ran the test on a nucleo-f103rb and got the expected 1Hz output

> + *
+ * @file
+ * @brief       Driver for the DS3234 Extremely Accurate SPI Bus RTC with
+ *              Integrated Crystal and SRAM, from Maxim
+ *
+ * @author      Joakim NohlgÄrd <joakim.nohlgard at eistec.se>
+ * @}
+ */
+
+#include <stdint.h>
+#include <errno.h>
+#include "ds3234.h"
+#include "ds323x_regs.h"
+#include "fmt.h"
+
+#define ENABLE_DEBUG    (1)

Please disable by default

> +}
+
+int ds3234_pps_init(const ds3234_params_t *dev)
+{
+    /* initialize CS pin */
+    int res = spi_init_cs(dev->spi, dev->cs);
+    if (res < 0) {
+        return DS3234_NO_SPI;
+    }
+    DEBUG("ds3234: init on SPI_DEV(%u)\n", dev->spi);
+
+    if (ENABLE_DEBUG) {
+        for (int k = 0; k <= 0x19; ++k) {
+            uint8_t dbg_reg = 0;
+            ds3234_read_reg(dev, k, 1, &dbg_reg);
+            print_byte_hex(k);

This has a dependency to the `fmt` module. 

> +#include "board.h"
+#include "ds3234.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name    Set default configuration parameters for the DS3234 devices
+ * @{
+ */
+#ifndef DS3234_PARAM_SPI
+#define DS3234_PARAM_SPI                (SPI_DEV(0))
+#endif
+#ifndef DS3234_PARAM_CS
+#define DS3234_PARAM_CS                 (SPI_HWCS(0))

I think `GPIO_PIN(0, 0)` would be the more common way here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/9838#pullrequestreview-204727060
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190218/f5880789/attachment.html>


More information about the notifications mailing list