1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

233 Commits

Author SHA1 Message Date
Dylan Laduranty
88fe7afe2b
Merge pull request #12121 from benpicco/sam0-fix_exti
cpu/sam0_common/gpio: don't hard-code number of ports
2019-09-12 20:17:11 +02:00
Benjamin Valentin
b1724a7d1b periph/rtc: normalize struct tm before usage
A naive implementation may set a RTC alarm in 30s by calling

	struct tm now;
	rtc_get_time(&now);
	now.tm_sec += 30;
	rtc_set_alarm(&now, _cb, NULL);

This works for RTC implementations that use a RTT internally and call
mktime() to convert the struct tm to a unix timestamp, as mktime() will
normalize the struct in the process.

Call rtc_tm_normalize() when the RTC uses separate registers for time / date
components to ensure it is normalized.

This also modifies tests/periph_rtc to exercise this case.
2019-09-12 11:32:31 +02:00
Sebastian Meiling
49acf98841 cpu/sam0: adapt timer to return 0 on success
Adapt periph/timer implementation of sam0 based MCUs
to return 0 on success for all functions.
2019-09-11 13:52:28 +02:00
Juan Carrano
f7279c84bb cpu/sam0_common: rtt: correcly clear flags.
The INTFLAGS register is cleared by writing a 1 to the corresponding interrupt
flag bit. From the samr21's manual:

> Writing a zero to this bit has no effect.
> Writing a one to this bit clears the Compare 0 interrupt flag.

This is a common pattern in flag registers.

This RTT driver is using or-equal to clear the flags, which means it can
possibly clear other interrupts. There's a small chance that one event is
missed if it happens very close to another event.

Credits to @benpicco, @dylad for pointing out missing fixes.
2019-09-11 12:55:10 +02:00
Benjamin Valentin
ba8dfc8341 cpu/sam0_common/gpio: don't hard-code number of ports
_exti() always assumes only 2 ports, so it will always fail when using
e.g. port C or port D on same54.

Instead, determine the number of ports from the dimensions of the exti_config
array.
2019-08-29 15:27:42 +02:00
Marian Buschsieweke
dd56b3bb71
cpu/sam0_common: Updated i2c_release() 2019-08-22 12:03:08 +02:00
Benjamin Valentin
a9b0db3ba4 cpu/sam0_common: add hwrng driver 2019-08-03 14:50:58 +02:00
Kevin "Bear Puncher" Weiss
a290f2d66c
Merge pull request #11712 from bergzand/pr/sam0_common/uart_modecfg
sam0_common: add uart modecfg support
2019-06-21 13:08:07 +02:00
3241aff71c
sam0_common: add uart modecfg 2019-06-21 10:54:24 +02:00
Benjamin Valentin
7928c74e26 sam0_common: rtc/rtt: don't setup oscilators
leave that to cpu.c
2019-06-18 13:20:04 +02:00
Benjamin Valentin
f375b00ff3 cpu/samd5x: add support for samd5x/same5x MCUs
This adds supoprt for the Atmel SAMD51 & SAME54 SoC.
The SAME5x/SAMD5x is a line of Cortex-M4F MCUs that share peripherals
with the samd2x Cortex-M0+ and saml1x Cortex-M23 parts.
2019-06-06 16:47:11 +02:00
Benjamin Valentin
f36d54f239 sam0/timer: various fixes
This cleans up the sam0 timer driver:

 - remove the check for the unused freq parameter
 - the MCU provides dedicated SET/CLR registers to avoid
   read-modify-write, so don't do read-modify-write on them.
 - workaround a possible hardware bug on SAMD5x:
   loop until the CMD_READSYNC is really set
2019-06-06 15:38:55 +02:00
Benjamin Valentin
7415e0590e sam0_common: spi: use sercom_set_gen() instead of re-implementing it
Don't repeat yourself and introduce errors in doing so.
2019-05-25 19:13:53 +02:00
Benjamin Valentin
31f88a2d0e sam0_common: periph/spi: use sercom_clk_en/dis()
Use already existing functions to turn on / off SERCOM clocks instead
of replicating the functionality in the driver.
2019-05-25 19:09:32 +02:00
Benjamin Valentin
849dd4cdce sam0_common: make Timer implementation common across all sam0 MCUs
The currently supported SAM0 MCUs (samd21, saml21, saml1x) share the same
Timer peripheral, yet each of them carries it's own copy of the Timer
driver.

This introduces a new timer driver that is common for all sam0 MCUs and
uses structs for configuration instead of defines.
2019-05-21 11:47:59 +02:00
Benjamin Valentin
077056b949 sam0_common: make RTT implementation common across all sam0 MCUs
The currently supported SAM0 MCUs (samd21, saml21, saml1x) share the
same RTC peripheral, yet each of them carries it's own copy of the RTT
driver.

