drivers/xbee: uncrustify
This commit is contained in:
parent
472f6495a8
commit
5579fd2220
@ -100,6 +100,7 @@ typedef struct {
|
|||||||
static uint8_t _cksum(size_t offset, uint8_t *buf, size_t size)
|
static uint8_t _cksum(size_t offset, uint8_t *buf, size_t size)
|
||||||
{
|
{
|
||||||
uint8_t res = 0xff;
|
uint8_t res = 0xff;
|
||||||
|
|
||||||
for (size_t i = offset; i < size; i++) {
|
for (size_t i = offset; i < size; i++) {
|
||||||
res -= buf[i];
|
res -= buf[i];
|
||||||
}
|
}
|
||||||
@ -231,7 +232,7 @@ static void _rx_cb(void *arg, uint8_t c)
|
|||||||
dev->rx_buf[dev->rx_count++] = c;
|
dev->rx_buf[dev->rx_count++] = c;
|
||||||
if (dev->rx_count == dev->rx_limit) {
|
if (dev->rx_count == dev->rx_limit) {
|
||||||
/* packet is complete */
|
/* packet is complete */
|
||||||
netdev_trigger_event_isr((netdev_t*) dev);
|
netdev_trigger_event_isr((netdev_t *)dev);
|
||||||
dev->int_state = XBEE_INT_STATE_IDLE;
|
dev->int_state = XBEE_INT_STATE_IDLE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -426,13 +427,14 @@ static int _set_encryption(xbee_t *dev, const uint8_t *val)
|
|||||||
{
|
{
|
||||||
uint8_t cmd[3];
|
uint8_t cmd[3];
|
||||||
resp_t resp;
|
resp_t resp;
|
||||||
|
|
||||||
/* get the current state of Encryption */
|
/* get the current state of Encryption */
|
||||||
cmd[0] = 'E';
|
cmd[0] = 'E';
|
||||||
cmd[1] = 'E';
|
cmd[1] = 'E';
|
||||||
_api_at_cmd(dev, cmd, 2, &resp);
|
_api_at_cmd(dev, cmd, 2, &resp);
|
||||||
|
|
||||||
/* Prevent writing the same value in EE. */
|
/* Prevent writing the same value in EE. */
|
||||||
if (val[0] != resp.data[0] ){
|
if (val[0] != resp.data[0]) {
|
||||||
cmd[0] = 'E';
|
cmd[0] = 'E';
|
||||||
cmd[1] = 'E';
|
cmd[1] = 'E';
|
||||||
cmd[2] = val[0];
|
cmd[2] = val[0];
|
||||||
@ -448,6 +450,7 @@ static int _set_encryption_key(xbee_t *dev, const uint8_t *val, size_t len)
|
|||||||
{
|
{
|
||||||
uint8_t cmd[18];
|
uint8_t cmd[18];
|
||||||
resp_t resp;
|
resp_t resp;
|
||||||
|
|
||||||
if (len != 16) { /* the AES key is 128bit, 16 byte */
|
if (len != 16) { /* the AES key is 128bit, 16 byte */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -519,6 +522,7 @@ int xbee_build_hdr(xbee_t *dev, uint8_t *xhdr, size_t payload_len,
|
|||||||
|
|
||||||
/* finally configure the packet size and copy the actual dst address */
|
/* finally configure the packet size and copy the actual dst address */
|
||||||
uint16_t size = (uint16_t)(payload_len + addr_len + 3);
|
uint16_t size = (uint16_t)(payload_len + addr_len + 3);
|
||||||
|
|
||||||
xhdr[1] = (uint8_t)(size >> 8);
|
xhdr[1] = (uint8_t)(size >> 8);
|
||||||
xhdr[2] = (uint8_t)(size & 0xff);
|
xhdr[2] = (uint8_t)(size & 0xff);
|
||||||
memcpy(&xhdr[5], dst_addr, addr_len);
|
memcpy(&xhdr[5], dst_addr, addr_len);
|
||||||
@ -598,7 +602,7 @@ int xbee_init(netdev_t *dev)
|
|||||||
/* put XBee module in "API mode without escaped characters" */
|
/* put XBee module in "API mode without escaped characters" */
|
||||||
_at_cmd(xbee, "ATAP1\r");
|
_at_cmd(xbee, "ATAP1\r");
|
||||||
/* disable xbee CTS and RTS, unless hardware flow control is used */
|
/* disable xbee CTS and RTS, unless hardware flow control is used */
|
||||||
if(!IS_USED(MODULE_PERIPH_UART_HW_FC)) {
|
if (!IS_USED(MODULE_PERIPH_UART_HW_FC)) {
|
||||||
DEBUG("[xbee] init: WARNING if using an arduino BOARD + arduino xbee " \
|
DEBUG("[xbee] init: WARNING if using an arduino BOARD + arduino xbee " \
|
||||||
"shield with ICSP connector, hardware flow control can't be " \
|
"shield with ICSP connector, hardware flow control can't be " \
|
||||||
"used since CTS pin is connected to ICSP RESET pin\n");
|
"used since CTS pin is connected to ICSP RESET pin\n");
|
||||||
@ -734,6 +738,7 @@ static void xbee_isr(netdev_t *netdev)
|
|||||||
static int xbee_get(netdev_t *ndev, netopt_t opt, void *value, size_t max_len)
|
static int xbee_get(netdev_t *ndev, netopt_t opt, void *value, size_t max_len)
|
||||||
{
|
{
|
||||||
xbee_t *dev = (xbee_t *)ndev;
|
xbee_t *dev = (xbee_t *)ndev;
|
||||||
|
|
||||||
assert(dev);
|
assert(dev);
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
@ -787,6 +792,7 @@ static int xbee_get(netdev_t *ndev, netopt_t opt, void *value, size_t max_len)
|
|||||||
static int xbee_set(netdev_t *ndev, netopt_t opt, const void *value, size_t len)
|
static int xbee_set(netdev_t *ndev, netopt_t opt, const void *value, size_t len)
|
||||||
{
|
{
|
||||||
xbee_t *dev = (xbee_t *)ndev;
|
xbee_t *dev = (xbee_t *)ndev;
|
||||||
|
|
||||||
assert(dev);
|
assert(dev);
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user