diff --git a/cpu/cc430/periph/rtc.c b/cpu/cc430/periph/rtc.c index f1efc891f37e8fa0620420168390b6b76a041dce..2be809ea82dcf1fc962fe5dc778f76d1ec955845 100644 --- a/cpu/cc430/periph/rtc.c +++ b/cpu/cc430/periph/rtc.c @@ -60,7 +60,7 @@ int rtc_set_time(struct tm *localt) } /* copy time to be set */ - memcpy(&time_to_set, localt, sizeof(struct tm)); + time_to_set = *localt; set_time = 1; return 0; } diff --git a/cpu/native/periph/rtc.c b/cpu/native/periph/rtc.c index ea6259ac78ba5e70b213b57b3ee7120d33f4b77d..1c8cb51261286ce6536db2023a962c2c5901b3a5 100644 --- a/cpu/native/periph/rtc.c +++ b/cpu/native/periph/rtc.c @@ -142,7 +142,7 @@ int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg) return -1; } - memcpy(&_native_rtc_alarm, time, sizeof(_native_rtc_alarm)); + _native_rtc_alarm = *time; warnx("rtc_set_alarm: not implemented"); @@ -162,7 +162,7 @@ int rtc_get_alarm(struct tm *time) return -1; } - memcpy(time, &_native_rtc_alarm, sizeof(_native_rtc_alarm)); + *time = _native_rtc_alarm; return 0; } diff --git a/drivers/apa102/apa102.c b/drivers/apa102/apa102.c index f9cbacaf6f939b37aceb94aa847f0690cfa82b59..1d529e47aa36dc77a35caa2d42014527b2425ba9 100644 --- a/drivers/apa102/apa102.c +++ b/drivers/apa102/apa102.c @@ -49,7 +49,7 @@ void apa102_init(apa102_t *dev, const apa102_params_t *params) { assert(dev && params); - memcpy(dev, params, sizeof(apa102_params_t)); + *dev = *params; gpio_init(dev->data_pin, GPIO_OUT); gpio_init(dev->clk_pin, GPIO_OUT); diff --git a/drivers/at86rf2xx/at86rf2xx.c b/drivers/at86rf2xx/at86rf2xx.c index 58cdf257146a9812c51891daf9576cf4b7f3a6c1..c73151a16c96781193856fe692c13abd9cd42365 100644 --- a/drivers/at86rf2xx/at86rf2xx.c +++ b/drivers/at86rf2xx/at86rf2xx.c @@ -43,7 +43,7 @@ void at86rf2xx_setup(at86rf2xx_t *dev, const at86rf2xx_params_t *params) netdev->driver = &at86rf2xx_driver; /* initialize device descriptor */ - memcpy(&dev->params, params, sizeof(at86rf2xx_params_t)); + dev->params = *params; /* State to return after receiving or transmitting */ dev->idle_state = AT86RF2XX_STATE_TRX_OFF; /* radio state is P_ON when first powered-on */ diff --git a/drivers/ata8520e/ata8520e.c b/drivers/ata8520e/ata8520e.c index c6168b6c935c06ccf06c767312b677e2242cb3ca..c456dbe35ee44ac88b07effe5554e6cd795fceac 100644 --- a/drivers/ata8520e/ata8520e.c +++ b/drivers/ata8520e/ata8520e.c @@ -239,7 +239,7 @@ static void _poweroff(const ata8520e_t *dev) int ata8520e_init(ata8520e_t *dev, const ata8520e_params_t *params) { /* write config params to device descriptor */ - memcpy(&dev->params, params, sizeof(ata8520e_params_t)); + dev->params = *params; /* Initialize pins*/ if (gpio_init_int(INTPIN, GPIO_IN_PD, diff --git a/drivers/bmx055/bmx055.c b/drivers/bmx055/bmx055.c index 2a8c17d5cd207426f6702cb3743b10b7a7f35d8c..244e0b54502d90612c1b811e8729f88cb1c26d29 100644 --- a/drivers/bmx055/bmx055.c +++ b/drivers/bmx055/bmx055.c @@ -54,7 +54,7 @@ int bmx055_init(bmx055_t *dev, const bmx055_params_t *params) uint8_t tmp; - memcpy(&dev->p, params, sizeof(bmx055_params_t)); + dev->p = *params; /* bring magnetometer from suspend mode to sleep mode just in case * and try to read magnetometer id diff --git a/drivers/cc2420/cc2420.c b/drivers/cc2420/cc2420.c index 7fc5f01e3d00ffa4d315739d5170e24825470c5a..b6982e096f98e1a6744696a05ca990026ca3dc65 100644 --- a/drivers/cc2420/cc2420.c +++ b/drivers/cc2420/cc2420.c @@ -38,7 +38,7 @@ void cc2420_setup(cc2420_t * dev, const cc2420_params_t *params) /* set pointer to the devices netdev functions */ dev->netdev.netdev.driver = &cc2420_driver; /* pull in device configuration parameters */ - memcpy(&dev->params, params, sizeof(cc2420_params_t)); + dev->params = *params; dev->state = CC2420_STATE_IDLE; /* reset device descriptor fields */ dev->options = 0; diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c index 8b81a3ef7db0d2e26e33f44e5a5945a350a226a8..c27f3a78d13d7cdc88661eded156a06a213bfdd0 100644 --- a/drivers/dht/dht.c +++ b/drivers/dht/dht.c @@ -69,7 +69,7 @@ int dht_init(dht_t *dev, const dht_params_t *params) assert(dev && params && ((dev->type == DHT11) || (dev->type == DHT22) || (dev->type == DHT21))); - memcpy(dev, params, sizeof(dht_t)); + *dev = *params; gpio_init(dev->pin, GPIO_OUT); gpio_set(dev->pin); diff --git a/drivers/hd44780/hd44780.c b/drivers/hd44780/hd44780.c index 0cf3c16764bcf71207fc538645ab1f97bf3448f1..12347a16a1e791ec29072858e8c60d3e270bb1ce 100644 --- a/drivers/hd44780/hd44780.c +++ b/drivers/hd44780/hd44780.c @@ -101,7 +101,7 @@ static void _write_bits(const hd44780_t *dev, uint8_t bits, uint8_t value) int hd44780_init(hd44780_t *dev, const hd44780_params_t *params) { /* write config params to device descriptor */ - memcpy(&dev->p, params, sizeof(hd44780_params_t)); + dev->p = *params; /* verify cols and rows */ if ((dev->p.cols > HD44780_MAX_COLS) || (dev->p.rows > HD44780_MAX_ROWS) || (dev->p.rows * dev->p.cols > 80)) { diff --git a/drivers/hdc1000/hdc1000.c b/drivers/hdc1000/hdc1000.c index 400ecab6fa584726f7b2b3c2243624ea5f3a139f..8030e312f724fd9814087a4c79d22b8cb286c780 100644 --- a/drivers/hdc1000/hdc1000.c +++ b/drivers/hdc1000/hdc1000.c @@ -40,7 +40,7 @@ int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params) uint16_t tmp; /* write device descriptor */ - memcpy(&dev->p, params, sizeof(hdc1000_params_t)); + dev->p = *params; /* try if we can interact with the device by reading its manufacturer ID */ i2c_acquire(dev->p.i2c); diff --git a/drivers/hts221/hts221.c b/drivers/hts221/hts221.c index 7ff9b79670074cea42025d8ac87f78ed958e4b76..a22e057ba9f759948065ff4b5f8a0f70d327538f 100644 --- a/drivers/hts221/hts221.c +++ b/drivers/hts221/hts221.c @@ -147,7 +147,7 @@ int hts221_init(hts221_t *dev, const hts221_params_t *params) { uint8_t reg; - memcpy(&dev->p, params, sizeof(hts221_params_t)); + dev->p = *params; i2c_acquire(BUS); /* try if we can interact with the device by reading its manufacturer ID */ diff --git a/drivers/kw2xrf/kw2xrf.c b/drivers/kw2xrf/kw2xrf.c index dc5cb1c0407ead0bbea213a7042741498b05b9ce..456bf9d6acd15547ba199c3224ee57c9880ac9ac 100644 --- a/drivers/kw2xrf/kw2xrf.c +++ b/drivers/kw2xrf/kw2xrf.c @@ -60,7 +60,7 @@ void kw2xrf_setup(kw2xrf_t *dev, const kw2xrf_params_t *params) netdev->driver = &kw2xrf_driver; /* initialize device descriptor */ - memcpy(&dev->params, params, sizeof(kw2xrf_params_t)); + dev->params = *params; dev->idle_state = XCVSEQ_RECEIVE; dev->state = 0; dev->pending_tx = 0; diff --git a/drivers/lpd8808/lpd8808.c b/drivers/lpd8808/lpd8808.c index 0363af761b3e897c1f39a9255086d25db33d3882..6835139e271d07be83cc73040d356d12951dd760 100644 --- a/drivers/lpd8808/lpd8808.c +++ b/drivers/lpd8808/lpd8808.c @@ -56,7 +56,7 @@ static void flush(const lpd8808_t *dev) int lpd8808_init(lpd8808_t *dev, const lpd8808_params_t *params) { - memcpy(dev, params, sizeof(lpd8808_params_t)); + *dev = *params; /* initialize pins */ gpio_init(dev->pin_dat, GPIO_OUT); diff --git a/drivers/mag3110/mag3110.c b/drivers/mag3110/mag3110.c index dec5d24efeab78e5eb6f375e1a8d79ee03f7d5ef..6c57d10d72358fc6670ee36dfd4d7f14155eb982 100644 --- a/drivers/mag3110/mag3110.c +++ b/drivers/mag3110/mag3110.c @@ -46,7 +46,7 @@ int mag3110_init(mag3110_t *dev, const mag3110_params_t *params) assert(params); /* write device descriptor */ - memcpy(dev, params, sizeof(mag3110_params_t)); + dev->params = *params; i2c_acquire(BUS); /* test device */ diff --git a/drivers/mma7660/mma7660.c b/drivers/mma7660/mma7660.c index b9e98d3364f2b2b5a3aa12437e9d23b9e9f0ca7b..d0902fd86ea79ea7b740cc46ecdbac225b36e228 100644 --- a/drivers/mma7660/mma7660.c +++ b/drivers/mma7660/mma7660.c @@ -48,7 +48,7 @@ int mma7660_init(mma7660_t *dev, const mma7660_params_t *params) { /* write device descriptor */ - memcpy(&dev->params, params, sizeof(mma7660_params_t)); + dev->params = *params; if (mma7660_set_mode(dev, 0, 0, 0, 0) != MMA7660_OK) { DEBUG("mma7660_set_mode failed!\n"); diff --git a/drivers/mma8x5x/mma8x5x.c b/drivers/mma8x5x/mma8x5x.c index 3850d23453f2b22a699e8a4fcc3e2818c8cc75d6..d515cc1d450a277f6a3eedf6e7093fa2b9d412ff 100644 --- a/drivers/mma8x5x/mma8x5x.c +++ b/drivers/mma8x5x/mma8x5x.c @@ -44,7 +44,7 @@ int mma8x5x_init(mma8x5x_t *dev, const mma8x5x_params_t *params) assert(dev && params); /* write device descriptor */ - memcpy(dev, params, sizeof(mma8x5x_params_t)); + dev->params = *params; /* acquire the I2C bus */ i2c_acquire(BUS); diff --git a/drivers/mpl3115a2/mpl3115a2.c b/drivers/mpl3115a2/mpl3115a2.c index ac76a7f18520e50b7afd4efda81ae2fd720c7eaf..79e2a7381e824ed8ba7617d8e282654383736edb 100644 --- a/drivers/mpl3115a2/mpl3115a2.c +++ b/drivers/mpl3115a2/mpl3115a2.c @@ -46,7 +46,7 @@ int mpl3115a2_init(mpl3115a2_t *dev, const mpl3115a2_params_t *params) assert(params); /* write device descriptor */ - memcpy(dev, params, sizeof(mpl3115a2_params_t)); + dev->params = *params; i2c_acquire(BUS); /* test device */ diff --git a/drivers/mrf24j40/mrf24j40.c b/drivers/mrf24j40/mrf24j40.c index befd12e8b138f45a9fc26474d98b58fb7d8ab415..2e58731781d7551389995e58c156799e954a4b57 100644 --- a/drivers/mrf24j40/mrf24j40.c +++ b/drivers/mrf24j40/mrf24j40.c @@ -37,7 +37,7 @@ void mrf24j40_setup(mrf24j40_t *dev, const mrf24j40_params_t *params) netdev->driver = &mrf24j40_driver; /* initialize device descriptor */ - memcpy(&dev->params, params, sizeof(mrf24j40_params_t)); + dev->params = *params; } void mrf24j40_reset(mrf24j40_t *dev) diff --git a/drivers/my9221/my9221.c b/drivers/my9221/my9221.c index 5060b057077382873c5a91006561982c3b70dd08..ce9e0ed8c739a6fc038f5268b72fb25505043185 100644 --- a/drivers/my9221/my9221.c +++ b/drivers/my9221/my9221.c @@ -96,7 +96,7 @@ int my9221_init(my9221_t *dev, const my9221_params_t *params) assert(dev); assert(params); /* write config params to device descriptor */ - memcpy(&dev->params, params, sizeof(my9221_params_t)); + dev->params = *params; /* init clock and data pins as output */ gpio_init(PIN_CLK, GPIO_OUT); gpio_init(PIN_DAT, GPIO_OUT); diff --git a/drivers/rn2xx3/rn2xx3.c b/drivers/rn2xx3/rn2xx3.c index faad12900d264f004c407fe6e9d0d45b241ef008..28d0723213eb1a5b7d403d772952dfe9daaee32e 100644 --- a/drivers/rn2xx3/rn2xx3.c +++ b/drivers/rn2xx3/rn2xx3.c @@ -141,7 +141,7 @@ void rn2xx3_setup(rn2xx3_t *dev, const rn2xx3_params_t *params) assert(dev && (params->uart < UART_NUMOF)); /* initialize device parameters */ - memcpy(&dev->p, params, sizeof(rn2xx3_params_t)); + dev->p = *params; /* initialize pins and perform hardware reset */ if (dev->p.pin_reset != GPIO_UNDEF) { diff --git a/drivers/sdcard_spi/sdcard_spi.c b/drivers/sdcard_spi/sdcard_spi.c index 435f0d03181557f2ad08ff365af557acac7a82f7..fe2b2dc409d2eebf71027d59b5c8b56fda171518 100644 --- a/drivers/sdcard_spi/sdcard_spi.c +++ b/drivers/sdcard_spi/sdcard_spi.c @@ -62,7 +62,7 @@ static int (*_dyn_spi_rxtx_byte)(sdcard_spi_t *card, char out, char *in); int sdcard_spi_init(sdcard_spi_t *card, const sdcard_spi_params_t *params) { sd_init_fsm_state_t state = SD_INIT_START; - memcpy(&card->params, params, sizeof(sdcard_spi_params_t)); + card->params = *params; card->spi_clk = SD_CARD_SPI_SPEED_PREINIT; do { diff --git a/drivers/si70xx/si70xx.c b/drivers/si70xx/si70xx.c index acb61fcb4afe5cf01780db43dc6cbb877ed00fcb..f99e85dc3153f0cf01ef0be2a095225a98e44dd0 100644 --- a/drivers/si70xx/si70xx.c +++ b/drivers/si70xx/si70xx.c @@ -148,7 +148,7 @@ static int _test_device(const si70xx_t *dev) int si70xx_init(si70xx_t *dev, const si70xx_params_t *params) { /* initialize the device descriptor */ - memcpy(&dev->params, params, sizeof(si70xx_params_t)); + dev->params = *params; /* setup the i2c bus */ i2c_acquire(SI70XX_I2C); diff --git a/drivers/slipdev/slipdev.c b/drivers/slipdev/slipdev.c index 430c26b24163b12cfd0bda4d1d79713953d48d65..7880008e156504ab4c1ce29619cda6aa47496dcc 100644 --- a/drivers/slipdev/slipdev.c +++ b/drivers/slipdev/slipdev.c @@ -200,7 +200,7 @@ static const netdev_driver_t slip_driver = { void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params) { /* set device descriptor fields */ - memcpy(&dev->config, params, sizeof(dev->config)); + dev->config = *params; dev->inesc = 0U; dev->netdev.driver = &slip_driver; } diff --git a/drivers/sx127x/sx127x.c b/drivers/sx127x/sx127x.c index 87dfa797cde4007c230dd1d34a9708a7abde11d7..392d04e2421ca898ea24402a72ab4081f8718a82 100644 --- a/drivers/sx127x/sx127x.c +++ b/drivers/sx127x/sx127x.c @@ -61,7 +61,7 @@ void sx127x_setup(sx127x_t *dev, const sx127x_params_t *params) { netdev_t *netdev = (netdev_t*) dev; netdev->driver = &sx127x_driver; - memcpy(&dev->params, params, sizeof(sx127x_params_t)); + dev->params = *params; } int sx127x_reset(const sx127x_t *dev) diff --git a/drivers/tcs37727/tcs37727.c b/drivers/tcs37727/tcs37727.c index 7977d2fe67ca0e4055c6b606ede3e5ed5909b387..7aa244ccfb18e547912e41cb7859622f14326279 100644 --- a/drivers/tcs37727/tcs37727.c +++ b/drivers/tcs37727/tcs37727.c @@ -44,7 +44,7 @@ int tcs37727_init(tcs37727_t *dev, const tcs37727_params_t *params) assert(dev && params); /* initialize the device descriptor */ - memcpy(&dev->p, params, sizeof(tcs37727_params_t)); + dev->p = *params; /* setup the I2C bus */ i2c_acquire(BUS); diff --git a/drivers/tmp006/tmp006.c b/drivers/tmp006/tmp006.c index 03171541ff3e7a255834c1d44927a4f71828b71d..350cd2c5740be162d8bcdd3b2038cc02fcf73ff5 100644 --- a/drivers/tmp006/tmp006.c +++ b/drivers/tmp006/tmp006.c @@ -70,7 +70,7 @@ int tmp006_init(tmp006_t *dev, const tmp006_params_t *params) uint16_t tmp; /* initialize the device descriptor */ - memcpy(&dev->p, params, sizeof(tmp006_params_t)); + dev->p = *params; if (dev->p.rate > TMP006_CONFIG_CR_AS16) { LOG_ERROR("tmp006_init: invalid conversion rate!\n"); diff --git a/drivers/w5100/w5100.c b/drivers/w5100/w5100.c index aec5ec2598f026e0a662c9a9bac7c7171c8de232..6759edafd3b79e2d5b8e78868dfb1ca66cda4c67 100644 --- a/drivers/w5100/w5100.c +++ b/drivers/w5100/w5100.c @@ -118,7 +118,7 @@ void w5100_setup(w5100_t *dev, const w5100_params_t *params) dev->nd.context = dev; /* initialize the device descriptor */ - memcpy(&dev->p, params, sizeof(w5100_params_t)); + dev->p = *params; /* initialize the chip select pin and the external interrupt pin */ spi_init_cs(dev->p.spi, dev->p.cs); diff --git a/drivers/xbee/xbee.c b/drivers/xbee/xbee.c index fb9985896d0739c1e177a9922a2612f7b9c80291..1b4b8843c7346d167e01386785f689e97338d4a7 100644 --- a/drivers/xbee/xbee.c +++ b/drivers/xbee/xbee.c @@ -483,7 +483,7 @@ void xbee_setup(xbee_t *dev, const xbee_params_t *params) dev->context = dev; /* set peripherals to use */ - memcpy(&dev->p, params, sizeof(xbee_params_t)); + dev->p = *params; /* initialize pins */ if (dev->p.pin_reset != GPIO_UNDEF) { diff --git a/examples/asymcute_mqttsn/main.c b/examples/asymcute_mqttsn/main.c index f0f58336e00fc6ffec8421c4b41f3750cf24cd50..430a3dc81b2959327615c495c58387283542e04b 100644 --- a/examples/asymcute_mqttsn/main.c +++ b/examples/asymcute_mqttsn/main.c @@ -128,7 +128,7 @@ static int _topic_find(asymcute_topic_t *t, const char *name) if (asymcute_topic_is_reg(&_topics[i]) && (strncmp(name, _topics[i].name, sizeof(_topics[i].name)) == 0)) { if (t) { - memcpy(t, &_topics[i], sizeof(asymcute_topic_t)); + *t = _topics[i]; } return 0; } diff --git a/tests/driver_sx127x/main.c b/tests/driver_sx127x/main.c index ea293a017e7a10e349ca094cb50db61bad1d5ff3..5261b869d22308af17495d2064ec60bb77266467 100644 --- a/tests/driver_sx127x/main.c +++ b/tests/driver_sx127x/main.c @@ -376,7 +376,7 @@ void *_recv_thread(void *arg) int main(void) { - memcpy(&sx127x.params, sx127x_params, sizeof(sx127x_params)); + sx127x.params = sx127x_params[0]; netdev_t *netdev = (netdev_t*) &sx127x; netdev->driver = &sx127x_driver;