Unify the drivers and move them to sam0_common.
2019-05-09 20:54:00 +02:00
Benjamin Valentin
9aa8c619c1 sam0_common: make RTC implementation common across all sam0 MCUs
The currently supported SAM0 MCUs (samd21, saml21, saml1x) share the
same RTC peripheral, yet each of them carries it's own copy of the RTC
driver.

Unify the drivers and move them to sam0_common.
2019-04-15 22:25:47 +02:00
Kevin "Bear Puncher" Weiss
15c2a48fdf
Merge pull request #10839 from dylad/pr/sam0/remove_gclk_slow
cpu/sam0_common: remove unneeded GCLK_SLOW setup in i2c driver
2019-03-28 14:31:16 +01:00
Dylan Laduranty
ccf12c57a8
Merge pull request #10884 from fedepell/sam_rwee_support
sam0 flashpage RWWEE flash support
2019-03-28 11:00:25 +01:00
1286b18ca9
sam0_common: Fix syntax mistake in usbdev driver 2019-03-26 16:09:03 +01:00
d7804823db
sam0_common: Add USB peripheral driver 2019-03-26 10:26:11 +01:00
Federico Pellegrin
5faafac092 sam0 flashpage RWWEE flash support 2019-03-21 04:27:41 +01:00
Martine Lenders
39e90502af sam0_common: check ADC_NUMOF on adc_init() 2019-02-04 09:28:13 +01:00
Federico Pellegrin
318f0cf679 sam0 flashpage: make ready check inline, add wait also after PBC 2019-01-30 04:29:23 +01:00
Federico Pellegrin
409d83e087 sam0 flashpage: minor code style fixes 2019-01-29 20:58:46 +01:00
Federico Pellegrin
051be66b76 sam0 flashpage: wait for READY bit in INTFLAG after write command 2019-01-27 07:39:10 +01:00
Dylan Laduranty
5dd51f2ec5 cpu/sam0_common: remove unneeded GCLK_SLOW setup in i2c driver 2019-01-22 09:29:42 +01:00
Dylan Laduranty
9450fa7dc3 cpu/sam0_common: add support for saml10/saml11
Add SAML10/SAML11 support through SAM0 because hardware IP are the same so reuse to avoid duplication
2019-01-21 17:06:58 +01:00
Federico Pellegrin
b8b8ffd163 sam0 flashpage_write: correct assert for last byte of flash + style 2018-12-21 13:11:38 +01:00
Federico Pellegrin
a0054654ee sam0 flashpage_write: fix writes translation from RIOT to CPU pages 2018-12-19 04:54:44 +01:00
Martine Lenders
95819c660b sam0_common: mark closing #endif for MODULE_PERIPH_GPIO_IRQ 2018-10-09 15:11:00 +02:00
13654a950b cpu/samr30: add support for samr30g18a
Co-authored-by: biboc <bapclenet@gmail.com>
2018-10-01 10:15:08 +02:00
Hauke Petersen
6afd0efdd8 cpu/sam0_common/gpio: use gpio_irq feature 2018-09-21 08:19:31 +02:00
dylad
4e6d3d1f92 sam0/spi: fix SPI mode assignment
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2018-09-04 13:58:51 +02:00
smlng
90f66a1952 cpu/sam0_common/i2c: fix ambiguous reg assignment
The value assigned to the register was unclear due to usage
    of bit-comparison and ternary operator, added parentheses to
    make it explicit.
