mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/mcp2515: support no rst_pin
This commit is contained in:
parent
0c526f12c6
commit
3084928151
@ -99,7 +99,9 @@ int mcp2515_init(candev_mcp2515_t *dev, void (*irq_handler_cb)(void *))
|
||||
DEBUG("Error setting interrupt pin!\n");
|
||||
return -1;
|
||||
}
|
||||
gpio_init(dev->conf->rst_pin, GPIO_OUT);
|
||||
if (gpio_is_valid(dev->conf->rst_pin)) {
|
||||
gpio_init(dev->conf->rst_pin, GPIO_OUT);
|
||||
}
|
||||
|
||||
res = mcp2515_spi_init(dev);
|
||||
if (res < 0) {
|
||||
@ -118,9 +120,14 @@ int mcp2515_init(candev_mcp2515_t *dev, void (*irq_handler_cb)(void *))
|
||||
|
||||
void mcp2515_reset(candev_mcp2515_t *dev)
|
||||
{
|
||||
gpio_clear(dev->conf->rst_pin);
|
||||
xtimer_usleep(RESET_DELAY_US);
|
||||
gpio_set(dev->conf->rst_pin);
|
||||
if (gpio_is_valid(dev->conf->rst_pin)) {
|
||||
gpio_clear(dev->conf->rst_pin);
|
||||
xtimer_usleep(RESET_DELAY_US);
|
||||
gpio_set(dev->conf->rst_pin);
|
||||
}
|
||||
else {
|
||||
mcp2515_spi_reset(dev);
|
||||
}
|
||||
xtimer_usleep(_osc_startup(dev));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user