1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +01:00

atmega_common: abstract Power Reduction Register

PR Register is PRR0 on atmega2560 and atmega1281
but PRR on atmega328p.
this abstracts as atmega Power Reduction Register as MEGA_PRR.
This commit is contained in:
Laurent Navet 2016-06-30 22:35:58 +02:00
parent 4c3c0d9571
commit 2cd918a07a
4 changed files with 5 additions and 1 deletions

View File

@ -97,6 +97,7 @@ extern "C" {
*/
#define SPI_NUMOF 1 /* set to 0 to disable SPI */
#define SPI_0_EN 1 /* remove once SPI rework is done */
#define MEGA_PRR PRR0 /* Power Reduction Register is PRR0 */
/** @} */
#ifdef __cplusplus

View File

@ -104,6 +104,7 @@ extern "C" {
*/
#define SPI_NUMOF 1 /* set to 0 to disable SPI */
#define SPI_0_EN 1 /* remove once SPI rework is done */
#define MEGA_PRR PRR0 /* Power Reduction Resgister */
/** @} */
#ifdef __cplusplus

View File

@ -133,7 +133,9 @@ int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
uint8_t pin_num = _pin_num(pin);
if ((_port_num(pin) == PORT_D && pin_num > 3)
#if defined (PORTE)
|| (_port_num(pin) == PORT_E && pin_num < 4)
#endif
|| ((mode != GPIO_IN) && (mode != GPIO_IN_PU))) {
return -1;
}

View File

@ -61,7 +61,7 @@ int spi_init_master(spi_t dev, spi_conf_t conf, spi_speed_t speed)
DDRB |= ((1 << DDB2) | (1 << DDB1) | (1 << DDB0));
/* make sure the SPI is not powered off */
PRR0 &= ~(1 << PRSPI);
MEGA_PRR &= ~(1 << PRSPI);
/* configure as master, with given mode and clock */
SPSR = (speed >> S2X_SHIFT);