Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
25 #ifndef ATA8520E_H
26 #define ATA8520E_H
28 #include <stdint.h>
29 #include <inttypes.h>
30 #include "xtimer.h"
31 #include "periph/gpio.h"
32 #include "periph/spi.h"
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
42 #define SIGFOX_PAC_LENGTH (16U)
43 #define SIGFOX_ID_LENGTH (8U)
44 #define SIGFOX_MAX_TX_LENGTH (12U)
45 #define SIGFOX_RX_LENGTH (8U)
51 enum {
58 };
63 enum {
68 };
73 typedef enum {
84 typedef enum {
100 typedef enum {
122 typedef struct {
125  gpio_t cs_pin;
126  gpio_t int_pin;
127  gpio_t power_pin;
128  gpio_t reset_pin;
134 typedef struct {
136  uint8_t internal_state;
137  uint8_t event_received;
139 } ata8520e_t;
156 int ata8520e_init(ata8520e_t *dev, const ata8520e_params_t *params);
163 void ata8520e_system_reset(const ata8520e_t *dev);
172 void ata8520e_read_atmel_version(const ata8520e_t *dev, uint8_t *version);
181 void ata8520e_read_sigfox_version(const ata8520e_t *dev, char *version);
190 void ata8520e_read_pac(const ata8520e_t *dev, char *pac);
199 void ata8520e_read_id(const ata8520e_t *dev, char *id);
211 int ata8520e_send_frame(ata8520e_t *dev, uint8_t *payload, uint8_t payload_len);
224 int ata8520e_send_receive_frame(ata8520e_t *dev, uint8_t *payload,
225  uint8_t payload_len, uint8_t *rx_payload);
236 int ata8520e_send_bit(ata8520e_t *dev, bool bit);
238 #ifdef __cplusplus
239 }
240 #endif
242 #endif /* ATA8520E_H */
Error building frame.
Definition: ata8520e.h:112
Command error / not supported.
Definition: ata8520e.h:86
No error.
Definition: ata8520e.h:101
gpio_t reset_pin
Reset pin.
Definition: ata8520e.h:128
spi_t spi
SPI device.
Definition: ata8520e.h:123
Low-level GPIO peripheral driver interface definitions.
void ata8520e_read_atmel_version(const ata8520e_t *dev, uint8_t *version)
Return the Atmel version of the device.
Device is in initialization phase.
Definition: ata8520e.h:65
No error.
Definition: ata8520e.h:85
spi_clk_t spi_clk
SPI clock speed.
Definition: ata8520e.h:124
Callback causes error.
Definition: ata8520e.h:114
Error in delay routine.
Definition: ata8520e.h:113
An error occurred with power pin.
Definition: ata8520e.h:56
Manufacturer error.
Definition: ata8520e.h:102
Sigfox statuses.
Definition: ata8520e.h:100
void ata8520e_system_reset(const ata8520e_t *dev)
Perform a complete reset of the device.
int ata8520e_init(ata8520e_t *dev, const ata8520e_params_t *params)
Initialize the device.
Low-level SPI peripheral driver interface definition.
Manufacturer send error.
Definition: ata8520e.h:106
Error getting PN9.
Definition: ata8520e.h:110
SoC System Management status.
Definition: ata8520e.h:74
ata8520e_params_t params
Device parameters.
Definition: ata8520e.h:135
device module status
Definition: ata8520e.h:73
State machine error.
Definition: ata8520e.h:104
mutex_t event_lock
mutex for waiting for event
Definition: ata8520e.h:138
Atmel status.
Definition: ata8520e.h:75
Device is in TX mode.
Definition: ata8520e.h:66
Initialization parameters.
Definition: ata8520e.h:122
Available SPI clock speeds.
Definition: spi.h:173
device descriptor
Definition: ata8520e.h:134
int ata8520e_send_frame(ata8520e_t *dev, uint8_t *payload, uint8_t payload_len)
Send a frame.
An error occurred with reset pin.
Definition: ata8520e.h:55
Close issues encountered.
Definition: ata8520e.h:108
xtimer interface definitions
Error getting frequency.
Definition: ata8520e.h:111
uint8_t internal_state
current state of the device
Definition: ata8520e.h:136
void ata8520e_read_pac(const ata8520e_t *dev, char *pac)
Return the porting authorization code (PAC) available in the device.
gpio_t cs_pin
Chip select pin.
Definition: ata8520e.h:125
int ata8520e_send_receive_frame(ata8520e_t *dev, uint8_t *payload, uint8_t payload_len, uint8_t *rx_payload)
Send a frame and wait for a RX packet.
Device is in idle state.
Definition: ata8520e.h:64
Adds include for missing inttype definitions.
An error occurred with interrupt pin.
Definition: ata8520e.h:54
API error indication.
Definition: ata8520e.h:109
An error occurred with SPI.
Definition: ata8520e.h:53
Frequency error.
Definition: ata8520e.h:88
uint8_t event_received
check if an event was received
Definition: ata8520e.h:137
void ata8520e_read_sigfox_version(const ata8520e_t *dev, char *version)
Return the Atmel version of the device.
gpio_t int_pin
IRQ pin.
Definition: ata8520e.h:126
An expected event never happened.
Definition: ata8520e.h:57
gpio_t power_pin
Power pin.
Definition: ata8520e.h:127
Mutex structure.
Definition: mutex.h:37
Sigfox status.
Definition: ata8520e.h:76
Get voltage/temperature error.
Definition: ata8520e.h:107
Everything is fine.
Definition: ata8520e.h:52
int ata8520e_send_bit(ata8520e_t *dev, bool bit)
Send a bit.
void ata8520e_read_id(const ata8520e_t *dev, char *id)
Return the ID of the device.
Sigfox statuses.
Definition: ata8520e.h:84
Device is in RX mode, just after TX.
Definition: ata8520e.h:67
unsigned int spi_t
Default type for SPI devices.
Definition: spi.h:118