-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSpi.h
More file actions
45 lines (31 loc) · 868 Bytes
/
Copy pathSpi.h
File metadata and controls
45 lines (31 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* File: Spi.h
* Author: philippe SIMIER Lycée Touchard Le Mans
*
* Created on 7 juillet 2024, 16:29
*
* Une classe SPI utilisée dans les applications où un Raspberry Pi
* doit communiquer avec des périphériques externes utilisant l'interface SPI.
*
*/
#ifndef SPI_H
#define SPI_H
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <wiringPi.h>
#include "wiringPiSPI.h"
class Spi {
public:
Spi(int channel=0, int speed=500000);
Spi(const Spi& orig) = delete; // L'objet Spi n'est pas clonable
virtual ~Spi();
int8_t read_reg(int8_t reg);
int write_reg(int8_t reg, int8_t byte);
int read_fifo( int8_t reg, int8_t *buff, int8_t size);
int write_fifo(int8_t reg, int8_t *buff, int8_t size);
protected:
int channel;
int speed;
};
#endif /* SPI_H */