[ARM] Support of s16le wav files

[ACT] New GVARS menu started
[X9D] Volume control added
This commit is contained in:
bsongis
2013-01-17 19:02:15 +00:00
parent 0287369be2
commit 5a11cf03cb
18 changed files with 244 additions and 142 deletions
+5 -3
View File
@@ -71,8 +71,10 @@ inline uint16_t dacQueue(uint16_t *data, uint16_t size)
return size;
}
inline void setVolume( unsigned char volume )
{
}
#if !defined(SIMU)
#define setVolume(v) I2C_set_volume(v)
#else
#define setVolume(v)
#endif
#endif
+45 -35
View File
@@ -47,7 +47,7 @@
#include "hal.h"
#include "aspi.h"
#include "i2c_ee.h"
#include "i2c.h"
#include "audio_driver.h"
#define PERI1_FREQUENCY 30000000
@@ -65,7 +65,6 @@ void sdPoll10ms();
void usbMassStorage();
void setVolume( register uint8_t volume );
#define JACK_PPM_OUT()
#define JACK_PPM_IN()
@@ -85,50 +84,18 @@ void pwrOff();
#define strcpy_P strcpy
#define strcat_P strcat
extern uint32_t readKeys();
#define KEYS_PRESSED() (~readKeys())
#define DBLKEYS_PRESSED_RGT_LFT(i) ((in & (0x20 + 0x40)) == (0x20 + 0x40))
#define DBLKEYS_PRESSED_UP_DWN(i) ((in & (0x10 + 0x08)) == (0x10 + 0x08))
#define DBLKEYS_PRESSED_RGT_UP(i) ((in & (0x20 + 0x10)) == (0x20 + 0x10))
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & (0x40 + 0x08)) == (0x40 + 0x08))
extern uint16_t sessionTimer;
#define BOOTLOADER_REQUEST() (0/*usbPlugged()*/)
#define SLAVE_MODE() (0/*pwrCheck() == e_power_trainer*/)
#if !defined(SIMU)
#define wdt_disable()
#define wdt_enable(x)
#define wdt_reset()
#endif
uint32_t pwrCheck();
#define setBacklight(xx)
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
#if !defined(SIMU)
#define eeprom_read_block I2C_EE_BufferRead
#define eeWriteBlockCmp I2C_EE_BufferWrite
#else
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size);
#endif
void keysInit();
void pwrInit();
void eepromInit(); // TODO check it's not in another include
void delaysInit();
void adcInit();
void debugInit();
void adcRead();
void init_trainer_ppm();
void init_trainer_capture();
extern volatile uint16_t Analog_values[];
#define DEBUG_UART_BAUDRATE 115200
@@ -138,4 +105,47 @@ void uartSendChar(uint8_t c);
void delaysInit(void);
void delay_01us(uint16_t nb);
// Keys driver
void keysInit();
uint32_t readKeys();
#define KEYS_PRESSED() (~readKeys())
#define DBLKEYS_PRESSED_RGT_LFT(i) ((in & (0x20 + 0x40)) == (0x20 + 0x40))
#define DBLKEYS_PRESSED_UP_DWN(i) ((in & (0x10 + 0x08)) == (0x10 + 0x08))
#define DBLKEYS_PRESSED_RGT_UP(i) ((in & (0x20 + 0x10)) == (0x20 + 0x10))
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & (0x40 + 0x08)) == (0x40 + 0x08))
// WDT driver
#if !defined(SIMU)
#define wdt_disable()
#define wdt_enable(x)
#define wdt_reset()
#endif
// ADC driver
void adcInit();
void adcRead();
extern volatile uint16_t Analog_values[];
// Power driver
void pwrInit();
uint32_t pwrCheck();
// Backlight driver
#define setBacklight(xx)
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
// EEPROM driver
#if !defined(SIMU)
#define eepromInit() I2C_EE_Init()
#define eeprom_read_block I2C_EE_BufferRead
#define eeWriteBlockCmp I2C_EE_BufferWrite
#else
#define eepromInit()
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size);
#endif
#endif
-42
View File
@@ -1,42 +0,0 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "../open9x.h"
void eepromInit()
{
#if !defined(SIMU)
I2C_EE_Init();
#endif
}
+30 -1
View File
@@ -1,6 +1,6 @@
/**
******************************************************************************
* @file Project/ee_drivers/i2c_ee.c
* @file Project/ee_drivers/i2c.c
* @author X9D Application Team
* @version V 0.2
* @date 12-JULY-2012
@@ -370,3 +370,32 @@ void I2C_EE_WaitEepromStandbyState(void)
I2C_STOP();
}
void I2C_set_volume( register uint8_t volume )
{
I2C_START();
I2C_SEND_DATA(I2C_CAT5137_ADDRESS|EE_CMD_WRITE);
I2C_WAIT_ACK();
I2C_SEND_DATA(0);
I2C_WAIT_ACK();
I2C_SEND_DATA(volume);
I2C_WAIT_ACK();
I2C_STOP();
}
uint8_t I2C_read_volume()
{
uint8_t volume ;
I2C_START();
I2C_SEND_DATA(I2C_CAT5137_ADDRESS|EE_CMD_WRITE);
I2C_WAIT_ACK();
I2C_SEND_DATA(0);
I2C_WAIT_ACK();
I2C_START();
I2C_SEND_DATA(I2C_CAT5137_ADDRESS|EE_CMD_READ);
I2C_WAIT_ACK();
volume = I2C_READ();
I2C_NO_ACK();
I2C_STOP();
return volume ;
}
+6 -5
View File
@@ -4,7 +4,7 @@
* @author X9D Application Team
* @version V 0.2
* @date 12-JLY-2012
* @brief Header for i2c_ee.c module
* @brief Header for i2c.c module
******************************************************************************
* @copy
*
@@ -18,13 +18,11 @@
* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
*/
/* Define to prevent recursive inclusion ------------------------------------ */
#ifndef __I2C_EE_H
#define __I2C_EE_H
#ifndef __I2C_H
#define __I2C_H
#define EE_CMD_WRITE (0)
#define EE_CMD_READ (1)
//#define I2C_delay() //do { delayUsec(5); } while(0)
#define SCL_H do{I2C_EE_GPIO->BSRRL = I2C_EE_SCL;}while(0)
#define SCL_L do{I2C_EE_GPIO->BSRRH = I2C_EE_SCL;}while(0)
@@ -43,6 +41,9 @@ void I2C_EE_BufferWrite(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteTo
void I2C_EE_BufferRead(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t NumByteToRead);
void I2C_EE_WaitEepromStandbyState(void);
void I2C_set_volume(register uint8_t volume);
uint8_t I2C_read_volume();
#endif /* __I2C_EE_H */
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/