2 * Copyright Droids Corporation (2008)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * Author : Julien LE GUEN - jlg@jleguen.info
28 /* Convenient macro to ckeck status bits */
29 #define CC2420_STATUS_CHECK(bit) ((cc2420_get_status() & _BV(bit)) >> (bit))
34 * Initialize the CC2420
36 void cc2420_init(void);
39 * Get CC2420's status byte
41 uint8_t cc2420_get_status(void);
44 * Write to a strobe register
47 inline uint8_t cc2420_strobe_register(uint8_t reg);
49 /* Read and Write from/to a register */
50 inline uint16_t cc2420_read_register(uint8_t reg);
51 inline void cc2420_write_register(uint8_t reg, uint16_t value);
54 * Write the contents of a buffer to TXFIFO
55 * Returns last read status byte
57 uint8_t cc2420_write_txfifo(uint8_t *buffer, uint8_t length);
60 * Write the contents of a buffer to RXFIFO
61 * Returns last read status byte
63 uint8_t cc2420_write_rxfifo(uint8_t *buffer, uint8_t length);
66 * Read the contents of RXFIFO into a buffer
68 void cc2420_read_rxfifo(uint8_t *buffer, uint8_t length);
71 * Write to a RAM address one or several byte(s)
72 * /!\ This is NOT foolproof, you have to be sure of the
73 * address you write to, and the length of your buffer
75 void cc2420_write_ram(uint16_t addr, uint8_t *buffer, uint16_t length);
78 * Read from RAM. Same warning.
80 void cc2420_read_ram(uint16_t addr, uint8_t *buffer, uint16_t length);
83 #endif /* _CC2420_H_ */