[X9D]
- blocking delay_01us using timer13 (need to check peripheral frequencies) - eeprom working
This commit is contained in:
+1
-1
@@ -494,7 +494,7 @@ ifeq ($(PCB), X9D)
|
||||
EEPROMSRC = eeprom_avr.cpp # TODO later eeprom_conversions.cpp
|
||||
PULSESSRC = pulses_arm.cpp
|
||||
CPPSRC += sky9x/audio.cpp
|
||||
CPPSRC += x9d/pwr_driver.cpp x9d/eeprom_driver.cpp x9d/pulses_driver.cpp x9d/keys_driver.cpp x9d/audio_driver.cpp
|
||||
CPPSRC += x9d/pwr_driver.cpp x9d/eeprom_driver.cpp x9d/pulses_driver.cpp x9d/keys_driver.cpp x9d/audio_driver.cpp x9d/delays.cpp
|
||||
CPPSRC += bmp.cpp monitors_views.cpp
|
||||
SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c
|
||||
SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c
|
||||
|
||||
@@ -46,6 +46,7 @@ extern uint32_t Peri2_frequency ;
|
||||
void keysInit();
|
||||
void pwrInit();
|
||||
void eepromInit(); // TODO check it's not in another include
|
||||
void delaysInit();
|
||||
|
||||
uint8_t getTemperature()
|
||||
{
|
||||
@@ -126,6 +127,7 @@ void boardInit()
|
||||
__enable_irq() ;
|
||||
|
||||
eepromInit();
|
||||
delaysInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+2
-1
@@ -44,6 +44,7 @@
|
||||
#include "aspi.h"
|
||||
#include "i2c_ee.h"
|
||||
#include "audio_driver.h"
|
||||
#include "delays.h"
|
||||
|
||||
// TODO elsewhere
|
||||
#if !defined(SIMU)
|
||||
@@ -111,7 +112,7 @@ uint32_t check_soft_power();
|
||||
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
|
||||
|
||||
#define udelay(x) do { uint32_t temp; temp=((x+0)<<3); while(--temp); } while (0)
|
||||
#define delayUsec(x) udelay(x)
|
||||
#define delayUsec(x) CoTickDelay(1);
|
||||
|
||||
#if !defined(SIMU)
|
||||
#define eeprom_read_block I2C_EE_BufferRead
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - 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 delaysInit(void) {
|
||||
|
||||
// Timer13
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM13EN; // Enable clock
|
||||
//TIM14->ARR = 4999; // 5mS
|
||||
TIM13->PSC = Peri1_frequency / 100000; // 0.1uS from 30MHz
|
||||
TIM13->CCER = 0;
|
||||
TIM13->CCMR1 = 0;
|
||||
TIM13->EGR = 0;
|
||||
TIM13->CR1 = 0x03;
|
||||
TIM13->DIER = 0;
|
||||
//NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn) ;
|
||||
}
|
||||
|
||||
|
||||
void delay_01us(uint32_t nb){
|
||||
TIM13->CNT = 0;
|
||||
while(TIM13->CNT < nb);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DELAYS_H
|
||||
#define __DELAYS_H
|
||||
|
||||
void delaysInit(void);
|
||||
void delay_01us(uint32_t us);
|
||||
|
||||
|
||||
#endif //__DELAYS_H
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "../open9x.h"
|
||||
|
||||
#define I2C_delay() delay_01us(15);
|
||||
|
||||
/**
|
||||
* @brief Configure the used I/O ports pin
|
||||
* @param None
|
||||
@@ -255,6 +257,7 @@ void I2C_EE_BufferWrite(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteTo
|
||||
/* If NumByteToWrite < I2C_FLASH_PAGESIZE */
|
||||
if (NumOfPage == 0) {
|
||||
I2C_EE_PageWrite(pBuffer, WriteAddr, NumOfSingle);
|
||||
|
||||
I2C_EE_WaitEepromStandbyState();
|
||||
}
|
||||
/* If NumByteToWrite > I2C_FLASH_PAGESIZE */
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
#define EE_CMD_WRITE (0)
|
||||
#define EE_CMD_READ (1)
|
||||
#define I2C_delay() do { delayUsec(5); } while(0)
|
||||
//#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)
|
||||
|
||||
Reference in New Issue
Block a user