mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-26 15:03:53 +01:00
Merge pull request #8572 from basilfx/bugfix/efm32_peripherals
cpu: efm32: fix ADC and RTC
This commit is contained in:
commit
879e949967
@ -76,7 +76,7 @@ int adc_sample(adc_t line, adc_res_t res)
|
||||
|
||||
init.acqTime = adc_channel_config[line].acq_time;
|
||||
init.reference = adc_channel_config[line].reference;
|
||||
init.resolution = (ADC_Res_TypeDef) (res & 0xFF);
|
||||
init.resolution = (ADC_Res_TypeDef) (res & 0x0F);
|
||||
#ifdef _SILICON_LABS_32B_SERIES_0
|
||||
init.input = adc_channel_config[line].input;
|
||||
#else
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
typedef struct {
|
||||
rtc_alarm_cb_t alarm_cb; /**< callback called from RTC interrupt */
|
||||
void *alarm_arg; /**< argument passed to the callback */
|
||||
uint32_t alarm; /**< scheduled alarm (may be defered) */
|
||||
time_t alarm; /**< scheduled alarm (may be deferred) */
|
||||
uint8_t overflows; /**< number of overflows */
|
||||
} rtc_state_t;
|
||||
|
||||
@ -95,7 +95,7 @@ void rtc_init(void)
|
||||
|
||||
int rtc_set_time(struct tm *time)
|
||||
{
|
||||
uint32_t timestamp = mktime(time);
|
||||
time_t timestamp = mktime(time);
|
||||
|
||||
rtc_state.overflows = (timestamp >> RTC_SHIFT_VALUE);
|
||||
RTC->CNT = timestamp & RTC_MAX_VALUE;
|
||||
@ -105,7 +105,7 @@ int rtc_set_time(struct tm *time)
|
||||
|
||||
int rtc_get_time(struct tm *time)
|
||||
{
|
||||
uint32_t timestamp = RTC_CounterGet();
|
||||
time_t timestamp = RTC_CounterGet();
|
||||
|
||||
timestamp = timestamp + (rtc_state.overflows << RTC_SHIFT_VALUE);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user