pwm begonnen zu implementieren, geht aber mal gar nicht. Muss mitm Oszi gecheckt werden

This commit is contained in:
BlexTw11
2016-01-31 20:01:47 +01:00
parent 3aa94ba475
commit eba00a6dc1
8 changed files with 138 additions and 36 deletions

View File

@@ -12,6 +12,11 @@
#define LDR_DDR DDRC
#define LDR_PIN PC2
#define LDR_CHANNEL 2
#define LDR_CHANNEL 3
#define LDR_SAMPLES 20
#define LDR_PRESCALER 4
void LDR_init(void);
uint8_t LDR_get_value(void);
#endif /* INCLUDE_LDR_H_ */

View File

@@ -8,8 +8,14 @@
#ifndef INCLUDE_MATRIX_H_
#define INCLUDE_MATRIX_H_
#include <avr/pgmspace.h>
#include "woerter.h"
const uint8_t log_lookup[64] PROGMEM =
{0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 15, 16, 17, 19, 21, 23,
25, 27, 29, 32, 35, 38, 41, 45, 49, 54, 59, 64, 70, 76, 83, 90, 98, 107, 117, 128, 139, 152, 165, 180, 197, 214, 234, 255};
uint8_t qlock_matrix[MAX_COLS][MAX_ROWS];

27
Firmware/include/pwm.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* pwm.h
*
* Created on: 31.01.2016
* Author: BlexTw11
*/
#ifndef INCLUDE_PWM_H_
#define INCLUDE_PWM_H_
#include "global.h"
#define PWM_ISR ISR
#define PWM_TIMER TIMER1_COMPA_vect
#define F_PWM 100L // PWM-Frequenz in Hz
#define PWM_PRESCALER 8 // Vorteiler für den Timer
#define PWM_STEPS 256 // PWM-Schritte pro Zyklus(1..256)
#define PWM_COMPARE_VAL 2816
#define PWM_FACTOR PWM_COMPARE_VAL / PWM_STEPS
void PWM_init_timer(void);
void PWM_update(void);
bool PWM_get_status(void);
#endif /* INCLUDE_PWM_H_ */

View File

@@ -10,7 +10,7 @@
#define UART_MAXSTRLEN 20
void UART_init(uint16_t baud_rate, char buffer[]);
void UART_init(uint16_t baud_rate, char * buffer);
uint8_t UART_rx_char(void);
uint8_t UART_rx_str(void);