Browse Source

Merge pull request #5870 from PeterKietzmann/boards_z1_driver_init

drivers/cc2420: improve z1 init and send routine
pr/spi.typo
Francisco Acosta 6 years ago committed by GitHub
parent
commit
b05d0b2748
  1. 2
      boards/z1/include/board.h
  2. 13
      drivers/cc2420/cc2420.c

2
boards/z1/include/board.h

@ -111,7 +111,7 @@ extern "C" {
* @brief Definition of the interface to the CC2420 radio
*/
#define CC2420_PARAMS_BOARD {.spi = SPI_0, \
.spi_clk = SPI_SPEED_1MHZ, \
.spi_clk = SPI_SPEED_5MHZ, \
.pin_cs = GPIO_PIN(P3, 0), \
.pin_fifo = GPIO_PIN(P1, 3), \
.pin_fifop = GPIO_PIN(P1, 2), \

13
drivers/cc2420/cc2420.c

@ -160,6 +160,7 @@ size_t cc2420_tx_prepare(cc2420_t *dev, const struct iovec *data, unsigned count
size_t pkt_len = 2; /* include the FCS (frame check sequence) */
/* wait for any ongoing transmissions to be finished */
DEBUG("cc2420: tx_exec: waiting for any ongoing transmission\n");
while (cc2420_get_state(dev) & NETOPT_STATE_TX) {}
/* get and check the length of the packet */
@ -186,9 +187,6 @@ size_t cc2420_tx_prepare(cc2420_t *dev, const struct iovec *data, unsigned count
void cc2420_tx_exec(cc2420_t *dev)
{
/* make sure, any ongoing transmission is finished */
DEBUG("cc2420: tx_exec: waiting for any ongoing transmission\n");
while (cc2420_get_state(dev) & NETOPT_STATE_TX) {}
/* trigger the transmission */
if (dev->options & CC2420_OPT_TELL_TX_START) {
dev->netdev.netdev.event_callback(&dev->netdev.netdev,
@ -203,15 +201,6 @@ void cc2420_tx_exec(cc2420_t *dev)
DEBUG("cc2420: tx_exec: triggering TX without CCA\n");
cc2420_strobe(dev, CC2420_STROBE_TXON);
}
while (gpio_read(dev->params.pin_sfd)) {
puts("\t...ongoing}");
}
if (dev->options & CC2420_OPT_TELL_TX_END) {
dev->netdev.netdev.event_callback(&dev->netdev.netdev,
NETDEV2_EVENT_TX_COMPLETE);
}
DEBUG("cc2420: tx_exec: TX_DONE\n");
}
int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info)

Loading…
Cancel
Save