2018-07-25 12:01:40 +02:00
dylad
e6bd6bfe3b sam0/i2c: update driver to new API 2018-07-25 12:01:34 +02:00
Vincent Dupont
a1f482cbf7 cpu/sam0: use const pointer in flashpage 2018-03-14 16:28:33 +01:00
c1e20f8231
Merge pull request #7709 from smlng/cpu/sam0_common/enh_uart
cpu, sam0 common: adapt periph-uart to use read-only bit-fields
2017-12-15 12:45:10 +01:00
smlng
150f3fb231 cpu/sam0_common: fix assert in periph/flashpage 2017-12-10 16:21:52 +01:00
43e972fc61
Merge pull request #7970 from kYc0o/add_flashpage_write_raw
periph/flashpage: add flashpage_write_raw interface
2017-12-04 13:13:52 +01:00
kYc0o
adc08d6578 cpu/sam0_common: add alignment and minimum size write block constants 2017-11-30 17:25:35 +01:00
fcb3fd9e70 cpu/sam0_common: add flashpage_write_raw() 2017-11-30 15:14:39 +01:00
Martine Lenders
39c122155c
Merge pull request #7995 from smlng/make/fix/unused_params
make: fix unused-params error
2017-11-28 14:46:23 +01:00
smlng
7309171303 build: fix unused parameter errors
cpu, sam0_common: fix unused parameter in periph/spi
        cpu, kinetis_common: fix unused parameter in periph/spi
        cpu, cc2538: fix unused param in periph/i2c
        cpu, cc2538: fix unused param in periph/spi
        cpu, sam3: fix unused param in periph/spi
        cpu, stm32_common: fix unused param in periph/pm
        cpu, stm32f3: fix unused params in periph/i2c
        cpu, nrf5x_common: fix unused param in periph/gpio
        cpu, nrf5x_common: fix unused param in periph/spi
        cpu, lpc2387: fix unused params in periph/spi
        cpu, cc2538: fix unused params in radio/netdev
        cpu, cc2650: fix unused params in periph/uart
        cpu, lm4f120: fix unused param in periph/spi
        cpu, lm4f120: fix unused params in periph/timer
        cpu, lm4f120: fix unused params in periph/uart
        cpu, stm32_common: fix unused params in periph/dac
        cpu, stm32l0: fix unused params in periph/i2c
        cpu, msp430fxyz: fix unused params in periph/uart
        cpu, mips: fix unused params
        cpu, cc430: fix unused-params in periph/timer
        cpu, msp430fxyz: fix unused params in periph/spi
        drivers, cc2420: fix unused param
        cpu, mips32r2_common: fix unused params in periph/timer
        cpu, cc2538: fix unused-param in periph/i2c
        cpu, mips32r2_common: fix unused-param in periph/timer
        cpu, msp430fxyz: fix unused params in periph/timer
        cpu, atmega_common: fix unused params in periph/spi
        driver, nrfmin: fix unused params
        cpu, cc2538_rf: fix unused params
        driver, netdev_ieee802514: fix unused param
        cpu, mip_pic32m: fix unused params
        cpu, lpc2387: fix unused params in periph/pwm
        tests/driver_sdcard_spi: fix unused params
        cpu, sam3: fix unused param in periph/pwm
        tests/driver_dynamixel: fix unused params, and style issues
        cpu, cc430: fix unused param in periph/rtc
        cpu, atmega_common: fix unused params in periph/i2c
2017-11-28 14:36:01 +01:00
smlng
e381317fbf make: fix sign-compare errors
cpu, nrf5x_common: fix sign-compare in periph/flashpage
    drivers, periph_common: fix sign-compare in flashpage
    cpu, sam0_common: fix sign-compare error in periph/gpio
    cpu, cc2538: fix sign-compare in periph/timer
    cpu, sam3: fix sign-compare in periph/gpio
    cpu, stm32_common: fix sign-compare in periph/pwm
    cpu, stm32_common: fix sign-compare in periph/timer
    cpu, stm32_common: fix sign-compare in periph/flashpage
    cpu, nrf5x_common: fix sign-compare in radio/nrfmin
    cpu, samd21: fix sign-compare in periph/pwm
    cpu, ezr32wg: fix sign-compare in periph/gpio
    cpu, ezr32wg: fix sign-compare in periph/timer
    drivers, ethos: fix sign-compare
    sys, net: fix sign-compare
    cpu, atmega_common: fix sign-compare error
    cpu, msp430fxyz: fix sign-compare in periph/gpio
    boards, msb-430-common: fix sign-compare in board_init
    driver, cc2420: fix sign-compared
    sys/net: fix sign-compare in gnrc_tftp
    driver, pcd8544: fix sign-compare
    driver, pn532: fix sign-compare
    driver, sdcard_spi: fix sign-compare
    tests: fix sign_compare
    sys/net, lwmac: fix sign_compare
    pkg, lwip: fix sign-compare
    boards, waspmote: make CORECLOCK unsigned long to fix sign_compare error
    tests, sock_ip: fix sign compare
    tests, msg_avail: fix sign compare
    tests, sock_udp: fix sign compare
    boards: fix sign-compare for calliope and microbit matrix
