forked from dwery/nrf24le1-bbb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwiring.h
35 lines (27 loc) · 862 Bytes
/
wiring.h
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
#ifndef __WIRING_H__
#define __WIRING_H__
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <linux/types.h>
#include "gpio_lib.h"
/* nrf24LE1 required signals */
#define WIRING_NRF_PROG_PIN SUNXI_GPA(13)
#define WIRING_NRF_RESET_PIN SUNXI_GPA(14)
/* Macros for sleep happiness */
#define udelay(us) usleep(us)
#define mdelay(ms) usleep(ms*1000)
/* Wiring functions for bootstraping SPI */
bool wiring_init(const char *device);
void wiring_destroy(void);
/* Full-duplex read and write function */
uint8_t wiring_write_then_read(uint8_t* out,
uint16_t out_len,
uint8_t* in,
uint16_t in_len);
/* Function for setting gpio values */
void wiring_set_gpio_value(uint8_t pin, uint8_t state);
#endif