I'm using cc2540 as mcu. But I feel ble stack is really complicate for me to use, because i don't using ble stack, yet.
Of course OSAL is good, but almost of things are compated with the keyfob device.
So I tried to remove ble stack stuffs, but i couldn't optimize OSAL.
And as i know, sleep timer uses ll timer that is contained in ble stack library.
ble stack is so hugh package for me. and it seizes almost of my code size.
please someone send me skeleton code with sleep timer?
I do not understand what you want.
Please click the Verify Answer button on a post if it answers your question! :)
I mean I want to use CC2540 only for computing unit. (Sleep Timer, ADC, UART only)
Thus the code that is provided from btool(including OSAL) is too huge package for me.
What I want is only function code.
Sorry for my bad English.
Anyway I'm not English, the problem was not about the language but the question's content ;) You do not have to verify the question till it is answered ;)
The core of the CC2540 is a 8051 processor. Perhaps you could arrange a main() of a sample program of the TI stack to not act as a BLE device but I really do not get the point of this approach. What are you trying to do? If you need a plattform with a microcontroller, you can try, for example, Arduino or Teensy. They are much easy to manage and are not bonded to IAR or BLE and the GPIO pins are easier to access :)
For example, a working base could look like this one:
#include "ioCC2540.h"#include "hal_adc.h"#include "hal_adc.c"volatile uint16 result [200];int main( void ){
volatile int i = 0;
CLKCONCMD = (0 << 6); // XOSC CLKCONCMD |= (0x0<<5); // Tick 32 MHz CLKCONCMD |= (0x0<<2); // CLK-Speed 32 MHz
HalAdcInit(); // Initialize the ADC HalAdcSetReference((uint8)HAL_ADC_REF_AVDD); // Reference is taken from AVDD-Pin while(1) { result[i++] = HalAdcRead((uint8)0, (uint8)HAL_ADC_RESOLUTION_14); if(i == 199) i = 0; } return 0;}
This piece of code fills an array with adc-samples of channel 0 in a loop, again and again.
I've tested code examples with only timer functionality. Any BLE-related thing was there.
As long as you deal with the power management issue, do whatever you want as in a 8051.