@@ -4,75 +4,6 @@ This project is designed to interface the [LSM303DLHC](https://www.st.com/resour
4
4
5
5
## Usage
6
6
7
- ### Shims
8
- First update I2C shim functions to let this library communicate with your system:
9
-
10
- > ** Note** : These shims are initially design to work in Zephyr RTOS using the build flag PLATFORM_ZEPHYR.
11
-
12
- For I2C Write:
13
-
14
- ```
15
- /**
16
- * @brief Writes data to a register of the LSM303 device over I2C.
17
- *
18
- * This function writes data to a specified register of the LSM303 device
19
- * using the provided data buffer.
20
- *
21
- * @param device Pointer to the LSM303 device structure.
22
- * @param address I2C address of the LSM303 device.
23
- * @param data_buffer Pointer to the buffer containing the data to be written.
24
- *
25
- * @return
26
- * - 0 on success.
27
- * - Non-zero error code on failure.
28
- */
29
- int8_t lsm303_i2c_write(lsm303_dev *device, uint8_t address,
30
- uint8_t *data_buffer) {
31
- #ifdef PLATFORM_ZEPHYR
32
- uint32_t bytecount = 2;
33
- return i2c_write(device->i2c0_dev, data_buffer, bytecount, address);
34
- #endif
35
- }
36
- ```
37
-
38
- FOr I2C Read:
39
-
40
- ```
41
- /**
42
- * @brief Reads a register value from the LSM303 device via I2C.
43
- *
44
- * Reads a single register from the LSM303 device and stores the retrieved value
45
- * in the specified buffer.
46
- *
47
- * @param device Pointer to the LSM303 device structure.
48
- * @param address I2C address of the LSM303 device.
49
- * @param reg Register address to read from.
50
- * @param read_data Pointer to the buffer where the read value will be stored.
51
- *
52
- * @return
53
- * - 0 on success.
54
- * - Non-zero error code on failure.
55
- */
56
- int8_t lsm303_i2c_read(lsm303_dev *device, uint8_t address, uint8_t reg,
57
- uint8_t *read_data) {
58
- #ifdef PLATFORM_ZEPHYR
59
- uint32_t bytecount = 1;
60
-
61
- if (i2c_write(device->i2c0_dev, ®, bytecount, address) !=
62
- LSM303_STATUS_SUCCESS) {
63
- return LSM303_STATUS_API_ERR;
64
- }
65
-
66
- if (i2c_read(device->i2c0_dev, read_data, sizeof(*read_data), address) != 0) {
67
- return LSM303_STATUS_API_ERR;
68
- }
69
-
70
- return LSM303_STATUS_SUCCESS;
71
- #endif
72
- ```
73
-
74
- ### Application
75
-
76
7
You may refer to [ mcu-dev/dev-apps] ( https://github.com/mcu-dev/dev-apps ) repository written for Zephyr RTOS for a sample application.
77
8
78
9
```
0 commit comments