2017-11-28 11:55:48 +01:00
Hauke Petersen
89db77710f
Merge pull request #7963 from dylad/opt_sam0_gpio
cpu/sam0: share GPIO configuration
2017-11-13 14:58:56 +01:00
dylad
2f4254b0df cpu/sam0: ensure PD is selected
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-11-10 10:43:40 +01:00
Hauke Petersen
ec27204408 cpu/sam0: fixed cppcheck issue in i2c driver 2017-11-09 13:53:15 +01:00
Hauke Petersen
b3962f8d2c cpu/sam0: removed guards form periph drivers 2017-11-09 12:57:02 +01:00
Sebastian Meiling
2c19595b7e
Merge pull request #7763 from photonthunder/sam0_common_uart_receive
cpu/sam0_common/periph/uart - don’t setup receive if no pin is selected
2017-11-06 17:33:42 +01:00
a20745b6c5 cpu: make use of Makefile.periph 2017-11-06 12:01:19 +01:00
Dan Evans
d6ef4d2d51 cpu/sam0_common/periph/uart - don’t setup receive if no pin is selected 2017-10-23 16:22:58 -07:00
Martine Lenders
6e8fc5cbe1 Merge pull request #7644 from smlng/cpu/sam0/flashpage
cpu, sam0_common: fix flashpage use bitfield
2017-10-13 12:05:44 +02:00
smlng
ea1aa38b86 cpu, sam0_common: periph/uart use read-only bit-fields 2017-10-10 18:47:35 +02:00
smlng
732e60bb88 cpu, sam0_common: fix uart TXC check 2017-10-10 18:24:03 +02:00
Francisco Acosta
6da78131e7 Merge pull request #7675 from kaspar030/fix_sam0_uart
cpu/sam0/periph/uart: ensure uart_init() idempotency
2017-10-09 13:59:20 +02:00
ef1a8c66ac cpu/sam0/periph/uart: ensure uart_init() idempotency 2017-10-09 13:45:46 +02:00
Hauke Petersen
5711b5d53d cpu/sam0/gpio: do not clear pin on init 2017-10-04 12:12:43 +02:00
dylad
1e5262506d cpu/sam0: merge GPIO driver 2017-10-01 14:48:12 +02:00
Dan Evans
531e6f5008 sam0:usart - wake from sleep on receive line 2017-09-25 12:47:31 -06:00
smlng
48a996bbaa cpu, sam0_common: fix flashpage use bitfield 2017-09-25 09:24:43 +02:00
Hauke Petersen
68abdff15a cpu/sam0: optimizations to the shared UART driver 2017-09-04 13:11:05 +02:00
Hauke Petersen
4707ad2f89 cpu/sam0_common: fixed UART for samd21 2017-08-31 09:47:09 +02:00
dylad
a3acd1d741 remove dev variable for cppcheck
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-08-29 21:36:21 +02:00
dylad
c81ae98068 boards: update periph_conf of sam0 based board
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-08-29 21:26:42 +02:00
dylad
89c885ea40 sam0/uart: merge samd21 & saml21 uart driver
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-08-29 21:26:42 +02:00
smlng
01af6d94c4 cpu, periph: retain constness in spi_transfer_bytes 2017-06-29 15:47:13 +02:00
smlng
692cf96297 doc: fix doxygen grouping of cpu periph drivers 2017-06-26 14:42:11 +02:00
Antonio Galea
dae3472d49 cpu/sam0_common: add saml21 i2c driver adaption 2017-06-23 11:19:56 +02:00
biboc
0e41861db0 Change my email address:
<baptiste.clenet@xsoen.com>
to
<bapclenet@gmail.com>
2017-06-19 10:38:16 +02:00
Dan Evans
4cc0e585d1 sam0/adc: assert resolution check fix 2017-06-08 11:04:11 -06:00
Hauke Petersen
4e29dce36b cpu/samd0: added flashpage driver implemenation 2017-06-02 11:32:34 +02:00
8501a03cbc cleanup: apply enable_debug_false.cocci to codebase (coccinelle)
Skipped sys/cbor/cbor.c, examples/microcoap_server/microcoap_sock.c,
as they use different semantics.
2017-05-15 18:45:43 +02:00
Hauke Petersen
5d5d4dc5a6 Merge pull request #6652 from hamilton-mote/spi-wtf
periph/spi: power regression
2017-05-15 09:17:28 +02:00
dylad
44dd56c3e8 sam0/adc: merged samd21 & saml21 adc driver
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-05-12 21:02:17 +02:00
Michael Andersen
20ee531486 periph/spi: hotfix for power regression 2017-05-12 10:24:47 -07:00
Joakim Nohlgård
9adeaf0942 cpu/sam0: cpuid: Refactor for clarity 2017-04-05 09:03:49 +02:00
Hauke Petersen
ea07a6817c cpu/sam0+boards: adapted to new SPI API
- adapted the SPI driver
- merged SPI driver for samr21 and saml21
- adapted all boards using the CPU
2017-01-25 16:46:45 +01:00
Kees Bakker
2cbd3c4819 cpu/sam21:i2c: function _start was declared inline, but definition not 2017-01-18 21:30:13 +01:00
Kees Bakker
d509221e77 cpu/samd21:i2c: increase timeout in _start to facilitate SHT2x hold 2017-01-18 21:30:13 +01:00
Kees Bakker
bf4741d0d7 cpu/sam21_common:i2c: refactor a function to wait for response 2017-01-18 21:30:13 +01:00
Kees Bakker
8ca8640060 cpu/sam21_common:i2c: uncrustify 2017-01-18 21:30:13 +01:00
Hauke Petersen
fcb1e68732 cpu/sam0: renamed sam21_common to sam0_common 2016-12-15 11:47:03 +01:00