C++ Library for the PsiSwarm Robot - Version 0.8
Dependents: PsiSwarm_V8_Blank_CPP Autonomia_RndmWlk
Fork of PsiSwarmV7_CPP by
eprom.h@5:3cdd1a37cdd7, 2016-10-15 (annotated)
- Committer:
- jah128
- Date:
- Sat Oct 15 13:29:37 2016 +0000
- Revision:
- 5:3cdd1a37cdd7
- Parent:
- 2:c6986ee3c7c5
- Child:
- 6:b340a527add9
Initial commit of API Version 7 (fork from version 5)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 0:d6269d17c8cf | 1 | /** University of York Robotics Laboratory PsiSwarm Library: Eprom Functions Header File |
jah128 | 0:d6269d17c8cf | 2 | * |
jah128 | 0:d6269d17c8cf | 3 | * File: eprom.h |
jah128 | 0:d6269d17c8cf | 4 | * |
jah128 | 0:d6269d17c8cf | 5 | * (C) Dept. Electronics & Computer Science, University of York |
jah128 | 0:d6269d17c8cf | 6 | * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis |
jah128 | 0:d6269d17c8cf | 7 | * |
jah128 | 5:3cdd1a37cdd7 | 8 | * PsiSwarm Library Version: 0.7 |
jah128 | 0:d6269d17c8cf | 9 | * |
jah128 | 5:3cdd1a37cdd7 | 10 | * October 2016 |
jah128 | 0:d6269d17c8cf | 11 | * |
jah128 | 0:d6269d17c8cf | 12 | * Functions for accessing the 64Kb EPROM chip and reading the reserved firmware block |
jah128 | 0:d6269d17c8cf | 13 | * |
jah128 | 0:d6269d17c8cf | 14 | * Example: |
jah128 | 0:d6269d17c8cf | 15 | * @code |
jah128 | 0:d6269d17c8cf | 16 | * #include "psiswarm.h" |
jah128 | 0:d6269d17c8cf | 17 | * |
jah128 | 0:d6269d17c8cf | 18 | * int main() { |
jah128 | 0:d6269d17c8cf | 19 | * init(); |
jah128 | 0:d6269d17c8cf | 20 | * write_eeprom_byte(0,0xDD); //Writes byte 0xDD in EPROM address 0 |
jah128 | 0:d6269d17c8cf | 21 | * char c = read_eeprom_byte(0); //c will hold 0xDD |
jah128 | 0:d6269d17c8cf | 22 | * //Valid address range is from 0 to 65279 |
jah128 | 0:d6269d17c8cf | 23 | * } |
jah128 | 0:d6269d17c8cf | 24 | * @endcode |
jah128 | 0:d6269d17c8cf | 25 | */ |
jah128 | 0:d6269d17c8cf | 26 | |
jah128 | 0:d6269d17c8cf | 27 | #ifndef EPROM_H |
jah128 | 0:d6269d17c8cf | 28 | #define EPROM_H |
jah128 | 0:d6269d17c8cf | 29 | |
jah128 | 0:d6269d17c8cf | 30 | /** Write a single byte to the EPROM |
jah128 | 0:d6269d17c8cf | 31 | * |
jah128 | 0:d6269d17c8cf | 32 | * @param address The address to store the data, range 0-65279 |
jah128 | 0:d6269d17c8cf | 33 | * @param data The character to store |
jah128 | 0:d6269d17c8cf | 34 | */ |
jah128 | 0:d6269d17c8cf | 35 | void write_eeprom_byte ( int address, char data ); |
jah128 | 0:d6269d17c8cf | 36 | |
jah128 | 0:d6269d17c8cf | 37 | /** Read a single byte from the EPROM |
jah128 | 0:d6269d17c8cf | 38 | * |
jah128 | 0:d6269d17c8cf | 39 | * @param address The address to read from, range 0-65279 |
jah128 | 0:d6269d17c8cf | 40 | * @return The character stored at address |
jah128 | 0:d6269d17c8cf | 41 | */ |
jah128 | 0:d6269d17c8cf | 42 | char read_eeprom_byte ( int address ); |
jah128 | 0:d6269d17c8cf | 43 | |
jah128 | 0:d6269d17c8cf | 44 | /** Read the next byte from the EPROM, to be called after read_eeprom_byte |
jah128 | 0:d6269d17c8cf | 45 | * |
jah128 | 0:d6269d17c8cf | 46 | * @return The character stored at address after the previous one read from |
jah128 | 0:d6269d17c8cf | 47 | */ |
jah128 | 0:d6269d17c8cf | 48 | char read_next_eeprom_byte ( void ); |
jah128 | 0:d6269d17c8cf | 49 | |
jah128 | 0:d6269d17c8cf | 50 | /** Read the data stored in the reserved firmware area of the EPROM |
jah128 | 0:d6269d17c8cf | 51 | * |
jah128 | 0:d6269d17c8cf | 52 | * @return 1 if a valid firmware is read, 0 otherwise |
jah128 | 0:d6269d17c8cf | 53 | */ |
jah128 | 0:d6269d17c8cf | 54 | char read_firmware ( void ); |
jah128 | 0:d6269d17c8cf | 55 | |
jah128 | 0:d6269d17c8cf | 56 | #endif |