--- /dev/null
+cmake_minimum_required(VERSION 3.5)
+project(libsi24
+ VERSION 0.30.0
+ LANGUAGES C
+)
+set(PROJECT_DESCRIPTION "si24r1 library")
+set(PROJECT_HOMEPAGE_URL https://github.com/robinkrens/libsi24)
+
+add_compile_options(-Wall -Wextra -pedantic -Werror)
+
+add_library(libsi24 libsi24.c)
+
+target_include_directories(libsi24
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+include(GNUInstallDirs)
+
+install(TARGETS libsi24
+ EXPORT libsi24-export
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+install(FILES libsi24.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+install(EXPORT libsi24-export
+ FILE libsi24.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libsi24
+)
+
+include(CPack)
--- /dev/null
+/**
+ * File : libsi24.c
+ * Author : Robin Krens <robin@robinkrens.nl>
+ * Date : 18.01.2023
+ * Last Modified Date: 18.01.2023
+ * Last Modified By : Robin Krens <robin@robinkrens.nl>
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "libsi24.h"
+#include "libsi24reg.h"
+
+struct si24_t {
+ const si24_opts_t *opts;
+ const si24_ioctl_t *ctl;
+ si24_event_handler_t eh;
+};
+
+si24_t* si24_init(const si24_opts_t *opts, si24_event_handler_t eh)
+{
+ struct si24_t *si = (si24_t*) calloc(1, sizeof(si24_t));
+ if (si == 0)
+ return 0;
+
+ si->opts = opts;
+ si->ctl = opts->ioctl;
+ si->eh = eh;
+
+ return si;
+}
+
+int main(void)
+{
+}
--- /dev/null
+/**
+ * File : libsi24.h
+ * Author : Robin Krens <robin@robinkrens.nl>
+ * Date : 18.01.2023
+ * Last Modified Date: 18.01.2023
+ * Last Modified By : Robin Krens <robin@robinkrens.nl>
+ */
+
+#include <stddef.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+enum si24_status_t {
+ SHUTDOWN = 0,
+ STANDBY,
+ IDLETX,
+ TX,
+ RX
+};
+
+typedef enum si24_status_t si24_status_t;
+
+enum si24_type_t {
+ RECV = 0,
+ SEND
+};
+
+typedef enum si24_type_t si24_type_t;
+
+enum si24_crc_t {
+ ONE_BYTE = 1,
+ TWO_BYTE = 2
+};
+
+typedef enum si24_crc_t si24_crc_t;
+
+enum si24_event_t {
+ TEST = 0
+};
+
+typedef enum si24_event_t si24_event_t;
+
+/* low level IO control */
+typedef struct {
+ size_t (*read)(unsigned char* buf, size_t size);
+ size_t (*write)(const unsigned char* buf, size_t size);
+} si24_ioctl_t;
+
+typedef struct {
+ si24_type_t type;
+ unsigned enable_ack;
+ si24_crc_t crc;
+ si24_ioctl_t *ioctl;
+ unsigned msg_len;
+} si24_opts_t;
+
+/* private data structure */
+typedef struct si24_t si24_t;
+
+typedef void (*si24_event_handler_t)(si24_t* si24, si24_event_t* event);
+
+extern si24_t* si24_init(const si24_opts_t* si24opts, si24_event_handler_t eh);
+extern void si24_free(si24_t* si24);
+extern void si24_send(si24_t* si24, const char* buf, size_t size);
+extern void si24_recv(si24_t* si24, char* buf, size_t size);
+extern void si24_reset(si24_t* si24);
+
+#if defined(__cplusplus)
+}
+#endif
--- /dev/null
+/**
+ * File : libsi24reg.h
+ * Author : Robin Krens <robin@robinkrens.nl>
+ * Date : 18.01.2023
+ * Last Modified Date: 18.01.2023
+ * Last Modified By : Robin Krens <robin@robinkrens.nl>
+ */
+
+
+#define SI24_READ_REG 0x00
+#define SI24_WRITE_REG 0x20
+#define SI24_R_RX_PAYLOAD 0x61
+#define SI24_W_TX_PAYLOAD 0xA0
+#define SI24_FLUSH_TX 0xE1
+
+typedef struct {
+ union {
+ unsigned char byte;
+ struct {
+ unsigned PRIM_XR : 1;
+ unsigned PWR_UP : 1;
+ unsigned CRCO : 1;
+ unsigned EN_CRC : 1;
+ unsigned MASK_MAX_RT : 1;
+ unsigned MASK_TX_DS : 1;
+ unsigned MAKS_RX_DS : 1;
+ unsigned _RESERVED : 1;
+ } bits;
+ };
+} config_reg_t;
+
+