mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
CC-6 Initial code for the flash chip on CC
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2578 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
7554021ed0
commit
d2f3e0d379
@ -216,6 +216,7 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
||||
|
||||
## PIOS Hardware (Common)
|
||||
SRC += $(PIOSCOMMON)/pios_flash_w25x.c
|
||||
SRC += $(PIOSCOMMON)/pios_adxl345.c
|
||||
SRC += $(PIOSCOMMON)/pios_com.c
|
||||
SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "attitudedesired.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "CoordinateConversions.h"
|
||||
#include "pios_flash_w25x.h"
|
||||
|
||||
// Private constants
|
||||
#define STACK_SIZE_BYTES 740
|
||||
|
@ -238,7 +238,8 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
|
||||
|
||||
#define PIOS_FLASH_ENABLE PIOS_GPIO_Off(0)
|
||||
#define PIOS_FLASH_DISABLE PIOS_GPIO_On(0)
|
||||
|
||||
#define PIOS_ADXL_ENABLE PIOS_SPI_RC_PinSet(PIOS_SPI_ACCEL,0)
|
||||
#define PIOS_ADXL_DISABLE PIOS_SPI_RC_PinSet(PIOS_SPI_ACCEL,1)
|
||||
|
||||
//-------------------------
|
||||
// USB
|
||||
|
@ -15,7 +15,7 @@
|
||||
void PIOS_ADXL345_ClaimBus()
|
||||
{
|
||||
// TODO: Semaphore to lock bus
|
||||
PIOS_SPI_RC_PinSet(PIOS_SPI_ACCEL,0);
|
||||
PIOS_ADXL_ENABLE;
|
||||
PIOS_DELAY_WaituS(1);
|
||||
|
||||
}
|
||||
@ -26,7 +26,7 @@ void PIOS_ADXL345_ClaimBus()
|
||||
void PIOS_ADXL345_ReleaseBus()
|
||||
{
|
||||
// TODO: Release semaphore
|
||||
PIOS_SPI_RC_PinSet(PIOS_SPI_ACCEL,1);
|
||||
PIOS_ADXL_DISABLE;
|
||||
PIOS_DELAY_WaituS(1);
|
||||
}
|
||||
|
||||
|
50
flight/PiOS/Common/pios_flash_w25x.c
Normal file
50
flight/PiOS/Common/pios_flash_w25x.c
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* pios_flash_w25x.c
|
||||
* OpenPilotOSX
|
||||
*
|
||||
* Created by James Cotton on 1/23/11.
|
||||
* Copyright 2011 OpenPilot. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pios.h"
|
||||
#include "pios_flash_w25x.h"
|
||||
|
||||
void PIOS_FLASH_W25X_ClaimBus()
|
||||
{
|
||||
// TODO: Semaphore to lock bus
|
||||
PIOS_FLASH_ENABLE;
|
||||
}
|
||||
|
||||
void PIOS_FLASH_W25X_ReleaseBus()
|
||||
{
|
||||
// TODO: Release semaphore
|
||||
PIOS_FLASH_DISABLE;
|
||||
}
|
||||
|
||||
void PIOS_FLASH_W25X_Init()
|
||||
{
|
||||
PIOS_FLASH_W25X_ClaimBus();
|
||||
PIOS_FLASH_W25X_ReleaseBus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the status register from flash chip and return it
|
||||
*/
|
||||
uint8_t PIOS_FLASH_ReadStatus()
|
||||
{
|
||||
PIOS_FLASH_W25X_ClaimBus();
|
||||
uint8_t out[2] = {W25X_READ_STATUS, 0};
|
||||
uint8_t in[2] = {0,0};
|
||||
PIOS_SPI_TransferBlock(PIOS_SPI_FLASH,out,in,sizeof(out),NULL);
|
||||
PIOS_FLASH_W25X_ReleaseBus();
|
||||
return in[1];
|
||||
}
|
||||
|
||||
void PIOS_FLASH_W25X_WriteData(uint32_t addr, uint8_t * data, uint16_t len)
|
||||
{
|
||||
}
|
||||
|
||||
void PIOS_FLASH_W25X_ReadData(uint32_t addr, uint8_t * data, uint16_t len)
|
||||
{
|
||||
}
|
21
flight/PiOS/inc/pios_flash_w25x.h
Normal file
21
flight/PiOS/inc/pios_flash_w25x.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* pios_flash_w25x.h
|
||||
* OpenPilotOSX
|
||||
*
|
||||
* Created by James Cotton on 1/23/11.
|
||||
* Copyright 2011 OpenPilot. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#define W25X_WRITE_ENABLE 0x06
|
||||
#define W25X_WRITE_DISABLE 0x04
|
||||
#define W25X_READ_STATUS 0x05
|
||||
#define W25X_WRITE_STATUS 0x01
|
||||
#define W25X_READ_DATA 0x03
|
||||
#define W25X_FAST_READ 0x0b
|
||||
#define W25X_DEVICE_ID 0x92
|
||||
|
||||
void PIOS_FLASH_W25X_Init();
|
||||
uint8_t PIOS_FLASH_ReadStatus();
|
||||
void PIOS_FLASH_W25X_WriteData(uint32_t addr, uint8_t * data, uint16_t len);
|
||||
void PIOS_FLASH_W25X_ReadData(uint32_t addr, uint8_t * data, uint16_t len);
|
@ -149,6 +149,8 @@
|
||||
650D8ECE12DFE17500D05CC9 /* watchdogstatus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = watchdogstatus.c; sourceTree = "<group>"; };
|
||||
650D8ED112DFE17500D05CC9 /* uavtalk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uavtalk.h; sourceTree = "<group>"; };
|
||||
650D8ED212DFE17500D05CC9 /* uavtalk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uavtalk.c; sourceTree = "<group>"; };
|
||||
6512D60512ED4CA2008175E5 /* pios_flash_w25x.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_flash_w25x.h; sourceTree = "<group>"; };
|
||||
6512D60712ED4CB8008175E5 /* pios_flash_w25x.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_flash_w25x.c; sourceTree = "<group>"; };
|
||||
65173C9F12EBFD1700D6A7CB /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../Makefile; sourceTree = SOURCE_ROOT; };
|
||||
651913371256C5240039C0A3 /* ahrs_comm_objects.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_comm_objects.c; sourceTree = "<group>"; };
|
||||
651913381256C5240039C0A3 /* ahrs_spi_comm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_comm.c; sourceTree = "<group>"; };
|
||||
@ -7478,6 +7480,7 @@
|
||||
65E8F03611EFF25C00BBF654 /* pios_sdcard.c */,
|
||||
65E8F03711EFF25C00BBF654 /* printf-stdarg.c */,
|
||||
6528CCB412E406B800CF5144 /* pios_adxl345.c */,
|
||||
6512D60712ED4CB8008175E5 /* pios_flash_w25x.c */,
|
||||
);
|
||||
name = Common;
|
||||
path = ../../PiOS/Common;
|
||||
@ -7487,6 +7490,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6528CCE212E40F6700CF5144 /* pios_adxl345.h */,
|
||||
6512D60512ED4CA2008175E5 /* pios_flash_w25x.h */,
|
||||
6526645B122DF972006F9A3C /* pios_wdg.h */,
|
||||
651CF9EF120B700D00EEFD70 /* pios_usb_hid_desc.h */,
|
||||
651CF9F0120B700D00EEFD70 /* pios_usb_hid_istr.h */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user