Merge branch 'master' into radio

This commit is contained in:
Rihards Skuja 2017-11-25 11:27:49 +02:00
commit af6219730b
No known key found for this signature in database
GPG Key ID: 53FA13A3F7F8571B
2 changed files with 8 additions and 6 deletions

View File

@ -1,8 +1,10 @@
#ifndef MAIN_H #ifndef MAIN_H
#define MAIN_H #define MAIN_H
#define SET_HIGH(PORT, PIN) (PORT) |= (1 << (PIN)) #define SET(PORT, PIN) (PORT |= (1 << PIN))
#define SET_LOW(PORT, PIN) (PORT) &= ~(1 << (PIN)) #define CLR(PORT, PIN) (PORT &= (~(1 << PIN)))
#define CHK(PORT, PIN) (PORT & (1 << PIN))
#define TOG(PORT, PIN) (PORT ^= (1 << PIN))
void initIO(void); void initIO(void);
void blinkLed(void); void blinkLed(void);

View File

@ -13,7 +13,7 @@
void initIO() void initIO()
{ {
/* Servos */ /* Servos */
SET_HIGH(DDRB, SERVO_L); SET(DDRB, SERVO_L);
/* Phase Correct PWM, 9-bit; Inverting mode */ /* Phase Correct PWM, 9-bit; Inverting mode */
TCCR1A |= 1 << WGM11 | 1 << COM1A1 | 1 << COM1A0; TCCR1A |= 1 << WGM11 | 1 << COM1A1 | 1 << COM1A0;
/* "Clear Timer on Compare match" mode; Prescaler = 1 */ /* "Clear Timer on Compare match" mode; Prescaler = 1 */
@ -21,7 +21,7 @@ void initIO()
ICR1 = 19999; // F_CPU / 50Hz - 1 ICR1 = 19999; // F_CPU / 50Hz - 1
/* LED */ /* LED */
SET_HIGH(DDRD, LED_1); SET(DDRD, LED_1);
} }
void readTemp() void readTemp()
@ -32,9 +32,9 @@ void readTemp()
for (;;) { for (;;) {
d = ds18b20_gettemp(); d = ds18b20_gettemp();
if (d >= 21) if (d >= 21)
SET_HIGH(PORTD, LED_1); SET(PORTD, LED_1);
else else
SET_LOW(PORTD, LED_1); CLR(PORTD, LED_1);
_delay_ms(500); _delay_ms(500);
} }