mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-18 19:31:02 +00:00
Revert "Stop publish examples to mongoose repo"
This reverts commit 1a17e17c462bdd4e1d26d8742f8b7087273e04c2. PUBLISHED_FROM=80028de308c9a021955d1425d2bfee8feb85f193
This commit is contained in:
1 parent
7cc7df8c0e
commit
eaef5bd133
351 files changed
+195424
No files matched your search
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Cesanta Software Limited
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
#include "app.h"
|
||||
#include "system/debug/sys_debug.h"
|
||||
#include "simplelink.h"
|
||||
#include "user_params.h"
|
||||
|
||||
P_EVENT_HANDLER g_cc3100_IRQ_handler = NULL;
|
||||
|
||||
void AssertCS() {
|
||||
PLIB_PORTS_PinClear(PORTS_ID_0, CS_PORT, CS_PIN);
|
||||
}
|
||||
|
||||
void DeassertCS() {
|
||||
PLIB_PORTS_PinSet(PORTS_ID_0, CS_PORT, CS_PIN);
|
||||
}
|
||||
|
||||
void CC3100_enable() {
|
||||
PLIB_PORTS_PinSet(PORTS_ID_0, HIB_PORT, HIB_PIN);
|
||||
}
|
||||
|
||||
void CC3100_disable() {
|
||||
PLIB_PORTS_PinClear(PORTS_ID_0, HIB_PORT, HIB_PIN);
|
||||
}
|
||||
|
||||
Fd_t spi_Open(char *ifName, unsigned long flags) {
|
||||
CC3100_disable();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int spi_Write(Fd_t fd, unsigned char *pBuff, int len) {
|
||||
if (len > 512) {
|
||||
SYS_PRINT("BUFFER TOO SMALL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
AssertCS();
|
||||
uint8_t dummy[512];
|
||||
DRV_SPI0_BufferAddWriteRead(pBuff, dummy, len);
|
||||
DRV_SPI_Tasks(sysObj.spiObjectIdx0);
|
||||
DeassertCS();
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int spi_Read(Fd_t fd, unsigned char *pBuff, int len) {
|
||||
if (len > 512) {
|
||||
SYS_PRINT("BUFFER TOO SMALL");
|
||||
return 0;
|
||||
}
|
||||
uint8_t dummy[512];
|
||||
memset(dummy, 0xFF, len);
|
||||
AssertCS();
|
||||
DRV_SPI0_BufferAddWriteRead(dummy, pBuff, len);
|
||||
DRV_SPI_Tasks(sysObj.spiObjectIdx0);
|
||||
DeassertCS();
|
||||
return len;
|
||||
}
|
||||
|
||||
int registerInterruptHandler(P_EVENT_HANDLER int_handler, void *pValue) {
|
||||
(void) pValue;
|
||||
g_cc3100_IRQ_handler = int_handler;
|
||||
}
|
||||
Reference in new issue
Block a user