60 #define PRINTF(...) printf(__VA_ARGS__)
65 #define RTC_INT1_PORT_BASE GPIO_PORT_TO_BASE(RTC_INT1_PORT)
66 #define RTC_INT1_PIN_MASK GPIO_PIN_MASK(RTC_INT1_PIN)
69 void (*rtcc_int1_callback)(uint8_t value);
71 static const char *ab080x_td_register_name[] =
83 static const char *ab080x_config_register_name[] =
106 bcd_to_dec(uint8_t val)
108 return (uint8_t)(((val >> 4) * 10) + (val % 16));
112 dec_to_bcd(uint8_t val)
114 return (uint8_t)(((val / 10) << 4) + (val % 10));
118 check_leap_year(uint8_t val)
120 return ((val % 4) && (val % 100)) || (val % 400);
124 ab08_read_reg(uint8_t reg, uint8_t *buf, uint8_t regnum)
136 ab08_write_reg(uint8_t reg, uint8_t *buf, uint8_t regnum)
138 uint8_t i, buff[INT_BUFF_SIZE];
140 if(regnum > (INT_BUFF_SIZE - 1)) {
147 for(i = 0; i < regnum; i++) {
148 buff[(i + 1)] = buf[i];
152 if(
i2c_burst_send(AB08XX_ADDR, buff, (regnum + 1)) == I2C_MASTER_ERR_NONE) {
160 write_default_config(
void)
162 const ab080x_register_config_t *settings;
163 settings = ab080x_default_setting;
164 uint8_t i, len = (
sizeof(ab080x_default_setting) /
sizeof(ab080x_register_config_t));
166 for(i = 0; i < len; i++) {
167 ab08_write_reg(settings[i].reg, (uint8_t *)&settings[i].val, 1);
172 ab08_key_reg(uint8_t unlock)
174 if((unlock != RTCC_CONFKEY_OSCONTROL) && (unlock != RTCC_CONFKEY_SWRESET) &&
175 (unlock != RTCC_CONFKEY_DEFREGS)) {
176 PRINTF(
"RTC: invalid confkey values\n");
180 if(ab08_write_reg((CONFIG_MAP_OFFSET + CONF_KEY_ADDR), &unlock, 1)) {
181 PRINTF(
"RTC: failed to write to confkey register\n");
189 ab08_read_status(uint8_t *buf)
191 return ab08_read_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), buf, 1);
195 ab08_ctrl1_config(uint8_t cmd)
199 if(cmd >= RTCC_CMD_MAX) {
203 if(ab08_read_reg((CONFIG_MAP_OFFSET + CTRL_1_ADDR), &ctrl1, 1)) {
204 PRINTF(
"RTC: failed to retrieve CTRL1 register\n");
210 ctrl1 &= ~CTRL1_WRTC;
212 case RTCC_CMD_UNLOCK:
215 case RTCC_CMD_ENABLE:
216 ctrl1 &= ~CTRL1_STOP;
225 if(ab08_write_reg((CONFIG_MAP_OFFSET + CTRL_1_ADDR),
226 &ctrl1, 1) == AB08_ERROR) {
227 PRINTF(
"RTC: failed to write to the CTRL1 register\n");
235 ab08_check_td_format(simple_td_map *data, uint8_t alarm_state)
238 if((data->seconds > 59) || (data->minutes > 59) || (data->hours > 23)) {
242 if((data->months > 12) || (data->weekdays > 7) || (data->day > 31)) {
247 if(data->months == 2) {
248 if(check_leap_year(data->years)) {
262 if(data->years > 199) {
274 uint8_t rtc_buffer[RTCC_TD_MAP_SIZE];
276 if(ab08_check_td_format(data, 0) == AB08_ERROR) {
277 PRINTF(
"RTC: Invalid time/date values\n");
281 if(ab08_read_reg((CTRL_1_ADDR + CONFIG_MAP_OFFSET),
282 &aux, 1) == AB08_ERROR) {
283 PRINTF(
"RTC: failed to retrieve CONTROL1 register\n");
287 rtc_buffer[WEEKDAYLS_ADDR] = dec_to_bcd(data->weekdays);
288 rtc_buffer[YEAR_ADDR] = dec_to_bcd(data->years);
289 rtc_buffer[MONTHS_ADDR] = dec_to_bcd(data->months);
290 rtc_buffer[DAY_ADDR] = dec_to_bcd(data->day);
291 rtc_buffer[HOUR_ADDR] = dec_to_bcd(data->hours);
292 rtc_buffer[MIN_ADDR] = dec_to_bcd(data->minutes);
293 rtc_buffer[SEC_ADDR] = dec_to_bcd(data->seconds);
294 rtc_buffer[CENTHS_ADDR] = dec_to_bcd(data->miliseconds);
297 if(data->mode == RTCC_24H_MODE) {
300 if((data->hours == 0) || (data->hours > 12)) {
301 PRINTF(
"RTC: Invalid hour configuration (12h mode selected)\n");
305 if(data->mode == RTCC_12H_MODE_PM) {
307 rtc_buffer[HOUR_ADDR] |= RTCC_TOGGLE_PM_BIT;
309 PRINTF(
"RTC: Invalid time mode selected\n");
315 if(ab08_write_reg((CTRL_1_ADDR + CONFIG_MAP_OFFSET),
316 &aux, 1) == AB08_ERROR) {
317 PRINTF(
"RTC: failed to write 12h/24h configuration\n");
326 if(ab08_read_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), &aux, 1) == AB08_ERROR) {
327 PRINTF(
"RTC: failed to retrieve STATUS register\n");
331 if(data->century == RTCC_CENTURY_20XX) {
333 }
else if(data->century == RTCC_CENTURY_19XX_21XX) {
336 PRINTF(
"RTC: invalid century value\n");
340 PRINTF(
"RTC: current STATUS value 0x%02X\n", aux);
342 if(ab08_write_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), &aux, 1) == AB08_ERROR) {
343 PRINTF(
"RTC: failed to write century to STATUS register\n");
348 if(ab08_ctrl1_config(RTCC_CMD_UNLOCK) == AB08_ERROR) {
353 if(ab08_write_reg(CENTHS_ADDR, rtc_buffer,
354 RTCC_TD_MAP_SIZE) == AB08_ERROR) {
355 PRINTF(
"RTC: failed to write date configuration\n");
360 if(ab08_ctrl1_config(RTCC_CMD_LOCK) == AB08_ERROR) {
370 uint8_t rtc_buffer[RTCC_TD_MAP_SIZE];
372 if(ab08_read_reg(CENTHS_ADDR, rtc_buffer,
373 RTCC_TD_MAP_SIZE) == AB08_ERROR) {
374 PRINTF(
"RTC: failed to retrieve date and time values\n");
378 data->weekdays = bcd_to_dec(rtc_buffer[WEEKDAYLS_ADDR]);
379 data->years = bcd_to_dec(rtc_buffer[YEAR_ADDR]);
380 data->months = bcd_to_dec(rtc_buffer[MONTHS_ADDR]);
381 data->day = bcd_to_dec(rtc_buffer[DAY_ADDR]);
382 data->hours = bcd_to_dec(rtc_buffer[HOUR_ADDR]);
383 data->minutes = bcd_to_dec(rtc_buffer[MIN_ADDR]);
384 data->seconds = bcd_to_dec(rtc_buffer[SEC_ADDR]);
385 data->miliseconds = bcd_to_dec(rtc_buffer[CENTHS_ADDR]);
393 uint8_t aux[4], buf[RTCC_ALARM_MAP_SIZE];
395 if(state == RTCC_ALARM_OFF) {
396 if(ab08_read_reg((INT_MASK_ADDR + CONFIG_MAP_OFFSET),
397 &aux[0], 1) == AB08_ERROR) {
398 PRINTF(
"RTC: failed to retrieve INTMASK register\n");
402 aux[0] &= ~INTMASK_AIE;
404 if(ab08_write_reg((INT_MASK_ADDR + CONFIG_MAP_OFFSET),
405 &aux[0], 1) == AB08_ERROR) {
406 PRINTF(
"RTC: failed to clear the alarm config\n");
412 if((data ==
NULL) || (ab08_check_td_format(data, 1) == AB08_ERROR)) {
413 PRINTF(
"RTC: invalid alarm values\n");
417 if((state >= RTCC_ALARM_MAX) || (repeat >= RTCC_REPEAT_100THS)) {
418 PRINTF(
"RTC: invalid alarm config type or state\n");
423 ab08_ctrl1_config(RTCC_CMD_STOP);
425 buf[WEEKDAYS_ALARM_ADDR] = dec_to_bcd(data->weekdays);
426 buf[MONTHS_ALARM_ADDR] = dec_to_bcd(data->months);
427 buf[DAY_ALARMS_ADDR] = dec_to_bcd(data->day);
428 buf[HOURS_ALARM_ADDR] = dec_to_bcd(data->hours);
429 buf[MINUTES_ALARM_ADDR] = dec_to_bcd(data->minutes);
430 buf[SECONDS_ALARM_ADDR] = dec_to_bcd(data->seconds);
431 buf[HUNDREDTHS_ALARM_ADDR] = dec_to_bcd(data->miliseconds);
434 if(ab08_read_reg((CTRL_1_ADDR + CONFIG_MAP_OFFSET),
435 &aux[0], 1) == AB08_ERROR) {
436 PRINTF(
"RTC: failed to retrieve CONTROL1 register\n");
440 if(((aux[0] & CTRL1_1224) && (data->mode == RTCC_24H_MODE)) ||
441 (!(aux[0] & CTRL1_1224) && ((data->mode == RTCC_12H_MODE_AM) ||
442 (data->mode == RTCC_12H_MODE_PM)))) {
443 PRINTF(
"RTC: 12/24h mode and present date config mismatch\n");
447 if(data->mode != RTCC_24H_MODE) {
448 if((data->hours == 0) || (data->hours > 12)) {
449 PRINTF(
"RTC: Invalid hour configuration (12h mode selected)\n");
454 if(data->mode == RTCC_12H_MODE_PM) {
455 buf[HOURS_ALARM_ADDR] |= RTCC_TOGGLE_PM_BIT;
460 if(ab08_read_reg((TIMER_CONTROL_ADDR + CONFIG_MAP_OFFSET),
461 &aux[0], 1) == AB08_ERROR) {
462 PRINTF(
"RTC: failed to retrieve TIMER CTRL register\n");
466 aux[0] &= ~COUNTDOWN_TIMER_RPT_SECOND;
469 if(repeat == RTCC_REPEAT_10THS) {
470 buf[HUNDREDTHS_ALARM_ADDR] |= RTCC_FIX_10THS_HUNDRETHS;
471 repeat = RTCC_REPEAT_SECOND;
472 }
else if(repeat == RTCC_REPEAT_100THS) {
473 buf[HUNDREDTHS_ALARM_ADDR] |= RTCC_FIX_100THS_HUNDRETHS;
474 repeat = RTCC_REPEAT_SECOND;
477 if(repeat != RTCC_REPEAT_NONE) {
478 aux[0] |= (repeat << COUNTDOWN_TIMER_RPT_SHIFT);
483 aux[0] |= COUNTDOWN_TIMER_TM;
484 aux[0] &= ~COUNTDOWN_TIMER_TRPT;
486 if(ab08_write_reg((TIMER_CONTROL_ADDR + CONFIG_MAP_OFFSET),
487 &aux[0], 1) == AB08_ERROR) {
488 PRINTF(
"RTC: failed to clear the alarm config\n");
492 if(ab08_read_reg((STATUS_ADDR + CONFIG_MAP_OFFSET),
493 aux, 4) == AB08_ERROR) {
494 PRINTF(
"RTC: failed to read configuration registers\n");
499 aux[STATUS_ADDR] &= ~STATUS_ALM;
501 #if RTCC_CLEAR_INT_MANUALLY
502 aux[CTRL_1_ADDR] &= ~CTRL1_ARST;
506 aux[INT_MASK_ADDR] &= ~INTMASK_AIE;
513 aux[CTRL_2_ADDR] |= CTRL2_OUT1S_NIRQ_NAIRQ_OUT;
515 if(repeat != RTCC_REPEAT_NONE) {
516 aux[INT_MASK_ADDR] &= ~INTMASK_IM_LOW;
518 aux[INT_MASK_ADDR] |= INTMASK_IM_LOW;
521 if(ab08_write_reg((STATUS_ADDR + CONFIG_MAP_OFFSET), aux, 4) == AB08_ERROR) {
522 PRINTF(
"RTC: failed to clear alarm config\n");
532 if(ab08_write_reg((HUNDREDTHS_ALARM_ADDR + ALARM_MAP_OFFSET), buf,
533 RTCC_ALARM_MAP_SIZE) == AB08_ERROR) {
534 PRINTF(
"RTC: failed to set the alarm\n");
539 aux[INT_MASK_ADDR] |= INTMASK_AIE;
540 if(ab08_write_reg((INT_MASK_ADDR + CONFIG_MAP_OFFSET),
541 &aux[INT_MASK_ADDR], 1) == AB08_ERROR) {
542 PRINTF(
"RTC: failed to enable the alarm\n");
547 ab08_ctrl1_config(RTCC_CMD_ENABLE);
552 PROCESS(rtcc_int_process,
"RTCC interruption process handler");
562 if(ab08_read_status(&buf) == AB08_ERROR) {
563 PRINTF(
"RTC: failed to retrieve ARST value\n");
568 if((buf & STATUS_ALM) && (rtcc_int1_callback !=
NULL)) {
569 #if RTCC_CLEAR_INT_MANUALLY
571 if(ab08_write_reg((STATUS_ADDR + CONFIG_MAP_OFFSET),
572 &buf, 1) == AB08_ERROR) {
573 PRINTF(
"RTC: failed to clear the alarm\n");
577 rtcc_int1_callback(0);
588 uint8_t rtc_buffer[RTCC_CONFIG_MAP_SIZE];
590 if(value >= RTCC_PRINT_MAX) {
595 case RTCC_PRINT_CONFIG:
596 len = (RTCC_CONFIG_MAP_SIZE - 1);
597 reg = STATUS_ADDR + CONFIG_MAP_OFFSET;
598 name = (
char **)ab080x_config_register_name;
600 case RTCC_PRINT_ALARM:
601 case RTCC_PRINT_ALARM_DEC:
602 len = RTCC_ALARM_MAP_SIZE;
603 reg = HUNDREDTHS_ALARM_ADDR + ALARM_MAP_OFFSET;
604 name = (
char **)ab080x_td_register_name;
606 case RTCC_PRINT_DATE:
607 case RTCC_PRINT_DATE_DEC:
608 len = RTCC_TD_MAP_SIZE;
610 name = (
char **)ab080x_td_register_name;
616 if(ab08_read_reg(reg, rtc_buffer, len) == AB08_ERROR) {
617 PRINTF(
"RTC: failed to retrieve values to print\n");
621 if(value == RTCC_PRINT_ALARM_DEC) {
622 printf(
"%02u/%02u (%02u) %02u:%02u:%02u/%02u\n",
623 bcd_to_dec(rtc_buffer[MONTHS_ALARM_ADDR]),
624 bcd_to_dec(rtc_buffer[DAY_ALARMS_ADDR]),
625 bcd_to_dec(rtc_buffer[WEEKDAYS_ALARM_ADDR]),
626 bcd_to_dec(rtc_buffer[HOURS_ALARM_ADDR]),
627 bcd_to_dec(rtc_buffer[MINUTES_ALARM_ADDR]),
628 bcd_to_dec(rtc_buffer[SECONDS_ALARM_ADDR]),
629 bcd_to_dec(rtc_buffer[HUNDREDTHS_ALARM_ADDR]));
633 if(value == RTCC_PRINT_DATE_DEC) {
634 printf(
"%02u/%02u/%02u (%02u) %02u:%02u:%02u/%02u\n",
635 bcd_to_dec(rtc_buffer[YEAR_ADDR]),
636 bcd_to_dec(rtc_buffer[MONTHS_ADDR]),
637 bcd_to_dec(rtc_buffer[DAY_ADDR]),
638 bcd_to_dec(rtc_buffer[WEEKDAYLS_ADDR]),
639 bcd_to_dec(rtc_buffer[HOUR_ADDR]),
640 bcd_to_dec(rtc_buffer[MIN_ADDR]),
641 bcd_to_dec(rtc_buffer[SEC_ADDR]),
642 bcd_to_dec(rtc_buffer[CENTHS_ADDR]));
646 for(i = 0; i < len; i++) {
647 printf(
"0x%02X <- %s\n", rtc_buffer[i], name[i]);
654 rtcc_interrupt_handler(uint8_t port, uint8_t pin)
664 if(period > RTCC_AUTOCAL_9_MIN) {
665 PRINTF(
"RTC: invalid autocal value\n");
669 if(ab08_read_reg((OSC_CONTROL_ADDR + CONFIG_MAP_OFFSET),
670 &aux, 1) == AB08_ERROR) {
671 PRINTF(
"RTC: failed to read oscillator registers\n");
676 aux &= ~OSCONTROL_ACAL_9_MIN;
679 ab08_key_reg(RTCC_CONFKEY_OSCONTROL);
682 case RTCC_AUTOCAL_DISABLE:
684 case RTCC_AUTOCAL_ONCE:
685 case RTCC_AUTOCAL_17_MIN:
686 aux |= OSCONTROL_ACAL_17_MIN;
688 case RTCC_AUTOCAL_9_MIN:
689 aux |= OSCONTROL_ACAL_9_MIN;
695 if(ab08_write_reg((OSC_CONTROL_ADDR + CONFIG_MAP_OFFSET),
696 &aux, 1) == AB08_ERROR) {
697 PRINTF(
"RTC: failed to clear the autocalibration\n");
701 if(period == RTCC_AUTOCAL_ONCE) {
703 ab08_key_reg(RTCC_CONFKEY_OSCONTROL);
704 aux &= ~OSCONTROL_ACAL_9_MIN;
705 if(ab08_write_reg((OSC_CONTROL_ADDR + CONFIG_MAP_OFFSET),
706 &aux, 1) == AB08_ERROR) {
707 PRINTF(
"RTC: failed to clear the autocalibration\n");
722 if(mode > RTCC_CAL_RC_OSC) {
723 PRINTF(
"RTC: invalid calibration mode\n");
728 if((mode == RTCC_CAL_XT_OSC) && ((adjust <= -610) || (adjust >= 242))) {
729 PRINTF(
"RTC: invalid adjust value for XT oscillator\n");
733 if((mode == RTCC_CAL_RC_OSC) && ((adjust <= -65536) || (adjust >= 65520))) {
734 PRINTF(
"RTC: invalid adjust value for XT oscillator\n");
740 adjint = ((adjust) * 1000 - 953);
742 adjint = ((adjust) * 1000 + 953);
745 adjint = adjint / 1907;
747 if(mode == RTCC_CAL_XT_OSC) {
751 adjreg[0] = ((adjint >> 1) & 0x3F) | 0x80;
752 }
else if(adjint > -65) {
754 adjreg[0] = (adjint & 0x7F);
755 }
else if(adjint > -129) {
757 adjreg[0] = ((adjint + 64) & 0x7F);
758 }
else if(adjint > -193) {
760 adjreg[0] = ((adjint + 128) & 0x7F);
761 }
else if(adjint > -257) {
763 adjreg[0] = ((adjint + 192) & 0x7F);
766 adjreg[0] = ((adjint + 192) >> 1) & 0xFF;
769 if(ab08_write_reg((CAL_XT_ADDR + CONFIG_MAP_OFFSET),
770 &adjreg[0], 1) == AB08_ERROR) {
771 PRINTF(
"RTC: failed to clear the autocalibration\n");
775 if(ab08_read_reg((OSC_STATUS_ADDR + CONFIG_MAP_OFFSET),
776 &adjreg[0], 1) == AB08_ERROR) {
777 PRINTF(
"RTC: failed to read oscillator registers\n");
783 adjreg[0] |= (xtcal << 6);
785 if(ab08_write_reg((OSC_STATUS_ADDR + CONFIG_MAP_OFFSET),
786 &adjreg[0], 1) == AB08_ERROR) {
787 PRINTF(
"RTC: failed to clear the autocalibration\n");
790 }
else if(mode == RTCC_CAL_RC_OSC) {
792 adjreg[1] = ((adjint >> 3) & 0xFF);
793 adjreg[0] = ((adjint >> 11) | 0xC0);
794 }
else if(adjint > 16383) {
795 adjreg[1] = ((adjint >> 2) & 0xFF);
796 adjreg[0] = ((adjint >> 10) | 0x80);
797 }
else if(adjint > 8191) {
798 adjreg[1] = ((adjint >> 1) & 0xFF);
799 adjreg[0] = ((adjint >> 9) | 0x40);
800 }
else if(adjint >= 0) {
801 adjreg[1] = ((adjint) & 0xFF);
802 adjreg[0] = (adjint >> 8);
803 }
else if(adjint > -8193) {
804 adjreg[1] = ((adjint) & 0xFF);
805 adjreg[0] = (adjint >> 8) & 0x3F;
806 }
else if(adjint > -16385) {
807 adjreg[1] = ((adjint >> 1) & 0xFF);
808 adjreg[0] = (adjint >> 9) & 0x7F;
809 }
else if(adjint > -32769) {
810 adjreg[1] = ((adjint >> 2) & 0xFF);
811 adjreg[0] = (adjint >> 10) & 0xBF;
813 adjreg[1] = ((adjint >> 3) & 0xFF);
814 adjreg[0] = (adjint >> 11) & 0xFF;
817 if(ab08_write_reg((CAL_RC_HI_ADDR + CONFIG_MAP_OFFSET),
818 adjreg, 2) == AB08_ERROR) {
819 PRINTF(
"RTC: failed to set the RC calibration\n");
834 i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN,
835 I2C_SCL_NORMAL_BUS_SPEED);
837 #if RTCC_SET_DEFAULT_CONFIG
838 write_default_config();
846 rtcc_int1_callback =
NULL;
#define GPIO_TRIGGER_SINGLE_EDGE(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to trigger an interrupt on single edge (controlled by G...
void process_poll(struct process *p)
Request a process to be polled.
#define GPIO_ENABLE_INTERRUPT(PORT_BASE, PIN_MASK)
Enable interrupt triggering for pins with PIN_MASK of port with PORT_BASE.
#define GPIO_SET_INPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to input.
#define IOC_OVERRIDE_PUE
Pull Up Enable.
#define GPIO_DETECT_EDGE(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to detect edge.
void i2c_master_enable(void)
Enable master I2C module.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
int8_t rtcc_set_alarm_time_date(simple_td_map *data, uint8_t state, uint8_t repeat)
Configure the RTCC to match an alarm counter.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_EXIT()
Exit the currently running process.
#define GPIO_DETECT_FALLING(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to trigger an interrupt on falling edge.
int8_t rtcc_print(uint8_t value)
Print data from the RTCC module, either from the memory map (values in BCD) or actual readable data (...
void i2c_init(uint8_t port_sda, uint8_t pin_sda, uint8_t port_scl, uint8_t pin_scl, uint32_t bus_speed)
Initialize the I2C peripheral and pins.
int8_t rtcc_set_calibration(uint8_t mode, int32_t adjust)
Manually calibrate the RTCC.
#define PROCESS_EXITHANDLER(handler)
Specify an action when a process exits.
uint8_t i2c_burst_send(uint8_t slave_addr, uint8_t *data, uint8_t len)
Perform all operations to send multiple bytes to a slave.
#define NULL
The null pointer.
uint8_t i2c_burst_receive(uint8_t slave_addr, uint8_t *data, uint8_t len)
Perform all operations to receive multiple bytes from a slave.
uint8_t i2c_single_send(uint8_t slave_addr, uint8_t data)
Perform all operations to send a byte to a slave.
#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be software controlled with PIN_MASK of port with PORT_BASE. ...
int8_t rtcc_set_autocalibration(uint8_t period)
Set the autocallibration period.
void process_start(struct process *p, process_data_t data)
Start a process.
#define PROCESS_YIELD_UNTIL(c)
Yield the currently running process until a condition occurs.
void nvic_interrupt_enable(uint32_t intr)
Enables interrupt intr.
int8_t rtcc_get_time_date(simple_td_map *data)
Get the current time and date.
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
void gpio_register_callback(gpio_callback_t f, uint8_t port, uint8_t pin)
Register GPIO callback.
void clock_delay_usec(uint16_t dt)
Delay a given number of microseconds.
int8_t rtcc_init(void)
Initialize the RTCC, configures the I2C bus, interrupts and registers.
Header file for the RE-Mote RF antenna switch.
int8_t rtcc_set_time_date(simple_td_map *data)
Set the time and date.
#define PROCESS_BEGIN()
Define the beginning of a process.