Lines Matching refs:regs
348 uint8_t regs[7]; in pcf8523_set_time() local
369 regs[0] = bin2bcd(timeptr->tm_sec) & PCF8523_SECONDS_MASK; in pcf8523_set_time()
370 regs[1] = bin2bcd(timeptr->tm_min) & PCF8523_MINUTES_MASK; in pcf8523_set_time()
371 regs[2] = bin2bcd(timeptr->tm_hour) & PCF8523_HOURS_24H_MASK; in pcf8523_set_time()
372 regs[3] = bin2bcd(timeptr->tm_mday) & PCF8523_DAYS_MASK; in pcf8523_set_time()
373 regs[4] = bin2bcd(timeptr->tm_wday) & PCF8523_WEEKDAYS_MASK; in pcf8523_set_time()
374 regs[5] = bin2bcd(timeptr->tm_mon + PCF8523_MONTHS_OFFSET) & PCF8523_MONTHS_MASK; in pcf8523_set_time()
375 regs[6] = bin2bcd(timeptr->tm_year - PCF8523_YEARS_OFFSET) & PCF8523_YEARS_MASK; in pcf8523_set_time()
378 err = pcf8523_write_regs(dev, PCF8523_SECONDS, ®s, sizeof(regs)); in pcf8523_set_time()
397 uint8_t regs[10]; in pcf8523_get_time() local
401 err = pcf8523_read_regs(dev, PCF8523_CONTROL_1, ®s, sizeof(regs)); in pcf8523_get_time()
406 if ((regs[0] & PCF8523_CONTROL_1_STOP) != 0) { in pcf8523_get_time()
411 if ((regs[3] & PCF8523_SECONDS_OS) != 0) { in pcf8523_get_time()
417 timeptr->tm_sec = bcd2bin(regs[3] & PCF8523_SECONDS_MASK); in pcf8523_get_time()
418 timeptr->tm_min = bcd2bin(regs[4] & PCF8523_MINUTES_MASK); in pcf8523_get_time()
419 timeptr->tm_hour = bcd2bin(regs[5] & PCF8523_HOURS_24H_MASK); in pcf8523_get_time()
420 timeptr->tm_mday = bcd2bin(regs[6] & PCF8523_DAYS_MASK); in pcf8523_get_time()
421 timeptr->tm_wday = bcd2bin(regs[7] & PCF8523_WEEKDAYS_MASK); in pcf8523_get_time()
422 timeptr->tm_mon = bcd2bin(regs[8] & PCF8523_MONTHS_MASK) - PCF8523_MONTHS_OFFSET; in pcf8523_get_time()
423 timeptr->tm_year = bcd2bin(regs[9] & PCF8523_YEARS_MASK) + PCF8523_YEARS_OFFSET; in pcf8523_get_time()
453 uint8_t regs[4]; in pcf8523_alarm_set_time() local
466 regs[0] = bin2bcd(timeptr->tm_min) & PCF8523_MINUTE_ALARM_MASK; in pcf8523_alarm_set_time()
468 regs[0] = PCF8523_MINUTE_ALARM_AEN_M; in pcf8523_alarm_set_time()
472 regs[1] = bin2bcd(timeptr->tm_hour) & PCF8523_HOUR_ALARM_24H_MASK; in pcf8523_alarm_set_time()
474 regs[1] = PCF8523_HOUR_ALARM_AEN_H; in pcf8523_alarm_set_time()
478 regs[2] = bin2bcd(timeptr->tm_mday) & PCF8523_DAY_ALARM_MASK; in pcf8523_alarm_set_time()
480 regs[2] = PCF8523_DAY_ALARM_AEN_D; in pcf8523_alarm_set_time()
484 regs[3] = bin2bcd(timeptr->tm_wday) & PCF8523_WEEKDAY_ALARM_MASK; in pcf8523_alarm_set_time()
486 regs[3] = PCF8523_WEEKDAY_ALARM_AEN_W; in pcf8523_alarm_set_time()
494 return pcf8523_write_regs(dev, PCF8523_MINUTE_ALARM, ®s, sizeof(regs)); in pcf8523_alarm_set_time()
500 uint8_t regs[4]; in pcf8523_alarm_get_time() local
509 err = pcf8523_read_regs(dev, PCF8523_MINUTE_ALARM, ®s, sizeof(regs)); in pcf8523_alarm_get_time()
517 if ((regs[0] & PCF8523_MINUTE_ALARM_AEN_M) == 0) { in pcf8523_alarm_get_time()
518 timeptr->tm_min = bcd2bin(regs[0] & PCF8523_MINUTE_ALARM_MASK); in pcf8523_alarm_get_time()
522 if ((regs[1] & PCF8523_HOUR_ALARM_AEN_H) == 0) { in pcf8523_alarm_get_time()
523 timeptr->tm_hour = bcd2bin(regs[1] & PCF8523_HOUR_ALARM_24H_MASK); in pcf8523_alarm_get_time()
527 if ((regs[2] & PCF8523_DAY_ALARM_AEN_D) == 0) { in pcf8523_alarm_get_time()
528 timeptr->tm_mday = bcd2bin(regs[2] & PCF8523_DAY_ALARM_MASK); in pcf8523_alarm_get_time()
532 if ((regs[3] & PCF8523_WEEKDAY_ALARM_AEN_W) == 0) { in pcf8523_alarm_get_time()
533 timeptr->tm_wday = bcd2bin(regs[3] & PCF8523_WEEKDAY_ALARM_MASK); in pcf8523_alarm_get_time()
767 uint8_t regs[3]; in pcf8523_init() local
823 err = pcf8523_read_regs(dev, PCF8523_CONTROL_1, ®s, sizeof(regs)); in pcf8523_init()
830 regs[0] |= PCF8523_CONTROL_1_CAP_SEL; in pcf8523_init()
832 regs[0] &= ~(PCF8523_CONTROL_1_CAP_SEL); in pcf8523_init()
836 regs[0] &= ~(PCF8523_CONTROL_1_12_24); in pcf8523_init()
839 regs[0] &= ~(PCF8523_CONTROL_1_SIE | PCF8523_CONTROL_1_AIE | PCF8523_CONTROL_1_CIE); in pcf8523_init()
847 regs[0] |= PCF8523_CONTROL_1_AIE; in pcf8523_init()
851 regs[1] &= ~(PCF8523_CONTROL_2_CTAF | PCF8523_CONTROL_2_CTBF | PCF8523_CONTROL_2_SF); in pcf8523_init()
854 regs[1] &= ~(PCF8523_CONTROL_2_WTAIE | PCF8523_CONTROL_2_CTAIE | PCF8523_CONTROL_2_CTBIE); in pcf8523_init()
857 regs[2] &= ~(PCF8523_CONTROL_3_PM_MASK); in pcf8523_init()
858 regs[2] |= FIELD_PREP(PCF8523_CONTROL_3_PM_MASK, config->pm); in pcf8523_init()
861 regs[2] &= ~(PCF8523_CONTROL_3_BSF); in pcf8523_init()
864 regs[2] &= ~(PCF8523_CONTROL_3_BSIE | PCF8523_CONTROL_3_BLIE); in pcf8523_init()
867 err = pcf8523_write_regs(dev, PCF8523_CONTROL_1, ®s, sizeof(regs)); in pcf8523_init()