MCP7940N: add read/write I2C device addresses

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
devices: add MCP7940N register definitions

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add TWI register bit defines for ATmega48P

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add ISR and ISR_WITH_INTS macros

This allows ISRs to be written 100% in C.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: expand SPI API to handle slave mode of operation

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: move SPI setup code into a generic helper

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add timer1_disable helper for ATmega48P

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add SPI API

Add simple init master and tx byte helpers.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add a timer1 ATmega48P API

This adds a simple to use function that sets up timer1.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: include mcu-specific headers after defining the various macros

This allows the mcu-specific headers to use them.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: make TCNT1, ICR1, OCR1A, and OCR1B accessible as uint16_t

Use unions to make the registers accessible as both uint8_t low/high pair as
well as a uint16_t.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: include string.h for memset, etc.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Add generic INTERRUPT_{EN,DIS}ABLE macros

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
build: warn if switch of enum doesn't list all values

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: define REG_PCICR_PCIE[0-2] on ATmega48P

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: define friedlier macros for TCCR1B's ICES field on ATmega48P

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch.h: add ARRAY_LEN

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add MCU_RAW_FREQ for ATmega48P

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: move most of generic code into arch/generic_*.h

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
arch: add mcu_set_clock_prescalar helper

A more advanced version would disable interrupts if they are enabled to
avoid an interrupt mid-function breaking the back-to-back instruction
requirement.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Next