libpynq (release 5EWC0-2023 version 0.2.1 of 2023-09-01 11:02)
Loading...
Searching...
No Matches
iic.h
Go to the documentation of this file.
1/*
2Copyright (c) 2023 Eindhoven University of Technology
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22#ifndef IIC_H
23#define IIC_H
24#include <stdbool.h>
25#include <stdint.h>
26
42typedef enum { IIC0 = 0, IIC1 = 1, NUM_IICS = 2 } iic_index_t;
43
51extern void iic_init(const iic_index_t iic);
52
58extern void iic_destroy(const iic_index_t iic);
59
71extern bool iic_read_register(const iic_index_t iic, const uint8_t addr,
72 const uint8_t reg, uint8_t *data,
73 uint16_t length);
74
86extern bool iic_write_register(const iic_index_t iic, const uint8_t addr,
87 const uint8_t reg, uint8_t *data,
88 uint16_t length);
89
93#endif
iic_index_t
Enum of IICs. Functions use a switch numbered from 0..NUM_IICS-1.
Definition iic.h:42
void iic_destroy(const iic_index_t iic)
Close the shared memory handle for the specified IIC index.
Definition iic.c:3
bool iic_write_register(const iic_index_t iic, const uint8_t addr, const uint8_t reg, uint8_t *data, uint16_t length)
Definition iic.c:7
bool iic_read_register(const iic_index_t iic, const uint8_t addr, const uint8_t reg, uint8_t *data, uint16_t length)
Definition iic.c:4
void iic_init(const iic_index_t iic)
Initialize the IIC specified by the index with a shared memory handle and a buffer size of 4096 bytes...
Definition iic.c:2
@ IIC1
Definition iic.h:42
@ IIC0
Definition iic.h:42
@ NUM_IICS
Definition iic.h:42